Video splicing method and device

By performing feature matching and target recognition on binocular video frames, the stitching lines are dynamically updated, which solves the quality problems caused by moving objects in video stitching in the existing technology, and improves the stitching quality and real-time performance.

CN118446888BActive Publication Date: 2024-10-11GUANGDONG UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410903300.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-08
Publication Date
2024-10-11
Estimated Expiration
2044-07-08

AI Technical Summary

Technical Problem

Existing video stitching methods will cause problems such as target misalignment, ghosting, and artifacts when moving objects pass through the stitching line, resulting in poor video stitching quality.

Method used

The preset image feature extraction algorithm and deep learning neural network are used to perform feature matching and target recognition on binocular video frames, and the stitching lines are updated through dynamic programming algorithms to ensure the accuracy and stability of image fusion.

Benefits of technology

It reduces ghosting and artifact problems caused by moving objects passing through the stitching line, and improves the quality and real-time performance of video stitching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118446888B_ABST
    Figure CN118446888B_ABST
Patent Text Reader

Abstract

The invention discloses a video stitching method and device, comprising obtaining a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image; performing feature extraction and matching on the left-eye video frame image and the corresponding right-eye video frame image to determine image camera parameters; performing AND operation on the left-eye video frame image and the corresponding right-eye video frame image to generate a fused image; performing target recognition on the fused image, outputting a marked target and a rectangular detection frame corresponding to the fused image, and judging whether the marked target overlaps with a stitching line in the fused image; if so, updating the stitching line to determine a target stitching line; performing image fusion on the left-eye video frame image and the corresponding right-eye video frame image using the target stitching line, and outputting a target stitching video frame; the technical problem that the existing video stitching method may cause target dislocation, ghosting, artifacts, etc. in the overlapping area of ​​the stitching image, resulting in poor video stitching quality is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a video splicing method and device. Background Art

[0002] Video stitching is essentially the use of image stitching technology to stitch each frame of the video. Image stitching technology is a technology that spatially aligns a group of overlapping images, resamples and fuses them to form a new, complete, high-definition image of a wide-angle scene that contains the information of each image sequence.

[0003] Image stitching is an important research direction in the field of digital image processing. It has a wide range of application values ​​in the fields of photogrammetry, computer vision, remote sensing image analysis, computer graphics, etc. It is also an important research topic in the fields of virtual reality, computer vision, computer graphics and image processing. It has a wide range of applications in the fields of space exploration, seabed survey, medicine, meteorology, geological survey, military, video compression and transmission, video indexing and retrieval, 3D reconstruction of objects, military reconnaissance and public security evidence collection, and super-resolution processing of digital cameras. Therefore, the research on image stitching technology has a good application prospect and practical application value.

[0004] Most of the existing video stitching methods define an intensity function, continuously iterate the sum of the minimum intensity values ​​according to the rows of image pixels, and trace back the stitching line to find the minimum stitching line of the current frame. In video stitching, the stitching line found in a certain frame is used as the stitching line of all video frames and is no longer updated. However, when a moving object passes through the stitching line, problems such as target misalignment, ghosting, and artifacts will appear in the overlapping areas of the stitched image, resulting in poor video stitching quality. Summary of the invention

[0005] The present invention provides a video stitching method and device, which are used to solve the technical problem that the existing video stitching method may cause target misalignment, ghosting, artifacts and other problems in the overlapping area of ​​the stitched image, resulting in poor video stitching quality.

[0006] A first aspect of the present invention provides a video stitching method, comprising:

[0007] Acquire a binocular video frame, wherein the binocular video frame includes a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image;

[0008] Using a preset image feature extraction algorithm to perform feature extraction and matching on the left-eye video frame image and the corresponding right-eye video frame image to determine image camera parameters;

[0009] Performing an AND operation on the left-eye video frame image and the corresponding right-eye video frame image using the image camera parameters to generate a fused image;

[0010] Performing target recognition on the fused image through a preset deep learning neural network, outputting a marked target and a rectangular detection frame corresponding to the fused image, and determining whether the marked target overlaps with a seam line in the fused image;

[0011] If so, using a preset dynamic programming algorithm to update the seam line according to the overlapping area in the fused image and the rectangular detection frame to determine the target seam line;

[0012] The target stitching line is used to perform image fusion on the left-eye video frame image and the corresponding right-eye video frame image, and a target stitching video frame is output.

[0013] Optionally, the image camera parameters include a homography matrix and internal and external parameters of a binocular camera; the step of using a preset image feature extraction algorithm to perform feature extraction and matching on the left-eye video frame image and the corresponding right-eye video frame image to determine the image camera parameters includes:

[0014] The preset image feature extraction algorithm is used to extract feature points of the left-eye video frame image and the corresponding right-eye video frame image, and a plurality of left-eye image feature points and a plurality of right-eye image feature points are output;

[0015] Performing feature matching on each of the left-eye image feature points and each of the right-eye image feature points, outputting a plurality of feature point correspondences, and constructing a homography matrix according to the feature point correspondences;

[0016] The corresponding relationship between the feature points and the homography matrix are used to calculate the internal and external parameters of the binocular camera.

[0017] Optionally, the step of performing an AND operation on the left-eye video frame image and the corresponding right-eye video frame image using the image camera parameters to generate a fused image includes:

[0018] Based on the internal and external parameters of the binocular camera, a preset image transformation model is used to perform image transformation on the left-eye video frame image and the corresponding right-eye video frame image, and a left-eye transformed image and a right-eye transformed image are output;

[0019] Using the internal and external parameters of the binocular camera to perform image correction compensation on the left-eye transformed image and the right-eye transformed image, respectively, to determine a left-eye corrected image and a right-eye corrected image;

[0020] The left-eye correction image and the right-eye correction image are ANDed by using the homography matrix and the internal and external parameters of the binocular camera to generate a fused image.

[0021] Optionally, the step of updating the seam line according to the overlapping area in the fused image and the rectangular detection frame using a preset dynamic programming algorithm to determine the target seam line includes:

[0022] Determine the center of gravity based on the target pixel points in the rectangular detection frame;

[0023] Substituting the plurality of regional pixel points and the centroid position in the overlapping area into a preset weight value calculation formula to calculate the weight value corresponding to each of the regional pixel points;

[0024] Performing a sum operation on each of the weight values ​​to determine a weight sum;

[0025] Calculate the intensity value corresponding to each pixel point in the region by using the weight sum, the gray value difference of each pixel point in the overlapping region and a preset Sobel operator;

[0026] The target seam line is determined according to the intensity values ​​corresponding to the pixel points in each region.

[0027] Optionally, the center of gravity position includes a horizontal axis center of gravity position and a vertical axis center of gravity position; the preset weight value calculation formula is specifically:

[0028] ;

[0029] in, is the normal model distribution value; for; is the width of the rectangular detection box; is the height of the rectangular detection frame; x is the horizontal coordinate of the pixel point in the area; x G is the horizontal axis center position; y is the vertical coordinate of the regional pixel point; y G is the position of the center of gravity of the longitudinal axis; is the overlapping area; is the minimum value of the normal model distribution; is the maximum value of the normal model distribution; for; is the weight value.

[0030] Optionally, the preset Sobel operator includes a Sobel operator in the horizontal axis direction and a Sobel operator in the vertical axis direction; the calculation formula of the intensity value is specifically:

[0031] ;

[0032] in, is the intensity value of the pixel point in the region; is the weight and value; is the gray value difference of the regional pixels in the overlapping area; is the structural value difference; is the Sobel operator in the horizontal direction; Transform the image for the left eye; Transform the image for the right eye; is the Sobel operator in the vertical direction.

[0033] A second aspect of the present invention provides a video splicing device, comprising:

[0034] An acquisition module, used for acquiring a binocular video frame, wherein the binocular video frame includes a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image;

[0035] An extraction and matching module is used to perform feature extraction and matching on the left-eye video frame image and the corresponding right-eye video frame image using a preset image feature extraction algorithm to determine image camera parameters;

[0036] An AND operation module, used for performing an AND operation on the left-eye video frame image and the corresponding right-eye video frame image using the image camera parameters to generate a fused image;

[0037] A judgment module, used to perform target recognition on the fused image through a preset deep learning neural network, output a marked target and a rectangular detection frame corresponding to the fused image, and judge whether the marked target overlaps with a seam line in the fused image;

[0038] An updating module, for, if yes, updating the seam line according to the overlapping area in the fused image and the rectangular detection frame using a preset dynamic programming algorithm to determine a target seam line;

[0039] A fusion module is used to use the target stitching line to perform image fusion on the left-eye video frame image and the corresponding right-eye video frame image, and output a target stitching video frame.

[0040] A third aspect of the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the video stitching method as described in any one of the above items.

[0041] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program / instruction stored thereon, wherein the computer program / instruction, when executed by a processor, implements the steps of the video stitching method as described in any one of the above items.

[0042] A fifth aspect of the present invention provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of any of the above-mentioned video stitching methods.

[0043] It can be seen from the above technical solutions that the present invention has the following advantages:

[0044] The above technical scheme of the present invention provides a video stitching method, firstly, a binocular video frame is obtained, the binocular video frame includes a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image; then, a preset image feature extraction algorithm is used to perform feature extraction and matching on the left-eye video frame image and the corresponding right-eye video frame image to determine the image camera parameters; the image camera parameters are used to perform an AND operation on the left-eye video frame image and the corresponding right-eye video frame image to generate a fused image; the fused image is subjected to target recognition through a preset deep learning neural network, and a marked target and a rectangular detection frame corresponding to the fused image are output, and it is determined whether the marked target overlaps with the stitching line in the fused image; if so, a detection frame is detected by using a preset deep learning neural network. A preset dynamic programming algorithm is used to update the stitching line according to the overlapping area and the rectangular detection frame in the fused image, and the target stitching line is determined. Finally, the target stitching line is used to fuse the left-eye video frame image and the corresponding right-eye video frame image, and the target stitching video frame is output. Based on the above scheme, the preset dynamic programming algorithm is used to update the stitching line according to the overlapping area and the rectangular detection frame in the fused image, the target stitching line is determined, and the left-eye video frame image and the corresponding right-eye video frame image are fused, and the process of outputting the target stitching video frame can reduce the problems of ghosting and artifacts caused by moving objects passing through the stitching line in video stitching, and further improve the quality of video stitching. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0046] Figure 1 A flowchart of a video splicing method provided by an embodiment of the present invention;

[0047] Figure 2 A schematic diagram of weight values ​​of regional pixel points provided by an embodiment of the present invention;

[0048] Figure 3 A schematic diagram of a seam line searched using a preset dynamic programming algorithm provided by an embodiment of the present invention;

[0049] Figure 4 A flowchart of another video stitching method provided by an embodiment of the present invention;

[0050] Figure 5A schematic diagram of a flow chart of a video stitching method provided by an embodiment of the present invention;

[0051] Figure 6 A structural block diagram of a video splicing device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0052] The embodiments of the present invention provide a video stitching method and device, which are used to solve the technical problem that the existing video stitching method may cause target misalignment, ghosting, artifacts and other problems in the overlapping area of ​​the stitched image, resulting in poor video stitching quality.

[0053] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] See also Figure 1 , Figure 1 A flowchart of the steps of a video stitching method provided by an embodiment of the present invention.

[0055] The present invention provides a video splicing method, comprising:

[0056] Step 101: Acquire a binocular video frame, where the binocular video frame includes a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image.

[0057] It should be noted that after the video to be spliced ​​is captured by the binocular camera, the video frame sequence of the binocular camera is read, and each video frame image in the video frame sequence of the binocular camera is spliced ​​left and right, so as to complete the splicing of the video. The video frame includes a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image. The video frame sequence of the left camera is recorded as [L0, L1, L2 ... L n ...], the video frame sequence of the right camera is recorded as [R0,R1,R2 ...R n ...], the initial left-eye video frame image L0 and the initial right-eye video frame image R0 require that the image noise of the scene is as small as possible and that no object moves relative to the scene, where L0 is the initial left-eye video frame image, L1 is the first left-eye video frame image, L2 is the second left-eye video frame image, and L n is the nth left-eye video frame image, R0 is the initial right-eye video frame image, R1 is the first right-eye video frame image, R2 is the second right-eye video frame image, and R nis the nth right-eye video frame image.

[0058] In this embodiment, a binocular video frame is acquired, and the binocular video frame includes a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image.

[0059] Step 102: Use a preset image feature extraction algorithm to perform feature extraction and matching on the left-eye video frame image and the corresponding right-eye video frame image to determine image camera parameters.

[0060] Image camera parameters include homography matrix and stereo camera internal and external parameters.

[0061] The preset image feature extraction algorithms are ORB (Oriented FAST and Rotated BRIEF), AKAZE (accelerated-KAZE), SIFT (Scale-Invariant Feature Transform), or SURF (Speeded UpRobust Features).

[0062] Specifically, a preset image feature extraction algorithm is used to extract feature points of a left-eye video frame image and a corresponding right-eye video frame image, and a plurality of left-eye image feature points and a plurality of right-eye image feature points are output; feature matching is performed on each left-eye image feature point and each right-eye image feature point, and a plurality of feature point correspondences are output, and a homography matrix is ​​constructed according to the correspondences of each feature point; the correspondences of each feature point and the homography matrix are used to calculate the internal and external parameters of the binocular camera, wherein the feature point correspondences include the correctly adapted feature point pairs.

[0063] In this embodiment, a preset image feature extraction algorithm is used to perform feature extraction and matching on the left-eye video frame image and the corresponding right-eye video frame image to determine the image camera parameters.

[0064] Step 103: Perform an AND operation on the left-eye video frame image and the corresponding right-eye video frame image using the image camera parameters to generate a fused image.

[0065] Specifically, based on the internal and external parameters of the binocular camera, a preset image transformation model is used to perform image transformation on a left-eye video frame image and a corresponding right-eye video frame image, and a left-eye transformed image and a right-eye transformed image are output; the internal and external parameters of the binocular camera are used to perform image correction compensation on the left-eye transformed image and the right-eye transformed image, and a left-eye corrected image and a right-eye corrected image are determined; and an AND operation is performed on the left-eye corrected image and the right-eye corrected image through a homography matrix and the internal and external parameters of the binocular camera to generate a fused image; wherein the preset image transformation model is an image transformation model such as a plane projection transformation model, a cylindrical projection transformation model or a spherical projection transformation model.

[0066] Furthermore, according to the homography matrix and the internal and external parameters of the binocular camera, an AND operation is performed on the left video frame image and the right video frame image corresponding to the left video frame image to obtain a fused image, which includes the overlapping area D and the stitching line of the stitched image.

[0067] In this embodiment, an AND operation is performed on a left-eye video frame image and a corresponding right-eye video frame image using image camera parameters to generate a fused image.

[0068] Step 104: Perform target recognition on the fused image through a preset deep learning neural network, output a marked target and a rectangular detection frame corresponding to the fused image, and determine whether the marked target overlaps with the seam line in the fused image.

[0069] It should be noted that the fused image is subjected to target recognition through a preset deep learning neural network, and the marked target and rectangular detection frame corresponding to the fused image are output, and it is determined whether the marked target overlaps with the seam line in the fused image. If the marked target does not overlap with the seam line in the fused image, the fused image is used as the final target stitching video frame, and the above operation is repeated for the remaining binocular video frames, thereby completing the stitching operation of the video frame sequence of the left camera and the video frame sequence of the right camera, and obtaining the final stitched video; wherein, the preset deep learning neural network can be an existing deep learning neural network, which can recognize the moving target (marked target) in the image and output the corresponding detection frame, and the present invention is not limited to this.

[0070] In this embodiment, target recognition is performed on the fused image through a preset deep learning neural network, a marked target and a rectangular detection frame corresponding to the fused image are output, and it is determined whether the marked target overlaps with the seam line in the fused image.

[0071] Step 105: If yes, a preset dynamic programming algorithm is used to update the seam line according to the overlapping area and the rectangular detection frame in the fused image to determine the target seam line.

[0072] It should be noted that, at time m when the object (marked target) marked by target recognition enters the overlapping area D, if the seam line overlaps with the marked object (marked target), the seam line of the spliced ​​image of the left-eye video frame image and the corresponding right-eye video frame image is updated, that is, if the marked target overlaps with the seam line in the fused image, the dynamic programming algorithm is used to find the best seam line, and the image fusion is performed according to the best seam line.

[0073] Furthermore, the geometric moment is invariant to rotation, translation, and scale, so the center of gravity of the target contour in the overlapping area D is calculated using the geometric moment. Specifically, based on the target pixel points in the rectangular detection frame, the center of gravity position G (x G , yG ), where the center of gravity position includes the horizontal axis center of gravity position x G and the longitudinal center of gravity position y G , the calculation process of the center of gravity position is as follows:

[0074]

[0075] in, is the position of the center of gravity of the horizontal axis; is the center of gravity position of the longitudinal axis; is the first-order x moment of the grayscale image; is the zero-order moment of the grayscale image; is the first-order y moment of the grayscale image; is the spatial moment; The gray value of the point (x, y) in the rectangular box of target detection, that is, the gray value of the target pixel point (x, y) in the rectangular detection box; is the horizontal coordinate of the target pixel point in the rectangular detection box; is the ordinate of the target pixel in the rectangular detection box, i and j are both non-negative integers, indicating the order of the moment.

[0076] For further information, see Figure 2 , assuming that the width of the target detection rectangle is a and the height is b, according to the two-dimensional normal distribution model, that is, according to the normal distribution model, and in order to make the weight W fall on the interval [1,u], combined with the weight calculation expression, a preset weight value calculation formula is constructed to calculate the weight W. Specifically, the multiple regional pixel points and the center of gravity positions in the overlapping area are respectively substituted into the preset weight value calculation formula to calculate the weight value corresponding to the pixel points in each area; wherein, the u value is determined according to the attributes of the overlapping area D, which can be the average intensity value or the average gradient value of the overlapping area D, such as Figure 2 As shown, according to the above preset weight value calculation formula and u value, the value of each pixel in the area is obtained, and the preset weight value calculation formula is specifically:

[0077] ;

[0078] in, is the normal model distribution value; is the normal distribution function; is the width of the rectangular detection box; is the height of the rectangular detection frame; x is the horizontal coordinate of the pixel point in the area; x G is the horizontal axis center position; y is the vertical coordinate of the regional pixel point; y G is the position of the center of gravity of the longitudinal axis; is the overlapping area; is the minimum value of the normal model distribution; is the maximum value of the normal model distribution; is the average intensity value of the overlapping area D, which is a hyperparameter that can be set independently and can be adjusted according to the application scenario. It can also be expressed as the average gradient value of the overlapping area D; is the weight value.

[0079] Furthermore, each weight value is summed to determine the weight sum; the weight sum, the gray value difference of each pixel point in the overlapping area and the preset Sobel operator are used to calculate the intensity value corresponding to the pixel point in each area; wherein the calculation formula of the intensity value is specifically:

[0080] ;

[0081] in, is the intensity value of the pixel point in the region; is the weight and value; is the gray value difference of the regional pixels in the overlapping area; is the structural value difference; is the Sobel operator in the horizontal direction; Transform the image for the left eye; Transform the image for the right eye; is the Sobel operator in the vertical direction.

[0082] Furthermore, the target stitching line is determined according to the intensity values ​​corresponding to the pixel points in each area; specifically, the minimum energy path is calculated using the dynamic programming method: one is selected from multiple seams to connect a single pixel, and for each pixel, a selection is made from the pixels that can be connected in the previous row, and each pixel in the first row of the overlapping area is used as the initial path starting point of the minimum intensity value; each row is traversed in turn to obtain the position of the path source of the minimum intensity value sum, which is the upper left, directly above or upper right of the current pixel; the vector of the sum of the minimum intensity values ​​of each row and column is recorded during the traversal, as well as the position of the path source to each row and column. The stitching line is traced back from the last row through the source position matrix recorded in the above steps, and the optimal stitching line is finally obtained.

[0083] For example, see Figure 3 , the value in the square is the intensity value, and the value under the square is the sum of the accumulated intensity values. Assuming that there are twenty regional pixels in the overlapping area, these twenty regional pixels form a matrix of four rows and five columns. After calculating the intensity values ​​corresponding to these twenty regional pixels according to the above steps, that is, Figure 3For example, the intensity values ​​of the regional pixels in the first row of the overlapping area from left to right are 9, 9, 0, 9, 9, and so on for the remaining three rows. After assigning an intensity value to each regional pixel, use each regional pixel in the first row as the starting point of the initial path with the minimum intensity value, and connect with the regional pixels that can be connected in the second row according to the lower left, directly below or lower right of each regional pixel in the first row to form a forward connection path between the first row and the second row. When the regional pixels in the first row are connected to the regional pixels in the second row, the sum of the intensity values ​​after connecting with the regional pixels in the first row is recorded below the box of the regional pixels in the second row. For example, the sum of the intensity values ​​of the regional pixels in the first column of the second row is 18, which comes from the regional pixels in the first column of the second row. After connecting with the regional pixel points in the first row and the first column, the sum of the intensity values ​​of the two is recorded according to the above steps. The sum of the intensity values ​​of the remaining regional pixel points is traced back in the fifth row, that is, the last row. The sum of the intensity values ​​of the regional pixel points in the last row is traversed, and the regional pixel point with the smallest sum of intensity values ​​is selected as the starting point. According to the reverse path of the regional pixel point corresponding to the smallest sum of intensity values, that is, according to the upper left, directly above or upper right of the regional pixel point, it is connected with the regional pixel point with the smallest sum of intensity values ​​that can be connected in the fourth row (previous row) to form a reverse connection path. When reversely connected to the first row, the regional pixel point with the smallest connectable intensity value in the first row is selected for connection, thereby obtaining the best seam line (target seam line).

[0084] In this embodiment, if yes, a preset dynamic programming algorithm is used to update the seam line according to the overlapping area and the rectangular detection frame in the fused image to determine the target seam line.

[0085] Step 106: Use the target stitching line to perform image fusion on the left-eye video frame image and the corresponding right-eye video frame image, and output a target stitching video frame.

[0086] In this embodiment, a target stitching line is used to perform image fusion on a left-eye video frame image and a corresponding right-eye video frame image, and a target stitching video frame is output.

[0087] In an embodiment of the present invention, the present invention provides a video stitching method, firstly obtaining a binocular video frame, the binocular video frame including a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image; then, using a preset image feature extraction algorithm to perform feature extraction and matching on the left-eye video frame image and the corresponding right-eye video frame image, and determining image camera parameters; using the image camera parameters to perform an AND operation on the left-eye video frame image and the corresponding right-eye video frame image, and generating a fused image; using a preset deep learning neural network to perform target recognition on the fused image, outputting a marked target and a rectangular detection frame corresponding to the fused image, and judging whether the marked target overlaps with a stitching line in the fused image; if so, A preset dynamic programming algorithm is used to update the stitching line according to the overlapping area and the rectangular detection frame in the fused image, and the target stitching line is determined. Finally, the left-eye video frame image and the corresponding right-eye video frame image are fused using the target stitching line to output the target stitching video frame. Based on the above scheme, a preset dynamic programming algorithm is used to update the stitching line according to the overlapping area and the rectangular detection frame in the fused image, and the target stitching line is determined, and the left-eye video frame image and the corresponding right-eye video frame image are fused to output the target stitching video frame. This process can reduce the problems of ghosting and artifacts caused by moving objects passing through the stitching line in video stitching, thereby further improving the quality of video stitching.

[0088] See also Figure 4 , Figure 4 A flowchart of another video stitching method provided by an embodiment of the present invention.

[0089] The present invention provides a video splicing method, comprising:

[0090] Step 401: Acquire a binocular video frame, where the binocular video frame includes a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image.

[0091] It should be noted that after the video to be stitched is captured by the binocular camera, the video frame sequence of the binocular camera is read, and each video frame image in the video frame sequence of the binocular camera is stitched left and right, thereby completing the splicing of the video, and the video frame includes a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image.

[0092] In this embodiment, a binocular video frame is acquired, and the binocular video frame includes a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image.

[0093] Step 402: Use a preset image feature extraction algorithm to extract feature points from a left-eye video frame image and a corresponding right-eye video frame image, and output a plurality of left-eye image feature points and a plurality of right-eye image feature points.

[0094] It should be noted that a preset image feature extraction algorithm, i.e., ORB, AKAZE, SIFT or SURF algorithm is used to extract image features of the left-eye video frame image and the right-eye video frame image corresponding to the left-eye video frame image, and feature matching is performed to obtain the correspondence of feature points and calculate the homography matrix.

[0095] In this embodiment, a preset image feature extraction algorithm is used to extract feature points from a left-eye video frame image and a corresponding right-eye video frame image, respectively, and a plurality of left-eye image feature points and a plurality of right-eye image feature points are output.

[0096] Step 403: perform feature matching on each feature point of the left eye image and each feature point of the right eye image, output a plurality of feature point correspondences, and construct a homography matrix according to the feature point correspondences.

[0097] In this embodiment, feature matching is performed on each feature point of the left eye image and each feature point of the right eye image, a plurality of feature point correspondences are output, and a homography matrix is ​​constructed according to the correspondences of the feature points.

[0098] Step 404: Calculate the internal and external parameters of the binocular camera using the correspondence between the feature points and the homography matrix.

[0099] The internal and external parameters of the stereo camera include internal parameters (camera matrix K) and external parameters (rotation matrix R).

[0100] It should be noted that, according to the correspondence between feature points and the homography matrix, the estimation of the camera's intrinsic parameters (camera matrix K) and extrinsic parameters (rotation matrix R) may refer to the existing process of estimating the camera's intrinsic and extrinsic parameters, and the present invention is not limited thereto.

[0101] In this embodiment, the correspondence relationship between the feature points and the homography matrix are used to calculate the internal and external parameters of the binocular camera.

[0102] Step 405: Perform an AND operation on the left-eye video frame image and the corresponding right-eye video frame image using the image camera parameters to generate a fused image.

[0103] Further, step 405 may include the following sub-steps:

[0104] S51, based on the internal and external parameters of the binocular camera, using a preset image transformation model to perform image transformation on the left-eye video frame image and the corresponding right-eye video frame image, and output a left-eye transformed image and a right-eye transformed image;

[0105] S52, using the internal and external parameters of the binocular camera to perform image correction compensation on the left eye transformation image and the right eye transformation image, respectively, to determine the left eye correction image and the right eye correction image;

[0106] S53, performing an AND operation on the left-eye correction image and the right-eye correction image through the homography matrix and the internal and external parameters of the binocular camera to generate a fused image.

[0107] It should be noted that according to the internal and external parameters of the binocular camera, the specified transformation model, that is, the preset image transformation model (such as plane projection, cylindrical projection, spherical projection, etc.) is used to transform the left-eye video frame image and the corresponding right-eye video frame image, and then the transformed image is corrected and exposure compensated according to the estimated internal and external parameters of the binocular camera to reduce problems such as perspective distortion and exposure inconsistency caused by stitching.

[0108] In this embodiment, an AND operation is performed on a left-eye video frame image and a corresponding right-eye video frame image using image camera parameters to generate a fused image.

[0109] Step 406: Perform target recognition on the fused image through a preset deep learning neural network, output a marked target and a rectangular detection frame corresponding to the fused image, and determine whether the marked target overlaps with the seam line in the fused image.

[0110] It should be noted that target recognition and target tracking are performed on the fused image, moving targets are marked, marked targets are obtained, and corresponding rectangular detection frames are output.

[0111] In this embodiment, target recognition is performed on the fused image through a preset deep learning neural network, a marked target and a rectangular detection frame corresponding to the fused image are output, and it is determined whether the marked target overlaps with the seam line in the fused image.

[0112] Step 407: If yes, use a preset dynamic programming algorithm to update the seam line according to the overlapping area and the rectangular detection frame in the fused image to determine the target seam line.

[0113] Further, step 407 may include the following sub-steps:

[0114] S71, determining the center of gravity position based on the target pixel points in the rectangular detection frame;

[0115] S72, substituting the multiple regional pixel points and the centroid positions in the overlapping area into the preset weight value calculation formula to calculate the weight value corresponding to each regional pixel point;

[0116] S73, performing a sum operation on each weight value to determine the weight sum;

[0117] S74, using the weighted sum, the grayscale value difference of the pixels in each area in the overlapping area and a preset Sobel operator to calculate the intensity value corresponding to the pixel points in each area;

[0118] S75. Determine the target stitching line according to the intensity values ​​corresponding to the pixel points in each area.

[0119] In this embodiment, if yes, a preset dynamic programming algorithm is used to update the seam line according to the overlapping area and the rectangular detection frame in the fused image to determine the target seam line.

[0120] Step 408: Use the target stitching line to perform image fusion on the left-eye video frame image and the corresponding right-eye video frame image, and output a target stitching video frame.

[0121] It should be noted that after the above steps are completed, the output image is used as the current video frame (target spliced ​​video frame), and the remaining binocular video frames [L1, L2 ... L n ...], [R1,R2 ...R n ...], repeat the above steps until the execution ends or an empty video frame is encountered, thus completing the video splicing.

[0122] In this embodiment, a target stitching line is used to perform image fusion on a left-eye video frame image and a corresponding right-eye video frame image, and a target stitching video frame is output.

[0123] For example, see Figure 5 , read the initial video frame, that is, obtain the initial left-eye video frame image and the right-eye video frame image corresponding to the left-eye video frame image, extract and match the image features based on the preset image feature extraction algorithm, output the image camera parameters, and use the image camera parameters to perform AND operations on the left-eye video frame image and the corresponding right-eye video frame image to generate a fused image; use the preset deep learning neural network to perform target recognition on the fused image, output the marked target and rectangular detection frame corresponding to the fused image, and determine whether the marked target overlaps with the stitching line in the fused image; if so, use the preset dynamic programming algorithm to update the stitching line according to the overlapping area and rectangular detection frame in the fused image, and determine the target stitching line. Finally, use the target stitching line to fuse the left-eye video frame image and the corresponding right-eye video frame image, output the target stitching video frame, and continue to repeat the above operations for the remaining video frames to output the stitched video.

[0124] As a comparison of technical effects, it can be combined with existing technologies for reference. The best seam line search is one of the steps of image fusion. Image registration or image stitching is generally difficult to completely align images. In order to improve the quality of registered or stitched images, a specific algorithm is used to find the seam lines of the images to be fused, so that the image fusion is more natural. At present, the methods for finding the best seam line include seam cutting, graph cutting, dynamic programming, etc. Recently, the best seam line search based on deep learning has emerged. At the same time, research on the best seam line search and update technology in video stitching is also ongoing. At present, in video stitching technology, by defining an intensity function, the sum of the minimum intensity values ​​is continuously iterated according to the rows of image pixels and the seam line is backtracked to find the minimum seam line of the current frame. In video stitching, the stitching line found in a certain frame is used as the stitching line of all video frames and is no longer updated, or the best stitching line is calculated separately for each frame. Therefore, in the scenario of using fixed dual cameras for video stitching and target tracking, when an object passes through the overlapping area captured by the two cameras, the object will have ghosting, artifacts, feature disappearance, distortion, etc., which affects the accuracy of target recognition and the quality of video stitching.

[0125] In view of the above problems, the present invention proposes a video stitching method, which realizes targeted stitching optimization by combining target position information and stitching line update; in the stitching line calculation step of image stitching, the target position information is obtained by using the target detection and tracking technology in deep learning, and the intensity value of each pixel in the overlapping area of ​​the stitched image is calculated, and the weight is set for the intensity value according to the above position information, and the dynamic programming method is used to find and update the optimal stitching line. This technology can guarantee the accuracy, continuity and stability of video stitching and target detection to a certain extent, and is adaptive, and can adjust and optimize parameters according to scene and target characteristics; it also reduces the problems of ghosting and artifacts caused by target movement through the stitching line in video stitching, improves the output video quality and ensures the real-time performance of video stitching.

[0126] In an embodiment of the present invention, the present invention provides a video stitching method, firstly obtaining a binocular video frame, the binocular video frame including a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image; then, using a preset image feature extraction algorithm to perform feature extraction and matching on the left-eye video frame image and the corresponding right-eye video frame image, and determining image camera parameters; using the image camera parameters to perform an AND operation on the left-eye video frame image and the corresponding right-eye video frame image, and generating a fused image; using a preset deep learning neural network to perform target recognition on the fused image, outputting a marked target and a rectangular detection frame corresponding to the fused image, and judging whether the marked target overlaps with a stitching line in the fused image; if so, A preset dynamic programming algorithm is used to update the stitching line according to the overlapping area and the rectangular detection frame in the fused image, and the target stitching line is determined. Finally, the left-eye video frame image and the corresponding right-eye video frame image are fused using the target stitching line to output the target stitching video frame. Based on the above scheme, a preset dynamic programming algorithm is used to update the stitching line according to the overlapping area and the rectangular detection frame in the fused image, and the target stitching line is determined, and the left-eye video frame image and the corresponding right-eye video frame image are fused to output the target stitching video frame. This process can reduce the problems of ghosting and artifacts caused by moving objects passing through the stitching line in video stitching, thereby further improving the quality of video stitching.

[0127] See also Figure 6 , Figure 6 A structural block diagram of a video splicing device provided by an embodiment of the present invention.

[0128] The present invention provides a video splicing device, comprising:

[0129] An acquisition module 601 is used to acquire a binocular video frame, where the binocular video frame includes a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image;

[0130] An extraction and matching module 602 is used to perform feature extraction and matching on a left-eye video frame image and a corresponding right-eye video frame image using a preset image feature extraction algorithm to determine image camera parameters;

[0131] An AND operation module 603 is used to perform an AND operation on the left-eye video frame image and the corresponding right-eye video frame image using image camera parameters to generate a fused image;

[0132] The judgment module 604 is used to perform target recognition on the fused image through a preset deep learning neural network, output a marked target and a rectangular detection frame corresponding to the fused image, and judge whether the marked target overlaps with a seam line in the fused image;

[0133] An updating module 605 is used to update the seam line according to the overlapping area and the rectangular detection frame in the fused image using a preset dynamic programming algorithm to determine the target seam line;

[0134] The fusion module 606 is used to perform image fusion on the left-eye video frame image and the corresponding right-eye video frame image using the target stitching line, and output a target stitching video frame.

[0135] Furthermore, the image camera parameters include homography matrix and internal and external parameters of the binocular camera; the extraction and matching module 602 is specifically used for:

[0136] A preset image feature extraction algorithm is used to extract feature points of a left-eye video frame image and a corresponding right-eye video frame image, and a plurality of left-eye image feature points and a plurality of right-eye image feature points are output;

[0137] Perform feature matching on the feature points of each left image and each right image, output the correspondence between multiple feature points, and construct a homography matrix based on the correspondence between the feature points;

[0138] The correspondence between feature points and the homography matrix are used to calculate the internal and external parameters of the binocular camera.

[0139] Furthermore, the AND operation module 603 is specifically used for:

[0140] Based on the internal and external parameters of the binocular camera, a preset image transformation model is used to transform the left video frame image and the corresponding right video frame image, and a left-eye transformed image and a right-eye transformed image are output;

[0141] The left eye transformation image and the right eye transformation image are respectively corrected and compensated by using the internal and external parameters of the binocular camera to determine the left eye correction image and the right eye correction image;

[0142] The left-eye correction image and the right-eye correction image are ANDed using the homography matrix and the internal and external parameters of the binocular camera to generate a fused image.

[0143] Furthermore, the update module 605 is specifically used for:

[0144] Determine the center of gravity based on the target pixel points in the rectangular detection frame;

[0145] Substitute the multiple regional pixel points and the centroid positions in the overlapping area into the preset weight value calculation formula to calculate the weight value corresponding to each regional pixel point;

[0146] Perform sum operation on each weight value to determine the weight sum;

[0147] The intensity value corresponding to the pixel point in each area is calculated by using the weighted sum, the gray value difference of the pixel points in each area in the overlapping area and the preset Sobel operator;

[0148] The target seam line is determined according to the intensity values ​​corresponding to the pixel points in each area.

[0149] Furthermore, the center of gravity position includes the horizontal axis center of gravity position and the vertical axis center of gravity position; the preset weight value calculation formula is specifically:

[0150] ;

[0151] in, is the normal model distribution value; for; is the width of the rectangular detection box; is the height of the rectangular detection frame; x is the horizontal coordinate of the pixel point in the area; x G is the horizontal axis center position; y is the vertical coordinate of the regional pixel point; y G is the position of the center of gravity of the longitudinal axis; is the overlapping area; is the minimum value of the normal model distribution; is the maximum value of the normal model distribution; for; is the weight value.

[0152] Furthermore, the preset Sobel operator includes a Sobel operator in the horizontal axis direction and a Sobel operator in the vertical axis direction; the calculation formula of the intensity value is specifically:

[0153] ;

[0154] in, is the intensity value of the pixel point in the region; is the weight and value; is the gray value difference of the regional pixels in the overlapping area; is the structural value difference; is the Sobel operator in the horizontal direction; Transform the image for the left eye; Transform the image for the right eye; is the Sobel operator in the vertical direction.

[0155] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, modules and sub-modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0156] An embodiment of the present invention further provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory; when the computer program is executed by the processor, the processor executes the steps of the video stitching method of any of the above embodiments.

[0157] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the video stitching method in any of the above embodiments are implemented.

[0158] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the video stitching method in any of the above embodiments when the computer program / instruction is executed by a processor.

[0159] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0160] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0161] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A video splicing method, It is characterized in that include: Acquire a binocular video frame, wherein the binocular video frame includes a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image; Using a preset image feature extraction algorithm to perform feature extraction and matching on the left-eye video frame image and the corresponding right-eye video frame image to determine image camera parameters; Performing an AND operation on the left-eye video frame image and the corresponding right-eye video frame image using the image camera parameters to generate a fused image; Performing target recognition on the fused image through a preset deep learning neural network, outputting a marked target and a rectangular detection frame corresponding to the fused image, and determining whether the marked target overlaps with a seam line in the fused image; If so, using a preset dynamic programming algorithm to update the seam line according to the overlapping area in the fused image and the rectangular detection frame to determine the target seam line; Using the target stitching line to fuse the left-eye video frame image and the corresponding right-eye video frame image, and output a target stitching video frame; The image camera parameters include a homography matrix and internal and external parameters of a binocular camera; the step of using a preset image feature extraction algorithm to perform feature extraction and matching on the left-eye video frame image and the corresponding right-eye video frame image to determine the image camera parameters includes: The preset image feature extraction algorithm is used to extract feature points of the left-eye video frame image and the corresponding right-eye video frame image, and a plurality of left-eye image feature points and a plurality of right-eye image feature points are output; Performing feature matching on each of the left-eye image feature points and each of the right-eye image feature points, outputting a plurality of feature point correspondence relationships, and constructing a homography matrix according to each of the feature point correspondence relationships; Calculating the internal and external parameters of the binocular camera by using the corresponding relationship of each feature point and the homography matrix; The step of updating the seam line according to the overlapping area in the fused image and the rectangular detection frame using a preset dynamic programming algorithm to determine the target seam line includes: Determine the center of gravity based on the target pixel points in the rectangular detection frame; Substituting the plurality of regional pixel points and the centroid position in the overlapping area into a preset weight value calculation formula to calculate the weight value corresponding to each of the regional pixel points; Performing a sum operation on each of the weight values ​​to determine a weight sum; Calculate the intensity value corresponding to each pixel point in the region by using the weight sum, the gray value difference of each pixel point in the overlapping region and a preset Sobel operator; The target seam line is determined according to the intensity values ​​corresponding to the pixel points in each region.

2. The video stitching method according to claim 1, It is characterized in that The step of performing an AND operation on the left-eye video frame image and the corresponding right-eye video frame image using the image camera parameters to generate a fused image comprises: Based on the internal and external parameters of the binocular camera, a preset image transformation model is used to perform image transformation on the left-eye video frame image and the corresponding right-eye video frame image, and a left-eye transformed image and a right-eye transformed image are output; Using the internal and external parameters of the binocular camera to perform image correction compensation on the left-eye transformed image and the right-eye transformed image, respectively, to determine a left-eye corrected image and a right-eye corrected image; The left-eye correction image and the right-eye correction image are ANDed by using the homography matrix and the internal and external parameters of the binocular camera to generate a fused image.

3. The video stitching method according to claim 1, It is characterized in that The center of gravity position includes the horizontal axis center of gravity position and the vertical axis center of gravity position; the preset weight value calculation formula is specifically: ; in, is the normal model distribution value; is the normal distribution function; is the width of the rectangular detection box; is the height of the rectangular detection frame; x is the horizontal coordinate of the pixel point in the area; x G is the horizontal axis center position; y is the vertical coordinate of the regional pixel point; y G is the position of the center of gravity of the longitudinal axis; is the overlapping area; is the minimum value of the normal model distribution; is the maximum value of the normal model distribution; is the average intensity value of the overlapping area D or the average gradient value of the overlapping area D; is the weight value.

4. The video stitching method according to claim 1, It is characterized in that The preset Sobel operator includes a Sobel operator in the horizontal axis direction and a Sobel operator in the vertical axis direction; the calculation formula of the intensity value is specifically: ; in, is the intensity value of the pixel point in the region; is the weight and value; is the gray value difference of the regional pixels in the overlapping area; is the structural value difference; is the Sobel operator in the horizontal direction; Transform the image for the left eye; Transform the image for the right eye; is the Sobel operator in the vertical direction.

5. A video splicing device, It is characterized in that include: An acquisition module, used for acquiring a binocular video frame, wherein the binocular video frame includes a left-eye video frame image and a right-eye video frame image corresponding to the left-eye video frame image; An extraction and matching module is used to perform feature extraction and matching on the left-eye video frame image and the corresponding right-eye video frame image using a preset image feature extraction algorithm to determine image camera parameters; An AND operation module, used for performing an AND operation on the left-eye video frame image and the corresponding right-eye video frame image using the image camera parameters to generate a fused image; A judgment module, used to perform target recognition on the fused image through a preset deep learning neural network, output a marked target and a rectangular detection frame corresponding to the fused image, and judge whether the marked target overlaps with a seam line in the fused image; An updating module, configured to update the seam line in the fused image using a preset dynamic programming algorithm according to the overlapping area in the fused image and the rectangular detection frame to determine a target seam line if the marked target overlaps with the seam line in the fused image; A fusion module, used to use the target stitching line to fuse the left-eye video frame image and the corresponding right-eye video frame image, and output a target stitching video frame; The image camera parameters include homography matrix and internal and external parameters of the binocular camera; the extraction and matching module is specifically used for: The preset image feature extraction algorithm is used to extract feature points of the left-eye video frame image and the corresponding right-eye video frame image, and a plurality of left-eye image feature points and a plurality of right-eye image feature points are output; Performing feature matching on each of the left-eye image feature points and each of the right-eye image feature points, outputting a plurality of feature point correspondence relationships, and constructing a homography matrix according to each of the feature point correspondence relationships; Calculating the internal and external parameters of the binocular camera by using the corresponding relationship of each feature point and the homography matrix; The update module is specifically used for: Determine the center of gravity based on the target pixel points in the rectangular detection frame; Substituting the plurality of regional pixel points and the centroid position in the overlapping area into a preset weight value calculation formula to calculate the weight value corresponding to each of the regional pixel points; Performing a sum operation on each of the weight values ​​to determine a weight sum; Calculate the intensity value corresponding to each pixel point in the region by using the weight sum, the gray value difference of each pixel point in the overlapping region and a preset Sobel operator; The target seam line is determined according to the intensity values ​​corresponding to the pixel points in each region.

6. A computer device, It is characterized in that The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the video stitching method according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program / instructions stored thereon, It is characterized in that When the computer program / instructions are executed by a processor, the steps of the video stitching method according to any one of claims 1 to 4 are implemented.

8. A computer program product comprising a computer program / instructions, It is characterized in that When the computer program / instructions are executed by a processor, the steps of the video stitching method according to any one of claims 1 to 4 are implemented.