Method and device for processing synchronization of multiple camera frames and storage medium
By extracting rigid body features and calculating the frame synchronization time difference in multi-camera video splicing, frame synchronization calibration is performed, which solves the problem of frame asynchrony between cameras and significantly improves video splicing quality and user experience.
Patent Information
- Application Number
- CN202410741810.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-08-23
- Estimated Expiration
- Not applicable · inactive patent
Smart Images

Figure CN118540589A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a processing method, device and storage medium for synchronizing frames of multiple cameras. Background Art
[0002] Panoramic video stitching technology is mainly used to solve the problem that a single imaging device is limited in viewing angle and cannot fully present the real scene. In the existing technology, multiple videos are stitched and encoded into one panoramic video through a stitching algorithm, and the information in the original video is retained and repeated redundant information is removed, thus overcoming the physical limitations of the sensor and providing a large field of view and high-resolution video information.
[0003] This technology has a wide range of applications in both civilian and military fields. In the civilian field, it can be used for virtual reality scene construction, panoramic video surveillance, car assisted driving systems, live events, etc. With the continuous development of computer vision technology, panoramic video stitching technology has shown broad application prospects and important research significance.
[0004] However, when performing multi-camera video stitching in the prior art, the time offset between the cameras may cause the frames between the cameras to be out of sync, thereby affecting the quality of the video stitching. Summary of the invention
[0005] The purpose of the present invention is to overcome the above technical deficiencies, provide a processing method, device and storage medium for synchronizing frames of multiple cameras, and solve the technical problem of frame asynchrony between cameras in the prior art.
[0006] In order to achieve the above technical objectives, the technical solution of the present invention provides a method for processing multiple camera frame synchronization, comprising the following steps:
[0007] S1, stitching multiple camera images that need to be frame synchronized into a panoramic picture;
[0008] S2, performing feature extraction, obtaining the feature vector and position of the rigid body that is identified to be moving in the panoramic image at time t, and calculating the speed of the rigid body movement;
[0009] S3, after the rigid body moves between multiple frames of images, find the optimal matching cost matrix between the feature vector and the position obtained by the rigid body in step S2;
[0010] S4. Based on the optimal matching result obtained in step S3, the actual position and predicted position of the detection target are calculated to obtain the deviation position between the predicted position value and the actual position. The frame synchronization time difference T between the cameras is obtained from the deviation position and the speed calculated in step S2:
[0011] T x =(x t -xt ')÷V x
[0012] T y =(y t -y t ')÷V y
[0013] Take T=(T x +T y )÷2;
[0014] in:
[0015] x t is the x-axis coordinate of the target at time t;
[0016] x t ' is the predicted value of the x-axis coordinate of the target at time t;
[0017] y t is the y-axis coordinate of the target at time t;
[0018] y' t The predicted value of the target's coordinate in the y-axis direction at time t;
[0019] T x The time difference between the actual value and the predicted value of the target in the x-axis direction of the image;
[0020] T y The time difference between the actual value and the predicted value of the target in the y-axis direction of the image;
[0021] S5. Perform frame synchronization calibration according to the frame synchronization time difference between the cameras calculated in step S4, insert frames or drop frames in the image sequence of each camera to eliminate frame differences.
[0022] In any implementation manner, in step S2, the speed of the rigid body motion is calculated by the following steps:
[0023] Identify the moving rigid body feature vector O in the panoramic image at time t t With position P t (x t ,y t );According to the position P of the target at time t-1 t-1 (x t-1 ,y t-1 ) and the position P at time t t (x t ,y t ) can predict the position P at time t+1 t ' +1 (x t ' +1 ,yt ' +1 ), the prediction method is:
[0024] x t ' +1 =x t '+(x t '-x t ' -1 )
[0025] y t ' +1 =y t '+(y t '-y t ' -1 )
[0026] At the same time, the speed of the rigid body motion is calculated as:
[0027] V x =(x t -x t-1 )÷Δt
[0028] V y =(y t -y t-1 )÷Δt;
[0029] in:
[0030] V x is the velocity of the rigid body in the x-axis direction;
[0031] V y is the velocity of the rigid body in the y-axis direction;
[0032] Δt is the time difference between the two frames before and after the image.
[0033] In any implementation, in step S2, the target frame is extracted using the neural network YOLO, and then the target frame image is extracted with the neural network CNN.
[0034] In any implementation, in step S3, the cost matrix is constructed by the following steps:
[0035] Suppose there are m new detection targets and n prediction targets, then the cost matrix is m×n dimensional, and each element is: C ij =λ×dist_P(P t ,P t ')+(1-λ)×dist_O(O t-1 ,O t );
[0036] Among them, C ij is the element in the cost matrix, i and j represent the subscript of the matrix element;
[0037] λ is a weight parameter, which is adjusted according to the experimental value;
[0038] P t is the target position at time t;
[0039] P t 'Predicted target position at time t;
[0040] O t-1 is the target feature vector at time t-1;
[0041] O t is the target feature vector at time t;
[0042] dist_P is used to calculate the Euclidean distance between the current model detection position and the predicted position, and dist_O is used to calculate the inner product of the rigid body feature vector detected by the model between frames.
[0043] In any implementation manner, in step S3, the optimal matching cost matrix is obtained by using the Hungarian algorithm.
[0044] In any implementation manner, in step S5, taking the imaging camera before the rigid body moves as a reference, assuming the camera frame rate is fps, when the frame synchronization time difference between cameras T>=0, it is necessary to insert frames for the imaging camera after the movement, and the number of inserted frames is:
[0045] N=|T×fps|
[0046] When T<0, the moving imaging camera needs to drop frames, and the number of dropped frames is:
[0047] N = |T×fps|.
[0048] The present invention also provides a processing device for synchronizing frames of multiple cameras, comprising:
[0049] A stitching unit, used to stitch multiple camera images that need to be frame synchronized into a panoramic picture;
[0050] An extraction unit is used to perform feature extraction, obtain the feature vector and position of the rigid body that is identified to be moving in the panoramic image at time t, and calculate the speed of the rigid body movement;
[0051] The matching unit is used to find the optimal matching cost matrix between the rigid body and the position after the rigid body moves between multiple frames of images;
[0052] The calculation unit calculates the actual position and the predicted position of the detection target based on the obtained optimal matching result; obtains the deviation position between the predicted position value and the actual position, and obtains the frame synchronization time difference between the cameras from the deviation position and the calculated speed;
[0053] The frame synchronization calibration unit is used to perform frame synchronization calibration according to the calculated frame synchronization time difference between cameras, insert frames or drop frames in the image sequence of each camera, and eliminate frame differences.
[0054] In addition, the present invention also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned processing method for synchronizing multiple camera frames is implemented.
[0055] Compared with the prior art, the beneficial effects of the present invention include: the present invention proposes a new processing method for synchronizing multiple camera frames, by calculating the deviation between the theoretical value and the actual value of the speed and position of the moving rigid body between different camera images, further obtaining the frame difference between cameras, thereby achieving accurate frame synchronization. This can greatly improve the effect of video splicing and enhance user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 It is a flowchart of a method for processing synchronization of multiple camera frames according to Embodiment 1 of the present invention. DETAILED DESCRIPTION
[0057] If not specifically stated, in this application, the term "or" is inclusive. For example, the phrase "A or B" means "A, B, or both A and B". More specifically, any of the following conditions satisfies the condition "A or B": A is true (or exists) and B is false (or does not exist); A is false (or does not exist) and B is true (or exists); or both A and B are true (or exist).
[0058] This specific implementation provides a method for processing multiple camera frame synchronization, including the following steps:
[0059] S1, stitching multiple camera images that need to be frame synchronized into a panoramic picture;
[0060] S2, using the neural network YOLO to perform feature extraction, obtaining the feature vector and position of the rigid body that identifies the movement in the panoramic image at time t, and calculating the speed of the rigid body movement; further, in some embodiments, the neural network YOLO is used to extract the target frame, and then the neural network CNN is used to extract features from the target frame image;
[0061] The speed of the rigid body motion is calculated by the following steps:
[0062] Identify the moving rigid body feature vector O in the panoramic image at time t t With position P t (x t ,y t );According to the position P of the target at time t-1 t-1 (x t-1 ,yt-1 ) and the position P at time t t (x t ,y t ) can predict the position P at time t+1 t ' +1 (x t ' +1 ,y t ' +1 ), the prediction method is:
[0063] x t ' +1 =x t '+(x t '-x t ' -1 )
[0064] y t ' +1 =y t '+(y t '-y t ' -1 )
[0065] At the same time, the speed of the rigid body motion is calculated as:
[0066] V x =(x t -x t-1 )÷Δt
[0067] V y =(y t -y t-1 )÷Δt;
[0068] in:
[0069] V x is the velocity of the rigid body in the x-axis direction;
[0070] V y is the velocity of the rigid body in the y-axis direction;
[0071] Δt is the time difference between the two frames before and after the image.
[0072] S3, after the rigid body moves between multiple frames of images, find the optimal matching cost matrix between the feature vector and the position obtained by the rigid body in step S2; the cost matrix is constructed by the following steps:
[0073] Suppose there are m new detection targets and n prediction targets, then the cost matrix is m×n dimensional, and each element is: C ij =λ×dist_P(P t ,P t ')+(1-λ)×dist_O(Ot-1 ,O t );C ij is the element in the cost matrix, i and j represent the subscript of the matrix element;
[0074] λ is a weight parameter, which is adjusted according to the experimental value;
[0075] P t is the target position at time t;
[0076] P t 'Predicted target position at time t;
[0077] O t-1 is the target feature vector at time t-1;
[0078] O t is the target feature vector at time t;
[0079] dist_P is used to calculate the Euclidean distance between the current model detection position and the predicted position, and dist_O is used to calculate the inner product of the rigid body feature vector detected by the model between frames; the optimal matching cost matrix is obtained by the Hungarian algorithm;
[0080] S4. Based on the optimal matching result obtained in step S3, the actual position and predicted position of the detection target are calculated to obtain the deviation position between the predicted position value and the actual position. The frame synchronization time difference between the cameras is obtained from the deviation position and the speed calculated in step S2:
[0081] T x =(x t -x t ')÷V x
[0082] T y =(y t -y t ')÷V y
[0083] Take T=(T x +T y )÷2;
[0084] in:
[0085] x t is the x-axis coordinate of the target at time t;
[0086] x t ' is the predicted value of the x-axis coordinate of the target at time t;
[0087] y t is the y-axis coordinate of the target at time t;
[0088] y't The predicted value of the target's coordinate in the y-axis direction at time t;
[0089] T x The time difference between the actual value and the predicted value of the target in the x-axis direction of the image;
[0090] T y The time difference between the actual value and the predicted value of the target in the y-axis direction of the image;
[0091] S5, performing frame synchronization calibration according to the frame synchronization time difference between the cameras calculated in step S4, inserting frames or dropping frames in the image sequence of each camera to eliminate frame differences;
[0092] Taking the camera that images the rigid body before it moves as the benchmark, assuming the camera frame rate is fps, when the frame synchronization time difference between cameras T>=0, it is necessary to insert frames for the camera that images the rigid body after it moves, and the number of inserted frames is:
[0093] N=|T×fps|
[0094] When T<0, the moving imaging camera needs to drop frames, and the number of dropped frames is:
[0095] N = |T×fps|.
[0096] This specific implementation also proposes a processing device for multiple camera frame synchronization, including:
[0097] A stitching unit, used to stitch multiple camera images that need to be frame synchronized into a panoramic picture;
[0098] An extraction unit is used to perform feature extraction, obtain the feature vector and position of the rigid body that is identified to be moving in the panoramic image at time t, and calculate the speed of the rigid body movement;
[0099] The matching unit is used to find the optimal matching cost matrix between the rigid body and the position after the rigid body moves between multiple frames of images;
[0100] The calculation unit calculates the actual position and the predicted position of the detection target based on the obtained optimal matching result; obtains the deviation position between the predicted position value and the actual position, and obtains the frame synchronization time difference between the cameras from the deviation position and the calculated speed;
[0101] The frame synchronization calibration unit is used to perform frame synchronization calibration according to the calculated frame synchronization time difference between cameras, insert frames or drop frames in the image sequence of each camera, and eliminate frame differences.
[0102] This specific implementation also provides a storage medium on which a computer program is stored. When the program is executed by a processor, it is the processing method for synchronizing multiple camera frames as described above.
[0103] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0104] Hereinafter, the embodiments of the present application will be described. The embodiments described below are exemplary and are only used to explain the present application, and should not be construed as limiting the present application. If no specific techniques or conditions are indicated in the embodiments, the techniques or conditions described in the literature in this area or the product specifications are used. If the manufacturer is not indicated in the reagents or instruments used, they are all conventional products that can be obtained commercially.
[0105] It should be noted that, in the present invention, the Hungarian algorithm is an algorithm proposed by American mathematician Harold W. Kuhn in 1955.
[0106] Example 1
[0107] Combination Figure 1 This embodiment proposes a method for processing multiple camera frame synchronization, comprising the following steps:
[0108] S1, stitching multiple camera images that need to be frame synchronized into a panoramic picture;
[0109] S2, using the neural network YOLO to extract the target frame, and then using the neural network CNN to extract features from the target frame image, obtaining the feature vector and position of the rigid body that identifies the movement in the panoramic image at time t, and calculating the speed of the rigid body movement;
[0110] The speed of the rigid body motion is calculated by the following steps:
[0111] Identify the moving rigid body feature vector O in the panoramic image at time t t With position P t (x t ,y t );According to the position P of the target at time t-1 t-1 (x t-1 ,y t-1 ) and the position P at time t t (x t ,y t ) can predict the position P at time t+1 t ' +1 (x t ' +1 ,y t ' +1 ), the prediction method is:
[0112] x t ' +1 =xt '+(x t '-x t ' -1 )
[0113] y t ' +1 =y t '+(y t '-y t ' -1 )
[0114] At the same time, the speed of the rigid body motion is calculated as:
[0115] V x =(x t -x t-1 )÷Δt
[0116] V y =(y t -y t-1 )÷Δt;
[0117] in:
[0118] V x is the velocity of the rigid body in the x-axis direction;
[0119] V y is the velocity of the rigid body in the y-axis direction;
[0120] Δt is the time difference between the two frames before and after the image.
[0121] S3, after the rigid body moves between multiple frames of images, find the optimal matching cost matrix between the feature vector and the position obtained by the rigid body in step S2; the cost matrix is constructed by the following steps:
[0122] Suppose there are m new detection targets and n prediction targets, then the cost matrix is m×n dimensional, and each element is: C ij =λ×dist_P(P t ,P t ')+(1-λ)×dist_O(O t-1 ,O t );C ij is the element in the cost matrix, i and j represent the subscript of the matrix element;
[0123] λ is a weight parameter, which is adjusted according to the experimental value;
[0124] P t is the target position at time t;
[0125] P t 'Predicted target position at time t;
[0126] O t-1 is the target feature vector at time t-1;
[0127] O t is the target feature vector at time t;
[0128] dist_P is used to calculate the Euclidean distance between the current model detection position and the predicted position, and dist_O is used to calculate the inner product of the rigid body feature vector detected by the model between frames; the optimal matching cost matrix is obtained by the Hungarian algorithm;
[0129] S4. Based on the optimal matching result obtained in step S3, the actual position and predicted position of the detection target are calculated to obtain the deviation position between the predicted position value and the actual position. The frame synchronization time difference between the cameras is obtained from the deviation position and the speed calculated in step S2:
[0130] T x =(x t -x t ')÷V x
[0131] T y =(y t -y t ')÷V y
[0132] Take T=(T x +T y )÷2;
[0133] in:
[0134] x t is the x-axis coordinate of the target at time t;
[0135] x t ' is the predicted value of the x-axis coordinate of the target at time t;
[0136] y t is the y-axis coordinate of the target at time t;
[0137] y' t The predicted value of the target's coordinate in the y-axis direction at time t;
[0138] T x The time difference between the actual value and the predicted value of the target in the x-axis direction of the image;
[0139] T y The time difference between the actual value and the predicted value of the target in the y-axis direction of the image;
[0140] S5, performing frame synchronization calibration according to the frame synchronization time difference between the cameras calculated in step S4, inserting frames or dropping frames in the image sequence of each camera to eliminate frame differences;
[0141] Taking the camera that images the rigid body before it moves as the benchmark, assuming the camera frame rate is fps, when the frame synchronization time difference between cameras T>=0, it is necessary to insert frames for the camera that images the rigid body after it moves, and the number of inserted frames is:
[0142] N=|T×fps|
[0143] When T<0, the moving imaging camera needs to drop frames, and the number of dropped frames is:
[0144] N = |T×fps|.
[0145] This embodiment further provides a processing device for synchronizing frames of multiple cameras, including:
[0146] A stitching unit, used to stitch multiple camera images that need to be frame synchronized into a panoramic picture;
[0147] An extraction unit is used to perform feature extraction, obtain the feature vector and position of the rigid body that is identified to be moving in the panoramic image at time t, and calculate the speed of the rigid body movement;
[0148] The matching unit is used to find the optimal matching cost matrix between the rigid body and the position after the rigid body moves between multiple frames of images;
[0149] The calculation unit calculates the actual position and the predicted position of the detection target based on the obtained optimal matching result; obtains the deviation position between the predicted position value and the actual position, and obtains the frame synchronization time difference between the cameras from the deviation position and the calculated speed;
[0150] The frame synchronization calibration unit is used to perform frame synchronization calibration according to the calculated frame synchronization time difference between cameras, insert frames or drop frames in the image sequence of each camera, and eliminate frame differences.
[0151] In addition, this embodiment further provides a storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned processing method for synchronizing multiple camera frames is implemented.
[0152] In the present invention, reference is made to “some embodiments”, “this embodiment”, examples, etc., which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0153] In this embodiment, the term "and / or" is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, object A and / or object B may represent three situations: object A exists alone, object A and object B exist at the same time, and object B exists alone.
[0154] The specific implementation of the present invention described above does not constitute a limitation on the protection scope of the present invention. Any other corresponding changes and modifications made based on the technical concept of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A method for processing multiple camera frame synchronization, characterized in that: The following steps are involved: S1, stitching multiple camera images that need to be frame synchronized into a panoramic picture; S2, performing feature extraction, obtaining the feature vector and position of the rigid body that is identified to be moving in the panoramic image at time t, and calculating the speed of the rigid body movement; S3, after the rigid body moves between multiple frames of images, find the optimal matching cost matrix between the feature vector and the position obtained by the rigid body in step S2; S4. Based on the optimal matching result obtained in step S3, the actual position and predicted position of the detection target are calculated to obtain the deviation position between the predicted position value and the actual position. The frame synchronization time difference between the cameras is obtained from the deviation position and the speed calculated in step S2: T x =(x t -x t ')÷V x T y (and t -and t ')÷V y Take T=(T x +T y )÷2; in: x t is the x-axis coordinate of the target at time t; x t ' is the predicted value of the x-axis coordinate of the target at time t; y t is the y-axis coordinate of the target at time t; y' t The predicted value of the target's coordinate in the y-axis direction at time t; T x The time difference between the actual value and the predicted value of the target in the x-axis direction of the image; T y The time difference between the actual value and the predicted value of the target in the y-axis direction of the image; S5. Perform frame synchronization calibration according to the frame synchronization time difference between the cameras calculated in step S4, insert frames or drop frames in the image sequence of each camera to eliminate frame differences.
2. The method for processing multiple camera frame synchronization according to claim 1, characterized in that: In step S2, the speed of the rigid body motion is calculated by the following steps: Identify the moving rigid body feature vector O in the panoramic image at time t t With position P t (x t ,y t ); According to the target position P at time t-1 t-1 (x t-1 ,y t-1 ) and the position P at time t t (x t ,y t ) can predict the position P at time t+1 t ' +1 (x t ' +1 ,y t ' +1 ), the prediction method is: x t ' +1 =x t '+(x t '-x t ' -1 ) and t ' +1 =and t '+(and t '-and t ' -1 ) At the same time, the speed of the rigid body motion is calculated as: V x =(x t -x t-1 )÷Δt V y (and t -and t-1 )÷Δt; in: V x is the velocity of the rigid body in the x-axis direction; V y is the velocity of the rigid body in the y-axis direction; Δt is the time difference between the two frames before and after the image.
3. The method for processing multiple camera frame synchronization according to claim 1, characterized in that: In step S2, the neural network YOLO is used to extract the target frame, and then the neural network CNN is used to extract features from the target frame image.
4. The method for processing multiple camera frame synchronization according to claim 1, characterized in that: In step S3, the cost matrix is constructed by the following steps: Suppose there are m new detection targets and n prediction targets, then the cost matrix is m×n dimensional, and each element is: C ij =λ×dist_P(P t ,P t ')+(1-λ)×dist_O(O t-1 ,O t ); in: C ij is the element in the cost matrix, i and j represent the subscript of the matrix element; λ is a weight parameter, which is adjusted according to the experimental value; P t is the target position at time t; P t 'Predicted target position at time t; O t-1 is the target feature vector at time t-1; O t is the target feature vector at time t; dist_P is the Euclidean distance between the current model detection position and the predicted position; dist_O is used to calculate the inner product of the rigid body feature vector detected by the inter-frame model.
5. The method for processing multiple camera frame synchronization according to claim 1, characterized in that: In step S3, the optimal matching cost matrix is obtained by using the Hungarian algorithm.
6. The method for processing multiple camera frame synchronization according to claim 1, characterized in that: In step S5, the camera for imaging before the rigid body moves is taken as a reference, and the camera frame rate is set to fps. When the frame synchronization time difference between cameras T>=0, it is necessary to insert frames for the camera for imaging after the movement, and the number of inserted frames is: N=|T×fps| When T<0, the moving imaging camera needs to drop frames, and the number of dropped frames is: N = |T×fps|.
7. A processing device for synchronizing frames of multiple cameras, characterized in that: include: A stitching unit, used to stitch multiple camera images that need to be frame synchronized into a panoramic picture; An extraction unit is used to perform feature extraction, obtain the feature vector and position of the rigid body that is identified to be moving in the panoramic image at time t, and calculate the speed of the rigid body movement; The matching unit is used to find the optimal matching cost matrix between the rigid body and the position after the rigid body moves between multiple frames of images; A calculation unit calculates the actual position and predicted position of the detection target based on the obtained optimal matching result; The deviation position between the predicted position value and the actual position is obtained, and the frame synchronization time difference between the cameras is obtained from the deviation position and the calculated speed; The frame synchronization calibration unit is used to perform frame synchronization calibration according to the calculated frame synchronization time difference between cameras, insert frames or drop frames in the image sequence of each camera, and eliminate frame differences.
8. A storage medium, characterized in that: A computer program is stored thereon, and when the program is executed by a processor, the processing method for synchronizing multiple camera frames as claimed in any one of claims 1 to 6 is implemented.
