WO2021139176A1 - Pedestrian trajectory tracking method and apparatus based on binocular camera calibration, computer device, and storage medium - Google Patents

Pedestrian trajectory tracking method and apparatus based on binocular camera calibration, computer device, and storage medium Download PDF

Info

Publication number
WO2021139176A1
WO2021139176A1 PCT/CN2020/111780 CN2020111780W WO2021139176A1 WO 2021139176 A1 WO2021139176 A1 WO 2021139176A1 CN 2020111780 W CN2020111780 W CN 2020111780W WO 2021139176 A1 WO2021139176 A1 WO 2021139176A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
picture
coordinates
camera
pixel
Prior art date
Application number
PCT/CN2020/111780
Other languages
French (fr)
Chinese (zh)
Inventor
程晓
雷晨雨
张国辉
宋晨
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021139176A1 publication Critical patent/WO2021139176A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/20Analysis of motion
    • G06T7/246Analysis of motion using feature-based methods, e.g. the tracking of corners or segments
    • G06T5/80
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/20Analysis of motion
    • G06T7/277Analysis of motion involving stochastic approaches, e.g. using Kalman filters
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person

Definitions

  • This application relates to the field of artificial intelligence image detection technology, and in particular to a pedestrian trajectory tracking method, device, computer equipment and storage medium based on binocular camera calibration.
  • Visual tracking and target detection are the earliest research directions in the field of computer vision. After decades of accumulation, these two directions have achieved remarkable development, and are widely used in robot navigation, intelligent surveillance video, target behavior analysis, and transportation. Management and security prevention and control and other fields.
  • the main task of visual tracking and target detection is to locate multiple targets of interest in a given video at the same time, maintain their IDs, and record their trajectories.
  • the goal can be arbitrary, and the most researched one is "pedestrian tracking”.
  • Multi-target tracking technology adopts Detection-Based Tracking strategy to perform specific type of target detection or motion detection in a given frame of the video, and then perform sequential or batch tracking, and connect the detection hypothesis to the trajectory, so as to achieve the camera's visual range Multiplayer trajectory tracking.
  • the use of the two-dimensional image coordinates of the camera has very strict requirements on the installation position and angle of the camera, which brings great difficulty to the deployment of the system and reduces the versatility of the system.
  • the embodiments of this application provide a pedestrian trajectory tracking method, device, computer equipment, and storage medium based on binocular camera calibration, aiming to solve the tracking and target detection technology in the prior art, and only provide the two-dimensional image captured by the camera.
  • the coordinates do not fully reflect the position of pedestrians in the real three-dimensional world.
  • an embodiment of the present application provides a pedestrian trajectory tracking method based on binocular camera calibration, which includes:
  • the single target fixed parameters include left camera internal parameters, left camera external parameters, left camera distortion parameters, right camera internal parameters, right camera external parameters, and right camera Distortion parameter
  • the target two-dimensional image coordinates of each frame of the target image in the target image set are converted into corresponding target 3D coordinates to form the target 3D according to the called sparse perspective change algorithm and the view difference. Coordinate collection.
  • an embodiment of the present application provides a pedestrian trajectory tracking device based on binocular camera calibration, which includes:
  • the single target setting unit is used to obtain the single target setting parameters of the binocular camera through the calibration object image set; wherein, the single target setting parameters include the left camera internal parameter, the left camera external parameter, the left camera distortion parameter, the right camera internal parameter, and the right camera internal parameter. External camera parameters and distortion parameters of the right camera;
  • the binocular correction unit is used to obtain a test picture, perform binocular correction on the test picture by using the single target setting parameters to obtain a left-corrected picture and a right-corrected picture, and obtain a reprojection matrix;
  • a view difference calculation unit configured to call a pre-stored StereoBM algorithm, and calculate the view difference from the left correction picture and the right correction picture through the StereoBM algorithm;
  • the target two-dimensional coordinate acquiring unit is used to acquire the target image set uploaded by the binocular camera and corresponding to the target to be tracked, and call a pre-stored trajectory tracking algorithm to acquire the target two-dimensional image coordinates of each frame of target image in the target image set;
  • the target 3D coordinate collection acquisition unit is used to convert the target two-dimensional image coordinates of each frame of the target image in the target image set into the corresponding two-dimensional image coordinates according to the called sparse perspective change algorithm and the view difference The 3D coordinates of the target to form a set of target 3D coordinates.
  • an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and running on the processor, and the processor executes the computer The following steps are implemented during the program:
  • the single target fixed parameters include left camera internal parameters, left camera external parameters, left camera distortion parameters, right camera internal parameters, right camera external parameters, and right camera Distortion parameter
  • the target two-dimensional image coordinates of each frame of the target image in the target image set are converted into corresponding target 3D coordinates to form the target 3D according to the called sparse perspective change algorithm and the view difference. Coordinate collection.
  • the embodiments of the present application also provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, which when executed by a processor causes the processor to perform the following operations :
  • the single target fixed parameters include left camera internal parameters, left camera external parameters, left camera distortion parameters, right camera internal parameters, right camera external parameters, and right camera Distortion parameter
  • the target two-dimensional image coordinates of each frame of the target image in the target image set are converted into corresponding target 3D coordinates to form the target 3D according to the called sparse perspective change algorithm and the view difference. Coordinate collection.
  • the embodiments of the application provide a pedestrian trajectory tracking method, device, computer equipment, and storage medium based on binocular camera calibration, including obtaining single target parameters of binocular cameras through a calibration object image set; obtaining test pictures through single target Perform binocular correction on the test picture by setting parameters to obtain the left and right correction pictures and get the reprojection matrix; call the StereoBM algorithm, and calculate the left and right correction pictures through the StereoBM algorithm to obtain the view difference; get the binocular camera upload
  • the target image set corresponding to the target to be tracked, the trajectory tracking algorithm is called to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set; the target two-dimensional image coordinates of each frame of the target image in the target image set are changed according to the called sparse perspective
  • the algorithm and the view are different, and the two-dimensional image coordinates of each target are converted into the corresponding target 3D coordinates to form a target 3D coordinate set.
  • the two-dimensional image coordinate system captured by the binocular camera is converted into a real
  • FIG. 1 is a schematic diagram of an application scenario of a pedestrian trajectory tracking method based on binocular camera calibration provided by an embodiment of the application;
  • FIG. 2 is a schematic flowchart of a pedestrian trajectory tracking method based on binocular camera calibration according to an embodiment of the application;
  • FIG. 3 is a schematic block diagram of a pedestrian trajectory tracking device based on binocular camera calibration provided by an embodiment of the application;
  • Fig. 4 is a schematic block diagram of a computer device provided by an embodiment of the application.
  • Figure 1 is a schematic diagram of an application scenario of a pedestrian trajectory tracking method based on binocular camera calibration provided by an embodiment of the application
  • Figure 2 is a pedestrian trajectory tracking based on binocular camera calibration provided by an embodiment of the application
  • the pedestrian trajectory tracking method based on binocular camera calibration is applied to a server, and the method is executed by application software installed in the server.
  • the method includes steps S110 to S150.
  • the single target parameter includes the left camera internal parameter, the left camera external parameter, the left camera distortion parameter, the right camera internal parameter, the right camera external parameter, and Distortion parameter of the right camera.
  • the calibration object image set (the calibration object image collection includes multiple checkerboard pictures in specific implementation, and the corresponding viewing angles of each checkerboard picture are different) through the checkerboard corner detection to calculate the binocular camera
  • the parameters corresponding to the left camera and the parameters corresponding to the right camera It is specifically calculated that the parameters corresponding to the left camera include the left camera internal parameters, the left camera external parameters, and the left camera distortion parameters; the parameters corresponding to the right camera include the right camera internal parameters, the right camera external parameters, and the right camera distortion parameters.
  • the process of obtaining the parameters corresponding to the right camera with a single target is the same as obtaining the parameters corresponding to the left camera with a single target.
  • only the parameters corresponding to the left camera obtained by the single target setting are taken as an example to illustrate the various parameters obtained after the single target setting.
  • the left camera internal parameters include 1/dx, 1/dy, u0, v0, and f;
  • dx represents the length occupied by a pixel in the x direction
  • dy represents the length occupied by a pixel in the y direction
  • u0 represents the center pixel coordinates of the image and the image
  • v0 represents the number of vertical pixels that differ between the center pixel coordinates of the image and the pixel coordinates of the image origin
  • f represents the focal length of the left camera.
  • the left camera external parameters include the rotation matrix R and the translation matrix T from the world coordinate system to the camera coordinate system of the camera.
  • the left camera distortion parameters include ⁇ k1, k2, p1, p2, k3 ⁇ , where k1, k2, and k3 represent radial distortion coefficients, and p1 and p2 represent tangential distortion coefficients.
  • step S110 includes:
  • Least square estimation is performed by using the Harris corner feature of the left image and the Harris corner feature of the right image to obtain the single target parameter of the binocular camera.
  • the left and right cameras in the binocular camera when calibrating the left and right cameras in the binocular camera, it is necessary to print 10-20 checkerboard pictures taken from different angles (wherein the checkerboard picture is the surface of the checkerboard and the imaging plane of the camera). The included angle must be less than 45 degrees) for the left camera and right camera to calibrate.
  • a left checkerboard picture is first extracted from the left checkerboard picture set as the target left checkerboard picture, and then the Harris corner detection function is called to detect the target left checkerboard Based on the multiple left image Harris corner features in the grid picture, the least square estimation is performed according to the multiple left image Harris corner features, and the single target parameter of the left camera is obtained.
  • the single target parameter setting process of the left camera and similarly, the single target parameter setting of the right camera can also be obtained.
  • the process of performing binocular correction is generally based on the left camera, and then the left camera and the right camera shoot the same object at the same time to obtain the left camera test picture and the right camera test picture. After that, the left camera test picture and the right camera test picture are processed, so that the two pictures finally achieve the following goal: that is, the same object has the same size in the two images and is horizontally in a straight line.
  • the right camera external parameters of the left camera obtained previously include the left rotation matrix R1 (that is, the above-mentioned rotation matrix R) and the left translation matrix T1 (that is, the above-mentioned translation matrix T)
  • the right camera external parameters include The right rotation matrix R2 and the right translation matrix T2.
  • the right rotation matrix R2 and the right translation matrix T2 can be decomposed into the rotation matrix R21 and R22, and the translation matrix T21 and T22, which are rotated by half of the left and right cameras, by using the cvStereoRectify algorithm of OpenCV. Then calculate the correction lookup mapping table of the left correction picture and the right correction picture to obtain the reprojection matrix Q.
  • step S120 includes:
  • the left actual imaging plane coordinates of each pixel are converted according to the left camera distortion parameters to obtain the left ideal plane imaging coordinates of each pixel, and the right actual imaging plane coordinates of each pixel are converted according to the right camera distortion parameters. Obtain the right ideal plane imaging coordinates of each pixel;
  • the left camera 3D coordinates of each pixel are rigid body converted according to the left camera external parameters to obtain the left actual 3D coordinates of each pixel, and the right camera 3D coordinates of each pixel are rigid body converted according to the right camera external parameters to obtain each pixel The actual right 3D coordinates of the point;
  • the reprojection matrix is obtained.
  • the essence of the binocular correction of the left and right cameras is to convert the picture from the image pixel coordinate system to the actual imaging plane coordinate, and then from the actual imaging plane coordinate to the ideal plane imaging coordinate system, and then from the ideal plane imaging coordinate system.
  • the system is converted to the camera 3D coordinate system, and finally from the camera 3D coordinate system to the actual 3D coordinate system, the left correction image is obtained according to the left actual 3D coordinates of each pixel, and the right correction image is obtained according to the right actual 3D coordinates of each pixel According to the mapping relationship between the left actual 3D coordinates of each pixel and the right actual 3D coordinates of each pixel, the reprojection matrix is finally obtained.
  • step S130 includes:
  • the left correction picture needs to be read first and converted into a left single-channel grayscale image.
  • the name of the left correction picture is zjztp1.jpg.
  • the left correction picture is first read through the cv2.imread() instruction of OpenCV.
  • the right-corrected picture When converting the right-corrected picture into a right single-channel grayscale image, it is necessary to read the right-corrected picture and convert it into a right single-channel grayscale image.
  • the name of the right-corrected picture is yjztp1.jpg.
  • S140 Obtain a target image set uploaded by the binocular camera and corresponding to the target to be tracked, and call a pre-stored trajectory tracking algorithm to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set.
  • the pre-stored trajectory tracking algorithm can be called at this time to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set corresponding to the target to be tracked uploaded by the binocular camera.
  • the specific implementation of the trajectory tracking algorithm adopts a multi-target tracking algorithm.
  • the multi-target tracking algorithm will be introduced below.
  • MOT Multiple Object Tracking
  • N N consecutive frames. From the first frame to the last frame, there are multiple targets inside, constantly moving in and out.
  • the purpose of multi-target tracking is to distinguish each target from other targets and track its trajectory in different frames.
  • the most classic application of multi-target tracking is to monitor pedestrians at intersections.
  • the multi-target tracking problem can be understood as a multi-variable estimation problem, and we give its formal definition.
  • the solution of the model corresponding to equation (1) can be calculated to obtain the target two-dimensional image coordinates of the target image of each frame.
  • the target two-dimensional image coordinates of each frame of the target image in the target image set are converted into corresponding target 3D coordinates according to the called sparse perspective change algorithm and the view difference, so as to form The target 3D coordinate collection.
  • the target two-dimensional image coordinates output by the trajectory tracking algorithm are converted.
  • the two-dimensional points are reprojected to the three-dimensional reprojection matrix Q, and the cvPerspectiveTransform algorithm (ie sparse perspective change algorithm) of OpenCV is used to convert the two-dimensional image coordinates of each target into the corresponding target 3D Coordinates to form a set of target 3D coordinates.
  • This application can be applied to smart city management/smart transportation scenarios to promote the construction of smart cities.
  • it can be used to draw a pedestrian trajectory map, accurately calculate the distance moved by the target pedestrian, and accurately calculate the distance between the target pedestrian and the target object.
  • step S150 the method further includes:
  • the server can be used as a blockchain node device to upload the target 3D coordinate set to the blockchain network, making full use of the non-tamperable characteristics of the blockchain data to achieve solidified storage of pedestrian trajectory data.
  • the corresponding summary information is obtained based on the target 3D coordinate set.
  • the summary information is obtained by hashing the target 3D coordinate set, for example by using the sha256 algorithm.
  • Uploading summary information to the blockchain can ensure its security and fairness and transparency to users.
  • the server can download the summary information from the blockchain to verify whether the target 3D coordinate set has been tampered with.
  • the blockchain referred to in this example is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information for verification. The validity of the information (anti-counterfeiting) and generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
  • This method realizes the conversion of the two-dimensional image coordinate system taken by the binocular camera into the real-world 3D coordinate system, and can obtain the accurate 3D coordinates of the target pedestrian under the camera.
  • the embodiment of the present application also provides a pedestrian trajectory tracking device based on binocular camera calibration.
  • the pedestrian trajectory tracking device based on binocular camera calibration is used to implement any embodiment of the aforementioned pedestrian trajectory tracking method based on binocular camera calibration.
  • FIG. 3 is a schematic block diagram of a pedestrian trajectory tracking device based on binocular camera calibration provided by an embodiment of the present application.
  • the pedestrian trajectory tracking device 100 based on binocular camera calibration can be configured in a server.
  • the pedestrian trajectory tracking device 100 based on binocular camera calibration includes: a single target positioning unit 110, a binocular correction unit 120, a view difference calculation unit 130, a target two-dimensional coordinate acquisition unit 140, and a target 3D coordinate collection acquisition Unit 150.
  • the single target setting unit 110 is used to obtain the single target setting parameters of the binocular camera through the calibration object image set; wherein, the single target setting parameters include left camera internal parameters, left camera external parameters, left camera distortion parameters, right camera internal parameters, External parameters of the right camera and distortion parameters of the right camera.
  • the calibration object image set (the calibration object image collection includes multiple checkerboard pictures in specific implementation, and the corresponding viewing angles of each checkerboard picture are different) through the checkerboard corner detection to calculate the binocular camera
  • the parameters corresponding to the left camera and the parameters corresponding to the right camera It is specifically calculated that the parameters corresponding to the left camera include the left camera internal parameters, the left camera external parameters, and the left camera distortion parameters; the parameters corresponding to the right camera include the right camera internal parameters, the right camera external parameters, and the right camera distortion parameters.
  • the process of obtaining the parameters corresponding to the right camera with a single target is the same as obtaining the parameters corresponding to the left camera with a single target.
  • only the parameters corresponding to the left camera obtained by the single target setting are taken as an example to illustrate the various parameters obtained after the single target setting.
  • the left camera internal parameters include 1/dx, 1/dy, u0, v0, and f;
  • dx represents the length occupied by a pixel in the x direction
  • dy represents the length occupied by a pixel in the y direction
  • u0 represents the center pixel coordinates of the image and the image
  • v0 represents the number of vertical pixels that differ between the center pixel coordinates of the image and the pixel coordinates of the image origin
  • f represents the focal length of the left camera.
  • the left camera external parameters include the rotation matrix R and the translation matrix T from the world coordinate system to the camera coordinate system of the camera.
  • the left camera distortion parameters include ⁇ k1, k2, p1, p2, k3 ⁇ , where k1, k2, and k3 represent radial distortion coefficients, and p1 and p2 represent tangential distortion coefficients.
  • the single target setting unit 110 includes:
  • the calibration object image set acquisition unit is used to receive the left checkerboard picture set sent by the left camera in the binocular camera, and the right checkerboard picture set sent by the right camera; wherein, the left checkerboard picture set and the right checkerboard picture set
  • the set forms a calibration object image set, and each left checkerboard picture in the left checkerboard picture set corresponds to a right checkerboard picture in the right checkerboard picture set;
  • the target checkerboard picture obtaining unit is used to obtain one of the left checkerboard pictures in the left checkerboard picture set as the target left checkerboard picture, and to obtain the right checkerboard picture set corresponding to the target left checkerboard picture The right checkerboard picture of the target;
  • Harris corner point feature detection unit used to call a pre-stored Harris corner point detection function to obtain the Harris corner point feature of the left image in the left checkerboard of the target, and obtain the right image in the right checkerboard of the target Harris corner features;
  • the least squares estimation unit is used to perform least squares estimation by using the Harris corner feature of the left image and the Harris corner feature of the right image to obtain the single target parameter of the binocular camera.
  • the left and right cameras in the binocular camera when calibrating the left and right cameras in the binocular camera, it is necessary to print 10-20 checkerboard pictures taken from different angles (wherein the checkerboard picture is the surface of the checkerboard and the imaging plane of the camera). The included angle must be less than 45 degrees) for the left camera and right camera to calibrate.
  • a left checkerboard picture is first extracted from the left checkerboard picture set as the target left checkerboard picture, and then the Harris corner detection function is called to detect the target left checkerboard
  • the single target parameter setting process of the left camera and similarly, the single target parameter setting of the right camera can be obtained.
  • the binocular correction unit 120 is configured to obtain a test picture, perform binocular correction on the test picture by using the single target parameter to obtain a left-corrected picture and a right-corrected picture, and obtain a reprojection matrix.
  • the process of performing binocular correction is generally based on the left camera, and then the left camera and the right camera shoot the same object at the same time to obtain the left camera test picture and the right camera test picture. After that, the left camera test picture and the right camera test picture are processed, so that the two pictures finally achieve the following goal: that is, the same object has the same size in the two images and is horizontally in a straight line.
  • the right camera external parameters of the left camera include the left rotation matrix R1 (that is, the above-mentioned rotation matrix R) and the left translation matrix T1 (that is, the above-mentioned translation matrix T)
  • the right camera external parameters include The right rotation matrix R2 and the right translation matrix T2.
  • the right rotation matrix R2 and the right translation matrix T2 can be decomposed into the rotation matrix R21 and R22, and the translation matrix T21 and T22, which are rotated by half of the left and right cameras, by using the cvStereoRectify algorithm of OpenCV. Then calculate the correction lookup mapping table of the left correction picture and the right correction picture to obtain the reprojection matrix Q.
  • the binocular correction unit 120 includes:
  • the first conversion unit is used for linearly converting the image coordinates of each pixel in the test picture according to the left camera internal parameters and the right camera internal parameters, to obtain the left actual imaging plane coordinates of each pixel, and to obtain the right of each pixel. Actual imaging plane coordinates;
  • the second conversion unit is used to convert the left actual imaging plane coordinates of each pixel according to the left camera distortion parameters to obtain the left ideal plane imaging coordinates of each pixel, and to calculate the right actual imaging plane coordinates of each pixel according to the right
  • the camera distortion parameter performs coordinate conversion to obtain the right ideal plane imaging coordinates of each pixel
  • the third conversion unit is used to perform perspective projection transformation of the left ideal plane imaging coordinates of each pixel point according to the left camera internal parameters to obtain the left camera 3D coordinates of each pixel point, and the right ideal plane imaging coordinates of each pixel point according to the right camera
  • the internal parameter performs perspective projection transformation to obtain the right camera 3D coordinates of each pixel
  • the fourth conversion unit is used to perform rigid body conversion of the left camera 3D coordinates of each pixel according to the external parameters of the left camera to obtain the actual left 3D coordinates of each pixel, and the 3D coordinates of the right camera of each pixel according to the external parameters of the right camera Perform rigid body transformation to obtain the actual right 3D coordinates of each pixel;
  • the correction picture acquisition unit is configured to obtain a left correction picture according to the left actual 3D coordinates of each pixel, and obtain a right correction picture according to the right actual 3D coordinates of each pixel;
  • the re-projection matrix obtaining unit is configured to obtain the re-projection matrix according to the mapping relationship between the left actual 3D coordinates of each pixel and the right actual 3D coordinates of each pixel.
  • the essence of the binocular correction of the left and right cameras is to convert the picture from the image pixel coordinate system to the actual imaging plane coordinate, and then from the actual imaging plane coordinate to the ideal plane imaging coordinate system, and then from the ideal plane imaging coordinate system.
  • the system is converted to the camera 3D coordinate system, and finally from the camera 3D coordinate system to the actual 3D coordinate system, the left correction image is obtained according to the left actual 3D coordinates of each pixel, and the right correction image is obtained according to the right actual 3D coordinates of each pixel According to the mapping relationship between the left actual 3D coordinates of each pixel and the right actual 3D coordinates of each pixel, the reprojection matrix is finally obtained.
  • the view difference calculation unit 130 is configured to call a pre-stored StereoBM algorithm, and calculate the view difference from the left correction picture and the right correction picture through the StereoBM algorithm.
  • the view difference calculation unit 130 includes:
  • the first gray scale conversion unit is configured to perform single-channel gray scale conversion on the left corrected picture to obtain a left single-channel gray scale image
  • the second gray scale conversion unit is configured to perform single-channel gray scale conversion on the right corrected picture to obtain a right single-channel gray scale image
  • the view difference acquisition unit is used to call the preset disparity search range and sliding window size in the StereoBM algorithm, and use the left single-channel grayscale image, right single-channel grayscale image, disparity search range, and sliding window size as all
  • the input parameters of the StereoBM algorithm are calculated to obtain the view difference.
  • the left correction picture needs to be read first and converted into a left single-channel grayscale image.
  • the name of the left correction picture is zjztp1.jpg.
  • the left correction picture is first read through the cv2.imread() instruction of OpenCV.
  • the right-corrected picture When converting the right-corrected picture into a right single-channel grayscale image, it is necessary to read the right-corrected picture and convert it into a right single-channel grayscale image.
  • the name of the right-corrected picture is yjztp1.jpg.
  • the target two-dimensional coordinate acquiring unit 140 is configured to acquire the target image set uploaded by the binocular camera and corresponding to the target to be tracked, and call a pre-stored trajectory tracking algorithm to acquire the target two-dimensional image coordinates of each frame of the target image in the target image set.
  • the pre-stored trajectory tracking algorithm can be called at this time to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set corresponding to the target to be tracked uploaded by the binocular camera.
  • the specific implementation of the trajectory tracking algorithm adopts a multi-target tracking algorithm.
  • the multi-target tracking algorithm will be introduced below.
  • MOT Multiple Object Tracking
  • N N consecutive frames. From the first frame to the last frame, there are multiple targets inside, constantly moving in and out.
  • the purpose of multi-target tracking is to distinguish each target from other targets and track its trajectory in different frames.
  • the most classic application of multi-target tracking is to monitor pedestrians at intersections.
  • the multi-target tracking problem can be understood as a multi-variable estimation problem, and we give its formal definition.
  • the above formula (1) can be obtained by generalization modeling using MAP (maximal a posteriori) estimation method
  • MAP maximal a posteriori
  • the solution of the model corresponding to formula (1) can be calculated to obtain the target two-dimensional image coordinates of the target image of each frame.
  • the target 3D coordinate set acquisition unit 150 is configured to convert the target two-dimensional image coordinates of each frame of the target image in the target image set according to the called sparse perspective change algorithm and the view difference to convert each target two-dimensional image coordinate into Corresponding target 3D coordinates to form a target 3D coordinate set.
  • the target two-dimensional image coordinates output by the trajectory tracking algorithm are converted.
  • the two-dimensional points are reprojected to the three-dimensional reprojection matrix Q, and the cvPerspectiveTransform algorithm (ie sparse perspective change algorithm) of OpenCV is used to convert the two-dimensional image coordinates of each target into the corresponding target 3D Coordinates to form a set of target 3D coordinates.
  • the cvPerspectiveTransform algorithm ie sparse perspective change algorithm
  • the pedestrian trajectory tracking device 100 based on binocular camera calibration further includes:
  • the data link unit is used to upload the target 3D coordinate set to the blockchain network.
  • the server can be used as a blockchain node device to upload the target 3D coordinate set to the blockchain network, making full use of the non-tamperable characteristics of the blockchain data to achieve solidified storage of pedestrian trajectory data.
  • the corresponding summary information is obtained based on the target 3D coordinate set.
  • the summary information is obtained by hashing the target 3D coordinate set, for example by using the sha256 algorithm.
  • Uploading summary information to the blockchain can ensure its security and fairness and transparency to users.
  • the server can download the summary information from the blockchain to verify whether the target 3D coordinate set has been tampered with.
  • the blockchain referred to in this example is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information for verification. The validity of the information (anti-counterfeiting) and generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
  • the device realizes the conversion of the two-dimensional image coordinate system captured by the binocular camera into the real-world 3D coordinate system, and can obtain the accurate 3D coordinates of the target pedestrian under the camera.
  • the aforementioned pedestrian trajectory tracking device based on binocular camera calibration can be implemented in the form of a computer program, and the computer program can be run on a computer device as shown in FIG. 4.
  • FIG. 4 is a schematic block diagram of a computer device according to an embodiment of the present application.
  • the computer device 500 is a server, and the server may be an independent server or a server cluster composed of multiple servers.
  • the computer device 500 includes a processor 502, a memory, and a network interface 505 connected through a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
  • the non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032.
  • the processor 502 can execute a pedestrian trajectory tracking method based on binocular camera calibration.
  • the processor 502 is used to provide calculation and control capabilities, and support the operation of the entire computer device 500.
  • the internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503.
  • the processor 502 can execute the pedestrian trajectory tracking method based on binocular camera calibration.
  • the network interface 505 is used for network communication, such as providing data information transmission.
  • the structure shown in FIG. 4 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied.
  • the specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
  • the processor 502 is configured to run a computer program 5032 stored in a memory to implement the pedestrian trajectory tracking method based on binocular camera calibration disclosed in the embodiment of the present application.
  • the embodiment of the computer device shown in FIG. 4 does not constitute a limitation on the specific configuration of the computer device.
  • the computer device may include more or less components than those shown in the figure. Or some parts are combined, or different parts are arranged.
  • the computer device may only include a memory and a processor. In such embodiments, the structures and functions of the memory and the processor are the same as those of the embodiment shown in FIG. 4, and will not be repeated here.
  • the processor 502 may be a central processing unit (Central Processing Unit, CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor.
  • a computer-readable storage medium In another embodiment of the present application, a computer-readable storage medium is provided.
  • the computer-readable storage medium may be non-volatile or volatile.
  • the computer-readable storage medium stores a computer program, where the computer program is executed by a processor to implement the pedestrian trajectory tracking method based on binocular camera calibration disclosed in the embodiments of the present application.
  • the disclosed equipment, device, and method may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods, or the units with the same function may be combined into one. Units, for example, multiple units or components can be combined or integrated into another system, or some features can be omitted or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms of connection.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments of the present application.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium.
  • the technical solution of this application is essentially or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium. It includes several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), magnetic disk or optical disk and other media that can store program codes.

Abstract

Disclosed in the present application are a pedestrian trajectory tracking method and apparatus based on binocular camera calibration, a computer device, and a storage medium. The present application relates to artificial intelligence and blockchain technology. The method comprises: by means of a calibration object image set, acquiring monocular calibration parameters of a binocular camera so as to carry out binocular correction on a test picture to obtain a left correction picture and a right correction picture, and obtaining a re-projection matrix; by means of a StereoBM algorithm, performing calculation on the left correction picture and the right correction picture to obtain a view difference; acquiring a target image set uploaded by the binocular camera and corresponding to a target to be tracked, calling a trajectory tracking algorithm to acquire target two-dimensional image coordinates of each frame of a target image; and according to a sparse perspective change algorithm and the view difference, correspondingly converting the target two-dimensional image coordinates into corresponding target 3D coordinates to constitute a target 3D coordinate set. A two-dimensional image coordinate system photographed by a binocular camera is converted into a real-world 3D coordinate system, and accurate 3D coordinates of a target pedestrian under the camera can be acquired.

Description

基于双目摄像机标定的行人轨迹跟踪方法、装置、计算机设备及存储介质Pedestrian track tracking method, device, computer equipment and storage medium based on binocular camera calibration
本申请要求于2020年7月30日提交中国专利局、申请号为202010752907.9,发明名称为“基于双目摄像机标定的行人轨迹跟踪方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on July 30, 2020, the application number is 202010752907.9, and the invention title is "Pedestrian trajectory tracking method and device based on binocular camera calibration", the entire content of which is incorporated by reference Incorporated in this application.
技术领域Technical field
本申请涉及人工智能的图像检测技术领域,尤其涉及一种基于双目摄像机标定的行人轨迹跟踪方法、装置、计算机设备及存储介质。This application relates to the field of artificial intelligence image detection technology, and in particular to a pedestrian trajectory tracking method, device, computer equipment and storage medium based on binocular camera calibration.
背景技术Background technique
视觉跟踪和目标检测是计算机视觉领域内较早开始的研究方向,经过几十年的积累,这两个方向已经取得了显著的发展,广泛应用于机器人导航、智能监控视频、目标行为分析、交通管理及安全防控等领域。Visual tracking and target detection are the earliest research directions in the field of computer vision. After decades of accumulation, these two directions have achieved remarkable development, and are widely used in robot navigation, intelligent surveillance video, target behavior analysis, and transportation. Management and security prevention and control and other fields.
视觉跟踪和目标检测主要任务是在给定视频中同时对多个感兴趣的目标进行定位,并且维持他们的ID、记录他们的轨迹。目标可以是任意的,研究最多的是“行人跟踪”。采用Detection-Based Tracking策略的多目标跟踪技术,对视频给定帧中进行特定类型的目标检测或运动检测,然后进行顺序或批量跟踪,将检测假设连接到轨迹中,从而实现摄像头可视范围内的多人轨迹追踪。The main task of visual tracking and target detection is to locate multiple targets of interest in a given video at the same time, maintain their IDs, and record their trajectories. The goal can be arbitrary, and the most researched one is "pedestrian tracking". Multi-target tracking technology adopts Detection-Based Tracking strategy to perform specific type of target detection or motion detection in a given frame of the video, and then perform sequential or batch tracking, and connect the detection hypothesis to the trajectory, so as to achieve the camera's visual range Multiplayer trajectory tracking.
然而,发明人意识到目前大多跟踪和目标检测技术,只提供了摄像机拍摄的二维图像中的坐标,并不能完全反应真实三维世界的行人位置。比如,行人沿着摄像机拍摄方向纵向移动时,通过二维图像的坐标无法判断行人准确的位置移动。另外,使用摄像机的二维图像坐标,对摄像机的安装位置及角度,有非常严格的要求,为系统部署带来很大的难度,降低了系统的通用性。However, the inventor realized that most of the current tracking and target detection technologies only provide the coordinates in the two-dimensional image taken by the camera, and cannot fully reflect the position of the pedestrian in the real three-dimensional world. For example, when a pedestrian moves longitudinally along the camera shooting direction, the accurate position movement of the pedestrian cannot be judged by the coordinates of the two-dimensional image. In addition, the use of the two-dimensional image coordinates of the camera has very strict requirements on the installation position and angle of the camera, which brings great difficulty to the deployment of the system and reduces the versatility of the system.
发明内容Summary of the invention
本申请实施例提供了一种基于双目摄像机标定的行人轨迹跟踪方法、装置、计算机设备及存储介质,旨在解决现有技术中跟踪和目标检测技术,只提供了摄像机拍摄的二维图像中的坐标,并不能完全反应真实三维世界的行人位置的问题。The embodiments of this application provide a pedestrian trajectory tracking method, device, computer equipment, and storage medium based on binocular camera calibration, aiming to solve the tracking and target detection technology in the prior art, and only provide the two-dimensional image captured by the camera. The coordinates do not fully reflect the position of pedestrians in the real three-dimensional world.
第一方面,本申请实施例提供了一种基于双目摄像机标定的行人轨迹跟踪方法,其包括:In the first aspect, an embodiment of the present application provides a pedestrian trajectory tracking method based on binocular camera calibration, which includes:
通过标定物图像集获取双目摄像机的单目标定参数;其中,所述单目标定参数包括左相机内参、左相机外参、左相机畸变参数、右相机内参、右相机外参、以及右相机畸变参数;Obtain the single target fixed parameters of the binocular camera through the calibration object image set; wherein, the single target fixed parameters include left camera internal parameters, left camera external parameters, left camera distortion parameters, right camera internal parameters, right camera external parameters, and right camera Distortion parameter
获取测试图片,通过所述单目标定参数对所述测试图片进行双目校正,得到左校正图片和右校正图片,以及得到重投影矩阵;Acquiring a test picture, performing binocular correction on the test picture by using the single target setting parameters to obtain a left-corrected picture and a right-corrected picture, and obtain a reprojection matrix;
调用预先存储的StereoBM算法,将所述左校正图片和所述右校正图片通过所述StereoBM算法计算得到视图差;Call the pre-stored StereoBM algorithm, and calculate the view difference between the left correction picture and the right correction picture through the StereoBM algorithm;
获取双目摄像机所上传与待追踪目标对应的目标图像集,调用预先存储的轨迹跟踪算法获取所述目标图像集中各帧目标图像的目标二维图像坐标;以及Obtaining the target image set uploaded by the binocular camera and corresponding to the target to be tracked, and calling a pre-stored trajectory tracking algorithm to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set; and
将所述目标图像集中各帧目标图像的目标二维图像坐标根据所调用的稀疏透视变化算法和所述视图差,将各目标二维图像坐标均转化为对应的目标3D坐标,以组成目标3D坐标集合。The target two-dimensional image coordinates of each frame of the target image in the target image set are converted into corresponding target 3D coordinates to form the target 3D according to the called sparse perspective change algorithm and the view difference. Coordinate collection.
第二方面,本申请实施例提供了一种基于双目摄像机标定的行人轨迹跟踪装置,其包括:In the second aspect, an embodiment of the present application provides a pedestrian trajectory tracking device based on binocular camera calibration, which includes:
单目标定单元,用于通过标定物图像集获取双目摄像机的单目标定参数;其中,所述单目标定参数包括左相机内参、左相机外参、左相机畸变参数、右相机内参、右相机外参、以及右相机畸变参数;The single target setting unit is used to obtain the single target setting parameters of the binocular camera through the calibration object image set; wherein, the single target setting parameters include the left camera internal parameter, the left camera external parameter, the left camera distortion parameter, the right camera internal parameter, and the right camera internal parameter. External camera parameters and distortion parameters of the right camera;
双目校正单元,用于获取测试图片,通过所述单目标定参数对所述测试图片进行双目校正,得到左校正图片和右校正图片,以及得到重投影矩阵;The binocular correction unit is used to obtain a test picture, perform binocular correction on the test picture by using the single target setting parameters to obtain a left-corrected picture and a right-corrected picture, and obtain a reprojection matrix;
视图差计算单元,用于调用预先存储的StereoBM算法,将所述左校正图片和所述右校正图片通过所述StereoBM算法计算得到视图差;A view difference calculation unit, configured to call a pre-stored StereoBM algorithm, and calculate the view difference from the left correction picture and the right correction picture through the StereoBM algorithm;
目标二维坐标获取单元,用于获取双目摄像机所上传与待追踪目标对应的目标图像集,调用预先存储的轨迹跟踪算法获取所述目标图像集中各帧目标图像的目标二维图像坐标;以及The target two-dimensional coordinate acquiring unit is used to acquire the target image set uploaded by the binocular camera and corresponding to the target to be tracked, and call a pre-stored trajectory tracking algorithm to acquire the target two-dimensional image coordinates of each frame of target image in the target image set;
目标3D坐标集合获取单元,用于将所述目标图像集中各帧目标图像的目标二维图像坐标根据所调用的稀疏透视变化算法和所述视图差,将各目标二维图像坐标均转化为对应的目标3D坐标,以组成目标3D坐标集合。The target 3D coordinate collection acquisition unit is used to convert the target two-dimensional image coordinates of each frame of the target image in the target image set into the corresponding two-dimensional image coordinates according to the called sparse perspective change algorithm and the view difference The 3D coordinates of the target to form a set of target 3D coordinates.
第三方面,本申请实施例又提供了一种计算机设备,其包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现以下步骤:In a third aspect, an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and running on the processor, and the processor executes the computer The following steps are implemented during the program:
通过标定物图像集获取双目摄像机的单目标定参数;其中,所述单目标定参数包括左相机内参、左相机外参、左相机畸变参数、右相机内参、右相机外参、以及右相机畸变参数;Obtain the single target fixed parameters of the binocular camera through the calibration object image set; wherein, the single target fixed parameters include left camera internal parameters, left camera external parameters, left camera distortion parameters, right camera internal parameters, right camera external parameters, and right camera Distortion parameter
获取测试图片,通过所述单目标定参数对所述测试图片进行双目校正,得到左校正图片和右校正图片,以及得到重投影矩阵;Acquiring a test picture, performing binocular correction on the test picture by using the single target setting parameters to obtain a left-corrected picture and a right-corrected picture, and obtain a reprojection matrix;
调用预先存储的StereoBM算法,将所述左校正图片和所述右校正图片通过所述StereoBM算法计算得到视图差;Call the pre-stored StereoBM algorithm, and calculate the view difference between the left correction picture and the right correction picture through the StereoBM algorithm;
获取双目摄像机所上传与待追踪目标对应的目标图像集,调用预先存储的轨迹跟踪算法获取所述目标图像集中各帧目标图像的目标二维图像坐标;以及Obtaining the target image set uploaded by the binocular camera and corresponding to the target to be tracked, and calling a pre-stored trajectory tracking algorithm to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set; and
将所述目标图像集中各帧目标图像的目标二维图像坐标根据所调用的稀疏透视变化算法和所述视图差,将各目标二维图像坐标均转化为对应的目标3D坐标,以组成目标3D坐标集合。The target two-dimensional image coordinates of each frame of the target image in the target image set are converted into corresponding target 3D coordinates to form the target 3D according to the called sparse perspective change algorithm and the view difference. Coordinate collection.
第四方面,本申请实施例还提供了一种计算机可读存储介质,其中所述计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行以下操作:In a fourth aspect, the embodiments of the present application also provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, which when executed by a processor causes the processor to perform the following operations :
通过标定物图像集获取双目摄像机的单目标定参数;其中,所述单目标定参数包括左相机内参、左相机外参、左相机畸变参数、右相机内参、右相机外参、以及右相机畸变参数;Obtain the single target fixed parameters of the binocular camera through the calibration object image set; wherein, the single target fixed parameters include left camera internal parameters, left camera external parameters, left camera distortion parameters, right camera internal parameters, right camera external parameters, and right camera Distortion parameter
获取测试图片,通过所述单目标定参数对所述测试图片进行双目校正,得到左校正图片和右校正图片,以及得到重投影矩阵;Acquiring a test picture, performing binocular correction on the test picture by using the single target setting parameters to obtain a left-corrected picture and a right-corrected picture, and obtain a reprojection matrix;
调用预先存储的StereoBM算法,将所述左校正图片和所述右校正图片通过所述StereoBM算法计算得到视图差;Call the pre-stored StereoBM algorithm, and calculate the view difference between the left correction picture and the right correction picture through the StereoBM algorithm;
获取双目摄像机所上传与待追踪目标对应的目标图像集,调用预先存储的轨迹跟踪算法获取所述目标图像集中各帧目标图像的目标二维图像坐标;以及Obtaining the target image set uploaded by the binocular camera and corresponding to the target to be tracked, and calling a pre-stored trajectory tracking algorithm to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set; and
将所述目标图像集中各帧目标图像的目标二维图像坐标根据所调用的稀疏透视变化算法和所述视图差,将各目标二维图像坐标均转化为对应的目标3D坐标,以组成目标3D坐标集合。The target two-dimensional image coordinates of each frame of the target image in the target image set are converted into corresponding target 3D coordinates to form the target 3D according to the called sparse perspective change algorithm and the view difference. Coordinate collection.
本申请实施例提供了一种基于双目摄像机标定的行人轨迹跟踪方法、装置、计算机设备及存储介质,包括通过标定物图像集获取双目摄像机的单目标定参数;获取测试图片,通过单目标定参数对测试图片进行双目校正,得到左校正图片和右校正图片及得到重投影矩阵; 调用StereoBM算法,将左校正图片和右校正图片通过StereoBM算法计算得到视图差;获取双目摄像机所上传与待追踪目标对应的目标图像集,调用轨迹跟踪算法获取目标图像集中各帧目标图像的目标二维图像坐标;将目标图像集中各帧目标图像的目标二维图像坐标根据所调用的稀疏透视变化算法和视图差,将各目标二维图像坐标均转化为对应的目标3D坐标,以组成目标3D坐标集合。实现了将双目摄像机拍摄的二维图像坐标系转化为真实世界3D坐标系,可以获取目标行人在摄像头下的准确3D坐标。The embodiments of the application provide a pedestrian trajectory tracking method, device, computer equipment, and storage medium based on binocular camera calibration, including obtaining single target parameters of binocular cameras through a calibration object image set; obtaining test pictures through single target Perform binocular correction on the test picture by setting parameters to obtain the left and right correction pictures and get the reprojection matrix; call the StereoBM algorithm, and calculate the left and right correction pictures through the StereoBM algorithm to obtain the view difference; get the binocular camera upload The target image set corresponding to the target to be tracked, the trajectory tracking algorithm is called to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set; the target two-dimensional image coordinates of each frame of the target image in the target image set are changed according to the called sparse perspective The algorithm and the view are different, and the two-dimensional image coordinates of each target are converted into the corresponding target 3D coordinates to form a target 3D coordinate set. The two-dimensional image coordinate system captured by the binocular camera is converted into a real-world 3D coordinate system, and the accurate 3D coordinates of the target pedestrian under the camera can be obtained.
附图说明Description of the drawings
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of the present application more clearly, the following will briefly introduce the drawings used in the description of the embodiments. Obviously, the drawings in the following description are some embodiments of the present application. Ordinary technicians can obtain other drawings based on these drawings without creative work.
图1为本申请实施例提供的基于双目摄像机标定的行人轨迹跟踪方法的应用场景示意图;FIG. 1 is a schematic diagram of an application scenario of a pedestrian trajectory tracking method based on binocular camera calibration provided by an embodiment of the application;
图2为本申请实施例提供的基于双目摄像机标定的行人轨迹跟踪方法的流程示意图;2 is a schematic flowchart of a pedestrian trajectory tracking method based on binocular camera calibration according to an embodiment of the application;
图3为本申请实施例提供的基于双目摄像机标定的行人轨迹跟踪装置的示意性框图;3 is a schematic block diagram of a pedestrian trajectory tracking device based on binocular camera calibration provided by an embodiment of the application;
图4为本申请实施例提供的计算机设备的示意性框图。Fig. 4 is a schematic block diagram of a computer device provided by an embodiment of the application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of them. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in this specification and appended claims, the terms "including" and "including" indicate the existence of the described features, wholes, steps, operations, elements and/or components, but do not exclude one or The existence or addition of multiple other features, wholes, steps, operations, elements, components, and/or collections thereof.
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。It should also be understood that the terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in the specification of this application and the appended claims, unless the context clearly indicates other circumstances, the singular forms "a", "an" and "the" are intended to include plural forms.
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It should be further understood that the term "and/or" used in the specification and appended claims of this application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations .
请参阅图1和图2,图1为本申请实施例提供的基于双目摄像机标定的行人轨迹跟踪方法的应用场景示意图;图2为本申请实施例提供的基于双目摄像机标定的行人轨迹跟踪方法的流程示意图,该基于双目摄像机标定的行人轨迹跟踪方法应用于服务器中,该方法通过安装于服务器中的应用软件进行执行。Please refer to Figures 1 and 2. Figure 1 is a schematic diagram of an application scenario of a pedestrian trajectory tracking method based on binocular camera calibration provided by an embodiment of the application; Figure 2 is a pedestrian trajectory tracking based on binocular camera calibration provided by an embodiment of the application A schematic flow chart of the method. The pedestrian trajectory tracking method based on binocular camera calibration is applied to a server, and the method is executed by application software installed in the server.
如图2所示,该方法包括步骤S110~S150。As shown in Figure 2, the method includes steps S110 to S150.
S110、通过标定物图像集获取双目摄像机的单目标定参数;其中,所述单目标定参数包括左相机内参、左相机外参、左相机畸变参数、右相机内参、右相机外参、以及右相机畸变参数。S110. Obtain the single target parameter of the binocular camera through the calibration object image set; wherein, the single target parameter includes the left camera internal parameter, the left camera external parameter, the left camera distortion parameter, the right camera internal parameter, the right camera external parameter, and Distortion parameter of the right camera.
在本实施例中,通过标定物图像集(具体实施时标定物图像集中包括多张棋盘格图片,各张棋盘格图片对应的视角各不相同)通过棋盘格角点检测计算出双目摄像机的左摄像机对应的参数以及右摄像机对应的参数。具体计算出左摄像机对应的参数包括左相机内参、左相机外参、左相机畸变参数;右摄像机对应的参数包括右相机内参、右相机外参、以及右相机畸变参数。In this embodiment, through the calibration object image set (the calibration object image collection includes multiple checkerboard pictures in specific implementation, and the corresponding viewing angles of each checkerboard picture are different) through the checkerboard corner detection to calculate the binocular camera The parameters corresponding to the left camera and the parameters corresponding to the right camera. It is specifically calculated that the parameters corresponding to the left camera include the left camera internal parameters, the left camera external parameters, and the left camera distortion parameters; the parameters corresponding to the right camera include the right camera internal parameters, the right camera external parameters, and the right camera distortion parameters.
由于单目标定得到右摄像机对应的参数与单目标定得到左摄像机对应的参数的过程相同。此时仅以单目标定得到左摄像机对应的参数为例来说明单目标定后得到的各种参数。The process of obtaining the parameters corresponding to the right camera with a single target is the same as obtaining the parameters corresponding to the left camera with a single target. At this time, only the parameters corresponding to the left camera obtained by the single target setting are taken as an example to illustrate the various parameters obtained after the single target setting.
具体的,左相机内参包括1/dx、1/dy、u0、v0及f;dx表示x方向一个像素所占长度,dy表示y方向一个像素所占长度,u0表示图像的中心像素坐标和图像原点像素坐标之间相差的横向像素数,v0表示图像的中心像素坐标和图像原点像素坐标之间相差的纵向像素数,f 表示左摄像机的焦距。Specifically, the left camera internal parameters include 1/dx, 1/dy, u0, v0, and f; dx represents the length occupied by a pixel in the x direction, dy represents the length occupied by a pixel in the y direction, and u0 represents the center pixel coordinates of the image and the image The number of horizontal pixels that differ between the pixel coordinates of the origin, v0 represents the number of vertical pixels that differ between the center pixel coordinates of the image and the pixel coordinates of the image origin, and f represents the focal length of the left camera.
左相机外参包括世界坐标系到摄像机的相机坐标系的旋转矩阵R和平移矩阵T。The left camera external parameters include the rotation matrix R and the translation matrix T from the world coordinate system to the camera coordinate system of the camera.
左相机畸变参数包括{k1,k2,p1,p2,k3},其中k1、k2及k3表示径向畸变系数,p1及p2表示切向畸变系数。The left camera distortion parameters include {k1, k2, p1, p2, k3}, where k1, k2, and k3 represent radial distortion coefficients, and p1 and p2 represent tangential distortion coefficients.
在一实施例中,步骤S110包括:In an embodiment, step S110 includes:
接收双目摄像机中左摄像机发送的左棋盘格图片集,和接收右摄像机发送的右棋盘格图片集;其中,所述左棋盘格图片集和右棋盘格图片集组成标定物图像集,且所述左棋盘格图片集中每一左棋盘格图片均对应一张所述右棋盘格图片集中的右棋盘格图片;Receive the left checkerboard picture set sent by the left camera in the binocular camera, and receive the right checkerboard picture set sent by the right camera; wherein the left checkerboard picture set and the right checkerboard picture set form a calibration object image set, and Each left checkerboard picture in the set of left checkerboard pictures corresponds to a right checkerboard picture in the set of right checkerboard pictures;
获取所述左棋盘格图片集中其中一张左棋盘格图片以作为目标左棋盘格图片,并获取所述右棋盘格图片集中获取与目标左棋盘格图片相对应的目标右棋盘格图片;Acquiring one of the left checkerboard pictures in the left checkerboard picture set as the target left checkerboard picture, and obtaining the target right checkerboard picture corresponding to the target left checkerboard picture in the right checkerboard picture set;
调用预先存储的哈里斯角点检测函数,获取所述目标左棋盘格中的左图像哈里斯角点特征,并获取所述目标右棋盘格中的右图像哈里斯角点特征;Calling a pre-stored Harris corner detection function to obtain the Harris corner feature of the left image in the left checkerboard of the target, and obtain the Harris corner feature of the right image in the right checkerboard of the target;
通过所述左图像哈里斯角点特征和所述右图像哈里斯角点特征进行最小二乘估算,得到所述双目摄像机的单目标定参数。Least square estimation is performed by using the Harris corner feature of the left image and the Harris corner feature of the right image to obtain the single target parameter of the binocular camera.
在本实施例中,对双目摄像机中的左摄像机和右摄像机进行标定时,需要先打印10-20张从不同角度拍摄的棋盘格图片(其中,棋盘格图片中棋盘表面和相机成像平面的夹角必须小于45度)以供左摄像机和右摄像机进行标定时使用。在对左摄像机进行单目标定时,是先从所述左棋盘格图片集中抽取一张左棋盘格图片以作为目标左棋盘格图片,然后调用哈里斯角点检测函数,检测到所述目标左棋盘格图片中的多个左图像哈里斯角点特征,最后根据多个左图像哈里斯角点特征进行最小二乘估算,得到左摄像机的单目标定参数。参考左摄像机的单目标定参数过程,同理也可得到右摄像机的单目标定参数。In this embodiment, when calibrating the left and right cameras in the binocular camera, it is necessary to print 10-20 checkerboard pictures taken from different angles (wherein the checkerboard picture is the surface of the checkerboard and the imaging plane of the camera). The included angle must be less than 45 degrees) for the left camera and right camera to calibrate. In the single target timing of the left camera, a left checkerboard picture is first extracted from the left checkerboard picture set as the target left checkerboard picture, and then the Harris corner detection function is called to detect the target left checkerboard Based on the multiple left image Harris corner features in the grid picture, the least square estimation is performed according to the multiple left image Harris corner features, and the single target parameter of the left camera is obtained. Refer to the single target parameter setting process of the left camera, and similarly, the single target parameter setting of the right camera can also be obtained.
S120、获取测试图片,通过所述单目标定参数对所述测试图片进行双目校正,得到左校正图片和右校正图片,以及得到重投影矩阵。S120. Obtain a test picture, perform binocular correction on the test picture by using the single target setting parameter to obtain a left-corrected picture and a right-corrected picture, and obtain a re-projection matrix.
在本实施例中,进行双目校正的过程一般以左摄像机为基准,然后左摄像机和右摄像机同时拍摄同一物体,得到左摄像机测试图片和右摄像机测试图片。之后对左摄像机测试图片和右摄像机测试图片进行处理,使得两幅图片最终达到以下目标:即同一个物体在两幅图像中的大小一样,且水平在一条直线上。In this embodiment, the process of performing binocular correction is generally based on the left camera, and then the left camera and the right camera shoot the same object at the same time to obtain the left camera test picture and the right camera test picture. After that, the left camera test picture and the right camera test picture are processed, so that the two pictures finally achieve the following goal: that is, the same object has the same size in the two images and is horizontally in a straight line.
由于之前获取了左摄像机的左相机外参中包括左旋转矩阵R1(也即上述的旋转矩阵R)和左平移矩阵T1(也即上述的平移矩阵T),还获取了右相机外参中包括的右旋转矩阵R2和右平移矩阵T2。此时若以左摄像机为基准,可以通过使用OpenCV的cvStereoRectify算法,将右旋转矩阵R2和右平移矩阵T2分解为左右摄像机各旋转一半的旋转矩阵R21和R22,以及和平移矩阵T21和T22。然后计算左校正图片和右校正图片的校正查找映射表,获得重投影矩阵Q。Since the left camera external parameters of the left camera obtained previously include the left rotation matrix R1 (that is, the above-mentioned rotation matrix R) and the left translation matrix T1 (that is, the above-mentioned translation matrix T), the right camera external parameters include The right rotation matrix R2 and the right translation matrix T2. At this time, if the left camera is used as the reference, the right rotation matrix R2 and the right translation matrix T2 can be decomposed into the rotation matrix R21 and R22, and the translation matrix T21 and T22, which are rotated by half of the left and right cameras, by using the cvStereoRectify algorithm of OpenCV. Then calculate the correction lookup mapping table of the left correction picture and the right correction picture to obtain the reprojection matrix Q.
在一实施例中,步骤S120包括:In an embodiment, step S120 includes:
将所述测试图片中各像素点的图像坐标分别根据左相机内参和右相机内参进行线性转换,得到各像素点的左实际成像平面坐标,以及得到各像素点的右实际成像平面坐标;Linearly transform the image coordinates of each pixel in the test picture according to the left camera internal parameters and the right camera internal parameters to obtain the left actual imaging plane coordinates of each pixel and the right actual imaging plane coordinates of each pixel;
将各像素点的左实际成像平面坐标根据左相机畸变参数进行坐标转换以得到各像素点的左理想平面成像坐标,并将各像素点的右实际成像平面坐标根据右相机畸变参数进行坐标转换以得到各像素点的右理想平面成像坐标;The left actual imaging plane coordinates of each pixel are converted according to the left camera distortion parameters to obtain the left ideal plane imaging coordinates of each pixel, and the right actual imaging plane coordinates of each pixel are converted according to the right camera distortion parameters. Obtain the right ideal plane imaging coordinates of each pixel;
将各像素点的左理想平面成像坐标根据左相机内参进行透视投影变换以得到各像素点的左摄像机3D坐标,并将各像素点的右理想平面成像坐标根据右相机内参进行透视投影变换以得到各像素点的右摄像机3D坐标;Perform perspective projection transformation on the left ideal plane imaging coordinates of each pixel according to the left camera internal parameters to obtain the left camera 3D coordinates of each pixel, and perform perspective projection transformation on the right ideal plane imaging coordinates of each pixel according to the right camera internal parameters to obtain 3D coordinates of the right camera of each pixel;
将各像素点的左摄像机3D坐标根据左相机外参进行刚体转换以得到各像素点的左实际3D坐标,并将各像素点的右摄像机3D坐标根据右相机外参进行刚体转换以得到各像素点的右实际3D坐标;The left camera 3D coordinates of each pixel are rigid body converted according to the left camera external parameters to obtain the left actual 3D coordinates of each pixel, and the right camera 3D coordinates of each pixel are rigid body converted according to the right camera external parameters to obtain each pixel The actual right 3D coordinates of the point;
根据各像素点的左实际3D坐标得到左校正图片,并根据各像素点的右实际3D坐标得到 右校正图片;Obtain a left correction picture according to the left actual 3D coordinates of each pixel, and obtain a right correction picture according to the right actual 3D coordinates of each pixel;
根据各像素点的左实际3D坐标与各像素点的右实际3D坐标之间的映射关系,获取重投影矩阵。According to the mapping relationship between the left actual 3D coordinates of each pixel and the right actual 3D coordinates of each pixel, the reprojection matrix is obtained.
在本实施例中,进行左右摄像机的双目校正的本质是将图片从图像像素坐标系转化为实际成像平面坐标,然后从实际成像平面坐标转化为理想平面成像坐标系,之后从理想平面成像坐标系转化为摄像机3D坐标系,最后从摄像机3D坐标系转化为实际3D坐标系后,根据各像素点的左实际3D坐标得到左校正图片,并根据各像素点的右实际3D坐标得到右校正图片,根据各像素点的左实际3D坐标与各像素点的右实际3D坐标之间的映射关系,最终获取重投影矩阵。In this embodiment, the essence of the binocular correction of the left and right cameras is to convert the picture from the image pixel coordinate system to the actual imaging plane coordinate, and then from the actual imaging plane coordinate to the ideal plane imaging coordinate system, and then from the ideal plane imaging coordinate system. The system is converted to the camera 3D coordinate system, and finally from the camera 3D coordinate system to the actual 3D coordinate system, the left correction image is obtained according to the left actual 3D coordinates of each pixel, and the right correction image is obtained according to the right actual 3D coordinates of each pixel According to the mapping relationship between the left actual 3D coordinates of each pixel and the right actual 3D coordinates of each pixel, the reprojection matrix is finally obtained.
S130、调用预先存储的StereoBM算法,将所述左校正图片和所述右校正图片通过所述StereoBM算法计算得到视图差。S130. Invoke a pre-stored StereoBM algorithm, and calculate the view difference between the left correction picture and the right correction picture through the StereoBM algorithm.
在本实施例中,如果通过一幅图片上一个点的特征在另一个二维图像空间上匹配对应点,这个过程会非常耗时。为了减少匹配搜索的运算量,利用极线约束使得对应点的匹配由二维搜索空间降到一维搜索空间。此时可以使用OpenCV的StereoBM算法可以将所述左校正图片和所述右校正图片计算得到视差图。In this embodiment, if the feature of a point on a picture is matched to a corresponding point on another two-dimensional image space, this process will be very time-consuming. In order to reduce the computational complexity of matching search, epipolar constraints are used to reduce the matching of corresponding points from a two-dimensional search space to a one-dimensional search space. At this time, the StereoBM algorithm of OpenCV can be used to calculate the left-corrected picture and the right-corrected picture to obtain a disparity map.
在一实施例中,步骤S130包括:In an embodiment, step S130 includes:
将所述左校正图片进行单通道灰度转换,得到左单通道灰度图;Performing single-channel grayscale conversion on the left-corrected picture to obtain a left single-channel grayscale image;
将所述右校正图片进行单通道灰度转换,得到右单通道灰度图;Performing single-channel grayscale conversion on the right-corrected picture to obtain a right single-channel grayscale image;
调用所述StereoBM算法中预设的视差搜索范围和滑动窗口大小,将所述左单通道灰度图、右单通道灰度图、视差搜索范围和滑动窗口大小作为所述StereoBM算法的入参进行计算,得到视图差。Call the preset disparity search range and sliding window size in the StereoBM algorithm, and use the left single-channel grayscale image, right single-channel grayscale image, disparity search range, and sliding window size as input parameters of the StereoBM algorithm Calculate to get the view difference.
在本实施例中,需要先读取所述左校正图片并转化为左单通道灰度图,例如左校正图片的名称为zjztp1.jpg,具体先通过OpenCV的cv2.imread()指令读取左校正图片zjztp1.jpg,即imgL=cv2.imread(’zjztp1.jpg’);之后通过OpenCV的cv2.cvtColor()指令将所述左校正图片转化为左单通道灰度图,即imgLG=cv2.cvtColor(imgL,cv2.COLOR_BGR2GRAY),其中imgLG表示左单通道灰度图。In this embodiment, the left correction picture needs to be read first and converted into a left single-channel grayscale image. For example, the name of the left correction picture is zjztp1.jpg. Specifically, the left correction picture is first read through the cv2.imread() instruction of OpenCV. The correction picture zjztp1.jpg, that is, imgL=cv2.imread('zjztp1.jpg'); then the left correction picture is converted into a left single-channel grayscale image through OpenCV's cv2.cvtColor() command, that is, imgLG=cv2. cvtColor(imgL, cv2.COLOR_BGR2GRAY), where imgLG represents the left single-channel grayscale image.
在将所述右校正图片并转化为右单通道灰度图时,需要先读取所述右校正图片并转化为右单通道灰度图,例如右校正图片的名称为yjztp1.jpg,具体先通过OpenCV的cv2.imread()指令读取右校正图片yjztp1.jpg,即imgR=cv2.imread(’yjztp1.jpg’);之后通过OpenCV的cv2.cvtColor()指令将所述右校正图片转化为右单通道灰度图,即imgRG=cv2.cvtColor(imgR,cv2.COLOR_BGR2GRAY),其中imgRG表示右单通道灰度图。其中,OpenCV的cv2.imread()指令为图片读取指令,OpenCV的cv2.cvtColor()指令为图片灰度化指令。When converting the right-corrected picture into a right single-channel grayscale image, it is necessary to read the right-corrected picture and convert it into a right single-channel grayscale image. For example, the name of the right-corrected picture is yjztp1.jpg. Read the right correction picture yjztp1.jpg through OpenCV's cv2.imread() instruction, that is, imgR=cv2.imread('yjztp1.jpg'); then use OpenCV's cv2.cvtColor() instruction to convert the right correction picture into The right single-channel grayscale image, that is, imgRG=cv2.cvtColor(imgR, cv2.COLOR_BGR2GRAY), where imgRG represents the right single-channel grayscale image. Among them, the cv2.imread() instruction of OpenCV is an image reading instruction, and the cv2.cvtColor() instruction of OpenCV is an image graying instruction.
在获取了左单通道灰度图imgLG和右单通道灰度图imgRG后,通过OpenCV的StereoBM算法stereo=cv2.StereoBM_create(numDisparities=16*9,blocksize=45),disp=stereo.compute(imgLG,imgRG)计算后,即得到了视图差;其中OpenCV的StereoBM算法中cv2.StereoBM_create指令为视差搜索范围和滑动窗口大小调用指令,OpenCV的StereoBM算法中disp=stereo.compute(imgLG,imgRG)为视图差计算指令。After obtaining the left single-channel grayscale image imgLG and the right single-channel grayscale image imgRG, the StereoBM algorithm of OpenCV stereo=cv2.StereoBM_create(numDisparities=16*9, blocksize=45), disp=stereo.compute(imgLG, imgRG) is calculated, and the view difference is obtained; the cv2.StereoBM_create instruction in the StereoBM algorithm of OpenCV is the disparity search range and sliding window size call instruction, and the disp=stereo.compute(imgLG, imgRG) in the StereoBM algorithm of OpenCV is the view difference Calculation instructions.
S140、获取双目摄像机所上传与待追踪目标对应的目标图像集,调用预先存储的轨迹跟踪算法获取所述目标图像集中各帧目标图像的目标二维图像坐标。S140: Obtain a target image set uploaded by the binocular camera and corresponding to the target to be tracked, and call a pre-stored trajectory tracking algorithm to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set.
在本实施例中,为了对行人路线进行追踪,此时可以调用预先存储的轨迹跟踪算法获取双目摄像机所上传与待追踪目标对应的目标图像集中各帧目标图像的目标二维图像坐标。In this embodiment, in order to track the pedestrian route, the pre-stored trajectory tracking algorithm can be called at this time to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set corresponding to the target to be tracked uploaded by the binocular camera.
其中,所述轨迹跟踪算法具体实施采用多目标跟踪算法。为了对多目标跟踪算法进行详细了解,下面对所述多目标跟踪算法进行介绍。Wherein, the specific implementation of the trajectory tracking algorithm adopts a multi-target tracking algorithm. In order to have a detailed understanding of the multi-target tracking algorithm, the multi-target tracking algorithm will be introduced below.
多目标跟踪(Multiple Object Tracking,MOT)的问题提出:有一段视频,视频是由N个连续帧构成的。从第一帧到最后一帧,里面有多个目标,不断地有出有进,不断地运动。多目标跟踪的目的是对每个目标,能跟其他目标区分开,能跟踪它在不同帧中的轨迹,多目标 跟踪最经典的应用就是路口监控行人。The problem of Multiple Object Tracking (MOT) is raised: There is a video, and the video is composed of N consecutive frames. From the first frame to the last frame, there are multiple targets inside, constantly moving in and out. The purpose of multi-target tracking is to distinguish each target from other targets and track its trajectory in different frames. The most classic application of multi-target tracking is to monitor pedestrians at intersections.
实际上,多目标跟踪问题可以被理解为一个多变量估计问题,我们给出它的形式化定义。给定一个图像序列,
Figure PCTCN2020111780-appb-000001
表示第t帧第i个目标的状态,
Figure PCTCN2020111780-appb-000002
表示在第t帧下所有目标M t的状态序列,
Figure PCTCN2020111780-appb-000003
表示第i个目标的状态序列,其中i s和i c分别表示目标i出现的第一帧图像和最后一帧图像,S 1:t={S 1,S 2,…,S t}表示所有目标从第1帧到第t帧的状态序列。需要注意的是每一帧目标的ID都有可能不同。相应的,在最常用的tracking-by-detection结构下,
Figure PCTCN2020111780-appb-000004
表示第t帧第i个观测目标,
Figure PCTCN2020111780-appb-000005
表示在第t帧下所有目标M t的观测目标,O 1:t={O 1,O 2,…,O t}表示所有目标从第1帧到第t帧的观测目标序列。多目标跟踪的目的就是找到所有目标最好的状态序列,在所有观测目标的状态序列上的条件分布上,可以通过使用MAP(maximal a posteriori)估计法泛化建模得到:
In fact, the multi-target tracking problem can be understood as a multi-variable estimation problem, and we give its formal definition. Given a sequence of images,
Figure PCTCN2020111780-appb-000001
Represents the state of the i-th target in the t-th frame,
Figure PCTCN2020111780-appb-000002
Represents the state sequence of all targets M t in the t-th frame,
Figure PCTCN2020111780-appb-000003
Represents the state sequence of the i-th target, where i s and i c represent the first and last image of the target i, respectively, S 1:t = {S 1 ,S 2 ,...,S t } means all The state sequence of the target from frame 1 to frame t. It should be noted that the ID of the target in each frame may be different. Correspondingly, under the most commonly used tracking-by-detection structure,
Figure PCTCN2020111780-appb-000004
Represents the i-th observation target in the t-th frame,
Figure PCTCN2020111780-appb-000005
Indicates the observation target of all targets M t in the t-th frame , O 1:t ={O 1 ,O 2 ,...,O t } represents the observation target sequence of all targets from the first frame to the t-th frame. The purpose of multi-target tracking is to find the best state sequence of all targets. The conditional distribution on the state sequence of all observed targets can be obtained by generalization modeling using the MAP (maximal a posteriori) estimation method:
Figure PCTCN2020111780-appb-000006
Figure PCTCN2020111780-appb-000006
通过基于概率预测的卡尔曼滤波方法可以计算式(1)所对应模型的解,以得到各帧目标图像的目标二维图像坐标。Through the Kalman filter method based on probability prediction, the solution of the model corresponding to equation (1) can be calculated to obtain the target two-dimensional image coordinates of the target image of each frame.
S150、将所述目标图像集中各帧目标图像的目标二维图像坐标根据所调用的稀疏透视变化算法和所述视图差,将各目标二维图像坐标均转化为对应的目标3D坐标,以组成目标3D坐标集合。S150. The target two-dimensional image coordinates of each frame of the target image in the target image set are converted into corresponding target 3D coordinates according to the called sparse perspective change algorithm and the view difference, so as to form The target 3D coordinate collection.
在本实施例中,对轨迹跟踪算法输出的目标二维图像坐标进行转换。具体是通过上述得到视差图,将二维的点重投影到三维中的重投影矩阵Q,使用OpenCV的cvPerspectiveTransform算法(即稀疏透视变化算法)将各目标二维图像坐标均转化为对应的目标3D坐标,以组成目标3D坐标集合。本申请可应用于智慧城管/智慧交通场景中,从而推动智慧城市的建设。而且在获取各目标行人的3D坐标后,可以用于绘制行人轨迹地图、准确计算目标行人移动的距离、准确计算目标行人与目标物体之前的距离等。In this embodiment, the target two-dimensional image coordinates output by the trajectory tracking algorithm are converted. Specifically, through the above-mentioned disparity map, the two-dimensional points are reprojected to the three-dimensional reprojection matrix Q, and the cvPerspectiveTransform algorithm (ie sparse perspective change algorithm) of OpenCV is used to convert the two-dimensional image coordinates of each target into the corresponding target 3D Coordinates to form a set of target 3D coordinates. This application can be applied to smart city management/smart transportation scenarios to promote the construction of smart cities. Moreover, after obtaining the 3D coordinates of each target pedestrian, it can be used to draw a pedestrian trajectory map, accurately calculate the distance moved by the target pedestrian, and accurately calculate the distance between the target pedestrian and the target object.
在一实施例中,步骤S150之后还包括:In an embodiment, after step S150, the method further includes:
将所述目标3D坐标集合上传至区块链网络。Upload the target 3D coordinate set to the blockchain network.
在本实施例中,服务器可以作为一个区块链节点设备,以将所述目标3D坐标集合上传至区块链网络,充分利用区块链数据不可篡改的特性,实现行人轨迹数据固化存储。In this embodiment, the server can be used as a blockchain node device to upload the target 3D coordinate set to the blockchain network, making full use of the non-tamperable characteristics of the blockchain data to achieve solidified storage of pedestrian trajectory data.
其中,基于所述目标3D坐标集合得到对应的摘要信息,具体来说,摘要信息由所述目标3D坐标集合进行散列处理得到,比如利用sha256算法处理得到。将摘要信息上传至区块链可保证其安全性和对用户的公正透明性。服务器可以从区块链中下载得该摘要信息,以便查证所述目标3D坐标集合是否被篡改。本示例所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。Wherein, the corresponding summary information is obtained based on the target 3D coordinate set. Specifically, the summary information is obtained by hashing the target 3D coordinate set, for example by using the sha256 algorithm. Uploading summary information to the blockchain can ensure its security and fairness and transparency to users. The server can download the summary information from the blockchain to verify whether the target 3D coordinate set has been tampered with. The blockchain referred to in this example is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information for verification. The validity of the information (anti-counterfeiting) and generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
该方法实现了将双目摄像机拍摄的二维图像坐标系转化为真实世界3D坐标系,可以获取目标行人在摄像头下的准确3D坐标。This method realizes the conversion of the two-dimensional image coordinate system taken by the binocular camera into the real-world 3D coordinate system, and can obtain the accurate 3D coordinates of the target pedestrian under the camera.
本申请实施例还提供一种基于双目摄像机标定的行人轨迹跟踪装置,该基于双目摄像机标定的行人轨迹跟踪装置用于执行前述基于双目摄像机标定的行人轨迹跟踪方法的任一实施例。具体地,请参阅图3,图3是本申请实施例提供的基于双目摄像机标定的行人轨迹跟踪装置的示意性框图。该基于双目摄像机标定的行人轨迹跟踪装置100可以配置于服务器中。The embodiment of the present application also provides a pedestrian trajectory tracking device based on binocular camera calibration. The pedestrian trajectory tracking device based on binocular camera calibration is used to implement any embodiment of the aforementioned pedestrian trajectory tracking method based on binocular camera calibration. Specifically, please refer to FIG. 3, which is a schematic block diagram of a pedestrian trajectory tracking device based on binocular camera calibration provided by an embodiment of the present application. The pedestrian trajectory tracking device 100 based on binocular camera calibration can be configured in a server.
如图3所示,基于双目摄像机标定的行人轨迹跟踪装置100包括:单目标定单元110、双目校正单元120、视图差计算单元130、目标二维坐标获取单元140、目标3D坐标集合获取单元150。As shown in FIG. 3, the pedestrian trajectory tracking device 100 based on binocular camera calibration includes: a single target positioning unit 110, a binocular correction unit 120, a view difference calculation unit 130, a target two-dimensional coordinate acquisition unit 140, and a target 3D coordinate collection acquisition Unit 150.
单目标定单元110,用于通过标定物图像集获取双目摄像机的单目标定参数;其中,所述单目标定参数包括左相机内参、左相机外参、左相机畸变参数、右相机内参、右相机外参、以及右相机畸变参数。The single target setting unit 110 is used to obtain the single target setting parameters of the binocular camera through the calibration object image set; wherein, the single target setting parameters include left camera internal parameters, left camera external parameters, left camera distortion parameters, right camera internal parameters, External parameters of the right camera and distortion parameters of the right camera.
在本实施例中,通过标定物图像集(具体实施时标定物图像集中包括多张棋盘格图片,各张棋盘格图片对应的视角各不相同)通过棋盘格角点检测计算出双目摄像机的左摄像机对应的参数以及右摄像机对应的参数。具体计算出左摄像机对应的参数包括左相机内参、左相机外参、左相机畸变参数;右摄像机对应的参数包括右相机内参、右相机外参、以及右相机畸变参数。In this embodiment, through the calibration object image set (the calibration object image collection includes multiple checkerboard pictures in specific implementation, and the corresponding viewing angles of each checkerboard picture are different) through the checkerboard corner detection to calculate the binocular camera The parameters corresponding to the left camera and the parameters corresponding to the right camera. It is specifically calculated that the parameters corresponding to the left camera include the left camera internal parameters, the left camera external parameters, and the left camera distortion parameters; the parameters corresponding to the right camera include the right camera internal parameters, the right camera external parameters, and the right camera distortion parameters.
由于单目标定得到右摄像机对应的参数与单目标定得到左摄像机对应的参数的过程相同。此时仅以单目标定得到左摄像机对应的参数为例来说明单目标定后得到的各种参数。The process of obtaining the parameters corresponding to the right camera with a single target is the same as obtaining the parameters corresponding to the left camera with a single target. At this time, only the parameters corresponding to the left camera obtained by the single target setting are taken as an example to illustrate the various parameters obtained after the single target setting.
具体的,左相机内参包括1/dx、1/dy、u0、v0及f;dx表示x方向一个像素所占长度,dy表示y方向一个像素所占长度,u0表示图像的中心像素坐标和图像原点像素坐标之间相差的横向像素数,v0表示图像的中心像素坐标和图像原点像素坐标之间相差的纵向像素数,f表示左摄像机的焦距。Specifically, the left camera internal parameters include 1/dx, 1/dy, u0, v0, and f; dx represents the length occupied by a pixel in the x direction, dy represents the length occupied by a pixel in the y direction, and u0 represents the center pixel coordinates of the image and the image The number of horizontal pixels that differ between the pixel coordinates of the origin, v0 represents the number of vertical pixels that differ between the center pixel coordinates of the image and the pixel coordinates of the image origin, and f represents the focal length of the left camera.
左相机外参包括世界坐标系到摄像机的相机坐标系的旋转矩阵R和平移矩阵T。The left camera external parameters include the rotation matrix R and the translation matrix T from the world coordinate system to the camera coordinate system of the camera.
左相机畸变参数包括{k1,k2,p1,p2,k3},其中k1、k2及k3表示径向畸变系数,p1及p2表示切向畸变系数。The left camera distortion parameters include {k1, k2, p1, p2, k3}, where k1, k2, and k3 represent radial distortion coefficients, and p1 and p2 represent tangential distortion coefficients.
在一实施例中,单目标定单元110包括:In an embodiment, the single target setting unit 110 includes:
标定物图像集获取单元,用于接收双目摄像机中左摄像机发送的左棋盘格图片集,和接收右摄像机发送的右棋盘格图片集;其中,所述左棋盘格图片集和右棋盘格图片集组成标定物图像集,且所述左棋盘格图片集中每一左棋盘格图片均对应一张所述右棋盘格图片集中的右棋盘格图片;The calibration object image set acquisition unit is used to receive the left checkerboard picture set sent by the left camera in the binocular camera, and the right checkerboard picture set sent by the right camera; wherein, the left checkerboard picture set and the right checkerboard picture set The set forms a calibration object image set, and each left checkerboard picture in the left checkerboard picture set corresponds to a right checkerboard picture in the right checkerboard picture set;
目标棋盘格图片获取单元,用于获取所述左棋盘格图片集中其中一张左棋盘格图片以作为目标左棋盘格图片,并获取所述右棋盘格图片集中获取与目标左棋盘格图片相对应的目标右棋盘格图片;The target checkerboard picture obtaining unit is used to obtain one of the left checkerboard pictures in the left checkerboard picture set as the target left checkerboard picture, and to obtain the right checkerboard picture set corresponding to the target left checkerboard picture The right checkerboard picture of the target;
哈里斯角点特征检测单元,用于调用预先存储的哈里斯角点检测函数,获取所述目标左棋盘格中的左图像哈里斯角点特征,并获取所述目标右棋盘格中的右图像哈里斯角点特征;Harris corner point feature detection unit, used to call a pre-stored Harris corner point detection function to obtain the Harris corner point feature of the left image in the left checkerboard of the target, and obtain the right image in the right checkerboard of the target Harris corner features;
最小二乘估算单元,用于通过所述左图像哈里斯角点特征和所述右图像哈里斯角点特征进行最小二乘估算,得到所述双目摄像机的单目标定参数。The least squares estimation unit is used to perform least squares estimation by using the Harris corner feature of the left image and the Harris corner feature of the right image to obtain the single target parameter of the binocular camera.
在本实施例中,对双目摄像机中的左摄像机和右摄像机进行标定时,需要先打印10-20张从不同角度拍摄的棋盘格图片(其中,棋盘格图片中棋盘表面和相机成像平面的夹角必须小于45度)以供左摄像机和右摄像机进行标定时使用。在对左摄像机进行单目标定时,是先从所述左棋盘格图片集中抽取一张左棋盘格图片以作为目标左棋盘格图片,然后调用哈里斯角点检测函数,检测到所述目标左棋盘格图片中的多个左图像哈里斯角点特征,最后根据多个左图像哈里斯角点特征进行最小二乘估算,得到左摄像机的单目标定参数。参考左摄像机的单目标定参数过程,同理也可得到右摄像机的单目标定参数。In this embodiment, when calibrating the left and right cameras in the binocular camera, it is necessary to print 10-20 checkerboard pictures taken from different angles (wherein the checkerboard picture is the surface of the checkerboard and the imaging plane of the camera). The included angle must be less than 45 degrees) for the left camera and right camera to calibrate. In the single target timing of the left camera, a left checkerboard picture is first extracted from the left checkerboard picture set as the target left checkerboard picture, and then the Harris corner detection function is called to detect the target left checkerboard The multiple left image Harris corner features in the grid picture, and finally the least square estimation is performed according to the multiple left image Harris corner features, and the single target parameter of the left camera is obtained. Refer to the single target parameter setting process of the left camera, and similarly, the single target parameter setting of the right camera can be obtained.
双目校正单元120,用于获取测试图片,通过所述单目标定参数对所述测试图片进行双目校正,得到左校正图片和右校正图片,以及得到重投影矩阵。The binocular correction unit 120 is configured to obtain a test picture, perform binocular correction on the test picture by using the single target parameter to obtain a left-corrected picture and a right-corrected picture, and obtain a reprojection matrix.
在本实施例中,进行双目校正的过程一般以左摄像机为基准,然后左摄像机和右摄像机同时拍摄同一物体,得到左摄像机测试图片和右摄像机测试图片。之后对左摄像机测试图片和右摄像机测试图片进行处理,使得两幅图片最终达到以下目标:即同一个物体在两幅图像中的大小一样,且水平在一条直线上。In this embodiment, the process of performing binocular correction is generally based on the left camera, and then the left camera and the right camera shoot the same object at the same time to obtain the left camera test picture and the right camera test picture. After that, the left camera test picture and the right camera test picture are processed, so that the two pictures finally achieve the following goal: that is, the same object has the same size in the two images and is horizontally in a straight line.
由于之前获取了左摄像机的左相机外参中包括左旋转矩阵R1(也即上述的旋转矩阵R)和左平移矩阵T1(也即上述的平移矩阵T),还获取了右相机外参中包括的右旋转矩阵R2和右平移矩阵T2。此时若以左摄像机为基准,可以通过使用OpenCV的cvStereoRectify算法,将右旋转矩阵R2和右平移矩阵T2分解为左右摄像机各旋转一半的旋转矩阵R21和R22,以及和平移矩阵T21和T22。然后计算左校正图片和右校正图片的校正查找映射表,获得重投影矩阵Q。Since the left camera external parameters of the left camera previously obtained include the left rotation matrix R1 (that is, the above-mentioned rotation matrix R) and the left translation matrix T1 (that is, the above-mentioned translation matrix T), the right camera external parameters include The right rotation matrix R2 and the right translation matrix T2. At this time, if the left camera is used as the reference, the right rotation matrix R2 and the right translation matrix T2 can be decomposed into the rotation matrix R21 and R22, and the translation matrix T21 and T22, which are rotated by half of the left and right cameras, by using the cvStereoRectify algorithm of OpenCV. Then calculate the correction lookup mapping table of the left correction picture and the right correction picture to obtain the reprojection matrix Q.
在一实施例中,双目校正单元120包括:In an embodiment, the binocular correction unit 120 includes:
第一转换单元,用于将所述测试图片中各像素点的图像坐标分别根据左相机内参和右相机内参进行线性转换,得到各像素点的左实际成像平面坐标,以及得到各像素点的右实际成像平面坐标;The first conversion unit is used for linearly converting the image coordinates of each pixel in the test picture according to the left camera internal parameters and the right camera internal parameters, to obtain the left actual imaging plane coordinates of each pixel, and to obtain the right of each pixel. Actual imaging plane coordinates;
第二转换单元,用于将各像素点的左实际成像平面坐标根据左相机畸变参数进行坐标转换以得到各像素点的左理想平面成像坐标,并将各像素点的右实际成像平面坐标根据右相机畸变参数进行坐标转换以得到各像素点的右理想平面成像坐标;The second conversion unit is used to convert the left actual imaging plane coordinates of each pixel according to the left camera distortion parameters to obtain the left ideal plane imaging coordinates of each pixel, and to calculate the right actual imaging plane coordinates of each pixel according to the right The camera distortion parameter performs coordinate conversion to obtain the right ideal plane imaging coordinates of each pixel;
第三转换单元,用于将各像素点的左理想平面成像坐标根据左相机内参进行透视投影变换以得到各像素点的左摄像机3D坐标,并将各像素点的右理想平面成像坐标根据右相机内参进行透视投影变换以得到各像素点的右摄像机3D坐标;The third conversion unit is used to perform perspective projection transformation of the left ideal plane imaging coordinates of each pixel point according to the left camera internal parameters to obtain the left camera 3D coordinates of each pixel point, and the right ideal plane imaging coordinates of each pixel point according to the right camera The internal parameter performs perspective projection transformation to obtain the right camera 3D coordinates of each pixel;
第四转换单元,用于将各像素点的左摄像机3D坐标根据左相机外参进行刚体转换以得到各像素点的左实际3D坐标,并将各像素点的右摄像机3D坐标根据右相机外参进行刚体转换以得到各像素点的右实际3D坐标;The fourth conversion unit is used to perform rigid body conversion of the left camera 3D coordinates of each pixel according to the external parameters of the left camera to obtain the actual left 3D coordinates of each pixel, and the 3D coordinates of the right camera of each pixel according to the external parameters of the right camera Perform rigid body transformation to obtain the actual right 3D coordinates of each pixel;
校正图片获取单元,用于根据各像素点的左实际3D坐标得到左校正图片,并根据各像素点的右实际3D坐标得到右校正图片;The correction picture acquisition unit is configured to obtain a left correction picture according to the left actual 3D coordinates of each pixel, and obtain a right correction picture according to the right actual 3D coordinates of each pixel;
重投影矩阵获取单元,用于根据各像素点的左实际3D坐标与各像素点的右实际3D坐标之间的映射关系,获取重投影矩阵。The re-projection matrix obtaining unit is configured to obtain the re-projection matrix according to the mapping relationship between the left actual 3D coordinates of each pixel and the right actual 3D coordinates of each pixel.
在本实施例中,进行左右摄像机的双目校正的本质是将图片从图像像素坐标系转化为实际成像平面坐标,然后从实际成像平面坐标转化为理想平面成像坐标系,之后从理想平面成像坐标系转化为摄像机3D坐标系,最后从摄像机3D坐标系转化为实际3D坐标系后,根据各像素点的左实际3D坐标得到左校正图片,并根据各像素点的右实际3D坐标得到右校正图片,根据各像素点的左实际3D坐标与各像素点的右实际3D坐标之间的映射关系,最终获取重投影矩阵。In this embodiment, the essence of the binocular correction of the left and right cameras is to convert the picture from the image pixel coordinate system to the actual imaging plane coordinate, and then from the actual imaging plane coordinate to the ideal plane imaging coordinate system, and then from the ideal plane imaging coordinate system. The system is converted to the camera 3D coordinate system, and finally from the camera 3D coordinate system to the actual 3D coordinate system, the left correction image is obtained according to the left actual 3D coordinates of each pixel, and the right correction image is obtained according to the right actual 3D coordinates of each pixel According to the mapping relationship between the left actual 3D coordinates of each pixel and the right actual 3D coordinates of each pixel, the reprojection matrix is finally obtained.
视图差计算单元130,用于调用预先存储的StereoBM算法,将所述左校正图片和所述右校正图片通过所述StereoBM算法计算得到视图差。The view difference calculation unit 130 is configured to call a pre-stored StereoBM algorithm, and calculate the view difference from the left correction picture and the right correction picture through the StereoBM algorithm.
在本实施例中,如果通过一幅图片上一个点的特征在另一个二维图像空间上匹配对应点,这个过程会非常耗时。为了减少匹配搜索的运算量,利用极线约束使得对应点的匹配由二维搜索空间降到一维搜索空间。此时可以使用OpenCV的StereoBM算法可以将所述左校正图片和所述右校正图片计算得到视差图。In this embodiment, if the feature of a point on a picture is matched to a corresponding point on another two-dimensional image space, this process will be very time-consuming. In order to reduce the computational complexity of matching search, epipolar constraints are used to reduce the matching of corresponding points from a two-dimensional search space to a one-dimensional search space. At this time, the StereoBM algorithm of OpenCV can be used to calculate the left-corrected picture and the right-corrected picture to obtain a disparity map.
在一实施例中,视图差计算单元130包括:In an embodiment, the view difference calculation unit 130 includes:
第一灰度转换单元,用于将所述左校正图片进行单通道灰度转换,得到左单通道灰度图;The first gray scale conversion unit is configured to perform single-channel gray scale conversion on the left corrected picture to obtain a left single-channel gray scale image;
第二灰度转换单元,用于将所述右校正图片进行单通道灰度转换,得到右单通道灰度图;The second gray scale conversion unit is configured to perform single-channel gray scale conversion on the right corrected picture to obtain a right single-channel gray scale image;
视图差获取单元,用于调用所述StereoBM算法中预设的视差搜索范围和滑动窗口大小,将所述左单通道灰度图、右单通道灰度图、视差搜索范围和滑动窗口大小作为所述StereoBM算法的入参进行计算,得到视图差。The view difference acquisition unit is used to call the preset disparity search range and sliding window size in the StereoBM algorithm, and use the left single-channel grayscale image, right single-channel grayscale image, disparity search range, and sliding window size as all The input parameters of the StereoBM algorithm are calculated to obtain the view difference.
在本实施例中,需要先读取所述左校正图片并转化为左单通道灰度图,例如左校正图片的名称为zjztp1.jpg,具体先通过OpenCV的cv2.imread()指令读取左校正图片zjztp1.jpg,即imgL=cv2.imread(’zjztp1.jpg’);之后通过OpenCV的cv2.cvtColor()指令将所述左校正图片转化为左单通道灰度图,即imgLG=cv2.cvtColor(imgL,cv2.COLOR_BGR2GRAY),其中imgLG表示左单通道灰度图。In this embodiment, the left correction picture needs to be read first and converted into a left single-channel grayscale image. For example, the name of the left correction picture is zjztp1.jpg. Specifically, the left correction picture is first read through the cv2.imread() instruction of OpenCV. The correction picture zjztp1.jpg, that is, imgL=cv2.imread('zjztp1.jpg'); then the left correction picture is converted into a left single-channel grayscale image through OpenCV's cv2.cvtColor() command, that is, imgLG=cv2. cvtColor(imgL, cv2.COLOR_BGR2GRAY), where imgLG represents the left single-channel grayscale image.
在将所述右校正图片并转化为右单通道灰度图时,需要先读取所述右校正图片并转化为右单通道灰度图,例如右校正图片的名称为yjztp1.jpg,具体先通过OpenCV的cv2.imread()指令读取右校正图片yjztp1.jpg,即imgR=cv2.imread(’yjztp1.jpg’);之后通过OpenCV的cv2.cvtColor()指令将所述右校正图片转化为右单通道灰度图,即imgRG=cv2.cvtColor(imgR,cv2.COLOR_BGR2GRAY),其中imgRG表示右单通道灰度图。When converting the right-corrected picture into a right single-channel grayscale image, it is necessary to read the right-corrected picture and convert it into a right single-channel grayscale image. For example, the name of the right-corrected picture is yjztp1.jpg. Read the right correction picture yjztp1.jpg through OpenCV's cv2.imread() instruction, that is, imgR=cv2.imread('yjztp1.jpg'); then use OpenCV's cv2.cvtColor() instruction to convert the right correction picture into The right single-channel grayscale image, that is, imgRG=cv2.cvtColor(imgR, cv2.COLOR_BGR2GRAY), where imgRG represents the right single-channel grayscale image.
在获取了左单通道灰度图imgLG和右单通道灰度图imgRG后,通过OpenCV的StereoBM算法stereo=cv2.StereoBM_create(numDisparities=16*9,blocksize=45),disp=stereo.compute (imgLG,imgRG)计算后,即得到了视图差。After obtaining the left single-channel grayscale image imgLG and the right single-channel grayscale image imgRG, the StereoBM algorithm of OpenCV stereo=cv2.StereoBM_create(numDisparities=16*9, blocksize=45), disp=stereo.compute (imgLG, imgRG) After calculation, the view difference is obtained.
目标二维坐标获取单元140,用于获取双目摄像机所上传与待追踪目标对应的目标图像集,调用预先存储的轨迹跟踪算法获取所述目标图像集中各帧目标图像的目标二维图像坐标。The target two-dimensional coordinate acquiring unit 140 is configured to acquire the target image set uploaded by the binocular camera and corresponding to the target to be tracked, and call a pre-stored trajectory tracking algorithm to acquire the target two-dimensional image coordinates of each frame of the target image in the target image set.
在本实施例中,为了对行人路线进行追踪,此时可以调用预先存储的轨迹跟踪算法获取双目摄像机所上传与待追踪目标对应的目标图像集中各帧目标图像的目标二维图像坐标。In this embodiment, in order to track the pedestrian route, the pre-stored trajectory tracking algorithm can be called at this time to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set corresponding to the target to be tracked uploaded by the binocular camera.
其中,所述轨迹跟踪算法具体实施采用多目标跟踪算法。为了对多目标跟踪算法进行详细了解,下面对所述多目标跟踪算法进行介绍。Wherein, the specific implementation of the trajectory tracking algorithm adopts a multi-target tracking algorithm. In order to have a detailed understanding of the multi-target tracking algorithm, the multi-target tracking algorithm will be introduced below.
多目标跟踪(Multiple Object Tracking,MOT)的问题提出:有一段视频,视频是由N个连续帧构成的。从第一帧到最后一帧,里面有多个目标,不断地有出有进,不断地运动。多目标跟踪的目的是对每个目标,能跟其他目标区分开,能跟踪它在不同帧中的轨迹,多目标跟踪最经典的应用就是路口监控行人。The problem of Multiple Object Tracking (MOT) is raised: There is a video, and the video is composed of N consecutive frames. From the first frame to the last frame, there are multiple targets inside, constantly moving in and out. The purpose of multi-target tracking is to distinguish each target from other targets and track its trajectory in different frames. The most classic application of multi-target tracking is to monitor pedestrians at intersections.
实际上,多目标跟踪问题可以被理解为一个多变量估计问题,我们给出它的形式化定义。给定一个图像序列,
Figure PCTCN2020111780-appb-000007
表示第t帧第i个目标的状态,
Figure PCTCN2020111780-appb-000008
表示在第t帧下所有目标M t的状态序列,
Figure PCTCN2020111780-appb-000009
表示第i个目标的状态序列,其中i s和i c分别表示目标i出现的第一帧图像和最后一帧图像,S 1:t={S 1,S 2,…,S t}表示所有目标从第1帧到第t帧的状态序列。需要注意的是每一帧目标的ID都有可能不同。相应的,在最常用的tracking-by-detection结构下,
Figure PCTCN2020111780-appb-000010
表示第t帧第i个观测目标,
Figure PCTCN2020111780-appb-000011
表示在第t帧下所有目标M t的观测目标,O 1:t={O 1,O 2,…,O t}表示所有目标从第1帧到第t帧的观测目标序列。多目标跟踪的目的就是找到所有目标最好的状态序列,在所有观测目标的状态序列上的条件分布上,可以通过使用MAP(maximal a posteriori)估计法泛化建模得到上述的式(1),通过基于概率预测的卡尔曼滤波方法可以计算式(1)所对应模型的解,以得到各帧目标图像的目标二维图像坐标。
In fact, the multi-target tracking problem can be understood as a multi-variable estimation problem, and we give its formal definition. Given a sequence of images,
Figure PCTCN2020111780-appb-000007
Represents the state of the i-th target in the t-th frame,
Figure PCTCN2020111780-appb-000008
Represents the state sequence of all targets M t in the t-th frame,
Figure PCTCN2020111780-appb-000009
Represents the state sequence of the i-th target, where i s and i c represent the first and last image of the target i, respectively, S 1:t = {S 1 ,S 2 ,...,S t } means all The state sequence of the target from frame 1 to frame t. It should be noted that the ID of the target in each frame may be different. Correspondingly, under the most commonly used tracking-by-detection structure,
Figure PCTCN2020111780-appb-000010
Represents the i-th observation target in the t-th frame,
Figure PCTCN2020111780-appb-000011
Indicates the observation target of all targets M t in the t-th frame , O 1:t ={O 1 ,O 2 ,...,O t } represents the observation target sequence of all targets from the first frame to the t-th frame. The purpose of multi-target tracking is to find the best state sequence of all targets. On the conditional distribution of the state sequence of all observed targets, the above formula (1) can be obtained by generalization modeling using MAP (maximal a posteriori) estimation method By using the Kalman filter method based on probability prediction, the solution of the model corresponding to formula (1) can be calculated to obtain the target two-dimensional image coordinates of the target image of each frame.
目标3D坐标集合获取单元150,用于将所述目标图像集中各帧目标图像的目标二维图像坐标根据所调用的稀疏透视变化算法和所述视图差,将各目标二维图像坐标均转化为对应的目标3D坐标,以组成目标3D坐标集合。The target 3D coordinate set acquisition unit 150 is configured to convert the target two-dimensional image coordinates of each frame of the target image in the target image set according to the called sparse perspective change algorithm and the view difference to convert each target two-dimensional image coordinate into Corresponding target 3D coordinates to form a target 3D coordinate set.
在本实施例中,对轨迹跟踪算法输出的目标二维图像坐标进行转换。具体是通过上述得到视差图,将二维的点重投影到三维中的重投影矩阵Q,使用OpenCV的cvPerspectiveTransform算法(即稀疏透视变化算法)将各目标二维图像坐标均转化为对应的目标3D坐标,以组成目标3D坐标集合。In this embodiment, the target two-dimensional image coordinates output by the trajectory tracking algorithm are converted. Specifically, through the above-mentioned disparity map, the two-dimensional points are reprojected to the three-dimensional reprojection matrix Q, and the cvPerspectiveTransform algorithm (ie sparse perspective change algorithm) of OpenCV is used to convert the two-dimensional image coordinates of each target into the corresponding target 3D Coordinates to form a set of target 3D coordinates.
在一实施例中,基于双目摄像机标定的行人轨迹跟踪装置100还包括:In an embodiment, the pedestrian trajectory tracking device 100 based on binocular camera calibration further includes:
数据上链单元,用于将所述目标3D坐标集合上传至区块链网络。The data link unit is used to upload the target 3D coordinate set to the blockchain network.
在本实施例中,服务器可以作为一个区块链节点设备,以将所述目标3D坐标集合上传至区块链网络,充分利用区块链数据不可篡改的特性,实现行人轨迹数据固化存储。In this embodiment, the server can be used as a blockchain node device to upload the target 3D coordinate set to the blockchain network, making full use of the non-tamperable characteristics of the blockchain data to achieve solidified storage of pedestrian trajectory data.
其中,基于所述目标3D坐标集合得到对应的摘要信息,具体来说,摘要信息由所述目标3D坐标集合进行散列处理得到,比如利用sha256算法处理得到。将摘要信息上传至区块链可保证其安全性和对用户的公正透明性。服务器可以从区块链中下载得该摘要信息,以便查证所述目标3D坐标集合是否被篡改。本示例所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。Wherein, the corresponding summary information is obtained based on the target 3D coordinate set. Specifically, the summary information is obtained by hashing the target 3D coordinate set, for example by using the sha256 algorithm. Uploading summary information to the blockchain can ensure its security and fairness and transparency to users. The server can download the summary information from the blockchain to verify whether the target 3D coordinate set has been tampered with. The blockchain referred to in this example is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information for verification. The validity of the information (anti-counterfeiting) and generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
该装置实现了将双目摄像机拍摄的二维图像坐标系转化为真实世界3D坐标系,可以获取目标行人在摄像头下的准确3D坐标。The device realizes the conversion of the two-dimensional image coordinate system captured by the binocular camera into the real-world 3D coordinate system, and can obtain the accurate 3D coordinates of the target pedestrian under the camera.
上述基于双目摄像机标定的行人轨迹跟踪装置可以实现为计算机程序的形式,该计算机程序可以在如图4所示的计算机设备上运行。The aforementioned pedestrian trajectory tracking device based on binocular camera calibration can be implemented in the form of a computer program, and the computer program can be run on a computer device as shown in FIG. 4.
请参阅图4,图4是本申请实施例提供的计算机设备的示意性框图。该计算机设备500 是服务器,服务器可以是独立的服务器,也可以是多个服务器组成的服务器集群。Please refer to FIG. 4, which is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 500 is a server, and the server may be an independent server or a server cluster composed of multiple servers.
参阅图4,该计算机设备500包括通过系统总线501连接的处理器502、存储器和网络接口505,其中,存储器可以包括非易失性存储介质503和内存储器504。Referring to FIG. 4, the computer device 500 includes a processor 502, a memory, and a network interface 505 connected through a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
该非易失性存储介质503可存储操作系统5031和计算机程序5032。该计算机程序5032被执行时,可使得处理器502执行基于双目摄像机标定的行人轨迹跟踪方法。The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, the processor 502 can execute a pedestrian trajectory tracking method based on binocular camera calibration.
该处理器502用于提供计算和控制能力,支撑整个计算机设备500的运行。The processor 502 is used to provide calculation and control capabilities, and support the operation of the entire computer device 500.
该内存储器504为非易失性存储介质503中的计算机程序5032的运行提供环境,该计算机程序5032被处理器502执行时,可使得处理器502执行基于双目摄像机标定的行人轨迹跟踪方法。The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute the pedestrian trajectory tracking method based on binocular camera calibration.
该网络接口505用于进行网络通信,如提供数据信息的传输等。本领域技术人员可以理解,图4中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备500的限定,具体的计算机设备500可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。The network interface 505 is used for network communication, such as providing data information transmission. Those skilled in the art can understand that the structure shown in FIG. 4 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
其中,所述处理器502用于运行存储在存储器中的计算机程序5032,以实现本申请实施例公开的基于双目摄像机标定的行人轨迹跟踪方法。The processor 502 is configured to run a computer program 5032 stored in a memory to implement the pedestrian trajectory tracking method based on binocular camera calibration disclosed in the embodiment of the present application.
本领域技术人员可以理解,图4中示出的计算机设备的实施例并不构成对计算机设备具体构成的限定,在其他实施例中,计算机设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。例如,在一些实施例中,计算机设备可以仅包括存储器及处理器,在这样的实施例中,存储器及处理器的结构及功能与图4所示实施例一致,在此不再赘述。Those skilled in the art can understand that the embodiment of the computer device shown in FIG. 4 does not constitute a limitation on the specific configuration of the computer device. In other embodiments, the computer device may include more or less components than those shown in the figure. Or some parts are combined, or different parts are arranged. For example, in some embodiments, the computer device may only include a memory and a processor. In such embodiments, the structures and functions of the memory and the processor are the same as those of the embodiment shown in FIG. 4, and will not be repeated here.
应当理解,在本申请实施例中,处理器502可以是中央处理单元(Central Processing Unit,CPU),该处理器502还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。其中,通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that in this embodiment of the application, the processor 502 may be a central processing unit (Central Processing Unit, CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor.
在本申请的另一实施例中提供计算机可读存储介质。该计算机可读存储介质可以是非易失性,也可以是易失性。该计算机可读存储介质存储有计算机程序,其中计算机程序被处理器执行时实现本申请实施例公开的基于双目摄像机标定的行人轨迹跟踪方法。In another embodiment of the present application, a computer-readable storage medium is provided. The computer-readable storage medium may be non-volatile or volatile. The computer-readable storage medium stores a computer program, where the computer program is executed by a processor to implement the pedestrian trajectory tracking method based on binocular camera calibration disclosed in the embodiments of the present application.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的设备、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the above-described equipment, device, and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here. A person of ordinary skill in the art may be aware that the units and algorithm steps of the examples described in the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both, in order to clearly illustrate the hardware and software Interchangeability, in the above description, the composition and steps of each example have been generally described in accordance with the function. Whether these functions are executed by hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
在本申请所提供的几个实施例中,应该理解到,所揭露的设备、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为逻辑功能划分,实际实现时可以有另外的划分方式,也可以将具有相同功能的单元集合成一个单元,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。In the several embodiments provided in this application, it should be understood that the disclosed equipment, device, and method may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, or the units with the same function may be combined into one. Units, for example, multiple units or components can be combined or integrated into another system, or some features can be omitted or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms of connection.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本申请实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments of the present application.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个 单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of this application is essentially or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium. It includes several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), magnetic disk or optical disk and other media that can store program codes.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above are only specific implementations of this application, but the protection scope of this application is not limited to this. Anyone familiar with the technical field can easily think of various equivalents within the technical scope disclosed in this application. Modifications or replacements, these modifications or replacements shall be covered within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.

Claims (20)

  1. 一种基于双目摄像机标定的行人轨迹跟踪方法,其中,包括:A pedestrian trajectory tracking method based on binocular camera calibration, which includes:
    通过标定物图像集获取双目摄像机的单目标定参数;其中,所述单目标定参数包括左相机内参、左相机外参、左相机畸变参数、右相机内参、右相机外参、以及右相机畸变参数;Obtain the single target fixed parameters of the binocular camera through the calibration object image set; wherein, the single target fixed parameters include left camera internal parameters, left camera external parameters, left camera distortion parameters, right camera internal parameters, right camera external parameters, and right camera Distortion parameter
    获取测试图片,通过所述单目标定参数对所述测试图片进行双目校正,得到左校正图片和右校正图片,以及得到重投影矩阵;Acquiring a test picture, performing binocular correction on the test picture by using the single target setting parameters to obtain a left-corrected picture and a right-corrected picture, and obtain a reprojection matrix;
    调用预先存储的StereoBM算法,将所述左校正图片和所述右校正图片通过所述StereoBM算法计算得到视图差;Call the pre-stored StereoBM algorithm, and calculate the view difference between the left correction picture and the right correction picture through the StereoBM algorithm;
    获取双目摄像机所上传与待追踪目标对应的目标图像集,调用预先存储的轨迹跟踪算法获取所述目标图像集中各帧目标图像的目标二维图像坐标;以及Obtaining the target image set uploaded by the binocular camera and corresponding to the target to be tracked, and calling a pre-stored trajectory tracking algorithm to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set; and
    将所述目标图像集中各帧目标图像的目标二维图像坐标根据所调用的稀疏透视变化算法和所述视图差,将各目标二维图像坐标均转化为对应的目标3D坐标,以组成目标3D坐标集合。The target two-dimensional image coordinates of each frame of the target image in the target image set are converted into corresponding target 3D coordinates to form the target 3D according to the called sparse perspective change algorithm and the view difference. Coordinate collection.
  2. 根据权利要求1所述的基于双目摄像机标定的行人轨迹跟踪方法,其中,所述通过标定物图像集获取双目摄像机的单目标定参数,包括;The pedestrian trajectory tracking method based on binocular camera calibration according to claim 1, wherein said obtaining the single target fixed parameters of the binocular camera through the calibration object image set comprises;
    接收双目摄像机中左摄像机发送的左棋盘格图片集,和接收右摄像机发送的右棋盘格图片集;其中,所述左棋盘格图片集和右棋盘格图片集组成标定物图像集,且所述左棋盘格图片集中每一左棋盘格图片均对应一张所述右棋盘格图片集中的右棋盘格图片;Receive the left checkerboard picture set sent by the left camera in the binocular camera, and receive the right checkerboard picture set sent by the right camera; wherein the left checkerboard picture set and the right checkerboard picture set form a calibration object image set, and Each left checkerboard picture in the set of left checkerboard pictures corresponds to a right checkerboard picture in the set of right checkerboard pictures;
    获取所述左棋盘格图片集中其中一张左棋盘格图片以作为目标左棋盘格图片,并获取所述右棋盘格图片集中获取与目标左棋盘格图片相对应的目标右棋盘格图片;Acquiring one of the left checkerboard pictures in the left checkerboard picture set as the target left checkerboard picture, and obtaining the target right checkerboard picture corresponding to the target left checkerboard picture in the right checkerboard picture set;
    调用预先存储的哈里斯角点检测函数,获取所述目标左棋盘格中的左图像哈里斯角点特征,并获取所述目标右棋盘格中的右图像哈里斯角点特征;Calling a pre-stored Harris corner detection function to obtain the Harris corner feature of the left image in the left checkerboard of the target, and obtain the Harris corner feature of the right image in the right checkerboard of the target;
    通过所述左图像哈里斯角点特征和所述右图像哈里斯角点特征进行最小二乘估算,得到所述双目摄像机的单目标定参数。Least square estimation is performed by using the Harris corner feature of the left image and the Harris corner feature of the right image to obtain the single target parameter of the binocular camera.
  3. 根据权利要求1所述的基于双目摄像机标定的行人轨迹跟踪方法,其中,所述获取测试图片,通过所述单目标定参数对所述测试图片进行双目校正,得到左校正图片和右校正图片,以及得到重投影矩阵,包括:The pedestrian trajectory tracking method based on binocular camera calibration according to claim 1, wherein said acquiring a test picture performs binocular correction on said test picture by setting parameters of said single target to obtain a left correction picture and a right correction Picture, and get the reprojection matrix, including:
    将所述测试图片中各像素点的图像坐标分别根据左相机内参和右相机内参进行线性转换,得到各像素点的左实际成像平面坐标,以及得到各像素点的右实际成像平面坐标;Linearly transform the image coordinates of each pixel in the test picture according to the left camera internal parameters and the right camera internal parameters to obtain the left actual imaging plane coordinates of each pixel and the right actual imaging plane coordinates of each pixel;
    将各像素点的左实际成像平面坐标根据左相机畸变参数进行坐标转换以得到各像素点的左理想平面成像坐标,并将各像素点的右实际成像平面坐标根据右相机畸变参数进行坐标转换以得到各像素点的右理想平面成像坐标;The left actual imaging plane coordinates of each pixel are converted according to the left camera distortion parameters to obtain the left ideal plane imaging coordinates of each pixel, and the right actual imaging plane coordinates of each pixel are converted according to the right camera distortion parameters. Obtain the right ideal plane imaging coordinates of each pixel;
    将各像素点的左理想平面成像坐标根据左相机内参进行透视投影变换以得到各像素点的左摄像机3D坐标,并将各像素点的右理想平面成像坐标根据右相机内参进行透视投影变换以得到各像素点的右摄像机3D坐标;Perform perspective projection transformation on the left ideal plane imaging coordinates of each pixel according to the left camera internal parameters to obtain the left camera 3D coordinates of each pixel, and perform perspective projection transformation on the right ideal plane imaging coordinates of each pixel according to the right camera internal parameters to obtain 3D coordinates of the right camera of each pixel;
    将各像素点的左摄像机3D坐标根据左相机外参进行刚体转换以得到各像素点的左实际 3D坐标,并将各像素点的右摄像机3D坐标根据右相机外参进行刚体转换以得到各像素点的右实际3D坐标;The left camera 3D coordinates of each pixel are rigid body converted according to the left camera external parameters to obtain the left actual 3D coordinates of each pixel, and the right camera 3D coordinates of each pixel are rigid body converted according to the right camera external parameters to obtain each pixel The actual 3D coordinates of the right of the point;
    根据各像素点的左实际3D坐标得到左校正图片,并根据各像素点的右实际3D坐标得到右校正图片;Obtain a left correction picture according to the left actual 3D coordinates of each pixel, and obtain a right correction picture according to the right actual 3D coordinates of each pixel;
    根据各像素点的左实际3D坐标与各像素点的右实际3D坐标之间的映射关系,获取重投影矩阵。According to the mapping relationship between the left actual 3D coordinates of each pixel and the right actual 3D coordinates of each pixel, the reprojection matrix is obtained.
  4. 根据权利要求1所述的基于双目摄像机标定的行人轨迹跟踪方法,其中,所述将所述左校正图片和所述右校正图片通过所述StereoBM算法计算得到视图差,包括:The pedestrian trajectory tracking method based on binocular camera calibration according to claim 1, wherein said calculating said left correction picture and said right correction picture through said StereoBM algorithm to obtain a view difference, comprises:
    将所述左校正图片进行单通道灰度转换,得到左单通道灰度图;Performing single-channel grayscale conversion on the left-corrected picture to obtain a left single-channel grayscale image;
    将所述右校正图片进行单通道灰度转换,得到右单通道灰度图;Performing single-channel grayscale conversion on the right-corrected picture to obtain a right single-channel grayscale image;
    调用所述StereoBM算法中预设的视差搜索范围和滑动窗口大小,将所述左单通道灰度图、右单通道灰度图、视差搜索范围和滑动窗口大小作为所述StereoBM算法的入参进行计算,得到视图差。Call the preset disparity search range and sliding window size in the StereoBM algorithm, and use the left single-channel grayscale image, right single-channel grayscale image, disparity search range, and sliding window size as input parameters of the StereoBM algorithm Calculate to get the view difference.
  5. 根据权利要求1所述的基于双目摄像机标定的行人轨迹跟踪方法,其中,所述调用预先存储的轨迹跟踪算法获取所述目标图像集中各帧目标图像的目标二维图像坐标,包括:The pedestrian trajectory tracking method based on binocular camera calibration according to claim 1, wherein the invoking a pre-stored trajectory tracking algorithm to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set comprises:
    调用所述轨迹跟踪算法对应的多目标跟踪算法获取所述目标图像集中各帧目标图像的目标二维图像坐标。The multi-target tracking algorithm corresponding to the trajectory tracking algorithm is called to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set.
  6. 根据权利要求1所述的基于双目摄像机标定的行人轨迹跟踪方法,其中,还包括:The pedestrian trajectory tracking method based on binocular camera calibration according to claim 1, further comprising:
    将所述目标3D坐标集合上传至区块链网络。Upload the target 3D coordinate set to the blockchain network.
  7. 根据权利要求4所述的基于双目摄像机标定的行人轨迹跟踪方法,其中,所述将所述左校正图片进行单通道灰度转换,得到左单通道灰度图,包括:The pedestrian trajectory tracking method based on binocular camera calibration according to claim 4, wherein the single-channel grayscale conversion of the left correction picture to obtain a left single-channel grayscale image comprises:
    通过OpenCV的图片读取指令读取左校正图片,通过OpenCV的图片灰度化指令指令将所述左校正图片转化为左单通道灰度图。The left correction picture is read through the OpenCV picture reading instruction, and the left correction picture is converted into a left single-channel grayscale image through the OpenCV picture grayscale instruction instruction.
  8. 根据权利要求4所述的基于双目摄像机标定的行人轨迹跟踪方法,其中,所述调用所述StereoBM算法中预设的视差搜索范围和滑动窗口大小,将所述左单通道灰度图、右单通道灰度图、视差搜索范围和滑动窗口大小作为所述StereoBM算法的入参进行计算,得到视图差,包括:The pedestrian trajectory tracking method based on binocular camera calibration according to claim 4, wherein said calling the preset disparity search range and sliding window size in the StereoBM algorithm, the left single-channel grayscale image, right The single-channel grayscale image, the disparity search range and the sliding window size are calculated as the input parameters of the StereoBM algorithm to obtain the view difference, including:
    通过OpenCV的StereoBM算法中视差搜索范围和滑动窗口大小调用指令调用视差搜索范围和滑动窗口大小,通过OpenCV的StereoBM算法中视图差计算指令以计算得到视图差;其中视差搜索范围是16*9,滑动窗口大小是45。The disparity search range and the sliding window size are called by the disparity search range and sliding window size call instructions in the StereoBM algorithm of OpenCV, and the view difference is calculated by the view difference calculation instructions in the StereoBM algorithm of OpenCV; the disparity search range is 16*9, sliding The window size is 45.
  9. 一种基于双目摄像机标定的行人轨迹跟踪装置,其中,包括:A pedestrian trajectory tracking device based on binocular camera calibration, which includes:
    单目标定单元,用于通过标定物图像集获取双目摄像机的单目标定参数;其中,所述单目标定参数包括左相机内参、左相机外参、左相机畸变参数、右相机内参、右相机外参、以及右相机畸变参数;The single target setting unit is used to obtain the single target setting parameters of the binocular camera through the calibration object image set; wherein, the single target setting parameters include the left camera internal parameter, the left camera external parameter, the left camera distortion parameter, the right camera internal parameter, and the right camera internal parameter. External camera parameters and distortion parameters of the right camera;
    双目校正单元,用于获取测试图片,通过所述单目标定参数对所述测试图片进行双目校正,得到左校正图片和右校正图片,以及得到重投影矩阵;The binocular correction unit is used to obtain a test picture, perform binocular correction on the test picture by using the single target setting parameters to obtain a left-corrected picture and a right-corrected picture, and obtain a reprojection matrix;
    视图差计算单元,用于调用预先存储的StereoBM算法,将所述左校正图片和所述右校正图片通过所述StereoBM算法计算得到视图差;A view difference calculation unit, configured to call a pre-stored StereoBM algorithm, and calculate the view difference from the left correction picture and the right correction picture through the StereoBM algorithm;
    目标二维坐标获取单元,用于获取双目摄像机所上传与待追踪目标对应的目标图像集,调用预先存储的轨迹跟踪算法获取所述目标图像集中各帧目标图像的目标二维图像坐标;以及The target two-dimensional coordinate acquiring unit is used to acquire the target image set uploaded by the binocular camera and corresponding to the target to be tracked, and call a pre-stored trajectory tracking algorithm to acquire the target two-dimensional image coordinates of each frame of target image in the target image set;
    目标3D坐标集合获取单元,用于将所述目标图像集中各帧目标图像的目标二维图像坐标根据所调用的稀疏透视变化算法和所述视图差,将各目标二维图像坐标均转化为对应的目标3D坐标,以组成目标3D坐标集合。The target 3D coordinate collection acquisition unit is used to convert the target two-dimensional image coordinates of each frame of the target image in the target image set into the corresponding two-dimensional image coordinates according to the called sparse perspective change algorithm and the view difference The 3D coordinates of the target to form a set of target 3D coordinates.
  10. 一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现以下步骤:A computer device includes a memory, a processor, and a computer program that is stored on the memory and can run on the processor, wherein the processor implements the following steps when the processor executes the computer program:
    通过标定物图像集获取双目摄像机的单目标定参数;其中,所述单目标定参数包括左相机内参、左相机外参、左相机畸变参数、右相机内参、右相机外参、以及右相机畸变参数;Obtain the single target fixed parameters of the binocular camera through the calibration object image set; wherein, the single target fixed parameters include left camera internal parameters, left camera external parameters, left camera distortion parameters, right camera internal parameters, right camera external parameters, and right camera Distortion parameter
    获取测试图片,通过所述单目标定参数对所述测试图片进行双目校正,得到左校正图片和右校正图片,以及得到重投影矩阵;Acquiring a test picture, performing binocular correction on the test picture by using the single target setting parameters to obtain a left-corrected picture and a right-corrected picture, and obtain a reprojection matrix;
    调用预先存储的StereoBM算法,将所述左校正图片和所述右校正图片通过所述StereoBM算法计算得到视图差;Call the pre-stored StereoBM algorithm, and calculate the view difference between the left correction picture and the right correction picture through the StereoBM algorithm;
    获取双目摄像机所上传与待追踪目标对应的目标图像集,调用预先存储的轨迹跟踪算法获取所述目标图像集中各帧目标图像的目标二维图像坐标;以及Obtaining the target image set uploaded by the binocular camera and corresponding to the target to be tracked, and calling a pre-stored trajectory tracking algorithm to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set; and
    将所述目标图像集中各帧目标图像的目标二维图像坐标根据所调用的稀疏透视变化算法和所述视图差,将各目标二维图像坐标均转化为对应的目标3D坐标,以组成目标3D坐标集合。The target two-dimensional image coordinates of each frame of the target image in the target image set are converted into corresponding target 3D coordinates to form the target 3D according to the called sparse perspective change algorithm and the view difference. Coordinate collection.
  11. 根据权利要求10所述的计算机设备,其中,所述通过标定物图像集获取双目摄像机的单目标定参数,包括;The computer device according to claim 10, wherein said obtaining the single target fixed parameter of the binocular camera through the calibration object image set comprises;
    接收双目摄像机中左摄像机发送的左棋盘格图片集,和接收右摄像机发送的右棋盘格图片集;其中,所述左棋盘格图片集和右棋盘格图片集组成标定物图像集,且所述左棋盘格图片集中每一左棋盘格图片均对应一张所述右棋盘格图片集中的右棋盘格图片;Receive the left checkerboard picture set sent by the left camera in the binocular camera, and receive the right checkerboard picture set sent by the right camera; wherein the left checkerboard picture set and the right checkerboard picture set form a calibration object image set, and Each left checkerboard picture in the set of left checkerboard pictures corresponds to a right checkerboard picture in the set of right checkerboard pictures;
    获取所述左棋盘格图片集中其中一张左棋盘格图片以作为目标左棋盘格图片,并获取所述右棋盘格图片集中获取与目标左棋盘格图片相对应的目标右棋盘格图片;Acquiring one of the left checkerboard pictures in the left checkerboard picture set as the target left checkerboard picture, and obtaining the target right checkerboard picture corresponding to the target left checkerboard picture in the right checkerboard picture set;
    调用预先存储的哈里斯角点检测函数,获取所述目标左棋盘格中的左图像哈里斯角点特征,并获取所述目标右棋盘格中的右图像哈里斯角点特征;Calling a pre-stored Harris corner detection function to obtain the Harris corner feature of the left image in the left checkerboard of the target, and obtain the Harris corner feature of the right image in the right checkerboard of the target;
    通过所述左图像哈里斯角点特征和所述右图像哈里斯角点特征进行最小二乘估算,得到所述双目摄像机的单目标定参数。Least square estimation is performed by using the Harris corner feature of the left image and the Harris corner feature of the right image to obtain the single target parameter of the binocular camera.
  12. 根据权利要求10所述的计算机设备,其中,所述获取测试图片,通过所述单目标定参数对所述测试图片进行双目校正,得到左校正图片和右校正图片,以及得到重投影矩阵,包括:10. The computer device according to claim 10, wherein said acquiring a test picture, performing binocular correction on the test picture by using the single target parameter to obtain a left-corrected picture and a right-corrected picture, and obtaining a reprojection matrix, include:
    将所述测试图片中各像素点的图像坐标分别根据左相机内参和右相机内参进行线性转换, 得到各像素点的左实际成像平面坐标,以及得到各像素点的右实际成像平面坐标;Linearly transform the image coordinates of each pixel in the test picture according to the left camera internal parameters and the right camera internal parameters to obtain the left actual imaging plane coordinates of each pixel and the right actual imaging plane coordinates of each pixel;
    将各像素点的左实际成像平面坐标根据左相机畸变参数进行坐标转换以得到各像素点的左理想平面成像坐标,并将各像素点的右实际成像平面坐标根据右相机畸变参数进行坐标转换以得到各像素点的右理想平面成像坐标;The left actual imaging plane coordinates of each pixel are converted according to the left camera distortion parameters to obtain the left ideal plane imaging coordinates of each pixel, and the right actual imaging plane coordinates of each pixel are converted according to the right camera distortion parameters. Obtain the right ideal plane imaging coordinates of each pixel;
    将各像素点的左理想平面成像坐标根据左相机内参进行透视投影变换以得到各像素点的左摄像机3D坐标,并将各像素点的右理想平面成像坐标根据右相机内参进行透视投影变换以得到各像素点的右摄像机3D坐标;Perform perspective projection transformation on the left ideal plane imaging coordinates of each pixel according to the left camera internal parameters to obtain the left camera 3D coordinates of each pixel, and perform perspective projection transformation on the right ideal plane imaging coordinates of each pixel according to the right camera internal parameters to obtain 3D coordinates of the right camera of each pixel;
    将各像素点的左摄像机3D坐标根据左相机外参进行刚体转换以得到各像素点的左实际3D坐标,并将各像素点的右摄像机3D坐标根据右相机外参进行刚体转换以得到各像素点的右实际3D坐标;The left camera 3D coordinates of each pixel are rigid body converted according to the left camera external parameters to obtain the left actual 3D coordinates of each pixel, and the right camera 3D coordinates of each pixel are rigid body converted according to the right camera external parameters to obtain each pixel The actual right 3D coordinates of the point;
    根据各像素点的左实际3D坐标得到左校正图片,并根据各像素点的右实际3D坐标得到右校正图片;Obtain a left correction picture according to the left actual 3D coordinates of each pixel, and obtain a right correction picture according to the right actual 3D coordinates of each pixel;
    根据各像素点的左实际3D坐标与各像素点的右实际3D坐标之间的映射关系,获取重投影矩阵。According to the mapping relationship between the left actual 3D coordinates of each pixel and the right actual 3D coordinates of each pixel, the reprojection matrix is obtained.
  13. 根据权利要求10所述的计算机设备,其中,所述将所述左校正图片和所述右校正图片通过所述StereoBM算法计算得到视图差,包括:11. The computer device according to claim 10, wherein said calculating said left correction picture and said right correction picture by said StereoBM algorithm to obtain a view difference, comprises:
    将所述左校正图片进行单通道灰度转换,得到左单通道灰度图;Performing single-channel grayscale conversion on the left-corrected picture to obtain a left single-channel grayscale image;
    将所述右校正图片进行单通道灰度转换,得到右单通道灰度图;Performing single-channel grayscale conversion on the right-corrected picture to obtain a right single-channel grayscale image;
    调用所述StereoBM算法中预设的视差搜索范围和滑动窗口大小,将所述左单通道灰度图、右单通道灰度图、视差搜索范围和滑动窗口大小作为所述StereoBM算法的入参进行计算,得到视图差。Call the preset disparity search range and sliding window size in the StereoBM algorithm, and use the left single-channel grayscale image, right single-channel grayscale image, disparity search range, and sliding window size as input parameters of the StereoBM algorithm Calculate to get the view difference.
  14. 根据权利要求10所述的计算机设备,其中,所述调用预先存储的轨迹跟踪算法获取所述目标图像集中各帧目标图像的目标二维图像坐标,包括:The computer device according to claim 10, wherein said calling a pre-stored trajectory tracking algorithm to obtain the target two-dimensional image coordinates of each frame of target image in the target image set comprises:
    调用所述轨迹跟踪算法对应的多目标跟踪算法获取所述目标图像集中各帧目标图像的目标二维图像坐标。The multi-target tracking algorithm corresponding to the trajectory tracking algorithm is called to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set.
  15. 根据权利要求10所述的计算机设备,其中,还包括:The computer device according to claim 10, further comprising:
    将所述目标3D坐标集合上传至区块链网络。Upload the target 3D coordinate set to the blockchain network.
  16. 根据权利要求13所述的计算机设备,其中,所述将所述左校正图片进行单通道灰度转换,得到左单通道灰度图,包括:11. The computer device according to claim 13, wherein said performing single-channel grayscale conversion on the left-corrected picture to obtain a left single-channel grayscale image comprises:
    通过OpenCV的图片读取指令读取左校正图片,通过OpenCV的图片灰度化指令将所述左校正图片转化为左单通道灰度图。The left correction picture is read through the OpenCV picture reading instruction, and the left correction picture is converted into a left single-channel grayscale image through the OpenCV picture grayscale instruction.
  17. 根据权利要求13所述的计算机设备,其中,所述调用所述StereoBM算法中预设的视差搜索范围和滑动窗口大小,将所述左单通道灰度图、右单通道灰度图、视差搜索范围和滑动窗口大小作为所述StereoBM算法的入参进行计算,得到视图差,包括:The computer device according to claim 13, wherein the disparity search range and the sliding window size preset in the StereoBM algorithm are invoked, and the left single-channel grayscale image, the right single-channel grayscale image, and the disparity search The range and sliding window size are calculated as the input parameters of the StereoBM algorithm to obtain the view difference, including:
    通过OpenCV的StereoBM算法中视差搜索范围和滑动窗口大小调用指令调用视差搜索范围和滑动窗口大小,通过OpenCV的StereoBM算法中视图差计算指令以计算得到视图差; 其中视差搜索范围是16*9,滑动窗口大小是45。The disparity search range and sliding window size are called through the disparity search range and sliding window size call instructions in the StereoBM algorithm of OpenCV, and the view difference is calculated by the view difference calculation instructions in the StereoBM algorithm of OpenCV; where the disparity search range is 16*9, sliding The window size is 45.
  18. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行以下操作:A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the following operations:
    通过标定物图像集获取双目摄像机的单目标定参数;其中,所述单目标定参数包括左相机内参、左相机外参、左相机畸变参数、右相机内参、右相机外参、以及右相机畸变参数;Obtain the single target fixed parameters of the binocular camera through the calibration object image set; wherein, the single target fixed parameters include left camera internal parameters, left camera external parameters, left camera distortion parameters, right camera internal parameters, right camera external parameters, and right camera Distortion parameter
    获取测试图片,通过所述单目标定参数对所述测试图片进行双目校正,得到左校正图片和右校正图片,以及得到重投影矩阵;Acquiring a test picture, performing binocular correction on the test picture by using the single target setting parameters to obtain a left-corrected picture and a right-corrected picture, and obtain a reprojection matrix;
    调用预先存储的StereoBM算法,将所述左校正图片和所述右校正图片通过所述StereoBM算法计算得到视图差;Call the pre-stored StereoBM algorithm, and calculate the view difference between the left correction picture and the right correction picture through the StereoBM algorithm;
    获取双目摄像机所上传与待追踪目标对应的目标图像集,调用预先存储的轨迹跟踪算法获取所述目标图像集中各帧目标图像的目标二维图像坐标;以及Obtaining the target image set uploaded by the binocular camera and corresponding to the target to be tracked, and calling a pre-stored trajectory tracking algorithm to obtain the target two-dimensional image coordinates of each frame of the target image in the target image set; and
    将所述目标图像集中各帧目标图像的目标二维图像坐标根据所调用的稀疏透视变化算法和所述视图差,将各目标二维图像坐标均转化为对应的目标3D坐标,以组成目标3D坐标集合。The target two-dimensional image coordinates of each frame of the target image in the target image set are converted into corresponding target 3D coordinates to form the target 3D according to the called sparse perspective change algorithm and the view difference. Coordinate collection.
  19. 根据权利要求18所述的计算机可读存储介质,其中,所述通过标定物图像集获取双目摄像机的单目标定参数,包括;18. The computer-readable storage medium according to claim 18, wherein said obtaining the single target fixed parameter of the binocular camera through the calibration object image set comprises;
    接收双目摄像机中左摄像机发送的左棋盘格图片集,和接收右摄像机发送的右棋盘格图片集;其中,所述左棋盘格图片集和右棋盘格图片集组成标定物图像集,且所述左棋盘格图片集中每一左棋盘格图片均对应一张所述右棋盘格图片集中的右棋盘格图片;Receive the left checkerboard picture set sent by the left camera in the binocular camera, and receive the right checkerboard picture set sent by the right camera; wherein the left checkerboard picture set and the right checkerboard picture set form a calibration object image set, and Each left checkerboard picture in the set of left checkerboard pictures corresponds to a right checkerboard picture in the set of right checkerboard pictures;
    获取所述左棋盘格图片集中其中一张左棋盘格图片以作为目标左棋盘格图片,并获取所述右棋盘格图片集中获取与目标左棋盘格图片相对应的目标右棋盘格图片;Acquiring one of the left checkerboard pictures in the left checkerboard picture set as the target left checkerboard picture, and obtaining the target right checkerboard picture corresponding to the target left checkerboard picture in the right checkerboard picture set;
    调用预先存储的哈里斯角点检测函数,获取所述目标左棋盘格中的左图像哈里斯角点特征,并获取所述目标右棋盘格中的右图像哈里斯角点特征;Calling a pre-stored Harris corner detection function to obtain the Harris corner feature of the left image in the left checkerboard of the target, and obtain the Harris corner feature of the right image in the right checkerboard of the target;
    通过所述左图像哈里斯角点特征和所述右图像哈里斯角点特征进行最小二乘估算,得到所述双目摄像机的单目标定参数。Least square estimation is performed by using the Harris corner feature of the left image and the Harris corner feature of the right image to obtain the single target parameter of the binocular camera.
  20. 根据权利要求18所述的计算机可读存储介质,其中,所述获取测试图片,通过所述单目标定参数对所述测试图片进行双目校正,得到左校正图片和右校正图片,以及得到重投影矩阵,包括:The computer-readable storage medium according to claim 18, wherein said acquiring a test picture performs binocular correction on said test picture by using said single target parameter to obtain a left-corrected picture and a right-corrected picture, and obtain re The projection matrix includes:
    将所述测试图片中各像素点的图像坐标分别根据左相机内参和右相机内参进行线性转换,得到各像素点的左实际成像平面坐标,以及得到各像素点的右实际成像平面坐标;Linearly transform the image coordinates of each pixel in the test picture according to the left camera internal parameters and the right camera internal parameters to obtain the left actual imaging plane coordinates of each pixel and the right actual imaging plane coordinates of each pixel;
    将各像素点的左实际成像平面坐标根据左相机畸变参数进行坐标转换以得到各像素点的左理想平面成像坐标,并将各像素点的右实际成像平面坐标根据右相机畸变参数进行坐标转换以得到各像素点的右理想平面成像坐标;The left actual imaging plane coordinates of each pixel are converted according to the left camera distortion parameters to obtain the left ideal plane imaging coordinates of each pixel, and the right actual imaging plane coordinates of each pixel are converted according to the right camera distortion parameters. Obtain the right ideal plane imaging coordinates of each pixel;
    将各像素点的左理想平面成像坐标根据左相机内参进行透视投影变换以得到各像素点的左摄像机3D坐标,并将各像素点的右理想平面成像坐标根据右相机内参进行透视投影变换以得到各像素点的右摄像机3D坐标;Perform perspective projection transformation on the left ideal plane imaging coordinates of each pixel according to the left camera internal parameters to obtain the left camera 3D coordinates of each pixel, and perform perspective projection transformation on the right ideal plane imaging coordinates of each pixel according to the right camera internal parameters to obtain 3D coordinates of the right camera of each pixel;
    将各像素点的左摄像机3D坐标根据左相机外参进行刚体转换以得到各像素点的左实际3D坐标,并将各像素点的右摄像机3D坐标根据右相机外参进行刚体转换以得到各像素点的右实际3D坐标;The left camera 3D coordinates of each pixel are rigid body converted according to the left camera external parameters to obtain the left actual 3D coordinates of each pixel, and the right camera 3D coordinates of each pixel are rigid body converted according to the right camera external parameters to obtain each pixel The actual right 3D coordinates of the point;
    根据各像素点的左实际3D坐标得到左校正图片,并根据各像素点的右实际3D坐标得到右校正图片;Obtain a left correction picture according to the left actual 3D coordinates of each pixel, and obtain a right correction picture according to the right actual 3D coordinates of each pixel;
    根据各像素点的左实际3D坐标与各像素点的右实际3D坐标之间的映射关系,获取重投影矩阵。According to the mapping relationship between the left actual 3D coordinates of each pixel and the right actual 3D coordinates of each pixel, the reprojection matrix is obtained.
PCT/CN2020/111780 2020-07-30 2020-08-27 Pedestrian trajectory tracking method and apparatus based on binocular camera calibration, computer device, and storage medium WO2021139176A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010752907.9A CN111899282A (en) 2020-07-30 2020-07-30 Pedestrian trajectory tracking method and device based on binocular camera calibration
CN202010752907.9 2020-07-30

Publications (1)

Publication Number Publication Date
WO2021139176A1 true WO2021139176A1 (en) 2021-07-15

Family

ID=73182689

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/111780 WO2021139176A1 (en) 2020-07-30 2020-08-27 Pedestrian trajectory tracking method and apparatus based on binocular camera calibration, computer device, and storage medium

Country Status (2)

Country Link
CN (1) CN111899282A (en)
WO (1) WO2021139176A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113781578A (en) * 2021-09-09 2021-12-10 南京康尼电子科技有限公司 Gate passing behavior identification and control method combining target detection and binocular vision
CN114910076A (en) * 2022-05-20 2022-08-16 泉州装备制造研究所 Outdoor camera positioning method and device based on GPS and IMU information
CN117437563A (en) * 2023-12-13 2024-01-23 黑龙江惠达科技股份有限公司 Plant protection unmanned aerial vehicle dotting method, device and equipment based on binocular vision

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112489134A (en) * 2020-11-26 2021-03-12 南方科技大学 Motion estimation-oriented design method of cross-frame ultrahigh-speed camera and motion estimation method
CN112633096A (en) * 2020-12-14 2021-04-09 深圳云天励飞技术股份有限公司 Passenger flow monitoring method and device, electronic equipment and storage medium
CN114299120B (en) * 2021-12-31 2023-08-04 北京银河方圆科技有限公司 Compensation method, registration method, and readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103868460A (en) * 2014-03-13 2014-06-18 桂林电子科技大学 Parallax optimization algorithm-based binocular stereo vision automatic measurement method
CN106485735A (en) * 2015-09-01 2017-03-08 南京理工大学 Human body target recognition and tracking method based on stereovision technique
CN106803273A (en) * 2017-01-17 2017-06-06 湖南优象科技有限公司 A kind of panoramic camera scaling method
CN109191509A (en) * 2018-07-25 2019-01-11 广东工业大学 A kind of virtual binocular three-dimensional reconstruction method based on structure light
US10503966B1 (en) * 2018-10-11 2019-12-10 Tindei Network Technology (Shanghai) Co., Ltd. Binocular pedestrian detection system having dual-stream deep learning neural network and the methods of using the same
CN111199556A (en) * 2019-12-31 2020-05-26 同济大学 Indoor pedestrian detection and tracking method based on camera
US10666926B1 (en) * 2017-07-18 2020-05-26 Edge 3 Technologies, Inc. Residual error mitigation in multiview calibration

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101344965A (en) * 2008-09-04 2009-01-14 上海交通大学 Tracking system based on binocular camera shooting
CN103337094B (en) * 2013-06-14 2016-05-18 西安工业大学 A kind of method of applying binocular camera and realizing motion three-dimensional reconstruction
CN107507243A (en) * 2016-06-14 2017-12-22 华为技术有限公司 A kind of camera parameters method of adjustment, instructor in broadcasting's video camera and system
CN106525004A (en) * 2016-11-09 2017-03-22 人加智能机器人技术(北京)有限公司 Binocular stereo vision system and depth measuring method
CN109941885A (en) * 2019-03-07 2019-06-28 无锡顶视科技有限公司 A kind of container number candid photograph and identification device and its method based on telescopic arm
CN111047536B (en) * 2019-12-18 2023-11-14 深圳市汉森软件股份有限公司 CCD image correction method, device, equipment and storage medium
CN111368820A (en) * 2020-03-06 2020-07-03 腾讯科技(深圳)有限公司 Text labeling method and device and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103868460A (en) * 2014-03-13 2014-06-18 桂林电子科技大学 Parallax optimization algorithm-based binocular stereo vision automatic measurement method
CN106485735A (en) * 2015-09-01 2017-03-08 南京理工大学 Human body target recognition and tracking method based on stereovision technique
CN106803273A (en) * 2017-01-17 2017-06-06 湖南优象科技有限公司 A kind of panoramic camera scaling method
US10666926B1 (en) * 2017-07-18 2020-05-26 Edge 3 Technologies, Inc. Residual error mitigation in multiview calibration
CN109191509A (en) * 2018-07-25 2019-01-11 广东工业大学 A kind of virtual binocular three-dimensional reconstruction method based on structure light
US10503966B1 (en) * 2018-10-11 2019-12-10 Tindei Network Technology (Shanghai) Co., Ltd. Binocular pedestrian detection system having dual-stream deep learning neural network and the methods of using the same
CN111199556A (en) * 2019-12-31 2020-05-26 同济大学 Indoor pedestrian detection and tracking method based on camera

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113781578A (en) * 2021-09-09 2021-12-10 南京康尼电子科技有限公司 Gate passing behavior identification and control method combining target detection and binocular vision
CN114910076A (en) * 2022-05-20 2022-08-16 泉州装备制造研究所 Outdoor camera positioning method and device based on GPS and IMU information
CN114910076B (en) * 2022-05-20 2024-04-05 泉州装备制造研究所 Outdoor camera positioning method and device based on GPS and IMU information
CN117437563A (en) * 2023-12-13 2024-01-23 黑龙江惠达科技股份有限公司 Plant protection unmanned aerial vehicle dotting method, device and equipment based on binocular vision
CN117437563B (en) * 2023-12-13 2024-03-15 黑龙江惠达科技股份有限公司 Plant protection unmanned aerial vehicle dotting method, device and equipment based on binocular vision

Also Published As

Publication number Publication date
CN111899282A (en) 2020-11-06

Similar Documents

Publication Publication Date Title
WO2021139176A1 (en) Pedestrian trajectory tracking method and apparatus based on binocular camera calibration, computer device, and storage medium
CN111145238B (en) Three-dimensional reconstruction method and device for monocular endoscopic image and terminal equipment
CN110568447B (en) Visual positioning method, device and computer readable medium
WO2021098080A1 (en) Multi-spectral camera extrinsic parameter self-calibration algorithm based on edge features
US11816810B2 (en) 3-D reconstruction using augmented reality frameworks
US10078899B2 (en) Camera system and image registration method thereof
EP3028252A1 (en) Rolling sequential bundle adjustment
CN107809610B (en) Camera parameter set calculation device, camera parameter set calculation method, and recording medium
US20160117821A1 (en) Apparatus and method for registering images
WO2023060964A1 (en) Calibration method and related apparatus, device, storage medium and computer program product
CN113140036A (en) Three-dimensional modeling method, device, equipment and storage medium
CN115035235A (en) Three-dimensional reconstruction method and device
Wan et al. Drone image stitching using local mesh-based bundle adjustment and shape-preserving transform
CN110111364B (en) Motion detection method and device, electronic equipment and storage medium
CN116194951A (en) Method and apparatus for stereoscopic based 3D object detection and segmentation
CN111882655A (en) Method, apparatus, system, computer device and storage medium for three-dimensional reconstruction
CN114266823A (en) Monocular SLAM method combining SuperPoint network characteristic extraction
CN111383264B (en) Positioning method, positioning device, terminal and computer storage medium
WO2018150086A2 (en) Methods and apparatuses for determining positions of multi-directional image capture apparatuses
US20230005213A1 (en) Imaging apparatus, imaging method, and program
WO2018100230A1 (en) Method and apparatuses for determining positions of multi-directional image capture apparatuses
CN112233185A (en) Camera calibration method, image registration method, camera device and storage device
CN115082570B (en) Calibration method for laser radar and panoramic camera
TWI823491B (en) Optimization method of a depth estimation model, device, electronic equipment and storage media
CN117788686A (en) Three-dimensional scene reconstruction method and device based on 2D image and electronic equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20912219

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20912219

Country of ref document: EP

Kind code of ref document: A1