Passenger flow monitoring method, device, electronic equipment and storage medium
By acquiring target image sequences from different angles for head detection and three-dimensional reconstruction, combined with ground calibration, the problem of poor passenger flow monitoring accuracy in the existing technology is solved and more accurate passenger flow information monitoring is achieved.
Patent Information
- Application Number
- CN202011466662.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-14
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2040-12-14
AI Technical Summary
Existing customer flow monitoring technology has poor counting accuracy when dealing with the variability of store scenes and the complexity of pedestrian entry routes, resulting in unreliable information analyzed.
By acquiring target image sequences collected at different angles at the same time, head detection and matching are performed, three-dimensional head reconstruction is performed, and a three-dimensional space is constructed in combination with ground calibration to achieve accurate monitoring of passenger flow.
It improves the accuracy and monitoring effect of passenger flow counting and enhances the reliability of passenger flow information.
Smart Images

Figure CN112633096B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence, and in particular to a passenger flow monitoring method, device, electronic equipment and storage medium. Background Art
[0002] With the development of artificial intelligence, offline stores are seeking a business model that can achieve precise marketing. They have adopted the image technology in artificial intelligence to obtain customer flow information, customer flow conversion rate information, customer behavior information in the store, etc., to make marketing strategies more accurate. In general image technology, the acquisition of customer flow information is generally carried out by drawing lines and frames in a two-dimensional plane. When a person crosses the line or enters the frame, the customer flow is counted. However, a single calculation logic cannot be compatible with factors such as the variability of store scenes, the variability of pedestrian routes into the store, the height of pedestrians, etc., resulting in poor counting accuracy, and the reliability of other information analyzed is also poor. Therefore, the existing customer flow monitoring effect is not good. Summary of the invention
[0003] The embodiment of the present invention provides a passenger flow monitoring method, which can improve the counting accuracy of passenger flow and further improve the passenger flow monitoring effect.
[0004] In a first aspect, an embodiment of the present invention provides a method for monitoring passenger flow, the method comprising:
[0005] Acquire a first target image sequence and a second target image sequence of a target area, wherein the first target image sequence and the second target image sequence are acquired at different angles at the same time;
[0006] Performing head detection on the first target image sequence and the second target image sequence respectively to obtain a first head frame sequence and a second head frame sequence, wherein the first head frame sequence includes a first head frame of at least one target person, and the second head frame sequence includes a second head frame of at least one target person;
[0007] According to the time sequence relationship between the first head frame sequence and the second head frame sequence, the first head frame is matched with the second head frame to obtain a paired head frame sequence of each target person, wherein the paired head frame sequence includes at least one paired head frame of the target person;
[0008] According to the paired head frame sequence, a three-dimensional reconstruction of the head is performed in a preset three-dimensional space to obtain a three-dimensional head sequence of the target person, wherein the three-dimensional head sequence includes the three-dimensional head of the target person;
[0009] The passenger flow in the target area is monitored according to the three-dimensional head sequence.
[0010] Optionally, the first target image sequence is acquired by a first camera, and the second target image sequence is acquired by a second camera, and the method further includes:
[0011] Perform ground calibration in the coordinate system of the first camera or the second camera to obtain a calibrated ground;
[0012] The three-dimensional space is constructed based on the calibrated ground.
[0013] Optionally, performing ground calibration in the coordinate system of the first camera or the second camera to obtain a calibrated ground includes:
[0014] Acquire calibration object information associated with the target area, where the calibration object information is calibration object information in a coordinate system of the first camera or the second camera;
[0015] The ground is calibrated according to the calibration object information to obtain a calibrated ground.
[0016] Optionally, performing ground calibration in the coordinate system of the first camera or the second camera to obtain a calibrated ground includes:
[0017] Calculating ground feature points corresponding to the first camera and the second camera, and triangulating the ground feature points to obtain three-dimensional space points corresponding to the ground feature points;
[0018] Plane parameter fitting is performed on the three-dimensional space points to obtain a calibrated ground surface.
[0019] Optionally, performing three-dimensional reconstruction of the head on the paired head frame sequence in a preset three-dimensional space to obtain a three-dimensional head sequence of the target person includes:
[0020] Calculate the effective disparity map of the first head frame and the second head frame in the paired head frame in the current frame;
[0021] Using the effective disparity map, a three-dimensional reconstruction of the human head is performed in a preset three-dimensional space to obtain a three-dimensional human head in the current frame;
[0022] Based on the three-dimensional head of the current frame, a three-dimensional head sequence of the target person is obtained.
[0023] Optionally, calculating a valid disparity map of a first head frame and a second head frame in the paired head frames in the current frame includes:
[0024] According to the preset prior disparity, the effective disparity interval is calculated;
[0025] Calculating a disparity map between a first head frame and a second head frame in the paired head frames in the current frame, and determining whether the disparity map falls within the valid disparity interval;
[0026] If the disparity map falls within the valid disparity interval, the disparity map is determined to be a valid disparity map.
[0027] Optionally, the performing three-dimensional reconstruction of a human head in a preset three-dimensional space by using the effective disparity map to obtain a three-dimensional human head in a current frame includes:
[0028] Calculating a final disparity value according to the effective disparity map;
[0029] Calculate the head depth information of the target person according to the preset first camera internal parameter or second camera internal parameter;
[0030] According to the depth information of the human head, a three-dimensional reconstruction of the human head is performed in the preset three-dimensional space to obtain a three-dimensional human head in the current frame.
[0031] Optionally, the three-dimensional space includes a calibrated ground, and monitoring passenger flow in the target area according to the three-dimensional head sequence includes:
[0032] Projecting the three-dimensional heads in the three-dimensional head sequence onto the calibrated ground to obtain a projection trajectory of the target person;
[0033] The passenger flow in the target area is monitored according to the projection trajectory.
[0034] Optionally, the calibrated ground includes a target calibration area corresponding to the target area, and monitoring the passenger flow of the target area according to the projection trajectory includes:
[0035] Calculating state information of the projection trajectory and the target calibration area at each time point to obtain a state sequence of the projection trajectory and the target calibration area;
[0036] The passenger flow in the target area is monitored according to the state sequence.
[0037] In a second aspect, an embodiment of the present invention further provides a passenger flow monitoring device, the device comprising:
[0038] A first acquisition module is used to acquire a first target image sequence and a second target image sequence of a target area, wherein the first target image sequence and the second target image sequence are acquired at different angles at the same time;
[0039] a processing module, configured to perform head detection on the first target image sequence and the second target image sequence respectively, to obtain a first head frame sequence and a second head frame sequence, wherein the first head frame sequence includes a first head frame of at least one target person, and the second head frame sequence includes a second head frame of at least one target person;
[0040] a matching module, configured to match the first head frame with the second head frame according to a time sequence relationship between the first head frame sequence and the second head frame sequence, to obtain a paired head frame sequence for each target person, wherein the paired head frame sequence includes a paired head frame of at least one target person;
[0041] A three-dimensional reconstruction module, used to perform three-dimensional reconstruction of the head in a preset three-dimensional space according to the paired head frame sequence, to obtain a three-dimensional head sequence of the target person, wherein the three-dimensional head sequence includes the three-dimensional head of the target person;
[0042] A monitoring module is used to monitor the passenger flow in the target area according to the three-dimensional head sequence.
[0043] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the passenger flow monitoring method provided in the embodiment of the present invention when executing the computer program.
[0044] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the passenger flow monitoring method provided in the embodiment of the invention are implemented.
[0045] In an embodiment of the present invention, a first target image sequence and a second target image sequence of a target area are acquired, wherein the first target image sequence and the second target image sequence are acquired at different angles at the same time; head detection is performed on the first target image sequence and the second target image sequence respectively to obtain a first head frame sequence and a second head frame sequence, wherein the first head frame sequence includes a first head frame of at least one target person, and the second head frame sequence includes a second head frame of at least one target person; according to a temporal relationship between the first head frame sequence and the second head frame sequence, the first head frame is matched with the second head frame to obtain a paired head frame sequence of each target person, wherein the paired head frame sequence includes a paired head frame of at least one target person; according to the paired head frame sequence, a three-dimensional reconstruction of the head is performed in a preset three-dimensional space to obtain a three-dimensional head sequence of the target person, wherein the three-dimensional head sequence includes the three-dimensional head of the target person; according to the three-dimensional head sequence, passenger flow of the target area is monitored. By using head images of target persons at different angles, more accurate target head information can be extracted for three-dimensional reconstruction, making the position of the three-dimensional target head in three-dimensional space more accurate, thereby improving the counting accuracy of passenger flow and further improving the passenger flow monitoring effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 is a flow chart of a passenger flow monitoring method provided by an embodiment of the present invention;
[0048] Figure 2 is a flow chart of a method for constructing a three-dimensional space provided by an embodiment of the present invention;
[0049] Figure 3 is a schematic diagram of a three-dimensional human head reconstruction method provided by an embodiment of the present invention;
[0050] Figure 4 is a flow chart of another passenger flow monitoring method provided by an embodiment of the present invention;
[0051] Figure 4a is a schematic diagram of a relationship between a region and a state provided by an embodiment of the present invention;
[0052] Figure 5 It is a structural schematic diagram of a passenger flow monitoring device provided by an embodiment of the present invention;
[0053] Figure 6 is a schematic structural diagram of another passenger flow monitoring device provided by an embodiment of the present invention;
[0054] Figure 7 is a structural schematic diagram of a calibration module provided by an embodiment of the present invention;
[0055] Figure 8 is a structural schematic diagram of another calibration module provided by an embodiment of the present invention;
[0056] Fig. 9 is a structural schematic diagram of a three-dimensional reconstruction module provided by an embodiment of the present invention;
[0057] Fig.10 is a structural schematic diagram of a second computing submodule provided by an embodiment of the present invention;
[0058] Fig.11 is a structural schematic diagram of a reconstruction submodule provided by an embodiment of the present invention;
[0059] Fig.12 is a structural diagram of a monitoring module provided by an embodiment of the present invention;
[0060] Fig.13is a structural diagram of a monitoring submodule provided by an embodiment of the present invention;
[0061] Fig.14 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0062] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0063] See also Figure 1 , Figure 1 is a flow chart of a passenger flow monitoring method provided by an embodiment of the present invention, such as Figure 1 As shown, the method is used to monitor passenger flow at a fixed time or in real time, and includes the following steps:
[0064] 101. Acquire a first target image sequence and a second target image sequence of a target area.
[0065] In an embodiment of the present invention, the first target image sequence and the second target image sequence are acquired at different angles at the same time. The first target image sequence and the second target image sequence include at least one target person.
[0066] The first target image sequence and the second target image sequence can be respectively collected by two cameras with different shooting angles. The two cameras can be calibrated and associated when installed so that the two cameras process the same coordinate system for shooting, and the two cameras can shoot at the same time. The first target image sequence and the second target image sequence can also be collected by a calibrated binocular camera. In an embodiment of the present invention, it is preferred to collect the first target image sequence and the second target image sequence by a calibrated binocular camera, and the first target image sequence and the second target image sequence can be a left-eye image sequence and a right-eye image sequence, respectively.
[0067] The first target image sequence and the second target image sequence may be continuous frame image sequences (video stream images) captured by the binocular camera in real time, or may be continuous frame images captured historically by the binocular camera.
[0068] 102. Perform head detection on the first target image sequence and the second target image sequence respectively to obtain a first head frame sequence and a second head frame sequence.
[0069] In an embodiment of the present invention, the first head frame sequence includes at least one first head frame of a target person, and the second head frame sequence includes at least one second head frame of a target person. The first head frame corresponds to the first target image sequence, and the second head frame corresponds to the second target image sequence.
[0070] The head detection model can be used to perform head detection on the first target image sequence and the second target image sequence respectively to obtain a first head frame sequence and a second head frame sequence. Specifically, the head detection model can be used to perform head detection on the first target image sequence and the second target image sequence frame by frame to obtain a head frame corresponding to each frame.
[0071] Optionally, the first head frame sequence can be tracked by a head tracking model to obtain a first head frame sequence that tracks the first head frame corresponding to each frame of the first target image. The above-mentioned first head frame sequence includes the first head frame detected in each frame of the first target image. Of course, the second head frame sequence can also be tracked by a head tracking model to obtain a second head frame sequence that tracks the second head frame corresponding to each frame of the second target image. In addition, the first head frame sequence can be tracked by a head tracking model, and at the same time, the second head frame sequence can be tracked by a head tracking model to obtain a first head frame sequence that tracks the first head frame corresponding to each frame of the first target image, and a second head frame sequence that tracks the second head frame corresponding to each frame of the second target image.
[0072] In a possible embodiment, the first head frame sequence may be a first head frame sequence corresponding to multiple target persons, and the second head frame sequence may be a second head frame sequence corresponding to multiple target persons. Further, the first head frame may be multiple first head frames corresponding to multiple target persons, and the second head frame may be multiple second head frames corresponding to multiple target persons.
[0073] Furthermore, an ID can be assigned to the head frame of each target person according to the head frame tracking algorithm, that is, each target person's head frame corresponds to a head frame ID, and the head frame ID is used to identify whether the corresponding head frame belongs to the same person. The same head frame ID corresponds to the head frame of the same target person. For example, when only the first head frame is tracked, different head frame IDs can be assigned to different target persons, and then the first head frame sequences of different target persons can be obtained according to the different head frame IDs. Furthermore, the second head frame sequences of different target persons can be obtained according to the similarity between the first head frame and the second head frame.
[0074] 103. According to the time sequence relationship between the first head frame sequence and the second head frame sequence, the first head frame is matched with the second head frame to obtain a paired head frame sequence of each target person.
[0075] In the embodiment of the present invention, the above-mentioned paired head frame sequence includes at least one paired head frame of a target person.
[0076] The timing relationship between the first head frame sequence and the second head frame sequence can be determined by the timing of each image frame in the first target image sequence and the second target image sequence. When head detection is performed frame by frame on the target image sequence, the obtained head frame has the same timing as the target image sequence.
[0077] Since the first target image sequence and the second target image sequence are acquired at the same time, the corresponding frame images in the first target image sequence and the second target image sequence are synchronized, and thus the first head frame sequence and the second head frame sequence extracted from the first target image sequence and the second target image sequence also have synchronization properties. Therefore, the synchronized first head frame and the second head frame can be matched for similarity to obtain a paired head frame sequence for each target person.
[0078] 104. According to the paired head frame sequence, a three-dimensional reconstruction of the head is performed in a preset three-dimensional space to obtain a three-dimensional head sequence of the target person.
[0079] In an embodiment of the present invention, the paired head frame sequence includes paired head frames corresponding to the first target image and the second target image in each frame, and each paired head frame includes the first head frame and the second head frame of the same target person. The depth of field information of the head of the target person in the first head frame and the second head frame can be calculated by the first head frame and the second head frame of the same target person, and the three-dimensional reconstruction of the head is performed in a preset three-dimensional space according to the depth of field information of the head to obtain the three-dimensional head of the target person. The three-dimensional reconstruction of the head is performed for each paired head frame in the paired head frame sequence of the target person, and the three-dimensional head sequence of the target person can be obtained.
[0080] Furthermore, the first head image corresponding to the first head frame can be extracted from the first target image, and the second head image corresponding to the second head frame can be extracted from the second target image. The first head image and the second head image are head images of the same target person at the same time. The depth of field information of the head of the target person can be calculated by the first head image and the second head image of the same target person. According to the depth of field information of the head, the head is reconstructed in three dimensions in a preset three-dimensional space to obtain the three-dimensional head of the target person. The head is reconstructed in three dimensions for each paired head frame in the paired head frame sequence of the target person, and a three-dimensional head sequence of the target person can be obtained.
[0081] 105. Monitor the passenger flow in the target area based on the three-dimensional head sequence.
[0082] In the embodiment of the present invention, since the target person is moving, the position of the reconstructed three-dimensional head of the target person in the three-dimensional space will also undergo a corresponding position change, thereby forming a moving trajectory of the three-dimensional head in the three-dimensional space. The moving trajectory of the target person can be obtained based on the moving trajectory of the three-dimensional head in the three-dimensional space. For example, the moving trajectory of the three-dimensional head in the three-dimensional space can be mapped to the real space, and the moving trajectory of the target person in the real space can be obtained to monitor the passenger flow of the target area. The position of the target area in the three-dimensional space can also be mapped in the three-dimensional space, and the passenger flow of the target area can be monitored based on the moving trajectory of the three-dimensional head in the three-dimensional space and the position of the target area in the three-dimensional space.
[0083] The above-mentioned monitoring of passenger flow in the target area may be quantitative statistical monitoring of passenger flow, for example, it may be quantitative statistics of passenger flow in and out of the target area, or it may be monitoring of passenger flow trajectory.
[0084] In an embodiment of the present invention, a first target image sequence and a second target image sequence of a target area are acquired, wherein the first target image sequence and the second target image sequence are acquired at different angles at the same time; head detection is performed on the first target image sequence and the second target image sequence respectively to obtain a first head frame sequence and a second head frame sequence, wherein the first head frame sequence includes a first head frame of at least one target person, and the second head frame sequence includes a second head frame of at least one target person; according to a temporal relationship between the first head frame sequence and the second head frame sequence, the first head frame is matched with the second head frame to obtain a paired head frame sequence of each target person, wherein the paired head frame sequence includes a paired head frame of at least one target person; according to the paired head frame sequence, a three-dimensional reconstruction of the head is performed in a preset three-dimensional space to obtain a three-dimensional head sequence of the target person, wherein the three-dimensional head sequence includes the three-dimensional head of the target person; according to the three-dimensional head sequence, passenger flow of the target area is monitored. By using head images of target persons at different angles, more accurate target head information can be extracted for three-dimensional reconstruction, making the position of the three-dimensional target head in three-dimensional space more accurate, thereby improving the counting accuracy of passenger flow and further improving the passenger flow monitoring effect.
[0085] Optionally, in an embodiment of the present invention, the first target image sequence is acquired through a first camera, and the second target image sequence is acquired through a second camera, and a three-dimensional space suitable for three-dimensional human head reconstruction can be constructed according to the settings and installations of the first camera and the second camera.
[0086] Specifically, the three-dimensional space includes the calibrated ground, see Figure 2 , Figure 2 is a flow chart of a method for constructing a three-dimensional space provided by an embodiment of the present invention. Figure 2 As shown, the following steps are included:
[0087] 201. Perform ground calibration in the coordinate system of the first camera or the second camera to obtain a calibrated ground.
[0088] In an embodiment of the present invention, the first camera and the second camera may be a left camera and a right camera in a binocular camera, respectively. When the first camera and the second camera are initialized, the intrinsic parameters and extrinsic parameters of the first camera and the second camera are calibrated, and the ground is calibrated to obtain a calibrated ground.
[0089] The above calibration of the intrinsic parameters and extrinsic parameters of the first camera and the second camera can adopt a chessboard-based calibration method. Specifically, a chessboard is used for single-camera calibration and dual-camera calibration to obtain the intrinsic parameters of the first camera, the intrinsic parameters of the second camera, and the extrinsic parameters between the first camera and the second camera.
[0090] The calibrated ground can be obtained based on the coordinate system of the first camera or the coordinate system of the second camera. The image captured by the first camera can be transformed with the image captured by the second camera. Specifically, the coordinates of the image captured by the first camera can be transformed into the coordinate system of the second camera through the intrinsic parameters of the first camera, the intrinsic parameters of the second camera, and the extrinsic parameters between the first camera and the second camera. Therefore, the calibrated ground can be calibrated in the coordinate system of either the first camera or the second camera.
[0091] In a possible embodiment, when calibrating the ground, calibration object information associated with the target area can be obtained, and the calibration object information is information of the calibration object in the same plane as the ground. The above-mentioned calibration object information is the calibration object information in the coordinate system of the above-mentioned first camera or second camera; the ground is calibrated according to the above-mentioned calibration object information to obtain the calibrated ground. Specifically, the above-mentioned calibration object information includes corner point information, and the camera pose can be calculated according to the corner point information using the PnP (Perspective-n-Point) algorithm to obtain the ground parameters, and the calibrated ground is obtained according to the ground parameters. For example, a QR code can be set on the ground in or near the target area, and the QR code is associated with the target area as specific calibration object information. In this way, the 4 corner points of the QR code can be found, the 4 corner points of the QR code can be sub-pixel refined, and the camera pose can be obtained by the 4 corner point PnP algorithm, thereby obtaining the calibrated ground. In the PnP algorithm, the camera pose can be calculated through the known camera intrinsic parameters, the coordinates of the four corner points in the world coordinate system, and the coordinates in the image coordinate system, so as to obtain the ground parameters, and the calibrated ground can be obtained based on the ground parameters.
[0092] In another possible embodiment, when calibrating the ground, the ground feature points corresponding to the first camera or the second camera may be calculated, and the ground feature points may be triangulated to obtain the three-dimensional space points corresponding to the ground feature points; the plane parameters may be fitted to the three-dimensional space points to obtain the calibrated ground. Specifically, after the ground feature points are calculated and extracted, the ground feature points may be triangulated to obtain the point cloud coordinates of the feature points in the world coordinate system, and the plane parameters may be fitted through the 3D Hough transform point cloud plane detection algorithm and the Ransac random consistency sampling algorithm to obtain the ground parameters, and the calibrated ground may be obtained based on the ground parameters.
[0093] In another possible embodiment, the above two ground calibration methods can be combined. For example, through feature extraction, ground calibration object information is extracted, and the ground calibration object information is a calibration object in the same plane as the ground. After extracting the ground calibration object feature points by calculation, the ground calibration object feature points are triangulated to obtain the point cloud coordinates of the ground calibration object feature points in the world coordinate system. The plane parameters can be fitted through the 3D Hough transform point cloud plane detection algorithm and the ransac random consistency sampling algorithm to obtain the ground parameters, and the calibrated ground is obtained according to the ground parameters.
[0094] 202. Based on the calibrated ground, a three-dimensional space is constructed.
[0095] In the embodiment of the present invention, the calibrated ground is obtained based on the coordinate system of the first camera or the coordinate system of the second camera, so the constructed three-dimensional space is also based on the three-dimensional space of the first camera or the second camera. Since the three-dimensional space is established based on the camera coordinate system, more accurate three-dimensional head information can be obtained by reconstructing the three-dimensional head through the three-dimensional space.
[0096] Optional, see Figure 3 , Figure 3 is a flow chart of a three-dimensional head reconstruction method provided by an embodiment of the present invention. Figure 3 As shown, the following steps are included:
[0097] 301. Calculate a valid disparity map of a first head frame and a second head frame in a paired head frame in a current frame.
[0098] In the embodiment of the present invention, the above disparity map refers to the distance between two images, and the same disparity means that the corresponding objects are at the same distance from the camera.
[0099] Specifically, the effective disparity interval can be calculated based on the preset prior disparity; and the disparity map of the first head frame and the second head frame in the paired head frame in the current frame is calculated, and it is determined whether the disparity map falls into the effective disparity interval; if the disparity map falls into the effective disparity interval, the disparity map is determined to be a valid disparity map. The effective disparity interval can be calculated by a preset disparity threshold. For example, assuming that the prior disparity is 64 and the threshold is 10, the effective disparity interval is 54-74, that is, when the value corresponding to the disparity map of the image is within 54-74 of the effective disparity interval, the disparity map of the image is a valid disparity map.
[0100] Optionally, the disparity map between the first head frame and the second head frame may be calculated using an SGBM (Semi-Global Block Matching) algorithm. An adaptive parameter in the SGBM algorithm may be determined based on a priori disparity. The result of dividing the priori disparity by 16 may be rounded and then added with one as an adaptive parameter of the SGBM algorithm.
[0101] It should be noted that the above-mentioned first head frame includes the head image of the target person in the first target image, and the second head frame includes the head image of the target person in the second target image. The disparity map between the first head frame and the second head frame can be understood as the disparity between the head image of the target person in the first target image and the head image of the target person in the second target image.
[0102] 302. Perform three-dimensional reconstruction of the human head in a preset three-dimensional space through the effective disparity map to obtain a three-dimensional human head in the current frame.
[0103] In the embodiment of the present invention, the depth information of the head of the target person (also referred to as the person's depth of field information) can be calculated through the disparity map, and then the three-dimensional reconstruction of the head can be performed according to the depth information of the head.
[0104] Furthermore, the final disparity value can be calculated based on the effective disparity map; the depth information of the head of the target person can be calculated based on the preset first camera internal parameters or second camera internal parameters; based on the head depth information, the head is reconstructed in three dimensions in a preset three-dimensional space to obtain the three-dimensional head of the current frame. When the three-dimensional space is constructed based on the coordinate system of the first camera, the depth information of the head of the target person can be calculated based on the first camera internal parameters; when the three-dimensional space is constructed based on the coordinate system of the second camera, the depth information of the head of the target person can be calculated based on the second camera internal parameters. The above-mentioned final disparity value can be the average value of the effective disparity map. The camera internal parameters can include the focal length and the baseline length of the camera. The depth information of the head of the target person is calculated by the camera internal parameters and the final disparity value, which can be specifically calculated by the formula Z=fb / d, where Z represents depth, f represents focal length, b represents baseline length, and d represents the final disparity value.
[0105] Optionally, after obtaining the depth information of the head, the depth information of the head may be subjected to coordinate transformation to obtain the depth information of the head in the coordinate system of the first camera or the second camera, so as to perform three-dimensional reconstruction of the head in three-dimensional space.
[0106] 303. Based on the 3D head of the current frame, a 3D head sequence of the target person is obtained.
[0107] In the embodiment of the present invention, a three-dimensional head reconstruction is performed on the target person in each frame of the first target image and the second target image, so that a three-dimensional head sequence of the target person can be obtained.
[0108] Optional, see Figure 4 , Figure 4 Flow chart of another passenger flow monitoring method provided by an embodiment of the present invention. In the embodiment of the present invention, the three-dimensional space includes a calibrated ground surface, and the passenger flow monitoring of the target area can be a quantitative statistical monitoring of passenger flow, for example, it can be a quantitative statistical monitoring of passenger flow in and out of the target area. Figure 4 As shown, the following steps are included:
[0109] 401. Project the three-dimensional heads in the three-dimensional head sequence onto the calibrated ground to obtain the projection trajectory of the target person.
[0110] If there are multiple target persons, the three-dimensional head of each target person can be projected onto the calibrated ground in the three-dimensional space, so as to obtain the projection trajectory of each target person.
[0111] 402. Monitor the passenger flow in the target area according to the projection trajectory.
[0112] The above-mentioned monitoring of passenger flow in the target area may be quantitative statistical monitoring of passenger flow.
[0113] Optionally, since the calibrated ground in the three-dimensional space is constructed based on the first camera coordinate system or the second camera coordinate system, the camera coordinate system can also be converted into the world coordinate system, and the projection trajectory of the target person can be further converted into the trajectory of the target person in the world coordinate system, so as to perform quantitative statistical monitoring of the passenger flow in the target area based on the trajectory of the target person in the world coordinate system.
[0114] In a possible embodiment, the ground calibrated in the three-dimensional space includes a target calibration area corresponding to the target area, and the state information of the projection trajectory and the target calibration area at each time point can be calculated to obtain a state sequence of the projection trajectory and the target calibration area; according to the state sequence, the passenger flow of the target area is monitored.
[0115] For example, taking the store entrance and exit as an example, the customer flow in and out of the store is statistically monitored. The state sequence of the projection trajectory and the target calibration area includes the state information of each time point. The above state information can be divided into valid area state and invalid area state. Specifically, Figure 4a As shown, the target area may be the area on the left and right sides of the store door, that is, the target calibration area may be the fixed area on the left and right sides of the store door in the calibrated ground. The effective area state may also be divided into:
[0116] a: Outside the store door, it can be said that the projection of the human head is on the outer side of the target calibration area at this time, and further indicates that the target person is in the outer area on both sides of the store door area.
[0117] b: Inside the store door, it can be said that the projection of the human head is on the inner side of the target calibration area, which further indicates that the target person is in the inner area on both sides of the store door area.
[0118] c: Outside the store, it can be said that the projection of the human head is outside the target calibration area at this time, which further indicates that the target person is outside the area outside the store door. The inside of the area outside the store door is the inner area on both sides of the store door area corresponding to state b.
[0119] d: Inside the store, it can be said that the head projection is on the inner side of the target calibration area at this time, which further indicates that the target person is on the inner side of the inner area of the store door, and the outer side of the inner area of the store door is the outer area on both sides of the store door area corresponding to state a.
[0120] Invalid state:
[0121] t: The id disappears, which means that the target person is out of the camera's shooting range.
[0122] n: Uncertain area, which may include buffer zones near a and b and areas very close to or far from the camera (usually caused by head frame matching errors).
[0123] At this time, the state sequence may be composed of a, b, c, d, t, and n. A regular search may be performed based on the state sequence to further perform passenger flow counting statistics. For example, a target person's state sequence is c…ca…ab…bd…dt, which indicates a process in which the target person goes from outside the store, to outside the store door, to inside the store door, to inside the store, and disappears, which can be counted as the inflow of customers into the store plus 1; a target person's state sequence is d…db…ba…ac…ct, which indicates a process in which the target person goes from inside the store, to inside the store door, to outside the store door, to outside the store, and disappears, which can be counted as the outflow of customers into the store plus 1; a target person's state sequence is c…ca…ac…ca…ab…ba…ab…bd…dt, which indicates a process in which the target person goes from outside the store, to outside the store door, to outside the store, to inside the store door, to outside the store door, to inside the store door, to inside the store door, to inside the store door, and disappears. Although there are two wandering steps in the middle, namely, from outside the store, to outside the store door, to outside the store door, and to inside the store door, to outside the store door, and to inside the store door, the target person eventually enters the store, which can be counted as the inflow of customers into the store plus 1. In this way, the problem of multiple customer counts when a person is wandering at the store entrance can be avoided, the accuracy of customer counts can be improved, and the accuracy of customer flow monitoring can be further improved.
[0124] Of course, the above-mentioned projection trajectory can also be converted into the world coordinate system, and the state information of the trajectory of the corresponding target person and the target area at each time point can be calculated to obtain the state sequence of the target person and the target area, and then the passenger flow of the target area can be monitored based on the state sequence.
[0125] It should be noted that the identification of each state can be set according to the needs of the user and should not be regarded as a limitation of the embodiment of the present invention. For example, a, b, c, d, t, and n can also be identified by 1, 2, 3, 4, 5, and 6.
[0126] In the embodiment of the present invention, the passenger flow statistics of the target personnel are performed through the state sequence, so that the accuracy of the statistics can be increased.
[0127] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a passenger flow monitoring device provided by an embodiment of the present invention, such as Figure 5 As shown, the device comprises:
[0128] An acquisition module 501 is used to acquire a first target image sequence and a second target image sequence of a target area, wherein the first target image sequence and the second target image sequence are acquired at different angles at the same time;
[0129] The processing module 502 is used to perform head detection on the first target image sequence and the second target image sequence respectively to obtain a first head frame sequence and a second head frame sequence, wherein the first head frame sequence includes a first head frame of at least one target person, and the second head frame sequence includes a second head frame of at least one target person;
[0130] A matching module 503 is used to match the first head frame with the second head frame according to the time sequence relationship between the first head frame sequence and the second head frame sequence to obtain a paired head frame sequence of each target person, wherein the paired head frame sequence includes at least one paired head frame of the target person;
[0131] A three-dimensional reconstruction module 504 is used to perform three-dimensional reconstruction of the head in a preset three-dimensional space according to the paired head frame sequence to obtain a three-dimensional head sequence of the target person, wherein the three-dimensional head sequence includes the three-dimensional head of the target person;
[0132] The monitoring module 505 is used to monitor the passenger flow in the target area according to the three-dimensional head sequence.
[0133] Optional, such as Figure 6 As shown, the first target image sequence is acquired by a first camera, the second target image sequence is acquired by a second camera, and the device further includes:
[0134] A calibration module 506, configured to perform ground calibration in the coordinate system of the first camera or the second camera to obtain a calibrated ground;
[0135] The construction module 507 is used to construct the three-dimensional space based on the calibrated ground.
[0136] Optional, such as Figure 7 As shown, the calibration module 506 includes:
[0137] An acquisition submodule 5061 is used to acquire calibration object information associated with the target area, where the calibration object information is calibration object information in the coordinate system of the first camera or the second camera;
[0138] The first calibration submodule 5062 is used to perform ground calibration according to the calibration object information to obtain a calibrated ground.
[0139] Optional, such as Figure 8 As shown, the calibration module 506 includes:
[0140] The first calculation submodule 5063 is used to calculate the ground feature points corresponding to the first camera and the second camera, and triangulate the ground feature points to obtain the three-dimensional space points corresponding to the ground feature points;
[0141] The second calibration submodule 5064 is used to perform plane parameter fitting on the three-dimensional space points to obtain a calibrated ground.
[0142] Optional, such as Fig. 9 As shown, the three-dimensional reconstruction module 504 includes:
[0143] The second calculation submodule 5041 is used to calculate the effective disparity map of the first head frame and the second head frame in the paired head frame in the current frame;
[0144] The reconstruction submodule 5042 is used to perform three-dimensional reconstruction of the human head in a preset three-dimensional space through the effective disparity map to obtain a three-dimensional human head in the current frame;
[0145] The sequence submodule 5043 is used to obtain a 3D head sequence of the target person based on the 3D head of the current frame.
[0146] Optional, such as Fig.10 As shown, the second calculation submodule 5041 includes:
[0147] A first calculation unit 50411 is used to calculate a valid disparity interval according to a preset priori disparity;
[0148] The second calculation unit 50412 is used to calculate the disparity map between the first head frame and the second head frame in the paired head frames in the current frame, and determine whether the disparity map falls within the valid disparity interval;
[0149] The judging unit 50413 is configured to judge that the disparity map is a valid disparity map if the disparity map falls within the valid disparity interval.
[0150] Optional, such as Fig.11 As shown, the reconstruction submodule 5042 includes:
[0151] A third calculation unit 50421 is used to calculate a final disparity value according to the effective disparity map;
[0152] The fourth calculation unit 50422 is used to calculate the head depth information of the target person according to the preset first camera internal parameter or second camera internal parameter;
[0153] The reconstruction unit 50423 is used to perform three-dimensional reconstruction of the human head in the preset three-dimensional space according to the depth information of the human head to obtain a three-dimensional human head in the current frame.
[0154] Optional, such as Fig.12 As shown, the monitoring module 505 includes:
[0155] The projection submodule 5051 is used to project the three-dimensional heads in the three-dimensional head sequence onto the calibrated ground to obtain the projection trajectory of the target person;
[0156] The monitoring submodule 5052 is used to monitor the passenger flow in the target area according to the projection trajectory.
[0157] Optional, such as Fig.13 As shown, the calibrated ground includes a target calibration area corresponding to the target area, and the monitoring submodule 5052 includes:
[0158] A fifth calculation unit 50521 is used to calculate the state information of the projection trajectory and the target calibration area at each time point to obtain a state sequence of the projection trajectory and the target calibration area;
[0159] The monitoring unit 50522 is used to monitor the passenger flow in the target area according to the state sequence.
[0160] It should be noted that the passenger flow monitoring device provided in the embodiment of the present invention can be applied to devices such as mobile phones, monitors, computers, servers, etc. that can monitor passenger flow.
[0161] The passenger flow monitoring device provided in the embodiment of the present invention can implement each process implemented by the passenger flow monitoring method in the above method embodiment and can achieve the same beneficial effect. To avoid repetition, it will not be described here.
[0162] See also Fig.14 , Fig.14 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Fig.14 As shown, it includes: a memory 1402, a processor 1401, and a computer program stored in the memory 1402 and executable on the processor 1401, wherein:
[0163] The processor 1401 is used to call the computer program stored in the memory 1402 and execute the following steps:
[0164] Acquire a first target image sequence and a second target image sequence of a target area, wherein the first target image sequence and the second target image sequence are acquired at different angles at the same time;
[0165] Performing head detection on the first target image sequence and the second target image sequence respectively to obtain a first head frame sequence and a second head frame sequence, wherein the first head frame sequence includes a first head frame of at least one target person, and the second head frame sequence includes a second head frame of at least one target person;
[0166] According to the time sequence relationship between the first head frame sequence and the second head frame sequence, the first head frame is matched with the second head frame to obtain a paired head frame sequence of each target person, wherein the paired head frame sequence includes at least one paired head frame of the target person;
[0167] According to the paired head frame sequence, a three-dimensional reconstruction of the head is performed in a preset three-dimensional space to obtain a three-dimensional head sequence of the target person, wherein the three-dimensional head sequence includes the three-dimensional head of the target person;
[0168] The passenger flow in the target area is monitored according to the three-dimensional head sequence.
[0169] Optionally, the first target image sequence is acquired by a first camera, and the second target image sequence is acquired by a second camera, and the processor 1401 further executes the following steps:
[0170] Perform ground calibration in the coordinate system of the first camera or the second camera to obtain a calibrated ground;
[0171] The three-dimensional space is constructed based on the calibrated ground.
[0172] Optionally, the processor 1401 performs ground calibration in the coordinate system of the first camera or the second camera to obtain a calibrated ground, including:
[0173] Acquire calibration object information associated with the target area, where the calibration object information is calibration object information in a coordinate system of the first camera or the second camera;
[0174] The ground is calibrated according to the calibration object information to obtain a calibrated ground.
[0175] Optionally, the processor 1401 performs ground calibration in the coordinate system of the first camera or the second camera to obtain a calibrated ground, including:
[0176] Calculating ground feature points corresponding to the first camera and the second camera, and triangulating the ground feature points to obtain three-dimensional space points corresponding to the ground feature points;
[0177] Plane parameter fitting is performed on the three-dimensional space points to obtain a calibrated ground surface.
[0178] Optionally, the processor 1401 performs three-dimensional reconstruction of the paired head frame sequence in a preset three-dimensional space to obtain a three-dimensional head sequence of the target person, including:
[0179] Calculate the effective disparity map of the first head frame and the second head frame in the paired head frame in the current frame;
[0180] Using the effective disparity map, a three-dimensional reconstruction of the human head is performed in a preset three-dimensional space to obtain a three-dimensional human head in the current frame;
[0181] Based on the three-dimensional head of the current frame, a three-dimensional head sequence of the target person is obtained.
[0182] Optionally, the calculating of the effective disparity map of the first head frame and the second head frame in the paired head frames in the current frame performed by the processor 1401 includes:
[0183] According to the preset prior disparity, the effective disparity interval is calculated;
[0184] Calculating a disparity map between a first head frame and a second head frame in the paired head frames in the current frame, and determining whether the disparity map falls within the valid disparity interval;
[0185] If the disparity map falls within the valid disparity interval, the disparity map is determined to be a valid disparity map.
[0186] Optionally, the processor 1401 performs three-dimensional reconstruction of a human head in a preset three-dimensional space through the effective disparity map to obtain a three-dimensional human head in a current frame, including:
[0187] Calculating a final disparity value according to the effective disparity map;
[0188] Calculate the head depth information of the target person according to the preset first camera internal parameter or second camera internal parameter;
[0189] According to the depth information of the human head, a three-dimensional reconstruction of the human head is performed in the preset three-dimensional space to obtain a three-dimensional human head in the current frame.
[0190] Optionally, the three-dimensional space includes a calibrated ground, and the monitoring of passenger flow in the target area according to the three-dimensional head sequence performed by the processor 1401 includes:
[0191] Projecting the three-dimensional heads in the three-dimensional head sequence onto the calibrated ground to obtain a projection trajectory of the target person;
[0192] The passenger flow in the target area is monitored according to the projection trajectory.
[0193] Optionally, the calibrated ground includes a target calibration area corresponding to the target area, and monitoring the passenger flow of the target area according to the projection trajectory includes:
[0194] Calculating state information of the projection trajectory and the target calibration area at each time point to obtain a state sequence of the projection trajectory and the target calibration area;
[0195] The passenger flow in the target area is monitored according to the state sequence.
[0196] It should be noted that the above-mentioned electronic devices may be mobile phones, monitors, computers, servers and other devices that can be used to monitor passenger flow.
[0197] The electronic device provided in the embodiment of the present invention can implement each process implemented by the passenger flow monitoring method in the above method embodiment and can achieve the same beneficial effects. To avoid repetition, it will not be described here.
[0198] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the passenger flow monitoring method provided by the embodiment of the present invention are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0199] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).
[0200] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A method for monitoring passenger flow, characterized in that: The following steps are involved: Acquire a first target image sequence and a second target image sequence of a target area, wherein the first target image sequence and the second target image sequence are acquired at different angles at the same time; Performing head detection on the first target image sequence and the second target image sequence respectively to obtain a first head frame sequence and a second head frame sequence, wherein the first head frame sequence includes a first head frame of at least one target person, and the second head frame sequence includes a second head frame of at least one target person; According to the time sequence relationship between the first head frame sequence and the second head frame sequence, the first head frame is matched with the second head frame to obtain a paired head frame sequence of each target person, wherein the paired head frame sequence includes at least one paired head frame of the target person; According to the paired head frame sequence, a three-dimensional reconstruction of the head is performed in a preset three-dimensional space to obtain a three-dimensional head sequence of the target person, wherein the three-dimensional head sequence includes the three-dimensional head of the target person; Monitoring passenger flow in the target area according to the three-dimensional head sequence; The three-dimensional space includes a calibrated ground surface, and monitoring passenger flow in the target area according to the three-dimensional head sequence includes: Projecting the three-dimensional heads in the three-dimensional head sequence onto the calibrated ground to obtain a projection trajectory of the target person; Monitoring passenger flow in the target area according to the projection trajectory; The calibrated ground includes a target calibration area corresponding to the target area, and monitoring the passenger flow of the target area according to the projection trajectory includes: Calculating state information of the projection trajectory and the target calibration area at each time point to obtain a state sequence of the projection trajectory and the target calibration area, wherein the state information includes a valid area state and an invalid area state; The passenger flow in the target area is monitored according to the state sequence.
2. The method according to claim 1, characterized in that The first target image sequence is acquired by a first camera, and the second target image sequence is acquired by a second camera. The method further includes: Perform ground calibration in the coordinate system of the first camera or the second camera to obtain a calibrated ground; The three-dimensional space is constructed based on the calibrated ground.
3. The method according to claim 2, characterized in that The step of performing ground calibration in the coordinate system of the first camera or the second camera to obtain a calibrated ground includes: Acquire calibration object information associated with the target area, where the calibration object information is calibration object information in a coordinate system of the first camera or the second camera; The ground is calibrated according to the calibration object information to obtain a calibrated ground.
4. The method according to claim 2, characterized in that The step of performing ground calibration in the coordinate system of the first camera or the second camera to obtain a calibrated ground includes: Calculating ground feature points corresponding to the first camera or the second camera, and triangulating the ground feature points to obtain three-dimensional space points corresponding to the ground feature points; Plane parameter fitting is performed on the three-dimensional space points to obtain a calibrated ground surface.
5. The method according to claim 1, characterized in that The step of reconstructing the paired head frame sequence in a preset three-dimensional space to obtain a three-dimensional head sequence of the target person includes: Calculate the effective disparity map of the first head frame and the second head frame in the paired head frame in the current frame; Using the effective disparity map, a three-dimensional reconstruction of the human head is performed in a preset three-dimensional space to obtain a three-dimensional human head in the current frame; Based on the three-dimensional head of the current frame, a three-dimensional head sequence of the target person is obtained.
6. The method according to claim 5, characterized in that The calculating of the effective disparity map of the first head frame and the second head frame in the paired head frames in the current frame includes: According to the preset prior disparity, the effective disparity interval is calculated; Calculating a disparity map between a first head frame and a second head frame in the paired head frames in the current frame, and determining whether the disparity map falls within the valid disparity interval; If the disparity map falls within the valid disparity interval, the disparity map is determined to be a valid disparity map.
7. The method according to claim 6, characterized in that The method of performing three-dimensional reconstruction of a human head in a preset three-dimensional space by using the effective disparity map to obtain a three-dimensional human head in a current frame includes: Calculating a final disparity value according to the effective disparity map; Calculate the head depth information of the target person according to the preset first camera internal parameter or second camera internal parameter; According to the depth information of the human head, a three-dimensional reconstruction of the human head is performed in the preset three-dimensional space to obtain a three-dimensional human head in the current frame.
8. A passenger flow monitoring device, characterized in that: The device comprises: A first acquisition module is used to acquire a first target image sequence and a second target image sequence of a target area, wherein the first target image sequence and the second target image sequence are acquired at different angles at the same time; a processing module, configured to perform head detection on the first target image sequence and the second target image sequence respectively, to obtain a first head frame sequence and a second head frame sequence, wherein the first head frame sequence includes a first head frame of at least one target person, and the second head frame sequence includes a second head frame of at least one target person; a matching module, configured to match the first head frame with the second head frame according to a time sequence relationship between the first head frame sequence and the second head frame sequence, to obtain a paired head frame sequence for each target person, wherein the paired head frame sequence includes a paired head frame of at least one target person; A three-dimensional reconstruction module, used to perform three-dimensional reconstruction of the head in a preset three-dimensional space according to the paired head frame sequence, to obtain a three-dimensional head sequence of the target person, wherein the three-dimensional head sequence includes the three-dimensional head of the target person; A monitoring module, used for monitoring passenger flow in the target area according to the three-dimensional head sequence; The three-dimensional space includes a calibrated ground surface, and the monitoring module includes: A projection submodule, used for projecting the three-dimensional heads in the three-dimensional head sequence onto the calibrated ground to obtain a projection trajectory of the target person; A monitoring submodule, used for monitoring passenger flow in the target area according to the projection trajectory; The calibrated ground includes a target calibration area corresponding to the target area, and the monitoring submodule includes: A fifth calculation unit, configured to calculate state information of the projection trajectory and the target calibration area at each time point, to obtain a state sequence of the projection trajectory and the target calibration area, wherein the state information includes a valid area state and an invalid area state; A monitoring unit is used to monitor the passenger flow in the target area according to the state sequence.
9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the passenger flow monitoring method as claimed in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the passenger flow monitoring method according to any one of claims 1 to 7 are implemented.
