Video image seam search method, video image splicing method and device

By obtaining the energy map of video images and dynamic programming algorithms, combined with the neural network model and the expansion technology of isometric projection pictures, the jitter problem in panoramic video splicing is solved and the splicing effect is improved.

CN113793382BActive Publication Date: 2024-10-18YUANLI TUXIN (CHONGQING) TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110893253.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-04
Publication Date
2024-10-18
Estimated Expiration
2041-08-04

AI Technical Summary

Technical Problem

In the process of panoramic video splicing, the image splicing algorithm in the existing technology is difficult to stably adapt to different fisheye cameras, resulting in large differences in the stitching areas of the front and rear frame images, causing the spliced ​​video to jitter during playback, affecting the splicing of the panoramic video Effect.

Method used

By obtaining the energy map of the video image, the dynamic programming algorithm and neural network model are used to determine the seam search results, constrain the seam search area range, reduce the seam area difference between the previous and next frame video images, alleviate the jitter problem, and project the image through equidistant The expansion and lighting compensation improve the stitching effect.

Benefits of technology

It effectively reduces the jitter of the spliced ​​video during playback, improves the splicing effect and stability of panoramic videos, and improves the quality of video image splicing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113793382B_ABST
    Figure CN113793382B_ABST
Patent Text Reader

Abstract

The present invention provides a video image seam search method, a video image splicing method and a device, which obtain an energy map of each frame of video images in a first video; for the first frame of video images, determine its seam search result based on its energy map; for each of the remaining video images, determine the seam search area range based on the seam search result of the previous frame of video images; within this range, determine its seam search result based on the energy map of the current video image. This method determines the seam search result based on the energy map of the video image, and for video images other than the first frame, first determine the seam search area range based on the seam search result of the previous frame of video images, and then determine the seam search result within the seam search area range. This method of constraining the seam search area range can reduce the seam area difference between the previous and next frames of video images, alleviate the jitter problem of the spliced ​​video during playback, and thus improve the splicing effect of the panoramic video.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Panoramic video stitching refers to stitching multiple videos with overlapping fields of view. Specifically, the frame images in the multiple videos correspond one to one, and the corresponding frame images in the multiple videos are stitched together to obtain a 360° panoramic field of view video. In the process of panoramic video stitching, it is usually necessary to search for the seams of each frame image in the multiple videos, and then stitch each frame image based on the searched seams. The image stitching algorithm in the related art is mainly used for the stitching of a single image. When the image stitching algorithm is used to stitch multiple videos to be stitched, it is easy for the seam areas of the previous and next frame images to be different. The stitched video will shake during playback, affecting the stitching effect of the panoramic video. Summary of the invention

[0003] The purpose of the present invention is to provide a video image seam search method, a video image splicing method and a device to alleviate the jitter of the spliced ​​video during the playback process and improve the splicing effect of the panoramic video.

[0004] The present invention provides a method for searching for seams in video images, the method comprising: obtaining an energy map of each frame of video images in a first video; wherein the energy map is used to indicate a position area and an edge of a specified object in the video image; for a first frame of video images in the first video, determining a seam search result of the first frame of video images based on the energy map of the first frame of video images; wherein the seam search result comprises: a seam area between the video image and a target image; the target image is a video image corresponding to the video image in a second video; for each frame of video images except the first frame in the first video, determining a seam search area range of the current video image based on a seam search result of a previous frame of video images of the current video image; and determining a seam search result of the current video image based on the energy map of the current video image within the seam search area range.

[0005] Furthermore, the step of obtaining an energy map of each frame of video image in the first video includes: obtaining a salient target energy map, a motion target energy map and an edge target energy map of each frame of video image in the first video; for each frame of video image, fusing the salient target energy map, the motion target energy map and the edge energy map corresponding to the frame of video image to obtain the energy map of the frame of video image.

[0006] Furthermore, the step of obtaining a salient target energy map, a motion target energy map and an edge energy map of each frame of video image in the first video includes: for each frame of video image in the first video, inputting the video image into a preset neural network model to output a salient target energy map of the frame of video image through the preset neural network model; based on the motion target in the frame of video image, determining the motion target energy map of the frame of video image; performing edge detection on each object in the frame of video image to obtain an edge energy map of the frame of video image.

[0007] Furthermore, for the first frame of video image in the first video, based on the energy map of the first frame of video image, the step of determining the stitching search results of the first frame of video image includes: for the first frame of video image in the first video, based on the energy map of the first frame of video image, using a dynamic programming algorithm to calculate the stitching search results of the first frame of video image.

[0008] Furthermore, for each video image frame except the first frame in the first video, based on the stitching search result of the previous frame of the current video image, the stitching search area range of the current video image is determined; within the stitching search area range, the step of determining the stitching search result of the current video image based on the energy map of the current video image includes: for each video image frame except the first frame in the first video, based on the stitching search result of the previous frame of the current video image, adding preset constraints to determine the stitching search area range of the current video image; within the stitching search area range, based on the energy map of the current video image, a dynamic programming algorithm is used to determine the stitching search result of the current video image.

[0009] Furthermore, in the first video, each frame of video image has an overlapping area with the target image corresponding to the video image, and the area corresponding to the overlapping area in the video image is a first overlapping area, and the area corresponding to the overlapping area in the target image is a second overlapping area; the method also includes: for each frame of video image, the image corresponding to the first overlapping area in the frame of video image and the image corresponding to the second overlapping area in the target image corresponding to the frame of video image are input into a pre-trained neural network model to obtain a stitching prediction result of the frame of video image; wherein the stitching prediction result includes: the stitching prediction area of ​​the video image and the corresponding target image.

[0010] Furthermore, the pre-trained neural network model is determined in the following manner: obtaining training samples comprising a plurality of consecutive groups of image pairs to be stitched, and stitching search results of each group of image pairs to be stitched; for each group of image pairs to be stitched except the first group of image pairs to be stitched, inputting the stitching prediction results of the group of image pairs to be stitched, and the adjacent previous group of image pairs to be stitched, into the initial neural network model, so as to output the stitching prediction results of the group of image pairs to be stitched through the initial neural network model; calculating the loss value of the stitching prediction results of the group of image pairs to be stitched based on the stitching search results of the group of image pairs to be stitched and a preset loss function; updating the weight parameters of the initial neural network model based on the loss value; and continuing to execute the step of obtaining training samples comprising a plurality of consecutive groups of image pairs to be stitched, until the initial neural network model converges to obtain the neural network model.

[0011] Furthermore, after the step of obtaining training samples including a plurality of consecutive groups of image pairs to be stitched, and stitching search results of each group of image pairs to be stitched, the method further includes: obtaining a preset stitching template; wherein the preset stitching template includes a preset stitching area; and for a first group of image pairs to be stitched, inputting the first group of image pairs to be stitched and the preset stitching template into an initial neural network model, so as to output stitching prediction results of the first group of image pairs to be stitched through the initial neural network model.

[0012] The present invention provides a video image splicing method, the method comprising: obtaining a first fisheye video and a second fisheye video; wherein the fisheye video images in the first fisheye video and the second fisheye video have an overlapping area; extracting a first target area of ​​each frame of the fisheye video image in the first fisheye video and a second target area of ​​each frame of the fisheye video image in the second fisheye video; for two corresponding frames of fisheye video images, based on the first target area and the second target area corresponding to the two frames of fisheye video images, and a pre-acquired update expansion parameter value, determining a first equidistant projection picture of the frame of the fisheye video image in the first fisheye video after expansion, and a second equidistant projection picture of the frame of the fisheye video image in the second fisheye video after expansion; determining a splicing search result based on the first equidistant projection picture and the second equidistant projection picture corresponding to the two frames of the fisheye video images; wherein the splicing search result is determined by using any of the above-mentioned video image splicing search methods; and determining a video splicing result of the video images based on the splicing search result corresponding to each group of two corresponding frames of the fisheye video images.

[0013] Furthermore, based on the first equidistant projection image and the second equidistant projection image that correspond to each other, the step of determining the stitching search result includes: aligning the first equidistant projection image and the second equidistant projection image that correspond to each other; extracting the third overlapping area based on the aligned first equidistant projection image and the second equidistant projection image; based on the third overlapping area, performing illumination compensation on the second equidistant projection image so that the pixel value of each pixel in the second equidistant projection image after illumination compensation matches the pixel value of each pixel in the corresponding first equidistant projection image; determining the stitching search result based on the first equidistant projection image and the second equidistant projection image after illumination compensation.

[0014] Furthermore, the updated expansion parameter values ​​include: the field of view angle parameter value, the parameter value of the optical center in the x-axis direction, the parameter value of the optical center in the y-axis direction and the fisheye rotation angle parameter value; the updated expansion parameter values ​​are pre-determined in the following manner: obtaining the initial expansion parameter value and the preset offset range of each expansion parameter; based on the initial expansion parameter value and the preset offset range of each expansion parameter, sampling each expansion parameter to obtain the sampled value of each expansion parameter, and based on the sampled value of each expansion parameter, determining the third equidistant projection image of the frame of fisheye video image in the first fisheye video after expansion, and the fourth equidistant projection image of the frame of fisheye video image in the second fisheye video after expansion; extracting the fourth overlapping area of ​​the third equidistant projection image and the fourth equidistant projection image; performing cross-correlation calculation on the fourth overlapping area to obtain a first cross-correlation calculation result; based on the first cross-correlation calculation result and the preset number of iterations, determining the updated expansion parameter value.

[0015] Furthermore, based on the first mutual correlation calculation result and a preset number of iterations, the step of determining an updated expansion parameter value includes: repeatedly executing the step of sampling each expansion parameter based on the initial expansion parameter value and the preset offset range of each expansion parameter according to the preset number of iterations to obtain multiple first mutual correlation calculation results; selecting the first mutual correlation calculation result with the largest value from the multiple first mutual correlation calculation results; and determining the sampled value of the expansion parameter corresponding to the first mutual correlation calculation result with the largest value as the updated expansion parameter value.

[0016] Furthermore, the step of aligning the corresponding first equidistant projection image and the second equidistant projection image includes: extracting first feature points from the first equidistant projection image, and extracting second feature points from the second equidistant projection image; determining matching feature point pairs based on the first feature points and the second feature points; and aligning the first equidistant projection image and the second equidistant projection image based on the matching feature point pairs.

[0017] Furthermore, the step of aligning the corresponding first equidistant projection image and the second equidistant projection image includes: moving the second equidistant projection image in a preset direction; during the movement, extracting multiple fifth overlapping areas of the first equidistant projection image and the second equidistant projection image; performing cross-correlation calculations on the multiple fifth overlapping areas respectively to obtain multiple second cross-correlation calculation results; and aligning the first equidistant projection image and the second equidistant projection image based on the multiple second cross-correlation calculation results.

[0018] Furthermore, based on multiple second correlation calculation results, the step of aligning the first equidistant projection image and the second equidistant projection image includes: selecting the second correlation calculation result with the largest value from the multiple second correlation calculation results; obtaining the position coordinates of the first boundary pixel point corresponding to the fifth overlapping area corresponding to the second correlation calculation result with the largest value in the first equidistant projection image, and the position coordinates of the second boundary pixel point corresponding to the second equidistant projection image; calculating the affine transformation matrix based on the position coordinates of the first boundary pixel point and the position coordinates of the second boundary pixel point; and aligning the first equidistant projection image and the second equidistant projection image based on the affine transformation matrix.

[0019] Furthermore, based on the stitching search results corresponding to each group of two corresponding fisheye video frames, the step of determining the video stitching result of the video image includes: for each group of two corresponding fisheye video frames, based on the stitching search results corresponding to the two fisheye video frames in the group, determining the fused overlapping area corresponding to the two fisheye video frames in the group; replacing the third overlapping area corresponding to the two fisheye video frames in the group with the fused overlapping area to obtain the image stitching result of the two fisheye video frames in the group; and determining the video stitching result of the video image based on the image stitching result of the two fisheye video frames in each group.

[0020] The present invention provides a video image seam search device, the device comprising: a first acquisition module, used to acquire an energy map of each frame of video image in a first video; wherein the energy map is used to indicate the position area and edge of a specified object in the video image; a first determination module, used to determine the seam search result of the first frame of video image in the first video based on the energy map of the first frame of video image; wherein the seam search result includes: a seam area between the video image and a target image; the target image is a video image corresponding to the video image in a second video; a second determination module, used to determine the seam search area range of the current video image based on the seam search result of the previous frame of video image of the current video image for each frame of video image except the first frame in the first video; within the seam search area range, determine the seam search result of the current video image based on the energy map of the current video image.

[0021] The present invention provides a video image splicing device, the device comprising: a second acquisition module, used to acquire a first fisheye video and a second fisheye video; wherein the fisheye video images in the first fisheye video and the second fisheye video have an overlapping area; an extraction module, used to extract a first target area of ​​each frame of the fisheye video image in the first fisheye video, and a second target area of ​​each frame of the fisheye video image in the second fisheye video; a third determination module, used to determine, for two corresponding frames of fisheye video images, a first equidistant projection picture of the frame of the fisheye video image in the first fisheye video after expansion, and a second equidistant projection picture of the frame of the fisheye video image in the second fisheye video after expansion based on the first target area and the second target area corresponding to the two frames of the fisheye video images, and a pre-acquired update expansion parameter value; a fourth determination module, used to determine a stitching search result based on the first equidistant projection picture and the second equidistant projection picture corresponding to the two frames of the fisheye video images; wherein the stitching search result is determined by the stitching search device for the video image; and a fifth determination module, used to determine a video stitching result of the video image based on the stitching search result corresponding to each group of two corresponding frames of the fisheye video images.

[0022] The present invention provides an electronic system, which includes: an image acquisition device, a processing device and a storage device; the image acquisition device is used to obtain preview video frames or image data; the storage device stores a computer program, and when the computer program is run by the processed device, it executes any of the above-mentioned video image seam search methods, or any of the above-mentioned video image splicing methods.

[0023] The present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processing device, the computer program executes the steps of any of the above-mentioned video image seam search methods, or the steps of any of the above-mentioned video image splicing methods.

[0024] The present invention provides a video image seam search method, a video image splicing method and a device, which first obtain an energy map of each frame of video image in a first video; then, for the first frame of video image in the first video, based on the energy map of the first frame of video image, determine the seam search result of the first frame of video image; for each frame of video image except the first frame in the first video, based on the seam search result of the previous frame of video image, determine the seam search area range of the current video image; within the seam search area range, determine the seam search result of the current video image based on the energy map of the current video image. This method determines the seam search result based on the energy map of the video image, and for video images except the first frame, first determines the seam search area range based on the seam search result of the previous frame of video image, and then determines the seam search result within the seam search area range. This method of constraining the seam search area range can reduce the seam area difference between the previous and next frames of video images, alleviate the jitter problem of the spliced ​​video during playback, and thus improve the splicing effect of the panoramic video. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0026] Figure 1 A schematic diagram of the structure of an electronic system provided by an embodiment of the present invention;

[0027] Figure 2 A flowchart of a method for searching for seams in a video image provided by an embodiment of the present invention;

[0028] Figure 3 A flowchart of another video image seam search method provided by an embodiment of the present invention;

[0029] Figure 4 A flowchart of another video image seam search method provided by an embodiment of the present invention;

[0030] Figure 5 A schematic diagram of a neural network model training process provided by an embodiment of the present invention;

[0031] Figure 6 A flowchart of a video image splicing method provided by an embodiment of the present invention;

[0032] Figure 7 A schematic diagram of an equidistant projection image expansion method provided by an embodiment of the present invention;

[0033] Figure 8 A schematic diagram of cross-correlation calculation provided by an embodiment of the present invention;

[0034] Fig. 9 A schematic diagram of picture alignment provided by an embodiment of the present invention;

[0035] Fig.10 A schematic structural diagram of a video image seam search device provided by an embodiment of the present invention;

[0036] Fig.11 A schematic structural diagram of a video image splicing device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0037] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than 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.

[0038] In recent years, research on computer vision, deep learning, machine learning, image processing, image recognition and other technologies based on artificial intelligence has made important progress. Artificial Intelligence (AI) is an emerging science and technology that studies and develops theories, methods, technologies and application systems for simulating and extending human intelligence. Artificial intelligence is a comprehensive discipline involving many types of technologies such as chips, big data, cloud computing, the Internet of Things, distributed storage, deep learning, machine learning, neural networks, etc. Computer vision, as an important branch of artificial intelligence, specifically allows machines to recognize the world. Computer vision technology usually includes face recognition, liveness detection, fingerprint recognition and anti-counterfeiting verification, biometric recognition, face detection, pedestrian detection, target detection, pedestrian recognition, image processing, image recognition, image semantic understanding, image retrieval, text recognition, video processing, video content recognition, behavior recognition, 3D reconstruction, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), computational photography, robot navigation and positioning and other technologies. With the research and advancement of artificial intelligence technology, this technology has been applied in many fields, such as security, urban management, traffic management, building management, park management, facial access, facial attendance, logistics management, warehouse management, robots, intelligent marketing, computational photography, mobile phone imaging, cloud services, smart homes, wearable devices, unmanned driving, automatic driving, smart medical care, facial payment, facial unlocking, fingerprint unlocking, identity verification, smart screens, smart TVs, cameras, mobile Internet, live streaming, beauty, makeup, medical beauty, and smart temperature measurement.

[0039] Currently, panoramic video stitching refers to stitching multiple videos with overlapping fields of view to obtain a 360° panoramic video; panoramic video stitching technology can be applied to application scenarios such as sports cameras, remote conferencing or security monitoring. Generally, panoramic video stitching can be achieved by combining multiple wide-angle cameras. The coverage field of view of multiple wide-angle cameras needs to exceed 360°. Fisheye cameras can be used to reduce the number of wide-angle cameras. Two fisheye cameras with a field of view greater than 180° can be stitched together to generate a 360° panoramic video. In the process of panoramic video stitching, it is usually necessary to search for the seams of each frame of images in multiple videos, and then stitch each frame of images based on the searched seams; the image stitching algorithm in the related art is mainly used for the stitching of single images. When the image stitching algorithm is applied to different fisheye cameras, the quality of the stitched image obtained is unstable, that is, the adaptability to different fisheye cameras is poor; and when the image stitching algorithm is used to stitch multiple videos to be stitched, it is easy for the stitching area of ​​the previous and next frame images to be different. The spliced ​​video will shake during the playback process, affecting the stitching effect of the panoramic video. Based on this, the embodiment of the present invention provides a video image stitching search method, a video image stitching method and a device. The technology can be applied to the stitching application of multiple videos. The technology can be implemented using corresponding software and hardware. The following is a detailed introduction to the embodiment of the present invention.

[0040] Embodiment 1

[0041] First, refer to Figure 1 An exemplary electronic system 100 for implementing the video image seam search method, video image splicing method and apparatus according to the embodiments of the present invention is described.

[0042] like Figure 1 The electronic system 100 includes one or more processing devices 102, one or more storage devices 104, an input device 106, an output device 108, and one or more image acquisition devices 110. These components are interconnected via a bus system 112 and / or other forms of connection mechanisms (not shown). It should be noted that Figure 1 The components and structure of the electronic system 100 shown are merely exemplary and not limiting. The electronic system may also have other components and structures as required.

[0043] The processing device 102 can be a gateway, or a smart terminal, or a device including a central processing unit (CPU) or other forms of processing units with data processing capabilities and / or instruction execution capabilities. It can process data of other components in the electronic system 100 and control other components in the electronic system 100 to perform desired functions.

[0044] The storage device 104 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processing device 102 may run the program instructions to implement the client functions and / or other desired functions in the embodiments of the present invention (implemented by the processing device) described below. Various applications and various data, such as various data used and / or generated by the application, may also be stored in the computer-readable storage medium.

[0045] The input device 106 may be a device used by a user to input instructions, and may include one or more of a keyboard, a mouse, a microphone, a touch screen, and the like.

[0046] The output device 108 may output various information (eg, images or sounds) to the outside (eg, a user), and may include one or more of a display, a speaker, and the like.

[0047] The image acquisition device 110 may acquire preview video frames or image data, and store the acquired preview video frames or image data in the storage device 104 for use by other components.

[0048] Exemplarily, the components in the example electronic system for implementing the video image seam search method, video image stitching method and device according to the embodiment of the present invention can be integrated or dispersed, such as integrating the processing device 102, the storage device 104, the input device 106 and the output device 108 into one body, and setting the image acquisition device 110 at a specified position where the target image can be acquired. When the components in the above electronic system are integrated, the electronic system can be implemented as a smart terminal such as a camera, a smart phone, a tablet computer, a computer, a vehicle-mounted terminal, etc.

[0049] Embodiment 2

[0050] This embodiment provides a method for searching for a seam in a video image. Figure 2 As shown, the method comprises the following steps:

[0051] Step S202, obtaining an energy map of each frame of the video image in the first video; wherein the energy map is used to indicate a location area and an edge of a specified object in the video image.

[0052] The above-mentioned first video can be a video collected by a camera or other device, for example, it can be a video collected by a wide-angle camera or a fisheye camera, etc.; the above-mentioned energy map can be represented in the form of a grayscale map, for example, if the energy map is in the form of a grayscale map, then in the energy map, the higher the grayscale value of the pixel point, generally means that the energy of the pixel point is greater, and the corresponding energy value is higher. Conversely, the lower the grayscale value of the pixel point, generally means that the energy of the pixel point is smaller, and the corresponding energy value is lower. The energy value in the energy map can be represented in a normalized manner, that is, the energy value can be a value between 0 and 1, and an energy distribution of 0 to 1 is adopted; the above-mentioned designated object can be any object in the video image, for example, the designated object can be a person or animal in the video image; the above-mentioned position area can be understood as the area occupied by the designated object in the video image; the above-mentioned edge can be understood as the outer edge contour corresponding to the designated object in the video image. In actual implementation, when searching for seams in video images is required, it is usually necessary to first obtain an energy map corresponding to each frame of video images in the first video. The energy map of each frame of video images can indicate the location area and edge contour of a specified object in the frame of video images.

[0053] Step S204, for the first frame of the video image in the first video, based on the energy map of the first frame of the video image, determine the stitching search results of the first frame of the video image; wherein the stitching search results include: a stitching area between the video image and the target image; the target image is a video image in the second video corresponding to the video image.

[0054] The second video may be a video captured by a camera or a camera, for example, a video captured by a wide-angle camera or a fisheye camera; the stitching area may be understood as an area corresponding to a corresponding stitching line when the video image and the target image are stitched together; the video image in the first video and the video image in the second video may correspond one to one; for example, two fisheye cameras simultaneously shoot two videos in the same scene, namely, the first video and the second video, and the fields of view of the two fisheye cameras are different. In the second video, the video image corresponding to the first frame of the video image of the first video is the first frame of the second video. Frame video image, the first frame video image of the second video corresponds to the above-mentioned target image; in actual implementation, for the first frame video image in the first video, the target image corresponding to the first frame video image in the first video can be determined in the second video first, and then the seam area between the first frame video image and the corresponding target image can be determined based on the energy map of the first frame video image to determine the seam search result of the first frame video image. For example, the seam area between the first video image and the corresponding target image can be searched from a relatively static area with smaller energy based on the energy map of the first frame video image.

[0055] Step S206, for each frame of video image except the first frame in the first video, determine the stitching search area range of the current video image based on the stitching search result of the previous frame of video image of the current video image; within the stitching search area range, determine the stitching search result of the current video image based on the energy map of the current video image.

[0056] The above-mentioned seam search area range can be understood as a constraint range limited to the search seam search results; in actual implementation, for each frame of video image in the first video except the first frame of video image, the corresponding seam search area range can be constrained for the seam search results of the current frame of video image based on the seam search results of the previous frame of video image of the current frame of video image, and within the seam search area range, the seam search results of the current frame of video image are determined based on the energy map of the current frame of video image; for example, based on the seam search results of the previous frame of video image, preset constraints can be added to constrain the seam search range of the current frame of video image, and within the determined seam search range, based on the energy map of the current frame of video image, the seam area of ​​the current frame of video image and the corresponding target image can be searched from a relatively static area with smaller energy, etc.

[0057] The above-mentioned method for searching for seams of video images first obtains the energy map of each frame of video images in the first video; then, for the first frame of video images in the first video, based on the energy map of the first frame of video images, determines the seam search results of the first frame of video images; for each frame of video images except the first frame in the first video, based on the seam search results of the previous frame of video images of the current video image, determines the seam search area range of the current video image; within the seam search area range, determines the seam search results of the current video image based on the energy map of the current video image. This method determines the seam search results based on the energy map of the video image, and for video images except the first frame, first determines the seam search area range based on the seam search results of the previous frame of video images, and then determines the seam search results within the seam search area range. This method of constraining the seam search area range can reduce the seam area difference between the previous and next frames of video images, alleviate the jitter problem of the spliced ​​video during playback, and thus improve the splicing effect of the panoramic video.

[0058] Embodiment 3

[0059] This embodiment provides another method for searching for seams in video images. The method is implemented on the basis of the method in the above embodiment. Figure 3 As shown, the method comprises the following steps:

[0060] Step S302: Obtain a salient target energy map, a moving target energy map, and an edge energy map of each frame of the video image in the first video.

[0061] The above-mentioned salient target energy map can indicate the position area of ​​the first object specified in the video image, that is, the area occupied by the first object in the video image. The first object is usually the most eye-catching object in the video image, and can also be understood as a salient target object, an object of interest or a subject in the video image. For example, in a video image containing a person, the person is usually the first object in the video image; in the salient target energy map, the energy value of the position area of ​​the first object is usually relatively high.

[0062] The above-mentioned moving target energy map can indicate the position area of ​​the second object specified in the video image, that is, the area occupied by the second object in the video image. The second object is usually a moving target in the video image, such as a moving vehicle contained in the video image; in the moving target energy map, the energy value of the position area of ​​the second object is usually relatively high.

[0063] The above-mentioned edge energy map can indicate the edge of a third object specified in the video image, that is, the outer edge contour corresponding to the third object. The third object usually includes the above-mentioned first object and second object, and may also include other objects contained in the video image; in the edge energy map, the energy value of the edge of the third object is usually relatively high.

[0064] In actual implementation, when it is necessary to search for the seams of video images, it is usually necessary to first obtain the salient target energy map, motion target energy map and edge energy map corresponding to each frame of the video image in the first video, so as to determine the seam search results of each frame of the video image based on the three target energy maps.

[0065] Specifically, step S302 can be implemented by the following steps 1 to 3:

[0066] Step 1: for each frame of video image in the first video, the video image is input into a preset neural network model to output a salient target energy map of the frame of video image through the preset neural network model.

[0067] The above-mentioned preset neural network model can be implemented by a variety of convolutional neural networks, such as residual networks, VGG networks, etc. The preset neural network model can be a convolutional neural network model of any size, for example, it can be resnet34_05x, etc.; in actual implementation, when it is necessary to construct a salient target energy map of each frame of video image in the first video, it can be implemented by neural networks and the like. For example, each frame of video image can be input into the preset neural network, and the preset neural network can detect the first object specified in each frame of video image, and output the salient target energy map of each frame of video image to indicate the position area of ​​the first object specified in each frame of video image. Of course, other methods can also be used to determine the salient target energy map of each frame of video image. For details, please refer to the implementation method in the prior art, which will not be repeated here.

[0068] Step 2: Based on the moving target in the frame of video image, determine the moving target energy map of the frame of video image.

[0069] In actual implementation, the moving target energy map of each frame of video image can be determined based on the moving target in each frame of video image by optical flow calculation or other methods. For example, for each frame of video image except the first frame in the first video, the moving target can be determined based on the current frame of video image and the previous frame of video image, and then the moving target energy map of the current frame of video image can be determined based on the determined moving target; wherein, the detection of the moving target can be understood as the process of proposing and marking the object whose spatial position changes in the image sequence or video as the foreground. Of course, other methods can also be used to determine the moving target energy map of each frame of video image. For details, please refer to the implementation method in the prior art, which will not be repeated here.

[0070] Step three, perform edge detection on each object in the frame of video image to obtain an edge energy map of the frame of video image.

[0071] The purpose of edge detection is to find a set of pixels in a video image whose brightness changes dramatically, which often appear as contours. In actual implementation, optical flow calculation and other methods can be used to perform edge detection on each object contained in each frame of video image, determine the contours of each object, and obtain an edge energy map for each frame of video image. Of course, other methods can also be used to determine the edge energy map of each frame of video image. For details, please refer to the implementation methods in the prior art, which will not be repeated here.

[0072] Step S304: for each frame of video image, the salient target energy map, the moving target energy map and the edge energy map corresponding to the frame of video image are fused to obtain the energy map of the frame of video image.

[0073] For each frame of video image, after obtaining the salient target energy map, moving target energy map and edge energy map of the frame of video image, these three energy maps can be fused to obtain the fused energy map corresponding to the frame of video image, that is, the energy map of the frame of video image; the fused energy map contains the position area and edge of the salient target object in the frame of video image, the position area and edge of the moving target, and the edges of other objects.

[0074] Step S306, for the first frame of the video image in the first video, based on the energy map of the first frame of the video image, a dynamic programming algorithm is used to calculate the stitching search results of the first frame of the video image; wherein the stitching search results include: a stitching area between the video image and the target image; the target image is a video image in the second video corresponding to the video image.

[0075] The above-mentioned dynamic programming algorithm can solve the problem in a recursive manner by splitting the problem, defining the problem state and the relationship between the states; it also decomposes the problem to be solved into several sub-problems, solves the sub-problems in sequence, and the solution of the previous sub-problem provides useful information for solving the next sub-problem; when solving any sub-problem, various possible local solutions are listed, and those local solutions that may reach the optimal are retained through decision-making, and other local solutions are discarded; each sub-problem is solved in sequence, and the last sub-problem is the solution to the initial problem; in this embodiment, for the first frame of video image in the first video, based on the energy map of the first frame of video image, a plurality of stitching search results of the first frame of video image can be searched out through a dynamic programming algorithm, and the optimal stitching search result is selected from the plurality of stitching search results, the optimal stitching search result is usually the stitching of the first frame of video image and the corresponding target image searched from a relatively static background with low energy, the shape of the stitching may be irregular, and the optimal stitching search result usually avoids the position area and edge of the significant target object contained in the first frame of video image, the position area and edge of the moving target, and the edge of other objects.

[0076] Step S308, for each video image frame except the first frame in the first video, based on the stitching search result of the previous video image frame of the current video image, a preset constraint condition is added to determine the stitching search area range of the current video image.

[0077] The above-mentioned preset constraints can be set according to actual needs. For example, for each frame of video image except the first frame in the first video, the constraint condition can be based on the stitching search result of the previous frame, and the difference between the upper and lower edges is constrained to be less than 50 pixels, that is, the difference between the upper and lower edges of the stitching search result of the current frame of video image and the stitching search result of the previous frame cannot exceed 50 pixels, and the stitching search range of the current frame of video image is determined based on the constraint condition.

[0078] Step S310 : within the seam search area, based on the energy graph of the current video image, a dynamic programming algorithm is used to determine the seam search results of the current video image.

[0079] For each video image frame except the first frame in the first video, after determining the stitching search area range of the current video image frame, a dynamic programming algorithm can be used based on the energy map of the current video image frame to calculate the stitching search results of the current video image frame; the stitching search results usually avoid the position area and edge of the significant target object contained in the current video image frame, the position area and edge of the moving target, and the edge of other objects; usually, the stitching of the current video image frame and the corresponding target image is searched from a relatively static background with less energy. In addition, there may be video images in the first video that cannot be searched normally. For such video images, the stitching search results of each video image frame in such video images can be determined by using the method of searching based on a single video image frame in step S306.

[0080] The above-mentioned video image seam search method first obtains the salient target energy map, the moving target energy map and the edge energy map of each frame of the video image in the first video; for each frame of the video image, the salient target energy map, the moving target energy map and the edge energy map corresponding to the frame of the video image are fused to obtain the energy map of the frame of the video image; then, for the first frame of the video image in the first video, based on the energy map of the first frame of the video image, a dynamic programming algorithm is used to calculate the seam search result of the first frame of the video image; for each frame of the video image except the first frame in the first video, based on the seam search result of the previous frame of the current video image, a preset constraint condition is added to determine the seam search area range of the current video image. Finally, within the seam search area range, based on the energy map of the current video image, a dynamic programming algorithm is used to determine the seam search result of the current video image. This method determines the stitching search result based on the energy map of the video image, and for video images other than the first frame, the stitching search area range is first determined based on the stitching search result of the previous frame of the video image, and then the stitching search result is determined within the stitching search area range. This method of constraining the stitching search area range can reduce the stitching area difference between the previous and next frames of the video image, alleviate the jitter problem of the stitched video during playback, and thereby improve the stitching effect of the panoramic video.

[0081] Embodiment 4

[0082] The present embodiment provides another method for searching for seams of video images, which is implemented on the basis of the method of the above embodiment. In the method, in the first video, each frame of the video image has an overlapping area with the target image corresponding to the video image, and the area corresponding to the overlapping area in the video image is the first overlapping area, and the area corresponding to the target image is the second overlapping area. In actual implementation, each frame of the video image in the first video has an overlapping area with the corresponding target image in the second video. The first overlapping area can be understood as an area corresponding to a part of the picture in the overlapping area in each frame of the video image in the first video; the second overlapping area can be understood as an area corresponding to a part of the picture in the overlapping area in each frame of the target image in the second video. Figure 4 As shown, the method comprises the following steps:

[0083] Step S402, obtaining an energy map of each frame of the video image in the first video; wherein the energy map is used to indicate a location area and an edge of a specified object in the video image.

[0084] Step S404, for the first frame of the video image in the first video, based on the energy map of the first frame of the video image, determine the stitching search results of the first frame of the video image; wherein the stitching search results include: a stitching area between the video image and the target image; the target image is a video image in the second video corresponding to the video image.

[0085] Step S406, for each frame of video image except the first frame in the first video, determine the stitching search area range of the current video image based on the stitching search result of the previous frame of video image of the current video image; within the stitching search area range, determine the stitching search result of the current video image based on the energy map of the current video image.

[0086] Step S408, for each frame of video image, the image corresponding to the first overlapping area in the frame of video image and the image corresponding to the second overlapping area in the target image corresponding to the frame of video image are input into a pre-trained neural network model to obtain a stitching prediction result of the frame of video image; wherein the stitching prediction result includes: a stitching prediction area of ​​the video image and the corresponding target image.

[0087] The above-mentioned pre-trained neural network model can be implemented by a variety of convolutional neural networks, such as Unet network, residual network, VGG network, etc. The preset neural network model can be a convolutional neural network model of any size, for example, it can be resnet34_05x, etc.; in actual implementation, based on the above-mentioned execution process, a dynamic programming algorithm can be used to determine the stitching search results of each frame of video image in the first video, but the dynamic programming algorithm takes a long time and has low execution efficiency. Therefore, the above-mentioned stitching search method can be distilled based on a neural network method, and hardware acceleration can be achieved through a neural network method to speed up processing speed and improve processing efficiency. In specific implementation, for each frame of video image, the image corresponding to the first overlapping area in the frame of video image and the image corresponding to the second overlapping area in the target image corresponding to the frame of video image can be input into the pre-trained neural network model, and the pre-trained neural network model can be used to obtain the stitching prediction result of the frame of video image and the corresponding target image, and the stitching prediction result includes the stitching prediction area of ​​the frame of video image and the corresponding target image.

[0088] The above pre-trained neural network model is determined by the following steps 4 to 9:

[0089] Step 4: Obtain training samples including a plurality of consecutive sets of image pairs to be stitched, and stitching search results of each set of image pairs to be stitched.

[0090] The above-mentioned image pair to be stitched usually includes two images to be stitched; the above-mentioned training sample can also be called a multi-frame data set, which usually includes multiple groups of continuous image pairs to be stitched; specifically, the training sample can be constructed in the following manner: first, a single image is obtained, and the single image can be represented by overlap_left, and the single image is subjected to a geometric transform to obtain an image to be stitched that is paired with the single image, and the image to be stitched can be represented by overlap_right, and the single image and the image to be stitched form a group of image pairs to be stitched; then, a sequence of images is generated based on the geometric transform, that is, multiple groups of image pairs to be stitched are generated to simulate video scenes, and the overlap_right and overlap_left in the multiple groups of image pairs to be stitched can be distinguished by numbering. The above-mentioned geometric transform usually includes random translation or rotation operations on the image, and each image to be stitched in the generated multiple groups of image pairs to be stitched may have black edges. In actual implementation, when a trained neural network model is needed, it is usually necessary to first obtain training samples containing multiple groups of image pairs to be stitched, and stitching search results of each group of image pairs to be stitched, wherein the stitching search results of each group of image pairs to be stitched can be determined in the manner described in the above-mentioned related steps, and the stitching search results of each group of image pairs to be stitched are used as GT (Ground Truth, indicating the classification accuracy of the training set of supervised learning, used to prove or disprove a hypothesis) to train the initial neural network to achieve the prediction of the stitching area of ​​each frame of video image.

[0091] Step 5: Obtain a preset seam template; wherein the preset seam template includes a preset seam area.

[0092] The preset seam area in the above-mentioned preset seam template can be set to a seam mask with the left half being 1 and the right half being 0, or can be set to a seam mask with all being 1; wherein a seam mask of 0 represents black, and a seam mask of 1 represents white; in actual implementation, the first group of image pairs to be stitched among multiple groups of image pairs to be stitched can be understood as the first frame overlap_right_1 and the first frame overlap_left_1 in the simulated video. For the first group of image pairs to be stitched, it is usually necessary to pre-provide a preset seam template containing a preset seam area for the first group of image pairs to be stitched.

[0093] Step six: for the first group of image pairs to be stitched, input the first group of image pairs to be stitched and a preset stitching template into the initial neural network model, so as to output the stitching prediction results of the first group of image pairs to be stitched through the initial neural network model.

[0094] The above initial neural network model can be implemented by a variety of convolutional neural networks, such as residual networks, VGG networks, etc. In actual implementation, see Figure 5 A schematic diagram of a neural network model training process is shown. For the first group of images to be stitched, after the above-mentioned preset stitching template is obtained, overlap_right_1, overlap_left_1 and the mask preset template (corresponding to the preset stitching template) in the first group of image pairs to be stitched can be input into NN (NeuralNetwork, quasi-neural network), that is, in the initial neural network model, the stitching search result of the first group of image pairs to be stitched is used as GT, and seam_mask_left_1, that is, the stitching prediction result of the first group of image pairs to be stitched, is output; the stitching prediction result includes: the stitching prediction areas of overlap_right_1 and overlap_left_1 in the first group of image pairs to be stitched.

[0095] Step seven, for each group of image pairs to be stitched except the first group of image pairs to be stitched, the stitching prediction results of the group of image pairs to be stitched and the adjacent previous group of image pairs to be stitched are input into the initial neural network model, so as to output the stitching prediction results of the group of image pairs to be stitched through the initial neural network model.

[0096] In actual implementation, each group of image pairs to be stitched except the first group of image pairs to be stitched can be understood as including each frame overlap_right except the first frame overlap_right_1 in the simulated video, and each frame overlap_left except the first frame overlap_left_1; in actual implementation, for each group of image pairs to be stitched except the first group of image pairs to be stitched, overlap_right and overlap_left in the current group of image pairs to be stitched, and the stitching prediction results of the adjacent previous group of image pairs to be stitched can be input into the initial neural network model, and the stitching search result of the image pairs to be stitched in the current group is used as GT, and the stitching prediction results of the image pairs to be stitched in the current group are output; the stitching prediction results include: the stitching prediction areas of overlap_right and overlap_left in the image pairs to be stitched in the current group; such as Figure 5As shown, overlap_right_2 and overlap_left_2 of the second frame, and seam_mask_left_1 of the first frame, i.e., the seam prediction results of the first group of image pairs to be stitched, are input into NN, i.e., the initial neural network model, and the seam search results of the second group of image pairs to be stitched are taken as GT, and seam_mask_left_2, i.e., the seam prediction results of the second group of image pairs to be stitched, are output; and so on, the seam prediction results of each group of image pairs to be stitched except the first group of image pairs to be stitched are output.

[0097] Step eight, based on the seam search results of the group of image pairs to be stitched and a preset loss function, calculate the loss value of the seam prediction results of the group of image pairs to be stitched.

[0098] The above loss function can be used to evaluate the degree of inconsistency between the patchwork prediction result output by the initial neural network model and the corresponding real patchwork search result. The degree of inconsistency can be represented by the above loss value. The loss function can be represented by Loss. In actual implementation, the design method of the above loss function can be as follows:

[0099] loss=loss_continue*scale+loss_gt;

[0100] Wherein, loss_continue=Max(L1(mask_cur-mask_prev),margin);

[0101] loss_gt=L1(mask_cur-mask_gt);

[0102] The above loss_continue represents the continuity loss between the output of the current group of image pairs to be stitched and the output of the previous group of image pairs to be stitched; scale represents the weight ratio of continuity loss, which is generally set to 0.1; loss_gt represents the L1 loss calculated between the output of the current group of image pairs to be stitched and the corresponding GT; mask_cur represents the stitching mask obtained by predicting the current group of image pairs to be stitched, that is, the stitching prediction result obtained by predicting the current group of image pairs to be stitched; mask_prev represents the stitching mask obtained by predicting the previous group of image pairs to be stitched, that is, the stitching prediction result obtained by predicting the previous group of image pairs to be stitched; margin is the allowable threshold of inconsistency, which is generally set to 0.2; mask_gt is the predicted stitching true value of the current group of image pairs to be stitched, and the predicted stitching true value is the real stitching search result of the current group of image pairs to be stitched.

[0103] Step nine, updating the weight parameters of the initial neural network model based on the loss value; continuing to execute the step of obtaining training samples containing multiple consecutive sets of image pairs to be spliced ​​until the initial neural network model converges to obtain a neural network model.

[0104] The weight parameters may include all parameters in the initial neural network model, such as convolution kernel parameters, etc. When training the initial neural network model, it is usually necessary to update all parameters in the initial neural network model based on the loss value of the seam prediction result of the set of image pairs to be spliced, so as to train the initial neural network model. Then, the step of obtaining training samples including multiple sets of continuous image pairs to be spliced ​​is continued until the initial neural network model converges or the loss value converges, and finally a trained neural network model is obtained.

[0105] The above-mentioned video image seam search method, for each frame of video image, inputs the image corresponding to the first overlapping area in the frame of video image and the image corresponding to the second overlapping area in the target image corresponding to the frame of video image into a pre-trained neural network model to obtain the seam prediction result of the frame of video image; and also discloses the training process of the neural network model. By predicting the seam area through the neural network, the processing speed of predicting the seam area can be accelerated and the processing efficiency can be improved.

[0106] Embodiment 5

[0107] This embodiment provides a video image splicing method, such as Figure 6 As shown, the method comprises the following steps:

[0108] Step S602, obtaining a first fisheye video and a second fisheye video; wherein the fisheye video images in the first fisheye video and the second fisheye video have an overlapping area.

[0109] A fisheye lens is a special camera lens with a short focal length and a large field of view, and its field of view angle can be close to or exceed 180 degrees. In actual implementation, a first fisheye video can be shot through a first fisheye lens, and a second fisheye video can be shot through a second fisheye lens in the same scene and at the same time. The fields of view corresponding to the first fisheye lens and the second fisheye lens are usually different, and the first fisheye video and the second fisheye video have overlapping fields of view. Since the first fisheye lens and the second fisheye lens shoot at the same time, the corresponding fisheye video images in the first fisheye video and the second fisheye video usually have overlapping areas. For example, the first frame of fisheye video image in the first fisheye video has an overlapping area with the first frame of fisheye video image in the second fisheye video, the second frame of fisheye video image in the first fisheye video has an overlapping area with the second frame of fisheye video image in the second fisheye video, and so on.

[0110] Step S604: extracting a first target region of each frame of the fisheye video image in the first fisheye video and a second target region of each frame of the fisheye video image in the second fisheye video.

[0111] The above-mentioned target area can be understood as the effective area in the fisheye video image, that is, the area containing the photographed object; in actual implementation, the original fisheye video image captured by the fisheye lens is generally square or rectangular, and there is a circular area in the square or rectangular area, which corresponds to the effective area of ​​the fisheye video image. The area other than the circular area in the square or rectangular area is usually a black background area. After obtaining the first fisheye video and the second fisheye video, it is necessary to extract the first target area corresponding to the circular area of ​​each frame of the fisheye video image in the first fisheye video, and extract the second target area corresponding to the circular area of ​​each frame of the fisheye video image in the second fisheye video; specifically, the preset pixel value can be used as a threshold to filter the black background area in the fisheye video image, for example, the pixel value 20 can be used as a threshold, etc., to extract the circular effective area of ​​the fisheye video image.

[0112] Step S606, for two corresponding frames of fisheye video images, based on the first target area and the second target area corresponding to the two frames of fisheye video images, and the pre-acquired updated expansion parameter value, determine the first equidistant projection image after the fisheye video image frame in the first fisheye video is expanded, and the second equidistant projection image after the fisheye video image frame in the second fisheye video is expanded.

[0113] The above-mentioned equidistant projection image can also be called an equidistant cylindrical projection image; the above-mentioned updated expansion parameters usually include fisheye lens parameters related to the expansion of fisheye video images, for example, they may include field of view angle parameter values, optical center related parameter values ​​or fisheye rotation angle parameter values, etc.; in actual implementation, the method of expanding the fisheye video image into an equidistant projection image is usually as follows: first, the target area is extracted, that is, the fisheye video image after the circular effective area is extracted, is converted from two-dimensional fisheye coordinates to three-dimensional coordinates, and then the spherical coordinates of the fisheye video image after the circular effective area is extracted are expanded according to the longitude and latitude mapping to obtain the expanded equidistant projection image corresponding to the fisheye video image.

[0114] The following is a further explanation of the process of expanding the fisheye video image into an equidistant projection image. Figure 7A schematic diagram of an equidistant projection image expansion method is shown. In the Normalised fisheye coordinates corresponding to the target area of ​​the fisheye video image, the pixel point with the coordinate position (x, y) is taken as an example. The distance between the pixel point with the coordinate position (x, y) and the origin in the coordinate system is r, and the angle with the x-axis direction is θ. Through the conversion formulas φ=raperture / 2 and θ=atan2(y, x), the fisheye video image after the circular effective area is extracted is converted from the normalized fisheye coordinates to the three-dimensional coordinates, that is, Figure 7 In the process from 2D fisheye to 3D vector, the pixel point (x, y) in the normalized fisheye coordinate system is converted to P(x, y, z) in the 3D coordinate system, and then the longitude = atan2(P y , P x ), latitude = atan2(P z ,√(P x 2 +P y 2 )) to get the corresponding longitude and latitude values, that is, Figure 7 In the process of 3D vector to longitude / latitude (3D vector to longitude / latitude value); then through x = longitude / π and y = 2latitude / π, the 3D coordinate system is expanded according to the longitude and latitude mapping to obtain the corresponding position of the pixel point with coordinate position (x, y) in the target area of ​​the fisheye video image in the equidistant projection image, that is, Figure 7 In the process of 3D vector to 2D equirectangular (3D vector to 2D equirectangular image), the equirectangular image corresponding to the fisheye video image is obtained based on the corresponding position and pixel value of each pixel point in the target area in the equirectangular image.

[0115] It can be seen from the above process that the fisheye video image after the target area is extracted can be input into the corresponding equidistant projection expansion module to output the equidistant projection image. The parameter aperture of the fisheye lens field of view needs to be used in the above conversion formula, that is, after the field of view of the fisheye lens is known, it can be expanded according to the above conversion formula; the r value in the above formula can be determined according to the coordinate value of (x, y), and the specific determination method can refer to the determination method in the prior art, which will not be repeated here. The above expansion method can calculate the remap parameter of the image transformation, that is, the mapping relationship of the coordinates represented by the above conversion formula. Since the remap parameter adopts a pixel-by-pixel serial processing method, the processing process is time-consuming and the processing efficiency is relatively low. Processing based on block warp can improve the efficiency of hardware implementation, wherein block warp is to block the target area of ​​the fisheye video image, and the obtained multiple small images after block can be processed in parallel, so the processing efficiency can be improved.

[0116] Correspondingly, the isometric projection image can also be reversely converted into the target area of ​​the fisheye video image, such as Figure 7 As shown, specifically, the conversion formula can be longitude = xπ, latitude = yπ / 2, P x =cos(latitude)cos(longitude),P y =cos(latitude)sin(longitude),P z =sin(latitude),r=2atan2(√(P x 2 +P z 2), Py) / aperture, θ=atan2(P z , P x ), x=rcos(θ) and y=rsin(θ), realizing the process of converting the equidistant projection picture into the target area of ​​the fisheye video image.

[0117] In actual implementation, due to process errors in the manufacture and installation of fisheye cameras, in order to avoid the influence of these errors on the equidistant projection image expansion process, it is necessary to update the corresponding expansion parameters, such as the field of view angle parameter value, the relevant parameter value of the optical center or the fisheye rotation angle parameter value, to obtain updated expansion parameters; then, for two corresponding frames of fisheye video images, based on the first target area and the second target area respectively corresponding to the two frames of fisheye video images, and the updated expansion parameters, refer to the above-mentioned equidistant projection image expansion method, the first target area is expanded into a first equidistant projection image, and the second target area is expanded into a second equidistant projection image.

[0118] Step S608, determining a stitching search result based on the first equidistant projection picture and the second equidistant projection picture that correspond to each other; wherein the stitching search result is determined using the method in the above-mentioned embodiment.

[0119] In actual implementation, after obtaining the above-mentioned first equidistant projection image and second equidistant projection image, the corresponding stitching search result can be determined based on the corresponding first equidistant projection image and second equidistant projection image; for example, based on the first equidistant projection image after the first frame of fisheye video image in the first fisheye video is expanded, and the second equidistant projection image after the first frame of fisheye video image in the second fisheye video is expanded, the stitching search result of the first equidistant projection image and the second equidistant projection image can be determined according to the scheme for determining the stitching search result in the aforementioned embodiment.

[0120] Step S610 , determining a video stitching result of the video images based on the stitching search results corresponding to each group of two corresponding fisheye video images.

[0121] In actual implementation, the stitching search results corresponding to each group of two corresponding fisheye video images can be determined according to the above steps, and based on the obtained multiple stitching search results, the video stitching results of the video images can be determined.

[0122] The above-mentioned video image stitching method first obtains the first fisheye video and the second fisheye video; extracts the first target area of ​​each frame of the fisheye video image in the first fisheye video, and the second target area of ​​each frame of the fisheye video image in the second fisheye video. Then, for the two corresponding fisheye video images, based on the first target area and the second target area corresponding to the two fisheye video images, and the pre-acquired update expansion parameter value, determine the first equidistant projection image of the fisheye video image in the first fisheye video after the frame is expanded, and the second equidistant projection image of the fisheye video image in the second fisheye video after the frame is expanded. Finally, based on the first equidistant projection image and the second equidistant projection image corresponding to each other, determine the stitching search results; based on the stitching search results corresponding to each group of two corresponding fisheye video images, determine the video stitching results of the video images. This method determines the stitching search result based on the energy map of the video image, and for video images other than the first frame, the stitching search area range is first determined based on the stitching search result of the previous frame of the video image, and then the stitching search result is determined within the stitching search area range. This method of constraining the stitching search area range can reduce the stitching area difference between the previous and next frames of the video image, alleviate the jitter problem of the stitched video during playback, and thereby improve the stitching effect of the panoramic video.

[0123] Embodiment 6

[0124] This embodiment provides another video image stitching method, which is implemented on the basis of the method in the above embodiment, and includes the following steps:

[0125] Step 802, obtaining a first fisheye video and a second fisheye video; wherein the fisheye video images in the first fisheye video and the second fisheye video have an overlapping area.

[0126] Step 804 , extracting a first target region of each frame of the fisheye video image in the first fisheye video and a second target region of each frame of the fisheye video image in the second fisheye video.

[0127] Step 806, for two corresponding frames of fisheye video images, based on the first target area and the second target area corresponding to the two frames of fisheye video images, and the pre-acquired updated expansion parameter value, determine the first equidistant projection image of the frame of fisheye video image in the first fisheye video after the expansion, and the second equidistant projection image of the frame of fisheye video image in the second fisheye video after the expansion.

[0128] The above-mentioned updated expansion parameter values ​​include: field of view angle parameter value, parameter value of the optical center in the x-axis direction, parameter value of the optical center in the y-axis direction, and fisheye rotation angle parameter value; the field of view angle parameter value can be a combination of the known standard field of view angle of the fisheye lens and the field of view angle offset, wherein the field of view angle offset can be represented by aperture_shift. For example, the known standard field of view angle of the fisheye lens is 190 degrees. Due to the manufacturing and installation process errors of the fisheye camera, the actual field of view angle may be offset. The estimated field of view angle offset is +5 degrees, and the field of view angle parameter value is 190+5=195. degrees; the parameter value of the optical center in the x-axis direction and the parameter value of the optical center in the y-axis direction can be understood as the coordinates of the optical center in the x-axis direction and the y-axis direction after considering the optical center offset, wherein the offset of the optical center in the x-axis direction can be represented by x_shift, and the offset of the optical center in the y-axis direction can be represented by y_shift; the fisheye rotation angle parameter value can be understood as the fisheye rotation angle after considering the fisheye rotation angle offset, wherein the fisheye rotation angle offset can be represented by rotation_shift; the update expansion parameter value is determined in advance by the following steps eleven to fifteen:

[0129] Step eleven: obtaining an initial expansion parameter value and a preset offset range of each expansion parameter.

[0130] The above-mentioned initial expansion parameter values ​​usually include an initial parameter value of the field of view angle, an initial parameter value of the optical center in the x-axis direction, an initial parameter value of the optical center in the y-axis direction, and an initial parameter value of the fisheye rotation angle. The initial expansion parameter values ​​can usually be obtained from the camera parameters given by the fisheye camera; the above-mentioned preset offset range usually includes an offset range corresponding to each expansion parameter, and the preset offset range is usually an offset range estimated by technicians for each expansion parameter based on experience; for the convenience of explanation, taking a binocular fisheye camera as an example, in actual implementation, for an existing binocular fisheye camera, the initial expansion parameter values ​​corresponding to the above four expansion parameters can be obtained from the camera parameters given by the fisheye camera, and a suitable offset range is set for each expansion parameter based on experience. The offset range should generally not be too large. For example, the initial expansion parameter value of the field of view angle is 190 degrees, and the corresponding preset offset range is set to ±10 degrees based on experience.

[0131] Step twelve, based on the initial expansion parameter value and the preset offset range of each expansion parameter, sample each expansion parameter to obtain the sampled value of each expansion parameter, and based on the sampled value of each expansion parameter, determine the third equidistant projection image of the frame of fisheye video image in the first fisheye video after expansion, and the fourth equidistant projection image of the frame of fisheye video image in the second fisheye video after expansion.

[0132] In actual implementation, after obtaining the initial expansion parameter value and preset offset range of each expansion parameter, random sampling can be performed for the above four expansion parameters in combination with the initial expansion parameter value and preset offset range of each expansion parameter. Among the four expansion parameters, each expansion parameter takes a sampling value to form a group of sampling values. For example, among the four expansion parameters, the offset of each expansion parameter has two optional values, 0 and 1 respectively, so the sampling values ​​of the four expansion parameters are 2 in total. 4 There are 16 combinations, each of which corresponds to a set of sampling values. Based on each set of sampling values, each frame of fisheye video image of the extracted target area in the first fisheye video is expanded to obtain a third equidistant projection image after expansion, and each frame of fisheye video image of the extracted target area in the second fisheye video is expanded to obtain a fourth equidistant projection image after expansion.

[0133] Step thirteen: extract a fourth overlapping area of ​​the third equidistant projection image and the fourth equidistant projection image.

[0134] A fourth overlapping area is extracted from the expanded third equidistant projection picture and the fourth equidistant projection picture that correspond to each other. The fourth overlapping area generally includes: a partial image area corresponding to the fourth overlapping area in the third equidistant projection picture, and a partial image area corresponding to the fourth overlapping area in the fourth equidistant projection picture.

[0135] Step fourteen: performing cross-correlation calculation on the fourth overlapping area to obtain a first cross-correlation calculation result.

[0136] After extracting the fourth overlapping area, a cross-correlation calculation may be performed on the partial image area corresponding to the third equidistant projection image and the partial image area corresponding to the fourth equidistant projection image contained in the fourth overlapping area to obtain a first cross-correlation calculation result, which may reflect a measure of similarity between the two partial image areas. Figure 8 A schematic diagram of cross-correlation calculation is shown in FIG. Figure 8 Including two signals f and g, f*g represents the cross-correlation settlement result of the two signals. It can be seen that the larger the data of the cross-correlation calculation result is, the more similar the two partial image areas are. Conversely, the smaller the value of the cross-correlation calculation result is, the more dissimilar the two partial image areas are.

[0137] Step 15: Determine the update expansion parameter value based on the first cross-correlation calculation result and the preset number of iterations.

[0138] The preset number of iterations can be set according to actual needs. For example, the preset number of iterations can be set to 10,000 times. In actual implementation, the update expansion parameters can be determined based on the first cross-correlation calculation result and the preset number of iterations.

[0139] Specifically, step fifteen can be implemented through the following steps A to C:

[0140] Step A, repeating the step of sampling each expansion parameter based on the initial expansion parameter value and the preset offset range of each expansion parameter according to a preset number of iterations, to obtain a plurality of first cross-correlation calculation results.

[0141] For ease of understanding, assuming that the preset number of iterations is 10,000, the step of sampling each expansion parameter based on the initial expansion parameter value and the preset offset range of each expansion parameter is repeated 10,000 times, so that 10,000 first cross-correlation calculation results can be obtained.

[0142] Step B: Selecting the first mutual correlation calculation result with the largest value from the multiple first mutual correlation calculation results.

[0143] Since the larger the value of the first mutual correlation calculation result is, the higher the similarity between the two partial image areas is, and the corresponding sampling value of the expansion parameter is more appropriate, the first mutual correlation calculation result with the largest value can be selected from the multiple calculated first mutual correlation calculation results.

[0144] Step C: determining the sample value of the expansion parameter corresponding to the first mutual correlation calculation result with the largest value as the updated expansion parameter value.

[0145] The first cross-correlation calculation result with the largest value indicates that the similarity between the two partial image regions is the highest. Therefore, the corresponding expansion parameter sampling value is the most appropriate, and the expansion parameter sampling value can be determined as the above-mentioned updated expansion parameter value.

[0146] The above-mentioned offline adaptive expansion parameter optimization process can enable the algorithm to adaptively obtain the optimal expansion parameters of the binocular fisheye camera. For a binocular fisheye camera with a fixed assembly, the offline calculation process only needs to be performed once.

[0147] Step 808: align the first equidistant projection image and the second equidistant projection image that correspond to each other.

[0148] Since the update expansion parameters obtained by offline optimization can generally only align well for scenes with a fixed depth of field, it is necessary to dynamically align the images when the depth of field changes significantly. There are two ways of dynamic alignment: one is a dynamic alignment method based on feature point matching, and the other is an affine parameter search method based on cross-correlation maximization. The two implementation methods are introduced below.

[0149] The above-mentioned dynamic alignment method based on feature point matching can be implemented through the following steps 20 to 22:

[0150] Step 20: extracting first feature points from the first equidistant projection image, and extracting second feature points from the second equidistant projection image.

[0151] In order to better align images, it is usually necessary to select representative areas in the isometric projection image, such as corner points, edge points, bright spots in dark areas or dark spots in bright areas in the isometric projection image. The above-mentioned first feature points can be corner points, edge points, bright spots in dark areas or dark spots in bright areas extracted from the first isometric projection image; the above-mentioned second feature points can be corner points, edge points, bright spots in dark areas or dark spots in bright areas extracted from the second isometric projection image; in actual implementation, the feature points of the above-mentioned isometric projection image can be extracted based on SIFT (Scale-Invariant Feature Transform) and other methods; wherein SIFT is a description used in the field of image processing, which has scale invariance, can detect key points in the image, and is a local feature descriptor.

[0152] Step 21: Determine a matching feature point pair based on the first feature point and the second feature point.

[0153] After extracting the first feature point in the first equidistant projection image and the second feature point in the second equidistant projection image through the above steps, the first feature point and the second feature point can be matched in a block manner. Fig. 9 A schematic diagram of image alignment is shown in FIG. Fig. 9 In the example, img1 corresponds to the first equidistant projection image, and img2 corresponds to the second equidistant projection image. The specific method of block division can be to match the feature points of the left half of img1 with the right half of img2, and to match the feature points of the right half of img1 with the left half of img2 to obtain the corresponding matching feature point pairs. Based on the obtained matching feature point pairs, img1 and img2 are aligned. The alignment method can be to minimize the difference between the matching feature points of img1 and img2 in the w dimension, so that the overlapping areas after splicing can be aligned as much as possible. For example, this can be achieved by calculating the Euclidean distance of the 128-dimensional key points of the two sets of feature points. The smaller the Euclidean distance, the higher the similarity. When the Euclidean distance is less than the set threshold, it can be determined that the match is successful.

[0154] Step 22: align the first equidistant projection image and the second equidistant projection image based on the matching feature point pairs.

[0155] Based on the determined matching feature point pairs, the first equidistant projection image and the second equidistant projection image are aligned. Each corresponding first equidistant projection image and second equidistant projection image are dynamically aligned in a feature point matching-based manner.

[0156] The above-mentioned affine parameter search method based on cross-correlation maximization can be implemented through the following steps 30 to 33:

[0157] Step 30, moving the second equidistant projection image in a preset direction.

[0158] The above-mentioned preset direction may be to move the second equidistant projection image horizontally, for example, see Fig. 9 As shown in the figure, for the expanded images img1 and img2, img2 can be moved horizontally to align with img1. For example, img2 can be moved to the left first, and then to the right. During the movement, the matching degree between img2 and img1 usually changes.

[0159] Step 31: During the moving process, extract multiple fifth overlapping areas of the first equidistant projection image and the second equidistant projection image.

[0160] By moving Fig. 9The overlapping area can be extracted from img2 in . Specifically, the corresponding overlapping area can be estimated based on the aperture field of view parameters. For example, for a binocular fisheye camera, if the aperture field of view of each fisheye lens in the two fisheye lenses is 180 degrees, the overlapping area is 0. If the aperture field of view of each fisheye lens is greater than 180 degrees, the corresponding overlapping area can be estimated based on the overlapping angle of the aperture field of view of the two fisheye lenses. In actual implementation, multiple fifth overlapping areas of the first equidistant projection image and the second equidistant projection image can be extracted during the process of moving the second equidistant projection image.

[0161] Step 32: Perform cross-correlation calculation on the multiple fifth overlapping areas respectively to obtain multiple second cross-correlation calculation results.

[0162] After extracting the above-mentioned multiple fifth overlapping areas, cross-correlation calculation can be performed on the partial image area corresponding to the first equidistant projection image contained in each fifth overlapping area, and the partial image area corresponding to the second equidistant projection image, to obtain the respective corresponding second cross-correlation calculation results, and the similarity between the two partial image areas is reflected by the second cross-correlation calculation results.

[0163] Step thirty-three: align the first equidistant projection image and the second equidistant projection image based on multiple second cross-correlation calculation results.

[0164] Specifically, step thirty-three can be implemented by the following steps H to K:

[0165] Step H: Selecting the second cross-correlation calculation result with the largest value from the multiple second cross-correlation calculation results.

[0166] Since a larger value of the second mutual correlation calculation result indicates a higher similarity between two partial image regions, the second mutual correlation calculation result with the largest value may be selected from the multiple second mutual correlation calculation results obtained by calculation.

[0167] Step I, obtaining the position coordinates of the first boundary pixel point corresponding to the fifth overlapping area corresponding to the second cross-correlation calculation result with the largest value in the first equidistant projection image, and the position coordinates of the second boundary pixel point corresponding to the second equidistant projection image.

[0168] Step J: Calculate an affine transformation matrix based on the position coordinates of the first boundary pixel point and the position coordinates of the second boundary pixel point.

[0169] Step K: aligning the first equidistant projection image and the second equidistant projection image based on the affine transformation matrix.

[0170] Search for an alignment parameter that maximizes the cross-correlation of the overlapping areas. The alignment parameter may also be referred to as an image boundary point. The image boundary point is the position coordinates of the first boundary pixel point in the first equidistant projection image corresponding to the second cross-correlation calculation result with the largest value mentioned above, and the position coordinates of the second boundary pixel point in the second equidistant projection image. Based on the searched position coordinates of the first boundary pixel point and the second boundary pixel point, calculate the affine parameter of the second equidistant projection image. The affine parameter may also be referred to as an affine transformation matrix. Based on the affine transformation matrix, the second equidistant projection image is projected and transformed to be well aligned with the first equidistant projection image.

[0171] Step 810: extract a third overlapping area based on the aligned first equidistant projection image and the second equidistant projection image.

[0172] The third overlapping area is extracted based on the aligned first equidistant projection image and the second equidistant projection image. Specifically, the third overlapping area can be extracted based on feature point matching. For example, after determining the matching feature point pairs, the first equidistant projection image and the second equidistant projection image can be matched according to the matching feature point pairs to extract the third overlapping area. The third overlapping area can also be determined based on aperture prior information. For example, for a binocular fisheye camera, if the aperture field of view of each of the two fisheye lenses is 180 degrees, the overlapping area is 0. If the aperture field of view of each fisheye lens is greater than 180 degrees, the corresponding third overlapping area can be estimated based on the overlapping angle of the aperture field of view of the two fisheye lenses.

[0173] Step 812: Based on the third overlapping area, perform illumination compensation on the second equidistant projection picture, so that the pixel value of each pixel in the illumination-compensated second equidistant projection picture matches the pixel value of each pixel in the corresponding first equidistant projection picture.

[0174] Based on the extracted third overlapping area, illumination compensation is performed on the second equidistant projection image. For example, a histogram matching method can be used to map the pixel value distribution of each pixel in the second equidistant projection image to a distribution similar to the pixel value of each pixel in the first equidistant projection image. Of course, other illumination compensation methods can also be used. For details, please refer to the illumination compensation methods in the relevant technology, which will not be repeated here.

[0175] Step 814: determine the stitching search results based on the first equidistant projection image and the second equidistant projection image after illumination compensation.

[0176] In actual implementation, after obtaining the above-mentioned first equidistant projection image and the second equidistant projection image after illumination compensation, the scheme for determining the stitching search results in the aforementioned embodiment can be used to determine the stitching search results of the first equidistant projection image and the corresponding second equidistant projection image after illumination compensation.

[0177] Step 816 : for each group of two corresponding fisheye video images, based on the stitching search results corresponding to the two fisheye video images in the group, determine the fused overlapping area corresponding to the two fisheye video images in the group.

[0178] In actual implementation, for each group of two corresponding fisheye video images, after obtaining the stitching search results corresponding to the two fisheye video images in each group, a fusion result of the overlapping area corresponding to the two fisheye video images in each group can be obtained through a fusion operation.

[0179] Step 818: Replace the third overlapping area corresponding to the two fisheye video images in the group with the fused overlapping area to obtain an image stitching result of the two fisheye video images in the group.

[0180] In actual implementation, for two fisheye video images in each group, the corresponding fused overlapping area can be used to replace the corresponding aligned third overlapping area to obtain the image stitching result of the two fisheye video images in the group.

[0181] In addition, it should be noted that the image stitching result of the two frames of fisheye video images in each group can also be obtained based on the optical flow method. Specifically, the optical flow information of the overlapping area of ​​the first equidistant projection image and the second equidistant projection image after illumination compensation is calculated, and the remap (remapping) transformation parameters of the second equidistant projection image after illumination compensation are calculated based on the optical flow information. Based on the calculated remap transformation parameters, the optical flow information of the overlapping area corresponding to the second equidistant projection image after illumination compensation is fused with the optical flow information of the overlapping area corresponding to the first equidistant projection image, thereby realizing the fusion of the overlapping area of ​​the first equidistant projection image and the second equidistant projection image after illumination compensation. For the case where each frame does not need to be updated, the remap transformation parameters can be merged into the remap parameters when the fisheye video image after extracting the target area is expanded into an equidistant projection image to reduce the amount of calculation; for the image fused by the optical flow method, the fused image can be directly obtained, that is, the image stitching result is obtained.

[0182] Step 820 , determining a video stitching result of the video images based on the image stitching results of the two frames of fisheye video images in each group.

[0183] In time sequence, the image stitching results of two frames of fisheye video images in each group are combined into a video stitching result of the video image.

[0184] The above-mentioned video image stitching method first aligns the first equidistant projection image and the second equidistant projection image corresponding to each other; extracts the third overlapping area based on the aligned first equidistant projection image and the second equidistant projection image; then performs illumination compensation on the second equidistant projection image based on the third overlapping area, so that the pixel value of each pixel in the second equidistant projection image after illumination compensation matches the pixel value of each pixel in the corresponding first equidistant projection image; determines the stitching search results based on the first equidistant projection image and the second equidistant projection image after illumination compensation; finally, for each group of two corresponding fisheye video images, based on the stitching search results corresponding to the two fisheye video images in the group, determines the fused overlapping area corresponding to the two fisheye video images in the group. Replaces the third overlapping area corresponding to the two fisheye video images in the group with the fused overlapping area to obtain the image stitching result of the two fisheye video images in the group; determines the video stitching result of the video image based on the image stitching result of the two fisheye video images in each group. This method determines the stitching search result based on the energy map of the video image, and for video images other than the first frame, the stitching search area range is first determined based on the stitching search result of the previous frame of the video image, and then the stitching search result is determined within the stitching search area range. This method of constraining the stitching search area range can reduce the stitching area difference between the previous and next frames of the video image, alleviate the jitter problem of the stitched video during playback, and thereby improve the stitching effect of the panoramic video.

[0185] The above-mentioned video image stitching method can improve the stitching alignment effect of video images and the adaptability to different binocular fisheye modules through an offline adaptive expansion parameter optimization process; the stitching effect of the stitching algorithm for scenes with different depths of field can be improved through a dynamic precise alignment algorithm; in addition, a method based on the stitching prediction fusion of video images can improve the stability of video image stitching and improve the stitching effect of panoramic videos; and the above-mentioned method also uses neural network distillation and block warp instead of remap operation to achieve hardware acceleration.

[0186] Embodiment 7

[0187] This embodiment provides a video image seam search device, such as Fig.10As shown, the device includes: a first acquisition module 100, used to acquire an energy map of each frame of a video image in a first video; wherein the energy map is used to indicate a position area and an edge of a specified object in the video image; a first determination module 101, used to determine, for a first frame of a video image in the first video, a stitching search result of the first frame of the video image based on the energy map of the first frame of the video image; wherein the stitching search result includes: a stitching area between the video image and a target image; the target image is a video image corresponding to the video image in a second video; a second determination module 102, used to determine, for each frame of the video image except the first frame in the first video, a stitching search area range of the current video image based on a stitching search result of a frame of the video image before the current video image; within the stitching search area range, determine the stitching search result of the current video image based on the energy map of the current video image.

[0188] The above-mentioned video image seam search device first obtains the energy map of each frame of video image in the first video; then, for the first frame of video image in the first video, based on the energy map of the first frame of video image, determines the seam search result of the first frame of video image; for each frame of video image except the first frame in the first video, based on the seam search result of the previous frame of video image, determines the seam search area range of the current video image; within the seam search area range, determines the seam search result of the current video image based on the energy map of the current video image. The device determines the seam search result based on the energy map of the video image, and for video images except the first frame, first determines the seam search area range based on the seam search result of the previous frame of video image, and then determines the seam search result within the seam search area range. This method of constraining the seam search area range can reduce the seam area difference between the previous and next frames of video images, alleviate the jitter problem of the spliced ​​video during playback, and thus improve the splicing effect of the panoramic video.

[0189] Furthermore, the first acquisition module 100 is also used to: obtain the salient target energy map, the motion target energy map and the edge energy map of each frame of video image in the first video; for each frame of video image, fuse the salient target energy map, the motion target energy map and the edge energy map corresponding to the frame of video image to obtain the energy map of the frame of video image.

[0190] Furthermore, the first acquisition module 100 is also used to: for each frame of video image in the first video, input the video image into a preset neural network model to output a salient target energy map of the frame of video image through the preset neural network model; determine the motion target energy map of the frame of video image based on the motion target in the frame of video image; perform edge detection on each object in the frame of video image to obtain an edge energy map of the frame of video image.

[0191] Furthermore, the first determination module 101 is further configured to: for a first frame of video image in the first video, based on an energy graph of the first frame of video image, use a dynamic programming algorithm to calculate a stitching search result of the first frame of video image.

[0192] Furthermore, the second determination module 102 is also used to: for each frame of video image except the first frame in the first video, based on the stitching search result of the previous frame of the current video image, add preset constraints to determine the stitching search area range of the current video image; within the stitching search area range, based on the energy map of the current video image, use a dynamic programming algorithm to determine the stitching search result of the current video image.

[0193] Furthermore, in the first video, each frame of video image has an overlapping area with the target image corresponding to the video image, and the area corresponding to the overlapping area in the video image is the first overlapping area, and the area corresponding to the overlapping area in the target image is the second overlapping area; the device is also used to: for each frame of video image, input the image corresponding to the first overlapping area in the frame of video image and the image corresponding to the second overlapping area in the target image corresponding to the frame of video image into a pre-trained neural network model to obtain a stitching prediction result of the frame of video image; wherein the stitching prediction result includes: the stitching prediction area of ​​the video image and the target image.

[0194] Furthermore, the device also includes a neural network model determination module, which is used to: obtain training samples containing multiple consecutive groups of image pairs to be stitched, and stitching search results of each group of image pairs to be stitched; for each group of image pairs to be stitched except the first group of image pairs to be stitched, input the stitching prediction results of the group of image pairs to be stitched and the adjacent previous group of image pairs to be stitched into the initial neural network model, so as to output the stitching prediction results of the group of image pairs to be stitched through the initial neural network model; based on the stitching search results of the group of image pairs to be stitched and a preset loss function, calculate the loss value of the stitching prediction results of the group of image pairs to be stitched; update the weight parameters of the initial neural network model based on the loss value; and continue to execute the step of obtaining training samples containing multiple consecutive groups of image pairs to be stitched until the initial neural network model converges to obtain the neural network model.

[0195] Furthermore, the neural network model determination module is also used to: obtain a preset stitching template; wherein the preset stitching template includes a preset stitching area; for a first group of image pairs to be stitched, input the first group of image pairs to be stitched and the preset stitching template into the initial neural network model, so as to output the stitching prediction results of the first group of image pairs to be stitched through the initial neural network model.

[0196] The implementation principle and technical effects of the video image seam search device provided in the embodiment of the present invention are the same as those of the aforementioned video image seam search method embodiment. For the sake of brief description, for matters not mentioned in the embodiment of the video image seam search device, reference may be made to the corresponding contents in the aforementioned video image seam search method embodiment.

[0197] Embodiment 8

[0198] This embodiment provides a video image splicing device, such as Fig.11 As shown, the device includes: a second acquisition module 110, used to acquire a first fisheye video and a second fisheye video; wherein the fisheye video images in the first fisheye video and the second fisheye video have an overlapping area; an extraction module 111, used to extract a first target area of ​​each frame of the fisheye video image in the first fisheye video, and a second target area of ​​each frame of the fisheye video image in the second fisheye video; a third determination module 112, used to determine, for two corresponding frames of fisheye video images, a first equidistant projection image of the frame of the fisheye video image in the first fisheye video after expansion, and a second equidistant projection image of the frame of the fisheye video image in the second fisheye video after expansion based on the first target area and the second target area corresponding to the two frames of the fisheye video images, and a pre-acquired update expansion parameter value; a fourth determination module 113, used to determine a stitching search result based on the first equidistant projection image and the second equidistant projection image corresponding to the two frames of the fisheye video images; wherein the stitching search result is determined by the stitching search device of the video image; a fifth determination module 114, used to determine a video stitching result of the video image based on the stitching search result corresponding to each group of two corresponding frames of the fisheye video images.

[0199] The above-mentioned video image stitching device first obtains the first fisheye video and the second fisheye video; extracts the first target area of ​​each frame of the fisheye video image in the first fisheye video, and the second target area of ​​each frame of the fisheye video image in the second fisheye video. Then, for the two corresponding frames of fisheye video images, based on the first target area and the second target area corresponding to the two frames of fisheye video images, and the pre-acquired update expansion parameter value, determine the first equidistant projection picture after the frame of the fisheye video image in the first fisheye video is expanded, and the second equidistant projection picture after the frame of the fisheye video image in the second fisheye video is expanded. Finally, based on the first equidistant projection picture and the second equidistant projection picture corresponding to each other, determine the stitching search result; based on the stitching search result corresponding to each group of two corresponding frames of fisheye video images, determine the video stitching result of the video images. The device determines the stitching search result based on the energy map of the video image, and for video images other than the first frame, first determines the stitching search area range based on the stitching search result of the previous frame of the video image, and then determines the stitching search result within the stitching search area range. This method of constraining the stitching search area range can reduce the stitching area difference between the previous and next frames of the video image, alleviate the jitter problem of the stitched video during playback, and thus improve the stitching effect of the panoramic video.

[0200] Furthermore, the fourth determination module 113 is also used to: align the corresponding first equidistant projection image and the second equidistant projection image; extract the third overlapping area based on the aligned first equidistant projection image and the second equidistant projection image; based on the third overlapping area, perform illumination compensation on the second equidistant projection image so that the pixel value of each pixel in the second equidistant projection image after illumination compensation matches the pixel value of each pixel in the corresponding first equidistant projection image; determine the stitching search results based on the first equidistant projection image and the second equidistant projection image after illumination compensation.

[0201] Furthermore, the device also includes a parameter value determination module, and the updated expansion parameter values ​​include: field of view angle parameter value, parameter value of the optical center in the x-axis direction, parameter value of the optical center in the y-axis direction and fisheye rotation angle parameter value; the parameter value determination module is used to: obtain the initial expansion parameter value and preset offset range of each expansion parameter; based on the initial expansion parameter value and preset offset range of each expansion parameter, sample each expansion parameter to obtain the sampled value of each expansion parameter, and based on the sampled value of each expansion parameter, determine the third equidistant projection image of the frame of fisheye video image in the first fisheye video after expansion, and the fourth equidistant projection image of the frame of fisheye video image in the second fisheye video after expansion; extract the fourth overlapping area of ​​the third equidistant projection image and the fourth equidistant projection image; perform cross-correlation calculation on the fourth overlapping area to obtain a first cross-correlation calculation result; based on the first cross-correlation calculation result and the preset number of iterations, determine the updated expansion parameter value.

[0202] Furthermore, the parameter value determination module is also used to: repeat the step of sampling each expansion parameter based on the initial expansion parameter value and the preset offset range of each expansion parameter according to a preset number of iterations to obtain multiple first mutual correlation calculation results; select the first mutual correlation calculation result with the largest value from the multiple first mutual correlation calculation results; and determine the sampled value of the expansion parameter corresponding to the first mutual correlation calculation result with the largest value as the updated expansion parameter value.

[0203] Furthermore, the fourth determination module 113 is also used to: extract first feature points from the first equidistant projection image, and extract second feature points from the second equidistant projection image; determine matching feature point pairs based on the first feature points and the second feature points; and align the first equidistant projection image and the second equidistant projection image based on the matching feature point pairs.

[0204] Furthermore, the fourth determination module 113 is also used to: move the second equidistant projection image in a preset direction; during the movement, extract multiple fifth overlapping areas of the first equidistant projection image and the second equidistant projection image; perform cross-correlation calculations on the multiple fifth overlapping areas respectively to obtain multiple second cross-correlation calculation results; and align the first equidistant projection image and the second equidistant projection image based on the multiple second cross-correlation calculation results.

[0205] Furthermore, the fourth determination module 113 is also used to: select the second cross-correlation calculation result with the largest value from multiple second cross-correlation calculation results; obtain the position coordinates of the first boundary pixel point corresponding to the fifth overlapping area corresponding to the second cross-correlation calculation result with the largest value in the first equidistant projection image, and the position coordinates of the second boundary pixel point corresponding to the second equidistant projection image; calculate the affine transformation matrix based on the position coordinates of the first boundary pixel point and the position coordinates of the second boundary pixel point; and align the first equidistant projection image and the second equidistant projection image based on the affine transformation matrix.

[0206] Furthermore, the fourth determination module 113 is also used to: for each group of two corresponding fisheye video frames, determine the fused overlapping area corresponding to the two fisheye video frames in the group based on the stitching search results corresponding to the two fisheye video frames in the group; replace the third overlapping area corresponding to the two fisheye video frames in the group with the fused overlapping area to obtain the image stitching result of the two fisheye video frames in the group; and determine the video stitching result of the video image based on the image stitching result of the two fisheye video frames in each group.

[0207] The video image splicing device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned video image splicing method embodiment. For the sake of brief description, for matters not mentioned in the video image splicing device embodiment, reference may be made to the corresponding contents in the aforementioned video image splicing method embodiment.

[0208] Embodiment 9

[0209] This embodiment provides an electronic system, characterized in that the electronic system includes: an image acquisition device, a processing device and a storage device; the image acquisition device is used to obtain preview video frames or image data; the storage device stores a computer program, and when the computer program is run by the processed device, it executes the above-mentioned video image seam search method, or the above-mentioned video image splicing method.

[0210] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the electronic system described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0211] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, characterized in that when the computer program is executed by a processing device, the steps of the above-mentioned video image seam search method or the above-mentioned video image splicing method are executed.

[0212] The computer program product of the video image seam search method, video image stitching method and device provided in the embodiments of the present invention includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the method described in the previous method embodiments. The specific implementation can be referred to the method embodiments, which will not be repeated here.

[0213] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0214] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for searching for seams in a video image, characterized in that: The method comprises: Obtain an energy map of each frame of video image in the first video; wherein the energy map is used to indicate the position area and edge of the specified object in the video image; the position area is represented as the area occupied by the specified object in the video image; the edge is represented as the outer edge contour corresponding to the specified object in the video image; the energy map is represented in the form of a grayscale map, in which the higher the grayscale value of a pixel point is, the greater the energy of the pixel point is, and the higher the corresponding energy value is; the lower the grayscale value of the pixel point is, the smaller the energy of the pixel point is, and the lower the corresponding energy value is; For a first frame of video image in the first video, based on an energy map of the first frame of video image, determining a stitching search result of the first frame of video image; wherein the stitching search result includes: a stitching area of ​​the video image and a target image; the target image is a video image in the second video corresponding to the video image; For each frame of video image in the first video except the first frame, a stitching search area range of the current video image is determined based on a stitching search result of a previous frame of video image of the current video image; within the stitching search area range, a stitching search result of the current video image is determined based on an energy map of the current video image.

2. The method according to claim 1, characterized in that The step of obtaining an energy graph of each frame of video image in the first video comprises: Obtaining a salient target energy map, a moving target energy map, and an edge energy map of each frame of the video image in the first video; For each frame of the video image, the salient target energy map, the moving target energy map and the edge energy map corresponding to the frame of the video image are fused to obtain the energy map of the frame of the video image.

3. The method according to claim 2, characterized in that The step of obtaining a salient target energy map, a moving target energy map and an edge energy map of each frame of video image in the first video comprises: For each frame of video image in the first video, the video image is input into a preset neural network model, so as to output a salient target energy map of the frame of video image through the preset neural network model; Determine a moving target energy map of the frame of video image based on the moving target in the frame of video image; Perform edge detection on each object in the frame of video image to obtain an edge energy map of the frame of video image.

4. The method according to any one of claims 1 to 3, characterized in that: The step of determining the stitching search result of the first frame of video image in the first video based on the energy graph of the first frame of video image comprises: For a first frame of video image in the first video, based on an energy graph of the first frame of video image, a dynamic programming algorithm is used to calculate a stitching search result of the first frame of video image.

5. The method according to any one of claims 1 to 4, characterized in that: determining, for each frame of video image except the first frame in the first video, a stitching search area range of the current video image based on a stitching search result of a frame of video image previous to the current video image; The step of determining the stitching search results of the current video image based on the energy map of the current video image within the stitching search area includes: For each video image frame other than the first frame in the first video, based on the stitching search result of the previous video image frame of the current video image, a preset constraint condition is added to determine the stitching search area range of the current video image; Within the seam search area, based on the energy map of the current video image, a dynamic programming algorithm is used to determine the seam search result of the current video image.

6. The method according to claim 1, characterized in that In the first video, each frame of the video image has an overlapping area with the target image corresponding to the video image, and the area corresponding to the overlapping area in the video image is a first overlapping area, and the area corresponding to the overlapping area in the target image is a second overlapping area; the method further includes: For each frame of video image, the image corresponding to the first overlapping area in the frame of video image and the image corresponding to the second overlapping area in the target image corresponding to the frame of video image are input into a pre-trained neural network model to obtain a stitching prediction result of the frame of video image; wherein the stitching prediction result includes: the stitching prediction area of ​​the video image and the corresponding target image.

7. The method according to claim 6, characterized in that The pre-trained neural network model is determined in the following way: Obtain training samples including a plurality of consecutive sets of image pairs to be stitched, and stitching search results of each set of image pairs to be stitched; For each group of image pairs to be stitched except the first group of image pairs to be stitched, inputting the stitching prediction results of the group of image pairs to be stitched and the adjacent previous group of image pairs to be stitched into the initial neural network model, so as to output the stitching prediction results of the group of image pairs to be stitched through the initial neural network model; Calculating a loss value of a seam prediction result of the set of image pairs to be stitched based on the seam search results of the set of image pairs to be stitched and a preset loss function; The weight parameters of the initial neural network model are updated based on the loss value; and the step of obtaining training samples including a plurality of consecutive sets of image pairs to be spliced ​​is continued until the initial neural network model converges to obtain the neural network model.

8. The method according to claim 7, characterized in that After the step of obtaining training samples including a plurality of consecutive groups of image pairs to be stitched and stitching search results of each group of image pairs to be stitched, the method further includes: Obtaining a preset patchwork template; wherein the preset patchwork template includes a preset patchwork area; For a first group of image pairs to be stitched, the first group of image pairs to be stitched and the preset stitching template are input into the initial neural network model, so as to output a stitching prediction result of the first group of image pairs to be stitched through the initial neural network model.

9. A video image splicing method, characterized in that: The method comprises: Acquire a first fisheye video and a second fisheye video; wherein the fisheye video images in the first fisheye video and the second fisheye video have an overlapping area; Extracting a first target area of ​​each frame of fisheye video image in the first fisheye video, and a second target area of ​​each frame of fisheye video image in the second fisheye video; For two corresponding frames of fisheye video images, based on the first target area and the second target area corresponding to the two frames of fisheye video images, and the pre-acquired update expansion parameter value, determine a first equidistant projection picture after the frame of fisheye video image in the first fisheye video is expanded, and a second equidistant projection picture after the frame of fisheye video image in the second fisheye video is expanded; Determine a stitching search result based on the first equidistant projection image and the second equidistant projection image that correspond to each other; wherein the stitching search result is determined by the method described in any one of claims 1 to 8 above; Based on the stitching search results corresponding to each group of two corresponding fisheye video images, a video stitching result of the video images is determined.

10. The method according to claim 9, characterized in that The step of determining the stitching search result based on the first equidistant projection picture and the second equidistant projection picture corresponding to each other comprises: Aligning the first equidistant projection image and the second equidistant projection image corresponding to each other; Extracting a third overlapping area based on the aligned first equidistant projection image and the second equidistant projection image; Based on the third overlapping area, perform illumination compensation on the second equidistant projection picture so that a pixel value of each pixel in the illumination-compensated second equidistant projection picture matches a pixel value of each pixel in the corresponding first equidistant projection picture; The stitching search result is determined based on the first equidistant projection image and the second equidistant projection image after illumination compensation.

11. The method according to claim 9, characterized in that The updated expansion parameter values ​​include: a field of view angle parameter value, a parameter value of the optical center in the x-axis direction, a parameter value of the optical center in the y-axis direction, and a fisheye rotation angle parameter value; the updated expansion parameter values ​​are pre-determined in the following manner: Get the initial expansion parameter value and preset offset range of each expansion parameter; Based on the initial expansion parameter value and the preset offset range of each expansion parameter, sampling each expansion parameter to obtain the sampled value of each expansion parameter, and based on the sampled value of each expansion parameter, determining a third equidistant projection picture after the fisheye video image of the frame in the first fisheye video is expanded, and a fourth equidistant projection picture after the fisheye video image of the frame in the second fisheye video is expanded; extracting a fourth overlapping area of ​​the third equidistant projection picture and the fourth equidistant projection picture; Performing cross-correlation calculation on the fourth overlapping area to obtain a first cross-correlation calculation result; The update expansion parameter value is determined based on the first mutual correlation calculation result and a preset number of iterations.

12. The method according to claim 11, characterized in that The step of determining the update expansion parameter value based on the first mutual correlation calculation result and the preset number of iterations includes: Repeating the step of sampling each expansion parameter based on the initial expansion parameter value of each expansion parameter and the preset offset range according to the preset number of iterations to obtain a plurality of first cross-correlation calculation results; Selecting the first mutual correlation calculation result with the largest value from the plurality of first mutual correlation calculation results; The sample value of the expansion parameter corresponding to the first mutual correlation calculation result with the largest value is determined as the updated expansion parameter value.

13. The method according to claim 10, characterized in that The step of aligning the first equidistant projection picture and the second equidistant projection picture corresponding to each other comprises: Extracting first feature points from the first equidistant projection picture, and extracting second feature points from the second equidistant projection picture; Determine a matching feature point pair based on the first feature point and the second feature point; Based on the matching feature point pairs, the first equidistant projection image and the second equidistant projection image are aligned.

14. The method according to claim 10, characterized in that The step of aligning the first equidistant projection picture and the second equidistant projection picture corresponding to each other comprises: Moving the second equidistant projection image in a preset direction; During the moving process, extracting a plurality of fifth overlapping regions of the first equidistant projection picture and the second equidistant projection picture; performing cross-correlation calculations on the plurality of fifth overlapping regions respectively to obtain a plurality of second cross-correlation calculation results; Based on the multiple second mutual correlation calculation results, the first equidistant projection picture and the second equidistant projection picture are aligned.

15. The method according to claim 14, characterized in that The step of aligning the first equidistant projection picture and the second equidistant projection picture based on the plurality of second mutual correlation calculation results comprises: Selecting the second cross-correlation calculation result with the largest value from the plurality of second cross-correlation calculation results; Obtaining position coordinates of a first boundary pixel point corresponding to a fifth overlapping area corresponding to the second cross-correlation calculation result having the largest value in the first equidistant projection picture, and position coordinates of a second boundary pixel point corresponding to the fifth overlapping area in the second equidistant projection picture; Calculating an affine transformation matrix based on the position coordinates of the first boundary pixel point and the position coordinates of the second boundary pixel point; Based on the affine transformation matrix, the first equidistant projection picture and the second equidistant projection picture are aligned.

16. The method according to claim 10, characterized in that The step of determining the video stitching result of the video image based on the stitching search results corresponding to each group of two corresponding fisheye video images comprises: For each group of two fisheye video images corresponding to each other, based on the stitching search results corresponding to the two fisheye video images in the group, determining the fused overlapping area corresponding to the two fisheye video images in the group; The fused overlapping area replaces the third overlapping area corresponding to the two fisheye video images in the group, to obtain an image stitching result of the two fisheye video images in the group; Based on the image stitching results of two frames of fisheye video images in each group, a video stitching result of the video images is determined.

17. A video image seam search device, characterized in that: The device comprises: A first acquisition module is used to acquire an energy map of each frame of a video image in a first video; wherein the energy map is used to indicate a position area and an edge of a specified object in the video image; the position area is represented as an area occupied by the specified object in the video image; the edge is represented as an outer edge contour corresponding to the specified object in the video image; the energy map is represented in the form of a grayscale map, in which the higher the grayscale value of a pixel point is, the greater the energy of the pixel point is, and the higher the corresponding energy value is, and the lower the grayscale value of the pixel point is, the smaller the energy of the pixel point is, and the lower the corresponding energy value is; A first determination module is used to determine, for a first frame of video image in the first video, a stitching search result of the first frame of video image based on an energy map of the first frame of video image; wherein the stitching search result includes: a stitching area of ​​the video image and a target image; the target image is a video image in the second video corresponding to the video image; A second determination module is used to determine, for each frame of video image in the first video except the first frame, a stitching search area range of the current video image based on the stitching search result of the previous frame of the current video image; within the stitching search area range, determine the stitching search result of the current video image based on the energy map of the current video image.

18. A video image splicing device, characterized in that: The device comprises: A second acquisition module is used to acquire a first fisheye video and a second fisheye video; wherein the fisheye video images in the first fisheye video and the second fisheye video have an overlapping area; An extraction module, used to extract a first target area of ​​each frame of the fisheye video image in the first fisheye video, and a second target area of ​​each frame of the fisheye video image in the second fisheye video; a third determination module, configured to determine, for two corresponding frames of fisheye video images, a first equidistant projection picture after the fisheye video image frame in the first fisheye video is expanded, and a second equidistant projection picture after the fisheye video image frame in the second fisheye video is expanded, based on the first target area and the second target area corresponding to the two frames of fisheye video images, and a pre-acquired update expansion parameter value; a fourth determination module, configured to determine a stitching search result based on the first equidistant projection picture and the second equidistant projection picture corresponding to each other; wherein the stitching search result is determined by the stitching search device for video images according to claim 17; The fifth determining module is used to determine the video stitching result of the video image based on the stitching search results corresponding to each group of two corresponding fisheye video images.

19. An electronic system, characterized in that: The electronic system includes: an image acquisition device, a processing device and a storage device; The image acquisition device is used to obtain preview video frames or image data; The storage device stores a computer program, which, when executed by the processing device, executes the video image seam search method according to any one of claims 1 to 8, or the video image splicing method according to any one of claims 9 to 16.

20. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processing device, the steps of the video image seam search method according to any one of claims 1 to 8 or the steps of the video image splicing method according to any one of claims 9 to 16 are executed.

Citation Information

Patent Citations

  • Video connecting method based on planar scanning around gradient joint regions

    CN104794683A

  • Panoramic video synthesis method and device and electronic equipment

    CN110519528A

  • Image stitching processing method, device and electronic system

    CN112862685A