Panoramic image generation method and apparatus, computer device, and storage medium

By performing local alignment processing during the panoramic image generation process to determine the reference image and the image to be aligned, and using the target mapping information to generate the panoramic image, the misalignment problem caused by camera intrinsic and extrinsic parameter errors is solved, and the stitching quality of panoramic images is improved.

CN116866722BActive Publication Date: 2026-11-20ARASHI VISION INC
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310327816.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-24
Publication Date
2026-11-20
Estimated Expiration
2043-03-24

AI Technical Summary

Technical Problem

Existing technologies often suffer from image misalignment when generating panoramic images due to errors or insufficient precision in camera intrinsic and extrinsic parameters, which affects the quality of image stitching.

Method used

By performing local alignment during the generation of panoramic images, the reference image and the image to be aligned are determined for each image alignment based on the initial image frame and initial mapping information, and alignment processing is performed to determine the target mapping information, and finally the target panoramic image is generated.

Benefits of technology

It reduces misalignment in panoramic image stitching, improves the precision and accuracy of image alignment, and generates higher quality panoramic images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116866722B_ABST
    Figure CN116866722B_ABST
Patent Text Reader

Abstract

The application relates to a panoramic image generation method and device, computer equipment and a storage medium. The method comprises the following steps: determining a reference image and a to-be-aligned image for each image alignment according to each initial image frame and initial mapping information, performing alignment processing on the corresponding to-be-aligned image according to the reference image for each image alignment, and determining target mapping information corresponding to each initial image frame after each image alignment, so as to generate a target panoramic image according to each initial image frame and the corresponding target mapping information. The mapping information is used for indicating the area of each initial image frame projected to the target panoramic image, and the reference image and the to-be-aligned image for each image alignment have an overlapping area. The method can reduce the misalignment phenomenon.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image technology, and in particular to a panoramic image generation method, apparatus, computer device, and storage medium. Background Technology

[0002] Panoramic images are increasingly widely used in daily life because they can show more of the surrounding environment. The process of generating panoramic images in related technologies involves first calculating the camera's intrinsic and extrinsic parameters based on multiple images, and then directly projecting these parameters onto the captured images to obtain the final panoramic image. However, errors or insufficient precision in the camera's intrinsic and extrinsic parameters can occur during this process, resulting in some misalignment in the currently obtained panoramic images. Summary of the Invention

[0003] Therefore, it is necessary to provide a panoramic image generation method, apparatus, computer equipment, and storage medium that can reduce misalignment phenomena in response to the above-mentioned technical problems.

[0004] Firstly, this application provides a method for generating panoramic images. The method includes:

[0005] Based on each initial image frame and initial mapping information, a reference image and an image to be aligned are determined for each image alignment; there is an overlapping area between the reference image and the image to be aligned for each image alignment.

[0006] Based on the reference image for each image alignment, the corresponding image to be aligned is aligned, and the target mapping information corresponding to each initial image frame after each image alignment is determined; the target mapping information is used to indicate the area of ​​each initial image frame projected onto the target panoramic image after each image alignment.

[0007] Based on each initial image frame and the corresponding target mapping information, a panoramic image of the target is generated.

[0008] Secondly, this application also provides a handheld gimbal, which includes: a motor, a camera, and a processor;

[0009] The motor is used to control the rotation of the gimbal to drive the rotation of the camera, and the processor is used to execute any of the methods described above.

[0010] Thirdly, this application also provides a panoramic image generation system, which includes a pan-tilt unit and a terminal;

[0011] This gimbal is used to rotate according to a preset path;

[0012] The terminal includes a camera and a processor. The camera is used to capture multiple initial image frames at multiple shooting angles during the rotation of the gimbal along a preset path, and to send the multiple initial image frames to the processor so that the processor can execute any of the methods described above.

[0013] Fourthly, this application also provides a panoramic image generation apparatus, the apparatus comprising:

[0014] The first determining module is used to determine the reference image and the image to be aligned for each image alignment based on each initial image frame and the initial mapping information.

[0015] The second determining module is used to perform alignment processing on the corresponding image to be aligned based on the reference image for each image alignment, and to determine the target mapping information corresponding to each initial image frame after each image alignment; the target mapping information is used to indicate the area of ​​each initial image frame projected onto the target panoramic image after each image alignment.

[0016] The first generation module is used to generate a panoramic image of the target based on each initial image frame and the corresponding target mapping information.

[0017] Fifthly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of any of the methods described above.

[0018] Sixthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of any of the methods described above.

[0019] In a seventh aspect, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of any of the methods described above.

[0020] The aforementioned panoramic image generation method, apparatus, computer device, and storage medium determine the reference image and the image to be aligned for each image alignment based on each initial image frame and initial mapping information. Then, based on the reference image for each alignment, the corresponding image to be aligned is aligned. Finally, the target mapping information corresponding to each initial image frame after each alignment is determined, thereby generating a target panoramic image based on each initial image frame and the corresponding target mapping information. In this application, since the target mapping information can indicate the area projected onto the target panoramic image by each initial image frame after each image alignment, and since each image alignment determines the reference image and the image to be aligned for the current alignment that have overlapping areas, and performs alignment processing on the image to be aligned for the current alignment, the reference image and the image to be aligned can be aligned after the alignment processing. Furthermore, the final generated target panoramic image can reduce stitching misalignment. Attached Figure Description

[0021] Figure 1 This is an application environment diagram of the panoramic image generation method in the embodiments of this application;

[0022] Figure 2 This is a flowchart illustrating the panoramic image generation method in an embodiment of this application;

[0023] Figure 3 This is a schematic diagram of the preset path in the embodiments of this application;

[0024] Figure 4 This is a schematic diagram of a process for determining a reference image and an image to be aligned, as described in an embodiment of this application.

[0025] Figure 5 This is a schematic diagram of a process for determining mapping information in an embodiment of this application;

[0026] Figure 6 A schematic diagram showing the coordinates of the overlapping region in two adjacent initial image frames;

[0027] Figure 7 This is a schematic diagram of a process for determining control points in an embodiment of this application;

[0028] Figure 8 This is a schematic diagram of a process for generating a target panoramic image in an embodiment of this application;

[0029] Figure 9 A schematic diagram of mask information;

[0030] Figure 10 This is a schematic diagram illustrating another process for generating a target panoramic image in an embodiment of this application;

[0031] Figure 11 This is a schematic diagram illustrating the principle of generating a target panoramic image in an embodiment of this application;

[0032] Figure 12 This is a schematic diagram of an equatorial splicing method;

[0033] Figure 13 This is a schematic diagram of an equatorial splicing process in an embodiment of this application;

[0034] Figure 14 This is a schematic diagram illustrating a top-joining or bottom-joining process in an embodiment of this application;

[0035] Figure 15 This is a diagram illustrating the distortion of the top view.

[0036] Figure 16 This is a schematic diagram showing the effect after the top is stitched together;

[0037] Figure 17 This is a schematic diagram of a two-sided splicing process in an embodiment of this application;

[0038] Figure 18 This is a structural block diagram of the panoramic image generation device in the embodiments of this application;

[0039] Figure 19 This is a diagram showing the internal structure of a computer device in an embodiment of this application. Detailed Implementation

[0040] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0041] Currently, to obtain panoramic images, users typically take multiple images from different locations, then determine the camera's intrinsic and extrinsic parameters based on these images, and finally project these images onto corresponding positions in the panoramic image using these parameters in a specific order to obtain the final panoramic image. However, the resulting panoramic images still exhibit misalignment. Therefore, it is necessary to provide a panoramic image generation method that can reduce misalignment, addressing the aforementioned technical problem. This panoramic image generation method will be introduced below.

[0042] To explain the panoramic image generation method in this application more clearly, the following concepts are introduced first.

[0043] A gimbal is a support device used to mount and fix shooting equipment such as mobile phones, cameras, and camcorders, and it can rotate in at least one degree of freedom.

[0044] Field of view (Fov) is a parameter of the lens in a shooting device. The larger the fov, the larger the area of ​​the image that the shooting device can capture.

[0045] Euler angles are used to describe the movement of the camera as the gimbal rotates. Euler angles include roll, pitch, and yaw. With the viewpoint as the origin, the horizontal direction is defined as the X-axis, the vertical direction as the Y-axis, and the direction perpendicular to both the X and Y axes as the Z-axis. The roll angle indicates the degree of rotation of the gimbal along the Z-axis, the pitch angle indicates the degree of rotation along the Y-axis, and the yaw angle indicates the degree of rotation along the X-axis.

[0046] A panoramic image refers to an image with an aspect ratio of 2:1 when unfolded, and it is generally obtained by stitching together multiple image frames. Panoramic images are unfolded using latitude and longitude methods; the width of a panoramic image is within the latitude range of 0-2π, and the height is within the longitude range of 0-π. For example, panoramic images can include 180° panoramic images, 270° panoramic images, and 360° panoramic images. Among these, a 360° panoramic image can record all information from latitude (0-2π) and longitude (0-π), meaning it can record all information from 360° horizontally and 180° vertically. The following explanation primarily uses the generation of a 360° panoramic image, also known as a spherical panoramic image, as an example.

[0047] Figure 1 This is an application environment diagram of the panoramic image generation method in the embodiments of this application, such as... Figure 1 As shown in (a) and (b), the gimbal 101 is connected to other shooting devices 102. The shooting devices 102 are mainly used to capture images of objects or environments in a scene to obtain corresponding multi-frame images; the shooting devices 102 can be cameras, webcams, mobile phones with cameras, etc. As the gimbal 101 rotates via its motor, it can drive the shooting devices 102 to rotate, thereby capturing multi-frame images from different perspectives.

[0048] Additionally, the imaging device 102 may include a built-in computer device (not shown in the figure), which can be a computer device 103, a central processing unit (CPU), or a digital signal processor (DSP), field-programmable gate array (FPGA), or other programmable logic devices. The computer device primarily processes the multiple frames of images captured by the imaging device 104.

[0049] Optionally, the gimbal 101 may also be equipped with a control panel 103 and control buttons 104. The control panel 103 allows users to operate the gimbal 101, and the control buttons 104 allow users to send shooting commands to the shooting device 102 through the gimbal 101.

[0050] It should be noted that, Figure 1 This example only illustrates one possible application environment. In some application scenarios, the gimbal 101 can be equipped with a camera 102. The camera 102 can also be connected to an external computer device. The external computer device can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The portable wearable device can be a smartwatch, smart bracelet, head-mounted device, etc.

[0051] Figure 2 This is a flowchart illustrating the panoramic image generation method in an embodiment of this application. This method can be applied to... Figure 1 In one embodiment of the computer device shown, such as Figure 2 As shown, it includes the following steps:

[0052] S201, based on each initial image frame and initial mapping information, determine the reference image and the image to be aligned for each image alignment; there is an overlapping area between the reference image and the image to be aligned for each image alignment.

[0053] Currently, when computer equipment generates panoramic images, it determines the camera's intrinsic and extrinsic parameters based on multiple images taken by the user. Then, it uses the camera's intrinsic and extrinsic parameters to project the multiple images onto the corresponding positions in the panoramic image in a certain order to obtain the final panoramic image.

[0054] However, when generating panoramic images, there are two main issues: firstly, the shooting device may inevitably experience translational movement during the shooting process, leading to significant parallax when objects are close; secondly, the determined camera intrinsic and extrinsic parameters may be incorrect or lack sufficient precision. Both of these factors can cause misalignment in the target panoramic image.

[0055] Therefore, this application performs local alignment (hereinafter referred to as image alignment) during the generation of panoramic images. Specifically, in this embodiment, when the computer device generates the target panoramic image based on each initial image frame and initial mapping information, it first determines the reference image and the image to be aligned for each image alignment based on each initial image frame and initial mapping information. Furthermore, there is an overlapping area between the reference image and the image to be aligned for each image alignment.

[0056] The initial mapping information is used to map each initial image frame onto a 2:1 panoramic unfolded image according to the shooting order and position to obtain the target panoramic image. In other words, the initial mapping information is used to indicate the area of ​​the target panoramic image to which each initial image frame will be projected.

[0057] Optionally, the computer device can crop out the overlapping area from each initial image frame based on the overlapping area between two adjacent initial image frames, extract similar feature points between two adjacent initial image frames based on the overlapping area, and optimize the intrinsic and extrinsic parameters of the camera device using the similar feature points, thereby determining the initial mapping information between each initial image frame and the target panoramic image based on the intrinsic and extrinsic parameters of the camera device.

[0058] For example, suppose the computer device acquires initial image frames 1 to 10, and adjacent image frames 2 to 10 have overlapping areas. Based on the initial mapping information, during the first image alignment, the computer device projects the latter part of the initial image frame 1 into the 2:1 panoramic unfolded image as the reference image, and projects the latter part of the initial image frame 2 into the 2:1 panoramic unfolded image as the image to be aligned. During the second image alignment, the computer device projects the latter part of the initial image frame 2 into the 2:1 panoramic unfolded image as the reference image, and projects the latter part of the initial image frame 3 into the 2:1 panoramic unfolded image as the image to be aligned. During the third image alignment, the computer device projects the latter part of the initial image frame 3 into the 2:1 panoramic unfolded image as the reference image, and projects the latter part of the initial image frame 4 into the 2:1 panoramic unfolded image as the image to be aligned. This process continues until the final image alignment, where the computer device projects the latter part of the initial image frame 9 into the 2:1 panoramic unfolded image as the reference image, and projects the latter part of the initial image frame 10 into the 2:1 panoramic unfolded image as the image to be aligned.

[0059] In some embodiments, in order to reduce computational load and improve computational efficiency, the computer device can determine the reference image and the image to be aligned for each image alignment in a small-resolution 2:1 panoramic unfolded view.

[0060] It should be noted that the above-described method involves the computer device determining the reference image and the image to be aligned for each image alignment sequentially, from initial image frame 1 to initial image frame 10. In some embodiments, the initial image frames may overlap each other in a certain proportion, and the computer device may also determine the reference image and the image to be aligned for each image alignment in other orders. This embodiment is not limited to this.

[0061] S202, based on the reference image for each image alignment, perform alignment processing on the corresponding image to be aligned, and determine the target mapping information corresponding to each initial image frame after each image alignment; the target mapping information is used to indicate the area of ​​each initial image frame projected onto the target panoramic image after each image alignment.

[0062] In this embodiment, the computer device performs alignment processing on the corresponding image to be aligned based on the mapping information of the reference image for each image alignment.

[0063] In this embodiment, the computer device performs alignment processing on the corresponding image to be aligned based on the reference image for each image alignment.

[0064] The target mapping information, also known as map information, indicates the area projected onto the target panoramic image after each initial image frame is aligned. It's understandable that the initial mapping information is merely an estimated mapping relationship based on each initial image frame; factors such as camera shake and gimbal rotation errors can affect the accuracy of the initial mapping information. The target mapping information, however, has undergone correction during the image alignment process, thus its accuracy is higher than that of the initial mapping information.

[0065] Furthermore, during each image alignment, the computer device aligns the image to be aligned based on the reference image used in the current alignment. After aligning the image to be aligned in the current alignment, the computer device obtains the target mapping information of the image to be aligned in the current alignment.

[0066] It should be noted that the target mapping information of the reference image during the first image alignment can be directly determined based on the initial mapping information of the reference image during the first image alignment. For example, during the first image alignment, the computer device directly uses the initial mapping information of the reference image as the target mapping information of the reference image.

[0067] Furthermore, optionally, the computer device can modify the initial mapping information of the images to be aligned after image alignment to obtain the target mapping information of the images to be aligned at the time of the current image alignment. Alternatively, the computer device can directly determine the target mapping information of the images to be aligned at the time of the current image alignment based on the portion of the images to be aligned in the 2:1 panoramic image after image alignment.

[0068] Taking the first image alignment as an example, during the first image alignment, the computer device projects the latter part of the initial image frame 1 onto the 2:1 panoramic unfolded image as the reference image, and projects the latter part of the initial image frame 2 onto the 2:1 panoramic unfolded image as the image to be aligned. Then, the computer device uses the reference image from the first image alignment to align the image to be aligned. After the alignment, the computer device modifies the initial mapping information of the initial image frame 2 to determine the target mapping information corresponding to the initial image frame 2.

[0069] The alignment process is used to align at least one edge of the reference image and the image to be aligned each time. The alignment process can include stretching, rotation, translation, etc.

[0070] S203, Generate a panoramic image of the target based on each initial image frame and the corresponding target mapping information.

[0071] In this embodiment, after each image alignment, the computer device also obtains the target mapping information corresponding to each initial image frame. Furthermore, the computer device can generate a panoramic image of the target based on each initial image frame and the corresponding target mapping information.

[0072] For example, after obtaining the target mapping information 1 to target mapping information 10 corresponding to the initial image frames 1 to 10, the computer device can project the initial image frames 1 to 10 onto a 2:1 panoramic unfolded image at a preset resolution, based on the initial image frames 1 to 10 and their corresponding target mapping information 1 to target mapping information 10, to obtain a target panoramic image. The preset resolution can be a user-specified resolution or a resolution automatically determined by the computer device based on its own performance; this embodiment does not impose any limitations.

[0073] In some embodiments, after the computer device projects the initial image frames 1 to 10 onto a 2:1 panoramic unfolded image based on the initial image frames 1 to 10 and the corresponding target mapping information 1 to 10, it will also perform post-processing on the obtained images to generate a target panoramic image.

[0074] Here, the target panoramic image obtained by projecting each initial image frame onto a 2:1 panoramic unfolded image using target mapping information can be either an unwound spherical panoramic image or an unfolded 2:1 panoramic image. It should be noted that an unwound spherical panoramic image is a spherical image that cannot be displayed on a single plane; users can observe the unwound spherical panoramic image by adjusting their viewing angle.

[0075] The panoramic image generation method provided in this embodiment determines the reference image and the image to be aligned for each image alignment based on each initial image frame and initial mapping information. It then performs alignment processing on the corresponding image to be aligned based on the reference image for each alignment and determines the target mapping information corresponding to each initial image frame after each alignment. Thus, a target panoramic image is generated based on each initial image frame and the corresponding target mapping information. Currently, in the process of generating panoramic images, the camera's intrinsic and extrinsic parameters are first calculated based on multiple images, and then the multiple images are directly projected using the camera's intrinsic and extrinsic parameters to obtain the final panoramic image. However, errors or insufficient precision in the camera's intrinsic and extrinsic parameters may occur during this process, resulting in misalignment in the currently obtained panoramic images. In this application, since the target mapping information can indicate the area to which each initial image frame is projected onto the target panoramic image after each image alignment, and each time an image is aligned, the reference image and the image to be aligned for the current image alignment with overlapping areas are determined, and the image to be aligned for the current image alignment is aligned, thus, the reference image and the image to be aligned can be aligned after the alignment processing. Furthermore, the resulting panoramic image of the target can reduce stitching misalignment.

[0076] In one embodiment, optionally, each initial image frame is an image frame from multiple shooting angles captured by a shooting device mounted on a gimbal during the rotation of the gimbal.

[0077] In this embodiment, the gimbal rotates along a preset path, and the imaging device connected to the gimbal also rotates with it. Consequently, the imaging device can capture multiple initial image frames from multiple shooting angles. These shooting angles include at least one of roll angle, pitch angle, and yaw angle. Furthermore, the imaging device communicates with a computer, enabling the computer to acquire these multiple initial image frames.

[0078] Optionally, the gimbal can rotate to a preset path and send a shooting command to the shooting device after each shooting angle, so that the shooting device can capture at least one initial image frame at that shooting angle. Further optional, after capturing at least one initial image frame at that shooting angle, the shooting device can send a completion command back to the gimbal, so that the gimbal, upon receiving the completion command, can rotate to the next shooting angle, and so on. Thus, the shooting device can capture initial image frames from multiple shooting angles while the gimbal rotates along the preset path.

[0079] Of course, the computer equipment can also be pre-set with the shooting frequency matching the rotation path of the gimbal, so that the shooting equipment can automatically capture multiple initial image frames as the gimbal rotates along the preset path according to the set shooting frequency.

[0080] Furthermore, the computer device can acquire the initial image frames captured by the camera in real time, or it can acquire the initial image frames captured by the camera at certain intervals.

[0081] The preset path can be a path planned by the computer device and sent to the gimbal, a path customized by the user through the computer device and sent to the gimbal, or a preset path that comes with the gimbal itself.

[0082] For example, Figure 3 This is a schematic diagram of the preset path in the embodiments of this application. The dashed line represents the rotation path of the gimbal, and each dot represents a shooting angle set in the path. For example... Figure 3 As shown, between points 1 and 9, the yaw angles of each row are the same, and the pitch angles of each column are the same.

[0083] like Figure 3 (a) and Figure 3 As shown in (b), the gimbal first rotates from its initial position to point 1, so that the shooting device captures the initial image frame 1 at the shooting angle corresponding to point 1. Then, the gimbal rotates along the dotted line to point 2, so that the shooting device captures the initial image frame 2 at the shooting angle corresponding to point 2. And so on, the shooting device captures the initial image frames 1 to 9 at the shooting angles corresponding to points 1 to 9.

[0084] The above only lists some possible forms of preset paths. It is understood that the preset path can also rotate horizontally first and then vertically, or vice versa. In some embodiments, the preset path can also be other forms, as long as it enables the shooting device to capture initial image frames from multiple shooting angles during the rotation of the gimbal. Furthermore, the above example uses only one initial image frame to be captured at each shooting angle, but multiple initial image frames can also be captured at each shooting angle, and this embodiment does not impose any limitations.

[0085] It should be noted that, in order to reduce subsequent workload and improve generation efficiency, the resolution of each initial image frame should remain the same. Of course, in some embodiments, the imaging device may also acquire initial image frames with different resolutions or different sizes, and the computer device may crop each initial image frame after acquiring it.

[0086] In this embodiment, since each initial image frame is an image frame from multiple shooting angles captured by a shooting device mounted on a gimbal during the rotation of the gimbal, the shooting device can capture multiple initial image frames during the rotation of the gimbal. After the computer device acquires these multiple initial image frames, it can generate the target panoramic image. In the process of generating the target panoramic image in this embodiment, the user does not need to manually capture a large number of images from multiple angles, thus avoiding the cumbersome operation process currently encountered in panoramic image generation. Furthermore, since the initial image frames are automatically captured during the rotation of the gimbal, the initial image frames acquired in this embodiment are more accurate than the large number of images currently captured manually by the user, thus improving the accuracy of the target panoramic image generated based on the initial image frames.

[0087] Figure 4 This is a schematic diagram of a process for determining a reference image and an image to be aligned, as described in an embodiment of this application. Figure 4 This embodiment relates to an optional implementation of how to determine the reference image and the image to be aligned for each image alignment from each initial image frame. Based on the above embodiment, step S201, which determines the reference image and the image to be aligned for each image alignment according to each initial image frame and initial mapping information, includes the following steps:

[0088] S401, using the initial mapping information, at least two image frames from each initial image frame are projected onto the first preset panoramic image to determine the reference image and the image to be aligned for the current image alignment.

[0089] In this embodiment, when the computer device determines the reference image and the image to be aligned for each image alignment based on each initial image frame and initial mapping information, it first uses the initial mapping information to project at least two image frames from each initial image frame onto a first preset panoramic image to determine the reference image and the image to be aligned for the current image alignment. The first preset panoramic image is also a 2:1 panoramic unfolded image, and its resolution can be set by the user or determined by the computer device according to preset rules.

[0090] Taking the first image alignment as an example, the computer device can use initial mapping information to project the first image frame from each initial image frame onto a low-resolution 2:1 panoramic unfolded image, and use the portion of the first image frame projected onto the low-resolution 2:1 panoramic unfolded image as the reference image for the current image alignment. Furthermore, the computer device uses the initial mapping information to project the second image frame from each initial image frame onto the aforementioned low-resolution 2:1 panoramic unfolded image, and use the portion of the second image frame projected onto this low-resolution 2:1 panoramic unfolded image as the image to be aligned for the current image alignment.

[0091] Of course, the computer device can also use the initial mapping information to randomly select at least two image frames from each initial image frame and project them onto the first preset panoramic image to determine the reference image or the image to be aligned for the current image alignment. Alternatively, the computer device can also use the initial mapping information to select at least two initial image frames from each initial image frame in a specified area as the reference image for the current image alignment. This embodiment does not impose any restrictions.

[0092] S402, based on the reference image of the current image alignment, after aligning the corresponding image to be aligned, the aligned image to be aligned and the reference image of the previous image alignment are used as the reference images for the next image alignment, and the image to be aligned for the next image alignment is determined from each initial image frame based on each initial image frame and the initial mapping information.

[0093] In this embodiment, it is assumed that during the first image alignment, the computer device projects the portion of the initial image frame 1 onto the first preset panoramic image as a reference image and the portion of the initial image frame 2 onto the first preset panoramic image as the image to be aligned. The computer device then uses the reference image from the first image alignment to perform alignment processing on the corresponding image to be aligned. That is, based on the portion of the initial image frame 1 projected onto the first preset panoramic image, the computer device performs alignment processing on the portion of the initial image frame 2 projected onto the first preset panoramic image. After the first image alignment processing, the computer device also determines the target mapping information 1 of the initial image frame 1 and the target mapping information 2 of the initial image frame 2.

[0094] Furthermore, during the second image alignment, the computer device uses the reference image from the first image alignment and the image to be aligned as reference images for the second alignment. That is, the portion of the initial image frame 1 projected onto the first preset panoramic image, and the portion of the initial image frame 2 projected onto the first preset panoramic image after image alignment, are used as reference images for the second alignment. Then, the computer device determines the initial image frame 3 from each initial image frame and, using the initial mapping relationship, projects the portion of the initial image frame 3 onto the first preset panoramic image as the image to be aligned for the second alignment. Further still, the computer device continues to use the reference images from the second alignment to align the image to be aligned for the second alignment. After the second image alignment, the computer device determines the target mapping information 3 corresponding to the initial image frame 3.

[0095] Similarly, the computer device aligns the corresponding image to be aligned based on the reference image of the current image alignment, and then uses the aligned image to be aligned and the reference image of the previous image alignment as the reference image for the next image alignment. The computer device also determines the image to be aligned for the next image alignment from each initial image frame. This will not be elaborated further here.

[0096] This embodiment utilizes initial mapping information to project at least two image frames from each initial image frame onto a first preset panoramic image. This determines the reference image and the image to be aligned for the current image alignment. Based on the reference image for the current image alignment, the corresponding image to be aligned is aligned. The aligned image to be aligned and the reference image from the previous image alignment are then used as the reference images for the next image alignment. Furthermore, the image to be aligned for the next image alignment is determined from each initial image frame based on the initial image frame and the initial mapping information. Because each image alignment uses the image to be aligned from the previous alignment and the reference image from the previous alignment as the current reference images, the precision and accuracy of the image alignment are guaranteed.

[0097] Figure 5 This is a schematic diagram of a process for determining mapping information in an embodiment of this application. (Refer to...) Figure 5 This embodiment relates to an optional implementation of how to determine the mapping information corresponding to each initial image frame after each image alignment. Based on the above embodiment, where adjacent initial image frames among multiple initial image frames have overlapping regions, step S202 above, according to the reference image for each image alignment, performs alignment processing on the corresponding images to be aligned and determines the target mapping information corresponding to each initial image frame after each image alignment, including the following steps:

[0098] S501, determine the control points corresponding to the overlapping area between the reference image and the corresponding image to be aligned for each image alignment.

[0099] In this embodiment, in order to ensure the accuracy and effect of generating the target panoramic image, two adjacent initial image frames in the multiple initial image frames have overlapping areas.

[0100] It should be noted that the two adjacent initial image frames here refer to the initial image frames taken from two different consecutive shooting angles. For example, combining... Figure 3 The initial image frame 1 corresponding to point 1 and the initial image frame 2 corresponding to point 2 are two adjacent initial image frames, meaning that there is an overlapping area between initial image frame 1 and initial image frame 2. Similarly, the initial image frame 2 corresponding to point 2 needs to have an overlapping area with the initial image frame 3 corresponding to point 3, and so on.

[0101] Optionally, when the computer device acquires each initial image frame, since the shooting order and shooting position are known, it can also acquire the adjacency relationship between each initial image frame.

[0102] Taking the capture of an initial image frame from each shooting angle as an example, the computer device can also determine and store the adjacent relationship edge_list of each initial image frame after acquiring each initial image frame.

[0103] For example, edge_list = [(a,b),(b,c),...], where a, b, c, and d are all integers greater than or equal to 1. Each set of parentheses represents a pair of adjacent initial image frames that overlap. For example, (a,b) indicates that initial image frame a overlaps with initial image frame b, and (b,c) indicates that initial image frame b overlaps with initial image frame c.

[0104] Furthermore, since the rotation path of the gimbal is known, the information of the overlapping area between the initial image frames can also be determined during the process of the imaging device capturing each initial image frame.

[0105] Optionally, the computer device may determine and store information about overlapping regions in two adjacent initial image frames, in the form of a list called roi_list.

[0106] For example, roi_list = [((x_a,y_a,w_a,h_a),(x_b,y_b,w_b,h_b)),((x_b,y_b,w_b,h_b),(x_c,y_c,w_c,h_c)),...]. Here, x and y represent the coordinates of the top-left corner of the overlapping region within the initial image frame; w and h represent the ratios of the width and height of the overlapping region relative to the width and height of the initial image frame.

[0107] It should be noted that only two adjacent initial image frames with overlapping areas are related. For example, the overlapping area between initial image frame a and initial image frame b is not related to the overlapping area between initial image frame b and initial image frame c, the overlapping area between initial image frame b and initial image frame c is not related to the overlapping area between initial image frame c and initial image frame d, and so on.

[0108] Specifically, in ((x_a,y_a,w_a,h_a),(x_b,y_b,w_b,h_b)), (x_a,y_a,w_a,h_a0) means: with the coordinate system established based on the upper left corner of the initial image frame a as the reference, the x-coordinate and y-coordinate of the upper left corner of the overlapping area of ​​the initial image frame a and the initial image frame b are x_a and y_a, respectively, and the x-coordinate and y-coordinate of the lower left corner of the overlapping area of ​​the initial image frame a and the initial image frame b are w_a and h_a, respectively.

[0109] (x_b,y_b,w_b,h_b) means: with the coordinate system established at the top left corner of the initial image frame b as the reference, the x-coordinate and y-coordinate of the top left corner of the overlapping area of ​​the initial image frame a and the initial image frame b are x_b and y_b, respectively, and the x-coordinate and y-coordinate of the bottom right corner of the overlapping area of ​​the initial image frame a and the initial image frame b are w_b and h_b, respectively.

[0110] For example, Figure 6 This is a schematic diagram showing the coordinates of the overlapping region in two adjacent initial image frames. (Example:) Figure 6 As shown, initial image frame a (thin dashed line) and initial image frame b (thick dashed line) have an overlapping area (diagonal line). Furthermore, based on the rotation path of the gimbal, the computer device knows the relative position of initial image frame a in initial image frame b. Initial image frames a and b are the same size, and the overlapping area occupies 50% of both initial image frames a and b.

[0111] In roi_list, the overlapping region can be represented as ((0.5,0,0.5,1),(0,0,0.5,1)), which means that the overlapping regions of the initial image frame a and the initial image frame b are located in the right half of the initial image frame a and the left half of the initial image frame b, respectively.

[0112] Furthermore, the computer device can determine the overlapping area between the reference image and the corresponding image to be aligned for each image alignment.

[0113] Optionally, in one implementation, the computer device can determine the overlapping area between the reference image and the corresponding image to be aligned for each image alignment based on the initial mapping information. For example, the computer device projects a portion of the initial image frame 1 onto the first preset panoramic image as the reference image, and projects a portion of the initial image frame 2 onto the first preset panoramic image as the image to be aligned, based on the initial mapping information. Then, the computer device determines the overlapping area between the projected portions of the initial image frame 1 and the projected portions of the initial image frame 2 in the first preset panoramic image.

[0114] In one embodiment, the computer device can also determine the overlapping area between the reference image and the corresponding image to be aligned for each image alignment based on information about the overlapping area of ​​two adjacent initial image frames. For example, during the first image alignment, the computer device determines the overlapping area between initial image frame 1 and initial image frame 2 based on roi_list, and directly uses the overlapping area between initial image frame 1 and initial image frame 2 as the overlapping area between the reference image and the image to be aligned during the first image alignment.

[0115] Furthermore, after the computer device determines the overlapping area between the reference image and the corresponding image to be aligned for each image alignment, it can then use the control points corresponding to that overlapping area.

[0116] Optionally, the computer device can sample corresponding control points from the pixels in the overlapping region between the reference image and the corresponding image to be aligned for each image alignment. For example, after determining the overlapping region of initial image frame 1 and initial image frame 2, the computer device can uniformly sample 100 pixels from the overlapping region of initial image frame 1 and initial image frame 2 to obtain 100 control points.

[0117] It should be noted that, in some embodiments, optionally, if due to misoperation or other reasons during the shooting process, there is no overlapping area between the reference image and the corresponding image to be aligned for each image alignment, the computer device can directly use the initial mapping information as the target mapping information of the initial image frame corresponding to the reference image and the image to be aligned for this image alignment, and then continue to perform subsequent image alignments.

[0118] Of course, to ensure the accuracy and effectiveness of image alignment, in some embodiments, optionally, the computer device needs to ensure that the reference image and the image to be aligned overlap in each image alignment. Further optionally, the computer device can determine the reference image and the image to be aligned for each image alignment based on two adjacent initial image frames and initial mapping information. For example, if the computer device knows that there is an overlap between initial image frame 1 and initial image frame 2, and an overlap between initial image frame 2 and initial image frame 3, then during the first image alignment, the computer device uses the initial mapping information to project the portion of initial image frame 1 onto the first preset panoramic image as the reference image for the first image alignment, and projects the portion of initial image frame 2 onto the first preset panoramic image as the image to be aligned for the first image alignment. Similarly, during the second image alignment, the computer device projects the portion of initial image frame 3 onto the first preset panoramic image as the image to be aligned for the second image alignment.

[0119] S502, based on the control points corresponding to each image alignment, perform alignment processing on the corresponding images to be aligned, and determine the target mapping information corresponding to each initial image frame after each image alignment.

[0120] In this embodiment, after the computer device determines the control points corresponding to the overlapping area between the reference image and the corresponding image to be aligned for each image alignment, it can perform alignment processing on the corresponding image to be aligned according to the control points corresponding to each image alignment, and determine the target mapping information corresponding to each initial image frame after each image alignment.

[0121] Taking the first image alignment as an example, the computer device uses the initial mapping information to project a portion of the initial image frame 1 into the 2:1 panoramic unfolded image as a reference image, and the portion of the initial image frame 1 projected into the 2:1 panoramic unfolded image as the image to be aligned. Then, the computer device can determine 100 control points corresponding to the overlapping area between the image to be aligned and the reference image, and use these 100 control points to align the portion of the initial image frame 2 projected into the 2:1 panoramic unfolded image, so that the portion of the initial image frame 2 projected into the 2:1 panoramic unfolded image is vertically aligned with the portion of the initial image frame 1 projected into the 2:1 panoramic unfolded image, thereby determining the target mapping information of the initial image frame 2 after the first image alignment.

[0122] Optionally, the computer device can align the corresponding control points for each image and interpolate the corresponding image to be aligned to achieve the alignment process for the corresponding image to be aligned.

[0123] This embodiment determines the control points corresponding to the overlapping area between the reference image and the corresponding image to be aligned for each image alignment, and performs alignment processing on the corresponding image to be aligned based on the control points corresponding to each image alignment, and determines the target mapping information corresponding to each initial image frame after each image alignment. Since the alignment processing of the corresponding image to be aligned is performed based on the control points corresponding to the overlapping area between the reference image and the corresponding image to be aligned for each image alignment, the accuracy and precision of image alignment are further guaranteed.

[0124] Figure 7 This is a schematic diagram of a process for determining control points in an embodiment of this application, referred to... Figure 7 This embodiment relates to an optional implementation of how to determine the control points corresponding to the overlapping area between the reference image and the corresponding image to be aligned for each image alignment. Based on the above embodiment, S501, which determines the control points corresponding to the overlapping area between the reference image and the corresponding image to be aligned for each image alignment, includes the following steps:

[0125] S701, determine the optical flow value of each pixel in the overlapping area of ​​the reference image and the image to be aligned.

[0126] In this embodiment, the computer device first determines the optical flow value of each pixel in the overlapping region between the reference image and the image to be aligned for each image alignment. For example, after determining the overlapping region of the reference image and the image to be aligned during the first image alignment, the computer device further determines the optical flow value of each pixel in that overlapping region.

[0127] Among them, the optical flow value is a two-dimensional vector that reflects the trend of gray level change at each point on the initial image frame. It can be regarded as the instantaneous velocity field generated by the movement of gray-level pixels on the image plane.

[0128] Computer equipment can determine the optical flow value of each pixel in the overlapping region of the reference image and the image to be aligned using methods such as the DIS (Dense Inverse Search-based method) optical flow algorithm and the RAFT (Recurrent All-Pairs Field Transforms for Optical Flow) optical flow algorithm.

[0129] S702, based on the optical flow value of each pixel, determine the control points corresponding to the overlapping area of ​​the reference image and the image to be aligned.

[0130] In this embodiment, after step S1201 described above, the computer device determines the control points corresponding to the overlapping areas of the reference image and the image to be aligned based on the optical flow values ​​of each pixel.

[0131] In this embodiment, the computer device can use interpolation to select control points in the overlapping area of ​​the reference image and the image to be aligned based on the optical flow value of each pixel; the computer device can also determine control points from the overlapping area of ​​the reference image and the image to be aligned based on the optical flow value of each pixel according to preset judgment conditions. This embodiment does not impose any limitations.

[0132] This embodiment determines the optical flow value of each pixel in the overlapping region of the reference image and the image to be aligned, and determines the control points corresponding to the overlapping region of the reference image and the image to be aligned based on the optical flow value of each pixel. Since the control points are selected based on the optical flow value of each pixel, using the control points to perform alignment processing on the images to be aligned can improve the accuracy and precision of image alignment.

[0133] Figure 8 This is a schematic diagram of a process for generating a target panoramic image in an embodiment of this application, referring to... Figure 3 This embodiment relates to an optional implementation of how to generate a target panoramic image. Based on the above embodiment, step S203, which generates a target panoramic image according to each initial image frame and the corresponding target mapping information, includes the following steps:

[0134] S801, determine the mask information corresponding to each initial image frame based on the overlapping area of ​​each initial image frame; the mask information is used to indicate the boundary of each initial image frame projected onto the target panoramic image.

[0135] In this embodiment, since the target mapping information of each initial image frame is redefined during the image alignment process, in order to further ensure the stitching effect of the target panoramic image, the computer device will also determine the mask information corresponding to each initial image frame based on the overlapping area of ​​each initial image frame.

[0136] The mask information, also known as mask information, is used to indicate the boundaries of each initial image frame projected onto the target panoramic image. Figure 14 This is a schematic diagram of mask information. For example... Figure 14 The white areas shown indicate the boundaries of the corresponding initial image frames projected onto the target panoramic image. In other words, the mask information is determined based on the seams between the initial image frames, instructing the computer device where to use which initial image frame when generating the target panoramic image. For example, if there is a seam between initial image frame 1 and initial image frame 2, the computer device will use initial image frame 1 to the left of the seam and initial image frame 2 to the right of the seam when generating the target panoramic image.

[0137] In one embodiment, after obtaining the target mapping information corresponding to each initial image frame, the computer device uses a dynamic stitching planning algorithm to sequentially find the stitching seams between each pair of adjacent initial image frames, thereby determining the mask information corresponding to each initial image frame. For example, after obtaining the target mapping information 1 to target mapping information 10 corresponding to initial image frames 1 to 10, the computer device finds a stitching seam in the overlapping area of ​​initial image frame 1 and initial image frame 2, thereby obtaining the mask information 1 of initial image frame 1 and the mask information 2 of initial image frame 2; then, the computer device finds a stitching seam in the overlapping area of ​​initial image frame 2 and initial image frame 3, thereby updating the mask information 1 of initial image frame 2 and determining the mask information 3 of initial image frame 3, and so on, until the computer device finally determines the mask information 1 to 10 corresponding to initial image frames 1 to 10.

[0138] Optionally, in one embodiment, the computer device can utilize a dynamic stitching seam planning algorithm to simultaneously determine mask information during each image alignment process. For example, after the first image alignment, the computer device uses the dynamic stitching seam planning algorithm to find a stitching seam in the overlapping area of ​​initial image frame 1 and initial image frame 2. Thus, after the first image alignment, the computer device not only determines the target mapping information 1 and target mapping information 2 corresponding to initial image frame 1 and initial image frame 2 respectively, but also determines the mask information 1 and mask information 2 corresponding to initial image frame 1 and initial image frame 2 respectively. After the second image alignment, the computer device uses the dynamic stitching seam planning algorithm again to find a stitching seam in the overlapping area of ​​initial image frame 2 and initial image frame 3, thereby updating the mask information 1 of initial image frame 2 and determining the mask information 3 of initial image frame 3, and so on, until the computer device finally determines the mask information 1 to 10 corresponding to initial image frames 1 to 10.

[0139] Compared to planning seams for all initial image frames simultaneously, planning seams one by one in sequence is less likely to result in moving objects being cut off in the final panoramic image.

[0140] S802, based on the target mapping information and mask information, project each initial image frame onto the second preset panoramic image to generate the target panoramic image.

[0141] In this embodiment, after image alignment is completed, the computer device also determines the target mapping information and the mask information corresponding to each initial image frame. Further, the computer device can project each initial image frame onto a second preset panoramic image based on the target mapping information and the mask information to generate a target panoramic image.

[0142] Similar to the principle of the lower-ratio panoramic image, the second preset panoramic image, also known as a 2:1 panoramic unfolded image, can have a resolution set by the user or determined by the computer device according to preset rules. The second preset panoramic image can be the same as or different from the first preset panoramic image.

[0143] For example, after acquiring initial image frames 1 to 10 and completing image alignment, the computer device also determines the target mapping information 1 to 10 corresponding to the initial image frames 1 to 10, as well as the mask information 1 to 10 corresponding to the initial image frames 1 to 10. Then, based on the target mapping information 1 to 10 and the mask information 1 to 10, the computer device projects the initial image frames 1 to 10 onto a second preset panoramic image at a 2:1 ratio to obtain the target panoramic image.

[0144] In some embodiments, considering the limited processing speed and memory of some computer devices, the computer device will use α-fusion to project each initial image frame onto a high-resolution 2:1 spherical panoramic unfolded image according to the target mapping information, and perform weighted fusion according to the weight of the mask information, and use the fused image as the target panoramic image.

[0145] In some embodiments, the computer device may also employ other fusion algorithms, such as multi-band fusion, to project each initial image frame onto a second preset panoramic image based on the target mapping information, mask information, and initial mapping information, in order to generate a target panoramic image.

[0146] In this embodiment, the mask information corresponding to each initial image frame is determined based on the overlapping area of ​​each initial image frame. Then, based on the target mapping information and the mask information, each initial image frame is projected onto a second preset panoramic image to generate a target panoramic image. Since the mask information is used to indicate the boundaries of each initial image frame projected onto the target panoramic image, and the computer device determines the mask information corresponding to each initial image frame based on the overlapping area of ​​each initial image frame, the target panoramic image can be generated by projecting each initial image frame onto the second preset panoramic image based on the target mapping information and the mask information.

[0147] Figure 10 This is a schematic diagram of another process for generating a target panoramic image in an embodiment of this application, referred to... Figure 10 This embodiment relates to an optional implementation of how to generate a target panoramic image. Based on the above embodiment, step S802, which projects each initial image frame onto a second preset panoramic image according to the target mapping information and mask information to generate the target panoramic image, includes the following steps:

[0148] S1001, based on the target mapping information and mask information, project each initial image frame onto the second preset panoramic image to generate the first panoramic image.

[0149] In this embodiment, when generating the target panoramic image, the computer device first projects each initial image frame onto a second preset panoramic image based on the target mapping information and mask information to generate the first panoramic image. For example, the computer device projects initial image frames 1 to 10 onto a 2:1 second preset panoramic image based on the target mapping information 1 to 10 and the mask information 1 to 10, using the initial mapping information, to obtain the first panoramic image.

[0150] S1002, Generate a target panoramic image based on the first panoramic image.

[0151] In this embodiment, after step S1001, the computer device continues to generate a target panoramic image based on the first panoramic image. Optionally, the computer device can perform achromatic aberration processing on the first panoramic image to generate the target panoramic image; the computer device can also perform bottom filling processing on the first panoramic image to generate the target panoramic image; the computer device can also perform bottom filling processing on the first panoramic image first, and then perform achromatic aberration processing on the first panoramic image to obtain the target panoramic image. Of course, the computer device can also generate the target panoramic image based on the first panoramic image in other ways or sequences, and this embodiment does not impose any limitations.

[0152] It is understandable that due to the difference in the light angle of each initial image frame, there is a color difference between each initial image frame. Therefore, the computer device can perform color difference aberration processing on the first panoramic image after obtaining it.

[0153] For example, the process of color difference ablation can be as follows:

[0154] First, the computer device projects each initial image frame onto a low-resolution 2:1 panoramic unfolded image based on mapping information, mask information, and target projection relationships, generating a second panoramic image. Then, the computer device performs gradient domain fusion processing on the second panoramic image, such as using Poisson fusion or multi-band fusion, to obtain a third panoramic image that eliminates chromatic aberration and is the same size as the second panoramic image.

[0155] Furthermore, the computer device projects the first panoramic image, i.e. the generated original panoramic image, onto the corresponding position of the third panoramic image to obtain a fourth panoramic image of the same size as the third panoramic image, which has not undergone color difference elimination processing.

[0156] Furthermore, the computer device divides the pixel value of each pixel in the third panoramic image by the pixel value of the same pixel in the fourth panoramic image to obtain a first gain image. Then, after performing filtering and other optimization processing on the first gain image, the computer device upsamples the optimized first gain image to obtain a second gain image of the same size as the first panoramic image.

[0157] Finally, the computer equipment processes the first panoramic image using the second gain image to obtain the final target panoramic image.

[0158] In some embodiments, the target panoramic image needs to be horizontally connected. Optionally, during gradient domain fusion, both ends of the first panoramic image need to be expanded, that is, a portion of the left side of the first panoramic image is copied to the right edge, and a portion of the right side is copied to the left edge. Then, the two portions of the left image and the two portions of the right image are fused separately.

[0159] Furthermore, due to the limited shooting angle, the final first panoramic image may have a bottom blind spot. Figure 11 This is a schematic diagram illustrating the principle of generating a target panoramic image in an embodiment of this application. Figure 11 As shown, the brighter the area, the more initial image frames are projected onto it, meaning more initial image frames overlap there. Among these, Figure 11The depth of color in a scene is inversely proportional to its brightness; that is, the brighter the area, the lighter the color. During the generation of a panoramic image, if a small portion of the bottom image is not covered by the initial image frame, a black border will appear at the bottom of the final panoramic image. Therefore, computer devices can perform bottom-filling processing on the first panoramic image after it has been obtained.

[0160] For example, the bottom padding process can be:

[0161] First, after the computer device obtains the first panoramic image, it projects the bottom blind area of ​​the first panoramic image to obtain the first intermediate image. Then, the computer device fills the first intermediate image with a preset filling image to obtain the final target panoramic image.

[0162] In some embodiments, the computer device may also use a preset filling algorithm to fill the first intermediate image to obtain the final target panoramic image.

[0163] In some embodiments, after obtaining the first panoramic image, the computer device may perform achromatic aberration processing and bottom filling processing sequentially, which will not be elaborated here.

[0164] In this embodiment, each initial image frame is projected onto a second preset panoramic image based on target mapping information and mask information to generate a first panoramic image, and then a target panoramic image is generated based on the first panoramic image. Since the first panoramic image still needs to be further processed after generating it based on the target mapping information and mask information to obtain the second panoramic image, the effect of the target panoramic image is improved.

[0165] The above embodiments do not limit the stitching method of the target panoramic image during image alignment. The computer device can stitch the images frame by frame to obtain the target panoramic image based on each initial image frame. In some other application scenarios, the computer device can also obtain the target panoramic image using other stitching methods. Other stitching methods in this application will be described below.

[0166] In one embodiment, optionally, the above-described panoramic image generation method further includes:

[0167] Using image stitching, the reference image and the image to be aligned are determined for each image alignment based on each initial image frame and initial mapping information. Based on the reference image for each image alignment, the corresponding image to be aligned is aligned, and the target mapping information corresponding to each initial image frame after each image alignment is determined.

[0168] Image stitching methods include at least one of frame-by-frame stitching, equatorial stitching, top stitching, bottom stitching, and side stitching.

[0169] A target panoramic image is generated based on each initial image frame and the image stitching method; the image stitching method includes at least one of frame-by-frame stitching, equatorial stitching, top stitching, bottom stitching, and side stitching.

[0170] In this embodiment, the order and process of projecting each initial image frame onto the target panoramic image will differ depending on the image stitching method.

[0171] For example, Figure 12 This is a schematic diagram of equatorial stitching. In the process of generating the target panoramic image from the initial images, the computer device first performs equatorial stitching. The initial image frames located in the middle row of the target panoramic image are projected directly onto the 2:1 panoramic unfolded image at intervals of one frame, as shown below. Figure 12 (a) and Figure 12 As shown in (b). Then, the computer device pastes the other initial image frames located in the middle row of the target panoramic image into the 2:1 panoramic unfolded image, as shown. Figure 12 (c) and Figure 12 As shown in (d).

[0172] Combining different image stitching methods can improve the flexibility of target panoramic image generation and, to some extent, improve the generation efficiency of target panoramic images.

[0173] The following section will detail the equatorial splicing process. Figure 13 This is a schematic diagram of an equatorial splicing process in an embodiment of this application, referring to... Figure 13 This embodiment relates to an optional implementation of equatorial splicing. Based on the above embodiment, the equatorial splicing includes the following steps:

[0174] S1301, determine the first initial image frame located at the first preset position and without overlapping areas from each initial image frame, and determine the reference image for the first image alignment based on the first initial image frame and the initial mapping information.

[0175] In this embodiment, during the equatorial stitching process, the computer device first determines a first initial image frame located at a first preset position and without overlapping areas from each initial image frame, and determines a reference image for the first image alignment based on the first initial image frame and initial mapping information. Optionally, the computer device uses the initial mapping information to project a portion of the first initial image frame onto a first preset panoramic image as the reference image for the first image alignment.

[0176] The first preset position is the middle part of the target panoramic image. Its coverage can be adjusted according to the needs. Generally, it is sufficient to cover the initial image frame located in the middle row of the target panoramic image.

[0177] For example, assuming the computer device acquires initial image frames 1 to 20, according to the preset path of the gimbal, initial image frames 6 to 10 are located in the middle row of the target panoramic image, and only adjacent frames of initial image frames 6 to 10 overlap. Therefore, during the first image alignment, the computer device can first use initial image frames 6, 8, and 10 as the first initial image frames, and according to the initial mapping information, project the first initial image frames, i.e., initial image frames 6, 8, and 10, onto the 2:1 panoramic unfolded image to obtain the reference image for the first image alignment.

[0178] S1302, based on the initial mapping information and other initial image frames located at the first preset position, determine the image to be aligned for the first image alignment; the other initial image frames are image frames other than the first initial image frame among the initial image frames.

[0179] In this embodiment, after S2701, the computer device determines the image to be aligned from other initial image frames located at the first preset position. These other initial image frames are image frames other than the first initial image frame.

[0180] Continuing with the example above, during the first image alignment, the computer device projects the initial image frames 6, 8, and 10 onto portions of the first preset panoramic image as reference images, and then projects the remaining initial image frames 7 and 9 onto portions of the first preset panoramic image as images to be aligned.

[0181] Furthermore, the computer device aligns the portions of initial image frames 7 and 9 projected onto the first preset panoramic image based on the portions of initial image frames 6, 8, and 10 respectively projected onto the first preset panoramic image, in order to determine the target mapping information corresponding to initial image frames 7 and 9 respectively. The image alignment process can refer to the steps in the above embodiments, and will not be repeated here.

[0182] It should be noted that the above is only an example of one possible order and number of images for equatorial stitching. The computer device may also use the initial image frame 8 and the initial image frame 10 as reference images and the initial image frame 9 as the image to be aligned in the first image alignment, and then perform subsequent image alignment. This embodiment does not impose any restrictions.

[0183] In this embodiment, during equatorial stitching, a first initial image frame located at a first preset position and without overlapping areas is first determined from all initial image frames. A reference image for the first image alignment is then determined based on the first initial image frame and initial mapping information. Subsequently, the image to be aligned is determined based on the initial mapping information and other initial image frames located at the first preset position. On one hand, the first initial image frame can be directly used as a reference image, eliminating the need for image alignment and thus accelerating the processing speed of the computer. On the other hand, the first initial image frame can be used as an anchor point to prevent excessive deformation or positional changes in the entire panoramic image during image alignment, thereby improving the quality of the target panoramic image.

[0184] The following will describe top splicing and bottom splicing. Figure 14 This is a schematic diagram illustrating a top-joining or bottom-joining process in an embodiment of this application. (Refer to...) Figure 14 This embodiment relates to an optional implementation of top-layer splicing or bottom-layer splicing. Based on the above embodiment, the top-layer splicing or bottom-layer splicing includes the following steps:

[0185] S1401, determine the second initial image frame located in the second preset region from each initial image frame, and project the second initial image frame onto the first target region in the first preset panoramic image according to the initial mapping information.

[0186] During the generation of the target panoramic image, the top and bottom parts of the panoramic image are severely stretched or distorted, and image alignment cannot avoid this. Figure 15 This is an illustration of top-view distortion, as shown below. Figure 15 (a) and Figure 15 (b) If the initial image frame at the top is directly projected into the first preset panoramic image in the current manner, the top image will be severely stretched, for example... Figure 15 The area outlined by the dashed line has been stretched.

[0187] Therefore, during the top or bottom stitching process, the computer device will project the second initial image frame located in the second preset area onto the first target area in the first preset panoramic image.

[0188] The second preset position is the top or bottom part of the target panoramic image. Its coverage can be adjusted according to the needs. Generally, it can cover the initial image frame located in the top or bottom row of the target panoramic image.

[0189] The first target region refers to a region in the panoramic image that will not be stretched or distorted. For example, the first target region includes the middle part of the target panoramic image.

[0190] For example, during top stitching, assuming the computer device acquires initial image frames 1 to 20, and according to the preset path of the gimbal, initial image frames 1 to 5 are located at the top of the target panoramic image. Then, the computer device uses initial image frames 1 to 5 as the second initial image frames and projects them onto the first target area in the first preset panoramic image.

[0191] Similarly, during bottom stitching, assuming the computer device acquires initial image frames 1 to 20, and according to the preset path of the gimbal, initial image frames 11 to 20 are located at the bottom of the target panoramic image. Therefore, the computer device uses initial image frames 11 to 20 as the second initial image frames and projects them onto the first target area in the first preset panoramic image.

[0192] In this way, the initial image frame after projection largely eliminates the effects of distortion, which is beneficial for subsequent image alignment.

[0193] S1402, based on the second initial image frame projected onto the first target region, determine the reference image and the image to be aligned for each image alignment, and perform alignment processing on the corresponding image to be aligned based on the reference image for each image alignment, so as to determine the intermediate mapping information corresponding to the second initial image frame after each image alignment.

[0194] In this embodiment, the computer device can further determine the reference image and the image to be aligned for each image alignment based on the second initial image frame projected onto the first target area, and perform alignment processing on the corresponding image to be aligned based on the reference image for each image alignment, so as to determine the intermediate mapping information corresponding to the second initial image frame after each image alignment.

[0195] For example, during the first image alignment at the top, the computer device projects the portion of the initial image frame 1 onto the first target region in the first preset panoramic image as a reference image, and projects the portion of the initial image frame 2 onto the first target region in the first preset panoramic image as the image to be aligned. Then, based on the reference image used for this image alignment, the corresponding image to be aligned is aligned to determine the intermediate mapping information corresponding to the second initial image frame after the first image alignment. That is, the computer device determines the intermediate mapping information 1 corresponding to the initial image frame 1 and the intermediate mapping information 2 corresponding to the initial image frame 2.

[0196] The image alignment process can be referred to in the above embodiments, and will not be repeated here.

[0197] S1403, determine the target mapping information of the second initial image frame based on the intermediate mapping information corresponding to the second initial image frame.

[0198] In this embodiment, after S1402, the computer device can determine the target mapping information of the second initial image frame based on the intermediate mapping information corresponding to the second initial image frame.

[0199] It is understandable that, since the second initial image frame located in the second preset area is projected onto the first target area in the first preset panoramic image, the intermediate mapping information obtained after image alignment is not the target mapping information required by the final computer device.

[0200] The computer device also modifies the intermediate mapping information corresponding to the image to be aligned projected onto the first target area, thereby updating the intermediate mapping information of the second initial image frame corresponding to the reference image and the image to be aligned projected onto the first target area, so as to obtain the target mapping information of the second initial image frame to ensure the accuracy of the target mapping information of each initial image frame.

[0201] For example, assuming the computer device obtains intermediate mapping information 1 corresponding to the initial image frame 1, the computer device will further modify the position in the intermediate mapping information 1, that is, modify some values ​​in the intermediate mapping information, to obtain target mapping information 1. So that when the computer device projects the initial image frame 1 using the target mapping information 1, it can ensure that the initial image frame 1 is still projected to the position corresponding to the second preset area, rather than to the position corresponding to the first target area, when the final target panoramic image is generated.

[0202] Figure 16 This is a schematic diagram showing the effect after the top is stitched together. Please refer to it. Figure 15 ,like Figure 16 (a) and Figure 16 As shown in (b), the projected top texture largely eliminates the effects of distortion and facilitates subsequent image alignment by computer equipment.

[0203] In some embodiments, the computer device first performs equatorial stitching, and then performs top stitching and bottom stitching based on the equatorial stitching. Furthermore, image alignment is performed simultaneously during the equatorial stitching, top stitching, and bottom stitching processes.

[0204] In this embodiment, when performing top or bottom stitching, a second initial image frame located in a second preset region is first determined from each initial image frame. Based on the initial mapping information, the second initial image frame is projected onto a first target region in a first preset panoramic image. Then, based on the second initial image frame projected onto the first target region, a reference image and an image to be aligned are determined for each image alignment. Based on the reference image for each image alignment, the corresponding image to be aligned is aligned to determine the intermediate mapping information corresponding to the second initial image frame after each image alignment. Thus, based on the intermediate mapping information corresponding to the second initial image frame, the target mapping information of the second initial image frame is determined. In this way, distortion at the top and bottom of the target panoramic image can be eliminated, thereby improving the quality of the target panoramic image.

[0205] The following will describe the splicing of both sides. Figure 17 This is a schematic diagram of a two-sided splicing process in an embodiment of this application, referring to... Figure 17 This embodiment relates to an optional implementation of two-sided splicing. Based on the above embodiment, the two-sided splicing includes the following steps:

[0206] S1701, connect the two sides of the target panoramic image with a third initial image frame, and project the third initial image frame onto the second target area in the first preset panoramic image according to the initial mapping information.

[0207] In this embodiment, in the 2:1 panoramic unfolded image, the left and right sides are connected, meaning the target panoramic image requires continuous images at both ends. Therefore, when stitching the two sides together, the computer device connects the third initial image frames of the two side regions of the target panoramic image and projects the third initial image frames onto the second target region in the first preset panoramic image according to the initial mapping information. The size of the two side regions can be set according to actual needs. The second target region can be any position in the first preset panoramic image; this embodiment does not impose any restrictions. It is understood that, to improve the stitching effect, the second target region can be set in the middle part of the first preset panoramic image.

[0208] For example, see reference Figure 11When the computer device needs to process the leftmost initial image frame 1 and the rightmost initial image frame 2, it connects initial image frames 1 and 2 together as a third initial image frame. Then, using initial mapping information, it projects this third initial image frame onto the second target area in the first preset panoramic image. In other words, the computer device uses initial mapping information to connect initial image frames 1 and 2 and project them onto the middle area of ​​the 2:1 panoramic unfolded image. This connects the two ends of the target panoramic image, forming a continuous picture. This ensures that the target panoramic image maintains its left-right continuity after subsequent image alignment and that the left and right ends of the stitching seam are connected.

[0209] S1702, based on the third initial image frame projected onto the second target region, determine the reference image and the image to be aligned for each image alignment, and perform alignment processing on the corresponding image to be aligned based on the reference image for each image alignment, so as to determine the intermediate mapping information corresponding to the third initial image frame after each image alignment.

[0210] In this embodiment, after S1701, the computer device can determine the reference image and the image to be aligned for each image alignment based on the third initial image frame projected onto the second target area, and perform alignment processing on the corresponding image to be aligned based on the reference image for each image alignment, so as to determine the intermediate mapping information corresponding to the third initial image frame after each image alignment.

[0211] The process of S1702 is the same as that of S1402, and the image alignment process can be referred to the above embodiments, which will not be repeated here.

[0212] S1703, determine the target mapping information of the third initial image frame based on the intermediate mapping information corresponding to the third initial image frame.

[0213] In this embodiment, similar to the top and bottom stitching principles, the computer device also updates the intermediate mapping information corresponding to the third initial image frame using the intermediate mapping information of the reference image projected onto the second target region and the image to be aligned, thereby obtaining the target mapping information of the third initial image frame and ensuring the accuracy of the target mapping information of each initial image frame. In other words, after image alignment, the computer device still needs to swap the left and right parts of the map and mask back to their original positions in the panoramic image corresponding to the initial image frame.

[0214] For example, assuming the third initial image frame includes initial image frame 5, after the computer device obtains the intermediate mapping information 5 corresponding to initial image frame 5, it will modify the position in the intermediate mapping information 5, that is, modify some values ​​in the intermediate mapping information, thereby obtaining target mapping information 5. So that when the computer device projects the initial image frame 5 using the target mapping information 5, it can ensure that the initial image frame 1 is still projected to the positions on both sides when the target panoramic image is finally generated.

[0215] In this embodiment, during the stitching of both sides, the third initial image frames of the two side regions of the target panoramic image are first stitched together. Based on the initial mapping information, the third initial image frames are projected onto the second target region in the first preset panoramic image. Then, based on the third initial image frames projected onto the second target region, the reference image and the image to be aligned for each image alignment are determined. Based on the reference image for each alignment, the corresponding image to be aligned is aligned to determine the intermediate mapping information corresponding to the third initial image frame after each alignment. Finally, based on the intermediate mapping information corresponding to the third initial image frame, the target mapping information of the third initial image frame is determined. In this way, the images at both ends of the target panoramic image are continuous, improving the quality of the target panoramic image.

[0216] In one embodiment, optionally, the panoramic image generation method described above may further include the following steps:

[0217] Send a rotation command to the gimbal; the rotation command instructs the gimbal to rotate along a preset path so that the shooting device can capture the initial image frame while the gimbal is rotating along the preset path.

[0218] In this embodiment, the computer device sends a rotation command to the gimbal. After receiving the rotation command, the gimbal can rotate along a preset path, so that the imaging device captures the initial image frame while the gimbal rotates along the preset path.

[0219] The rotation command can include a preset path. The rotation command can be a command sent periodically from a computer device to the gimbal, or it can be a command sent to the gimbal after receiving a user's input.

[0220] In this embodiment, the computer device can send rotation commands to the gimbal, so that after receiving the rotation command, the gimbal can rotate along a preset path, allowing the imaging device to capture the initial image frame while the gimbal is rotating along the preset path. This enables the automated generation of a panoramic image of the target, simplifying the user's operation.

[0221] In one embodiment, optionally, the preset path enables the field of view captured by the shooting device to cover 360° in a first direction and 180° in a second direction; the first direction is perpendicular to the second direction.

[0222] In this embodiment, "the first direction is perpendicular to the second direction" means that the angle difference between the angle between the first direction and the second direction and 90° is less than a preset angle threshold, where the preset difference threshold is a number greater than or equal to 0°. For example, the preset path enables the field of view captured by the imaging device to cover 360° horizontally and 180° vertically.

[0223] In one embodiment, optionally, the preset path includes multiple parallel sub-paths, wherein the difference in target angle parameters between two adjacent shooting points in the sub-path is less than a preset difference threshold, and the target angle parameters include at least one of yaw angle, pitch angle, and roll angle.

[0224] In this embodiment, reference can be made to Figure 3 The preset path includes three parallel sub-paths, which can be horizontal or vertical. Taking vertical parallelism as an example, for each sub-path, the difference in pitch angle between any two adjacent shooting points is less than a preset difference threshold. Similarly, for horizontal parallelism, the difference in yaw angle between any two adjacent shooting points is less than a preset difference threshold. The preset difference threshold can be set according to requirements and can be 0.

[0225] For example, the preset path includes three horizontally parallel sub-paths 1 to 3. That is, the shooting device needs to capture three rows of images. Sub-path 1 captures 5 initial image frames at equal or approximately equal intervals, sub-path 2 captures 8 initial image frames at equal or approximately equal intervals, and sub-path 3 captures 5 initial image frames at equal or approximately equal intervals.

[0226] In one embodiment, to facilitate subsequent stitching, optionally, the number of initial image frames corresponding to the target sub-path among the multiple sub-paths is even, and at least one set of image frames with the same yaw angle exists among the initial image frames corresponding to the multiple sub-paths; the target sub-path is the sub-path located in the middle row among the multiple sub-paths. That is, for the sub-path located in the middle row, i.e., the equatorial row, the imaging device needs to acquire an even number of initial image frames, and each sub-path needs to have one initial image frame vertically aligned.

[0227] Optionally, in one embodiment, the shooting device is a non-panoramic shooting device.

[0228] In this embodiment, the shooting device is a non-panoramic shooting device. A dedicated panoramic shooting device refers to a photographic device with a field of view that covers 360° horizontally and 180° vertically. For example, a dedicated panoramic shooting device is a shooting device that includes two fisheye cameras.

[0229] Non-panoramic shooting equipment refers to shooting equipment whose lens field of view cannot cover 360° in the first direction and 180° in the second direction. For example, shooting equipment includes at least one of the following: a standard lens with a field of view of 45°, a wide-angle lens with a field of view of 60-80°, an ultra-wide-angle lens with a field of view of 80-120°, and a fisheye lens with a field of view of 180-220°.

[0230] In some embodiments, the shooting device may also be a mobile phone, and the user uses the mobile phone's rear camera to capture the initial image frame of the device.

[0231] Currently, in some application scenarios, users can only obtain panoramic images using dedicated panoramic shooting equipment, thus limiting the application scenarios of current panoramic image generation methods. However, in this embodiment, the shooting equipment is a non-panoramic shooting device. Therefore, this application provides a panoramic image generation method that can be applied to non-panoramic shooting devices, expanding the application scope and flexibility of panoramic image generation methods.

[0232] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0233] Based on the same inventive concept, this application also provides a handheld gimbal. The handheld gimbal includes a motor, a camera, and a processor. The motor controls the rotation of the gimbal to drive the rotation of the camera, and the processor executes any of the panoramic image generation methods described above.

[0234] In one embodiment, optionally, in the handheld gimbal, the original upper limit of the gimbal's tilt angle is used as the new upper limit of the gimbal's elevation angle, and the original upper limit of the gimbal's elevation angle is used as the new upper limit of the gimbal's tilt angle.

[0235] Taking a mobile phone as an example, since the rear camera of a mobile phone generally has a wider field of view (FOV) and is more suitable for shooting scenes, users usually use the rear camera of the mobile phone to capture the initial image frame to obtain a panoramic image of the target. In order to capture the bottom as much as possible, the gimbal and the mobile phone need to be at a very low angle of attack, which causes the bottom of the gimbal body to enter the field of view of the mobile phone's rear camera, thus affecting the image of the initial image frame at the low angle of attack.

[0236] Therefore, in this embodiment, the phone is clamped upside down on the gimbal to reverse the gimbal's tilt and elevation settings. That is, the original maximum tilt angle of the gimbal is used as the new maximum elevation angle, and vice versa. For example, if the original maximum tilt angle was 60° and the maximum elevation angle was 70°, clamping the phone upside down on the gimbal updates the maximum tilt angle to 70° and the maximum elevation angle to 60°.

[0237] Thus, even with a low tilt angle for the phone's rear camera, the gimbal body remains hidden in the frame, achieving a "hidden gimbal" effect near the bottom of the image and improving the quality of the generated panoramic image. It should be noted that the gimbal clamping method described above is due to the gimbal's structural design. Other gimbal structures, if they do not have limitations on tilt angle, do not require this reverse clamping method.

[0238] In one embodiment, this application also provides a panoramic image generation system, which includes a gimbal and a terminal. The gimbal is used to rotate along a preset path; the terminal includes a camera and a processor. The camera is used to capture multiple initial image frames from multiple shooting angles while the gimbal rotates along the preset path, and sends these initial image frames to the processor so that the processor can execute any of the panoramic image generation methods described above. Specific limitations of the panoramic image generation system can be found in the limitations of the panoramic image generation method described above, and will not be repeated here.

[0239] Based on the same inventive concept, this application also provides a panoramic image generation apparatus for implementing the panoramic image generation method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more panoramic image generation apparatus embodiments provided below can be found in the limitations of the panoramic image generation method described above, and will not be repeated here.

[0240] Figure 18 This is a structural block diagram of the panoramic image generation device in the embodiments of this application, such as... Figure 18As shown, this application provides a panoramic image generation device 1800, including: a first determining module 1801, a second determining module 1802, and a first generating module 1803, wherein:

[0241] The first determining module 1801 is used to determine the reference image and the image to be aligned for each image alignment based on each initial image frame and the initial mapping information.

[0242] The second determining module 1802 is used to perform alignment processing on the corresponding image to be aligned according to the reference image for each image alignment, and to determine the target mapping information corresponding to each initial image frame after each image alignment; the target mapping information is used to indicate the area of ​​each initial image frame projected onto the target panoramic image after each image alignment.

[0243] The first generation module 1803 is used to generate a panoramic image of the target based on each initial image frame and the corresponding target mapping information.

[0244] The panoramic image generation apparatus provided in this embodiment determines the reference image and the image to be aligned for each image alignment based on each initial image frame and initial mapping information. It then performs alignment processing on the corresponding image to be aligned based on the reference image for each alignment and determines the target mapping information corresponding to each initial image frame after each alignment. Thus, a target panoramic image is generated based on each initial image frame and the corresponding target mapping information. Currently, in the process of generating panoramic images, the camera's intrinsic and extrinsic parameters are first calculated based on multiple images, and then the multiple images are directly projected using the camera's intrinsic and extrinsic parameters to obtain the final panoramic image. However, errors or insufficient precision in the camera's intrinsic and extrinsic parameters may occur during this process, resulting in misalignment in the currently obtained panoramic images. In this application, since the target mapping information can indicate the area to which each initial image frame is projected onto the target panoramic image after each image alignment, and each time an image is aligned, the reference image and the image to be aligned for the current image alignment with overlapping areas are determined, and the image to be aligned for the current image alignment is aligned, thus, the reference image and the image to be aligned can be aligned after the alignment processing. Furthermore, the resulting panoramic image of the target can reduce stitching misalignment.

[0245] Optionally, each initial image frame is an image frame taken from multiple shooting angles by a shooting device set on the gimbal during the rotation of the gimbal.

[0246] Optionally, the first determining module 1801 includes:

[0247] The first determining unit is used to project at least two image frames from each initial image frame onto a first preset panoramic image using initial mapping information, so as to determine the reference image and the image to be aligned for the current image alignment.

[0248] The second determining unit is used to perform alignment processing on the corresponding image to be aligned based on the reference image of the current image alignment, and then use the aligned image to be aligned and the reference image of the previous image alignment as the reference image for the next image alignment, and determine the image to be aligned for the next image alignment based on each initial image frame and the initial mapping information.

[0249] Optionally, alignment processing includes at least one of translation, rotation, and stretching.

[0250] Optionally, two adjacent initial image frames in the plurality of initial image frames have overlapping regions; the second determining module 1802 includes:

[0251] The third determining unit is used to determine the control points corresponding to the overlapping area between the reference image and the corresponding image to be aligned for each image alignment.

[0252] The fourth determining unit performs alignment processing on the corresponding image to be aligned based on the control points corresponding to each image alignment, and determines the target mapping information corresponding to each initial image frame after each image alignment.

[0253] Optionally, the third determining unit includes:

[0254] The first determining subunit is used to determine the optical flow value of each pixel in the overlapping region of the reference image and the image to be aligned.

[0255] The second determining subunit is used to determine the control points corresponding to the overlapping areas of the reference image and the image to be aligned based on the optical flow values ​​of each pixel.

[0256] Optionally, the first generation module 1803 includes:

[0257] The fifth determining unit is used to determine the mask information corresponding to each initial image frame based on the overlapping area of ​​each initial image frame; the mask information is used to indicate the boundary of each initial image frame projected onto the target panoramic image.

[0258] The generation unit is used to project each initial image frame onto a second preset panoramic image based on the target mapping information and mask information to generate a target panoramic image.

[0259] Optionally, the generation unit includes:

[0260] The first generation subunit is used to project each initial image frame onto the second preset panoramic image based on the target mapping information and mask information to generate the first panoramic image.

[0261] The second generation subunit is used to generate a target panoramic image based on the first panoramic image.

[0262] Optionally, the panoramic image generation device 1800 also includes:

[0263] The third determining module is used to determine the reference image and the image to be aligned for each image alignment based on each initial image frame and initial mapping information using the image stitching method, and to perform alignment processing on the corresponding image to be aligned based on the reference image for each image alignment, and to determine the target mapping information corresponding to each initial image frame after each image alignment; the image stitching method includes at least one of frame-by-frame stitching, equatorial stitching, top stitching, bottom stitching, and side stitching.

[0264] Optional, equatorial splicing includes:

[0265] Determine the first initial image frame located at the first preset position and without overlapping areas from each initial image frame, and determine the reference image for the first image alignment based on the first initial image frame and the initial mapping information;

[0266] Based on the initial mapping information and other initial image frames located at the first preset position, the image to be aligned for the first image alignment is determined; the other initial image frames are the image frames other than the first initial image frame among the initial image frames.

[0267] Optional top or bottom splicing includes:

[0268] A second initial image frame located in the second preset region is determined from each initial image frame, and the second initial image frame is projected onto the first target region in the first preset panoramic image according to the initial mapping information;

[0269] Based on the second initial image frame projected onto the first target region, a reference image and an image to be aligned are determined for each image alignment. Based on the reference image for each image alignment, the corresponding image to be aligned is aligned to determine the intermediate mapping information corresponding to the second initial image frame after each image alignment.

[0270] The target mapping information of the second initial image frame is determined based on the intermediate mapping information corresponding to the second initial image frame.

[0271] Optional, side splicing includes:

[0272] A third initial image frame is connected to the two sides of the target panoramic image, and the third initial image frame is projected onto the second target area in the first preset panoramic image according to the initial mapping information.

[0273] Based on the third initial image frame projected onto the second target region, the reference image and the image to be aligned for each image alignment are determined, and the corresponding image to be aligned is aligned based on the reference image for each image alignment, so as to determine the intermediate mapping information corresponding to the third initial image frame after each image alignment.

[0274] Based on the intermediate mapping information corresponding to the third initial image frame, determine the target mapping information of the third initial image frame.

[0275] Optionally, the panoramic image generation device 1800 also includes:

[0276] The sending module is used to send rotation commands to the gimbal; the rotation commands instruct the gimbal to rotate along a preset path so that the shooting device can capture the initial image frame while the gimbal is rotating along the preset path.

[0277] Optionally, the preset path enables the field of view captured by the shooting device to cover 360° in the first direction and 180° in the second direction; the first direction is perpendicular to the second direction.

[0278] Optionally, the preset path includes multiple parallel sub-paths, where the difference in target angle parameters between two adjacent shooting points in a sub-path is less than a preset difference threshold. The target angle parameters include yaw angle or pitch angle.

[0279] Optionally, the number of initial image frames corresponding to the target sub-path in the multiple sub-paths is even, and there is at least one set of image frames with the same yaw angle among the initial image frames corresponding to the multiple sub-paths; the target sub-path is the sub-path located in the middle row among the multiple sub-paths.

[0280] Optional, the shooting equipment is a non-panoramic shooting equipment.

[0281] Each module in the aforementioned panoramic image generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.

[0282] Figure 19 This is an internal structure diagram of a computer device in an embodiment of this application. This application provides a computer device, which may be a server, and its internal structure diagram can be as follows. Figure 19 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores relevant data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a panoramic image generation method.

[0283] Those skilled in the art will understand that Figure 19 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0284] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0285] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.

[0286] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0287] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0288] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0289] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for generating panoramic images, characterized in that, The method includes: Based on each initial image frame and initial mapping information, a reference image and an image to be aligned are determined for each image alignment; the reference image and the image to be aligned for each image alignment have an overlapping area; the initial mapping information is determined based on the overlapping area between two adjacent initial image frames in each initial image frame; Based on the reference image for each image alignment, control points corresponding to the overlapping area between the reference image for each image alignment and the corresponding image to be aligned are determined. Based on the control points corresponding to each image alignment, the corresponding image to be aligned is aligned, and the target mapping information corresponding to each initial image frame after each image alignment is determined. The target mapping information is used to indicate the area of ​​each initial image frame projected onto the target panoramic image after each image alignment. The aligned image to be aligned and the reference image of the previous image alignment are used as the reference image for the next image alignment, and the image to be aligned for the next image alignment is determined based on each initial image frame and the initial mapping information. The target panoramic image is generated based on each initial image frame and the corresponding target mapping information.

2. The method according to claim 1, characterized in that, Each of the initial image frames is an image frame taken from multiple shooting angles by a shooting device mounted on a gimbal during the rotation of the gimbal.

3. The method according to claim 2, characterized in that, The step of determining the reference image and the image to be aligned for each image alignment based on each initial image frame and initial mapping information includes: Using the initial mapping information, at least two image frames from each of the initial image frames are projected onto a first preset panoramic image to determine the reference image and the image to be aligned for the current image alignment.

4. The method according to claim 3, characterized in that, The alignment process includes at least one of translation, rotation, and stretching.

5. The method according to claim 4, characterized in that, Two adjacent initial image frames in a plurality of initial image frames have overlapping regions.

6. The method according to claim 5, characterized in that, The process of determining the control points corresponding to the overlapping area between the reference image and the corresponding image to be aligned for each image alignment includes: Determine the optical flow value of each pixel in the overlapping region of the reference image and the image to be aligned; Based on the optical flow value of each pixel, control points corresponding to the overlapping areas of the reference image and the image to be aligned are determined.

7. The method according to claim 6, characterized in that, The step of generating the target panoramic image based on each of the initial image frames and the corresponding target mapping information includes: Based on the overlapping areas of each initial image frame, mask information corresponding to each initial image frame is determined; the mask information is used to indicate the boundary of each initial image frame projected onto the target panoramic image; Based on the target mapping information and the mask information, each of the initial image frames is projected onto the second preset panoramic image to generate the target panoramic image.

8. The method according to claim 7, characterized in that, The step of projecting each of the initial image frames onto a second preset panoramic image based on the target mapping information and the mask information to generate the target panoramic image includes: Based on the target mapping information and the mask information, each of the initial image frames is projected into the second preset panoramic image to generate the first panoramic image; The target panoramic image is generated based on the first panoramic image.

9. The method according to any one of claims 1-8, characterized in that, The method further includes: Using an image stitching method, a reference image and an image to be aligned are determined for each image alignment based on each initial image frame and the initial mapping information. Based on the reference image for each image alignment, the corresponding image to be aligned is aligned, and the target mapping information corresponding to each initial image frame after each image alignment is determined. The image stitching method includes at least one of frame-by-frame stitching, equatorial stitching, top stitching, bottom stitching, and side stitching.

10. The method according to claim 9, characterized in that, The equatorial splicing includes: A first initial image frame located at a first preset position and having no overlapping area is determined from each of the initial image frames, and a reference image for the first image alignment is determined based on the first initial image frame and the initial mapping information; Based on the initial mapping information and other initial image frames located at the first preset position, the image to be aligned for the first image alignment is determined; the other initial image frames are image frames other than the first initial image frame among the initial image frames.

11. The method according to claim 9, characterized in that, The top or bottom splicing includes: A second initial image frame located in a second preset region is determined from each of the initial image frames, and the second initial image frame is projected onto a first target region in a first preset panoramic image according to the initial mapping information; Based on the second initial image frame projected onto the first target region, the reference image and the image to be aligned for each image alignment are determined, and the corresponding image to be aligned is aligned based on the reference image for each image alignment, so as to determine the intermediate mapping information corresponding to the second initial image frame after each image alignment. The target mapping information of the second initial image frame is determined based on the intermediate mapping information corresponding to the second initial image frame.

12. The method according to claim 9, characterized in that, The two-sided splicing includes: A third initial image frame is connected to the two side regions of the target panoramic image, and the third initial image frame is projected onto the second target region in the first preset panoramic image according to the initial mapping information; Based on the third initial image frame projected onto the second target region, the reference image and the image to be aligned for each image alignment are determined, and the corresponding image to be aligned is aligned based on the reference image for each image alignment, so as to determine the intermediate mapping information corresponding to the third initial image frame after each image alignment. The target mapping information of the third initial image frame is determined based on the intermediate mapping information corresponding to the third initial image frame.

13. The method according to claim 2, characterized in that, The method further includes: A rotation command is sent to the gimbal; the rotation command instructs the gimbal to rotate along a preset path so that the imaging device can capture the initial image frame while the gimbal is rotating along the preset path.

14. The method according to claim 13, characterized in that, The preset path enables the field of view captured by the shooting device to cover 360° in the first direction and 180° in the second direction; the first direction is perpendicular to the second direction.

15. The method according to claim 14, characterized in that, The preset path includes multiple parallel sub-paths. The difference in target angle parameters between two adjacent shooting points in the sub-path is less than a preset difference threshold. The target angle parameters include at least one of yaw angle, pitch angle, and roll angle.

16. The method according to claim 15, characterized in that, The number of frames of the initial image frames corresponding to the target sub-paths in the multiple sub-paths is even, and there is at least one set of image frames with the same yaw angle among the initial image frames corresponding to the multiple sub-paths. The target sub-path is the sub-path located in the middle row among the multiple sub-paths.

17. The method according to claim 2, characterized in that, The shooting device is a non-panoramic shooting device.

18. A handheld gimbal, characterized in that, The handheld gimbal includes: a motor, a camera, and a processor; The motor is used to control the rotation of the gimbal to drive the rotation of the camera, and the processor is used to execute the method according to any one of claims 1-17.

19. A panoramic image generation system, characterized in that, The panoramic image generation system includes a gimbal and a terminal; The gimbal is used to rotate according to a preset path; The terminal includes a shooting device and a processor. The shooting device is used to capture multiple initial image frames at multiple shooting angles during the rotation of the gimbal along a preset path, and send the multiple initial image frames to the processor so that the processor can execute the method according to any one of claims 1-17.

20. A panoramic image generation device, characterized in that, The device includes: The first determining module is used to determine the reference image and the image to be aligned for each image alignment based on each initial image frame and the initial mapping information; the initial mapping information is determined based on the overlapping area between two adjacent initial image frames in each initial image frame. The second determining module is used to perform alignment processing on the corresponding image to be aligned according to the reference image for each image alignment, and to determine the target mapping information corresponding to each initial image frame after each image alignment; the target mapping information is used to indicate the area of ​​each initial image frame projected onto the target panoramic image after each image alignment; the aligned image to be aligned and the reference image of the previous image alignment are used as the reference image for the next image alignment, and the image to be aligned for the next image alignment is determined according to each initial image frame and the initial mapping information; The first generation module is used to generate the target panoramic image based on each of the initial image frames and the corresponding target mapping information; The third determining unit is used to determine the control points corresponding to the overlapping area between the reference image and the corresponding image to be aligned for each image alignment. The fourth determining unit is used to perform alignment processing on the corresponding image to be aligned according to the control points corresponding to each image alignment, and to determine the target mapping information corresponding to each initial image frame after each image alignment.

21. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 17.

22. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 17.

23. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 17.

Citation Information

Patent Citations

  • Image splicing method and device, panoramic image splicing method and device, storage medium and electronic equipment

    CN111429354A

  • Image splicing processing method, device and equipment and computer storage medium

    CN114972023A

  • Panoramic image generation method, photography apparatus, flight system, and storage medium

    WO2022027313A1