Panoramic image generation method and device, equipment and storage medium

By filtering and merging the images to be processed when the image collection device moves in the target direction, the problem of reduced response speed caused by the equipment's computing power usage is solved, more efficient panoramic image generation is achieved, and the user experience is improved.

CN118587106APending Publication Date: 2024-09-03SHANGHAI WINGTECH ELECTRONICS TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410577399.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-10
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

When generating panoramic images, a large amount of device computing resources are occupied, resulting in reduced response speed and affecting user experience.

Method used

By acquiring multiple images to be processed collected when the image acquisition device moves along the target direction, screening images to be fused with large offset distances, and performing registration and fusion processing to reduce the number of images to be processed required to generate panoramic images, thereby Reduce computing power requirements.

Benefits of technology

It effectively reduces the computing power required to generate panoramic images, improves device response speed, and enhances user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587106A
    Figure CN118587106A
Patent Text Reader

Abstract

The invention relates to a panoramic image generation method and device, equipment and a storage medium. The panoramic image generation method comprises the steps that a to-be-processed image sequence is acquired, and the image sequence comprises a plurality of to-be-processed images acquired by multiple times of acquisition of the same scene when an image acquisition device moves in the target direction; multiple to-be-fused images are screened from the multiple to-be-processed images, the multiple to-be-fused images comprise the first to-be-processed image, and the offset distance of adjacent to-be-fused images in the multiple to-be-fused images in the target direction is larger than or equal to a preset threshold value; the offset distance between the to-be-processed image between the adjacent to-be-fused images and the previous to-be-fused image in the target direction is smaller than a preset threshold value; and performing registration and fusion processing on the plurality of to-be-fused images to obtain a panoramic image. According to the embodiment of the invention, the to-be-fused image used for generating the panoramic image can be screened based on the offset distance between the to-be-processed images, and the calculation power required for generating the panoramic image is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a panoramic image generation method, device, equipment and storage medium. Background Art

[0002] Panoramic images refer to images obtained by stitching together multiple photos taken while the camera moves or rotates in a single direction. Panoramic images can accommodate more people and scenery, simulating the scenes seen by the human eye, and thus providing a more realistic visual experience. However, a large amount of computing processing is required in the process of generating panoramic images. When the camera's hardware configuration is limited, a large amount of computing power resources are occupied, which will lead to a decrease in device response speed and freezes when taking photos, seriously affecting the user experience. Therefore, how to reduce the computing power required to generate panoramic images is a technical problem that needs to be solved urgently. Summary of the invention

[0003] Based on this, it is necessary to provide a panoramic image generation method, device, equipment and storage medium to address the above technical problems.

[0004] The present application provides a method for generating a panoramic image, the method comprising:

[0005] Acquire a sequence of images to be processed, wherein the sequence of images includes a plurality of images to be processed obtained by acquiring the same scene multiple times when the image acquisition device moves along a target direction;

[0006] Screening a plurality of images to be fused from the plurality of images to be processed, wherein the plurality of images to be fused include a first image to be processed, and an offset distance between adjacent images to be fused in the plurality of images to be fused in the target direction is greater than or equal to a preset threshold, and an offset distance between an image to be processed between the adjacent images to be fused and a previous image to be fused in the target direction is less than the preset threshold;

[0007] The multiple images to be fused are registered and fused to obtain a panoramic image.

[0008] In one embodiment, the step of selecting a plurality of images to be fused from the plurality of images to be processed includes:

[0009] Respectively obtaining down-sampled images corresponding to the plurality of images to be processed;

[0010] For each image to be processed except the first image to be processed in the image sequence, calculating a first homography matrix between a down-sampled image corresponding to the image to be processed and a down-sampled image corresponding to a previous image to be fused;

[0011] Based on the first homography matrix, an offset distance between the image to be processed and the previous image to be fused in the target direction is determined.

[0012] In one embodiment, the registering and fusing the multiple images to be fused to obtain a panoramic image includes:

[0013] Performing registration and fusion processing on a first image to be fused and a second image to be fused that are acquired earliest among the multiple images to be fused, to obtain a fused image;

[0014] According to the time sequence relationship between the other images to be fused except the first image to be fused and the second image to be fused among the multiple images to be fused, the fused image is sequentially registered and fused with the next image to be fused, and the fused image is updated based on the fusion result, and the above fusion and update operations are performed repeatedly until the third image to be fused with the latest acquisition time among the multiple images to be fused is fused to obtain the panoramic image.

[0015] In one embodiment, the registering and fusing the first image to be fused and the second image to be fused with the earliest acquisition time among the multiple images to be fused to obtain the fused image includes:

[0016] Performing feature point detection on the first image to be fused and the second image to be fused respectively to obtain first feature points and second feature points;

[0017] Extracting first image features and second image features corresponding to the first feature points and the second feature points from the first image to be fused and the second image to be fused respectively;

[0018] Performing feature point matching on the first feature point and the second feature point based on the first image feature and the second image feature;

[0019] Based on the feature point matching result, calculating a second homography matrix between the first image to be fused and the second image to be fused;

[0020] Based on the second homography matrix, transform the second image to be fused;

[0021] The first image to be fused and the transformed second image to be fused are fused to obtain the fused image.

[0022] In one embodiment, after performing feature point matching on the first feature point and the second feature point based on the first image feature and the second image feature, the method further includes:

[0023] Optimizing the feature point matching result based on a random sampling consensus algorithm;

[0024] The calculating, based on the feature point matching result, a second homography matrix between the first image to be fused and the second image to be fused includes:

[0025] Based on the optimized feature point matching result, a second homography matrix between the first image to be fused and the second image to be fused is calculated.

[0026] In one embodiment, extracting a first image feature corresponding to the first feature point from the first image to be fused includes:

[0027] For each first feature point, selecting at least two pairs of image blocks in a preset area centered on the first feature point in the first image to be fused;

[0028] Calculate the difference in average grayscale values ​​of pixels corresponding to each pair of image blocks;

[0029] Binary conversion is performed on the difference between the average grayscale values ​​of the pixels corresponding to the at least two pairs of image blocks to obtain a first image feature corresponding to the first feature point.

[0030] In one embodiment, the fusion process is implemented using a Laplacian pyramid algorithm.

[0031] The present application also provides a panoramic image generation device, which includes:

[0032] An acquisition module, used to acquire a sequence of images to be processed, wherein the sequence of images includes a plurality of images to be processed obtained by acquiring the same scene multiple times when the image acquisition device moves along a target direction;

[0033] a screening module, configured to screen a plurality of images to be fused from the plurality of images to be processed, wherein the plurality of images to be fused include a first image to be processed, and an offset distance between adjacent images to be fused in the target direction is greater than or equal to a preset threshold, and an offset distance between an image to be processed between the adjacent images to be fused and a previous image to be fused in the target direction is less than the preset threshold;

[0034] The fusion module is used to perform registration and fusion processing on the multiple images to be fused to obtain a panoramic image.

[0035] An embodiment of the present application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the panoramic image generation method provided in any embodiment of the present application are implemented.

[0036] An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the panoramic image generation method provided in any embodiment of the present application are implemented.

[0037] The panoramic image generation method, apparatus, device and storage medium provided in the embodiments of the present application obtain a sequence of images to be processed, wherein the image sequence includes multiple images to be processed obtained by multiple acquisitions of the same scene by an image acquisition device when moving along a target direction, and multiple images to be fused are screened from the multiple images to be processed, wherein the multiple images to be fused include a first image to be processed, and an offset distance in the target direction between adjacent images to be fused in the multiple images to be fused is greater than or equal to a preset threshold, and an offset distance in the target direction between an image to be processed between adjacent images to be fused and a previous image to be fused is less than a preset threshold, and the multiple images to be fused are registered and fused to obtain a panoramic image, and images to be fused with a larger offset distance can be screened from the images to be processed according to the offset distance between the images to be processed, and then the images to be fused are registered and fused to obtain a panoramic image, thereby reducing the number of images to be processed used to generate the panoramic image, and thereby reducing the computing power required to generate the panoramic image. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 is a schematic diagram of a flow chart of a method for generating a panoramic image in one embodiment;

[0039] Figure 2 A schematic diagram of a flow chart of a method for determining an offset distance in one embodiment;

[0040] Figure 3 is a schematic diagram of a flow chart of a method for generating a fused image in one embodiment;

[0041] Figure 4 Schematic diagram of a flow chart of an image feature extraction method in one embodiment;

[0042] Figure 5 is a structural block diagram of a panoramic image generating device in one embodiment;

[0043] Figure 6 FIG. 4 is a diagram showing the internal structure of an electronic device in one embodiment. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0045] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as being limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes and are not intended to limit the scope of protection of the present application.

[0046] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as being limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes and are not intended to limit the scope of protection of the present application.

[0047] It should be noted that the concepts such as "first" and "second" mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0048] It should be noted that the modifications of "one" and "plurality" mentioned in the present application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0049] The names of the messages or information exchanged between multiple devices in the embodiments of the present application are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0050] In one embodiment, Figure 1 As shown, a method for generating a panoramic image is provided. This embodiment mainly applies the method to electronic devices, and the method for generating a panoramic image may include the following steps:

[0051] S110, obtaining an image sequence to be processed, where the image sequence includes a plurality of images to be processed obtained by capturing the same scene multiple times when the image acquisition device moves along a target direction.

[0052] The image acquisition device can be understood as a device with an image acquisition function, such as a camera, a mobile terminal equipped with a camera, etc., which is not limited here. Optionally, the electronic device that executes the panoramic image generation method of this embodiment and the image acquisition device that acquires the image sequence can be the same device or different devices, which is not limited here.

[0053] The target direction may be understood as the moving direction or the rotating direction of the image acquisition device during the panoramic photography process.

[0054] Specifically, the electronic device can acquire the image sequence to be processed after acquiring an image sequence including multiple images to be processed by acquiring the same scene multiple times when the image acquisition device moves along the target direction.

[0055] In one of the embodiments, the electronic device can acquire a complete image sequence captured by the image capture device after the image capture device completes the capture of all to-be-processed images of the same scene to form a complete image sequence.

[0056] In one of the embodiments, the electronic device may also obtain the images to be processed captured by the image acquisition device in real time while the image acquisition device is capturing the images to be processed of the same scene, determine the sequence composed of the currently acquired images to be processed as the image sequence to be processed, and update the image sequence in real time.

[0057] S120, screening multiple images to be fused from multiple images to be processed, wherein the multiple images to be fused include a first image to be processed, and an offset distance between adjacent images to be fused in a target direction among the multiple images to be fused is greater than or equal to a preset threshold, and an offset distance between an image to be processed between adjacent images to be fused and a previous image to be fused in the target direction is less than the preset threshold.

[0058] The panoramic image is obtained by stitching and fusing multiple images, and the image to be fused can be understood as the image to be processed when generating the panoramic image.

[0059] Among them, the offset distance is used to characterize the relative displacement between images. Since the multiple images to be processed are acquired multiple times by the image acquisition device during movement, there will be some overlapping areas in the multiple images acquired within a certain period of time. The offset distance is the distance between the positions of the overlapping areas in different images.

[0060] Specifically, after obtaining the image sequence to be processed, the electronic device can filter out multiple images to be fused from the multiple images to be processed contained in the image sequence according to preset filtering conditions, the multiple images to be fused include the first image to be processed and other images to be processed, and after the filtered images to be fused are arranged according to the acquisition time, the offset distance between adjacent images to be fused in the target direction is greater than or equal to a preset threshold, and the offset distance between each image to be processed between adjacent images to be fused and the previous image to be fused in the target direction is less than the preset threshold.

[0061] In one embodiment, the electronic device can create a list of images to be fused, add the first image to be processed to the list, and traverse the remaining images to be processed starting from the second image to be processed according to the time sequence relationship between the images to be processed. For each image to be processed, determine its offset distance from the last image to be processed in the current list in the target direction. If the offset distance is greater than or equal to a preset threshold, add the current image to be processed to the list of images to be fused. If the offset distance is less than the preset threshold, skip the current image to be processed and continue to traverse the next image. When all images to be processed are traversed, the screening process ends and all images to be processed contained in the list of images to be fused are determined as images to be fused.

[0062] S130 , performing registration and fusion processing on a plurality of images to be fused to obtain a panoramic image.

[0063] Specifically, after screening out a plurality of images to be fused in the image sequence, the electronic device may perform registration and fusion processing on the plurality of images to be fused to obtain a panoramic image.

[0064] In one embodiment, the electronic device can input multiple images to be fused into a pre-trained deep learning model, use the deep learning model to automatically identify and match feature points in the multiple images to be fused, and achieve accurate image registration. In the fusion stage, a pixel-based and / or feature-based fusion algorithm can be used to obtain a high-quality panoramic image.

[0065] In one of the embodiments, the electronic device can perform registration and fusion processing on the first image to be fused and the second image to be fused that are acquired the earliest among multiple images to be fused to obtain a fused image, and then perform registration and fusion processing on the fused image and the next image to be fused in sequence according to the time sequence relationship between the other images to be fused except the first image to be fused and the second image to be fused among the multiple images to be fused, and update the fused image based on the fusion result, and repeat the above fusion and update operations until the third image to be fused that is acquired the latest among the multiple images to be fused is fused to obtain a panoramic image.

[0066] Specifically, the electronic device can first align and fuse the first image to be fused and the second image to be fused to obtain a fused image, and traverse other images to be fused according to the time sequence relationship between the images to be fused, and determine whether the current image to be fused is the last image to be fused (that is, the third image to be fused with the latest acquisition time). If it is not the last image to be fused, the current image to be fused is aligned and fused with the fused image to obtain a new fused image, and continue to traverse the next image to be fused. If it is the last image to be fused, the current image to be fused is aligned and fused with the fused image to obtain a new fused image. After obtaining the new fused image, it is determined that the newly generated fused image is a panoramic image, and the traversal ends.

[0067] In an embodiment of the present application, by acquiring a sequence of images to be processed, the image sequence includes multiple images to be processed obtained by multiple acquisitions of the same scene when the image acquisition device moves along a target direction, multiple images to be fused are screened from the multiple images to be processed, wherein the multiple images to be fused include a first image to be processed, and an offset distance in the target direction between adjacent images to be fused in the multiple images to be fused is greater than or equal to a preset threshold, and an offset distance in the target direction between an image to be processed between adjacent images to be fused and a previous image to be fused is less than a preset threshold, the multiple images to be fused are registered and fused to obtain a panoramic image, and images to be fused with a larger offset distance can be screened from the images to be processed according to the offset distance between the images to be processed, and then these images to be fused are registered and fused to obtain a panoramic image, thereby reducing the number of images to be processed used to generate the panoramic image, and thereby reducing the computing power required to generate the panoramic image.

[0068] In one embodiment, Figure 2 As shown, a method for determining an offset distance is provided, and the method for determining an offset distance may include the following steps:

[0069] S210 , respectively obtaining down-sampled images corresponding to a plurality of images to be processed.

[0070] Specifically, after obtaining the image sequence, the electronic device may perform down-sampling processing on each image to be processed in the image sequence to obtain down-sampled images corresponding to each of the multiple images to be processed.

[0071] In one embodiment, the electronic device may use a pooling layer or a learnable convolutional layer with a preset step size for downsampling processing, or may use a bilinear interpolation method or other methods for downsampling processing, which is not limited here.

[0072] S220 . For each image to be processed except the first image to be processed in the image sequence, calculate a first homography matrix between a down-sampled image corresponding to the image to be processed and a down-sampled image corresponding to a previous image to be fused.

[0073] Specifically, after obtaining the downsampled images corresponding to each image to be processed, the electronic device can determine, for each image to be processed, the previous image to be fused corresponding to the current image to be processed (i.e., the last image to be processed in the current list of images to be fused), perform feature point matching on the downsampled image corresponding to the current image to be processed and the downsampled image corresponding to the previous image to be fused, and calculate the first homography matrix between the two downsampled images based on the matching results.

[0074] S230: Based on the first homography matrix, determine an offset distance between the image to be processed and the previous image to be fused in a target direction.

[0075] Specifically, after obtaining the first homography matrix between the downsampled image corresponding to the current image to be processed and the downsampled image corresponding to the previous image to be fused, the electronic device can calculate the offset distance between the image to be processed and the previous image to be fused in the target direction according to the first homography matrix.

[0076] In one of the embodiments, the electronic device can transform the feature points in the downsampled image based on the homography matrix, calculate the offset distance between the two downsampled images in the target direction according to the difference between the transformed position and the original position, adjust the offset distance according to the scaling ratio during the downsampling process, and obtain the offset distance in the target direction between the image to be processed and the previous image to be fused.

[0077] In an embodiment of the present application, by respectively acquiring downsampled images corresponding to multiple images to be processed, for each image to be processed except the first image to be processed in the image sequence, a first homography matrix between the downsampled image corresponding to the image to be processed and the downsampled image corresponding to the previous image to be fused is calculated, and based on the first homography matrix, the offset distance in the target direction between the image to be processed and the previous image to be fused is determined, so that the calculation of the homography matrix can be performed in a downsampled image with a smaller size and resolution and containing fewer feature points, thereby reducing the computing power required to determine the offset distance.

[0078] In one embodiment, Figure 3 As shown, a fused image generation method is provided, and the fused image generation method may include the following steps:

[0079] S310 , performing feature point detection on the first image to be fused and the second image to be fused respectively to obtain first feature points and second feature points.

[0080] Among them, the feature points can be understood as points that can reflect the essential characteristics of the image and identify the target objects in the image, such as points where the image grayscale value changes dramatically or points with large curvature on the edge of the image. The first feature point is the feature point extracted from the first image to be fused, and the second feature point is the feature point extracted from the second image to be fused.

[0081] Specifically, after screening out the first image to be fused and the second image to be fused, the electronic device can respectively perform feature point detection on the first image to be fused and the second image to be fused, extract the first feature point from the first image to be fused, and extract the second feature point from the second image to be fused.

[0082] In one embodiment, the electronic device can extract the first feature point and the second feature point by using a scale-invariant feature transform (SIFT) algorithm, a speeded up robust features (SURF) algorithm, a features from accelerated segment test (FAST) algorithm, an ORB (Oriented FAST and Rotated BRIEF) algorithm, or the like.

[0083] S320: Extract first image features and second image features corresponding to the first feature points and the second feature points from the first image to be fused and the second image to be fused, respectively.

[0084] Specifically, after determining the first feature point and the second feature point, the electronic device may extract a first image feature corresponding to the first feature point from the first image to be fused, and extract a second image feature corresponding to the second feature point from the second image to be fused.

[0085] In one embodiment, the first image feature and the second image feature may be feature descriptors, specifically SIFT descriptor, SURF descriptor, BRIEF (Binary Robust Independent Elementary Features Descriptor) descriptor, ORB descriptor, BEBlid (Boosted Efficient Binary Local Image Descriptor) descriptor, etc., which are not limited here.

[0086] S330 , performing feature point matching on the first feature point and the second feature point based on the first image feature and the second image feature.

[0087] Specifically, after determining the first image feature corresponding to the first feature point and the second image feature corresponding to the second feature point, the electronic device can use a matching algorithm to compare the first image feature and the second image feature to find a pair of first feature points and second feature points that match each other. The matching algorithm can determine whether the corresponding first feature point and second feature point match based on a similarity measure (such as Euclidean distance, Hamming distance, etc.) between the first image feature and the second image feature.

[0088] S340: Calculate a second homography matrix between the first image to be fused and the second image to be fused based on the feature point matching result.

[0089] Specifically, after obtaining the feature point matching results of the first feature points and the second feature points, the electronic device can determine a corresponding linear equation for each group of matched first feature points and second feature points, obtain a group of linear equations corresponding to each group of matched first feature points and second feature points, solve the group of linear equations by the least squares method, and obtain a second homography matrix.

[0090] Optionally, the electronic device may optimize the feature point matching result based on a random sampling consensus algorithm after matching the first feature point and the second feature point based on the first image feature and the second image feature, and calculate a second homography matrix between the first image to be fused and the second image to be fused based on the optimized feature point matching result.

[0091] Among them, the random sampling consensus algorithm is the RANSAC (Random Sample Consensus) algorithm. The electronic device can adopt the RANSAC algorithm to iteratively screen out the optimal matching feature point pairs for calculating the second homography matrix, obtain the optimized feature point matching results, and then calculate the second homography matrix between the first image to be fused and the second image to be fused based on the optimized feature point matching results.

[0092] S350: Based on the second homography matrix, transform the second image to be fused.

[0093] Specifically, after obtaining the second homography matrix, the electronic device may use the second homography matrix to perform transformation processing on all pixel points in the second image to be fused.

[0094] S360: Fusing the first image to be fused and the transformed second image to be fused to obtain a fused image.

[0095] Specifically, the electronic device may perform a fusion process on the first image to be fused and the transformed second image to be fused after transforming the second image to be fused, and may adopt some fusion algorithms such as a weighted average fusion algorithm, a multi-band fusion algorithm, etc. to obtain a fused image.

[0096] Optionally, the electronic device can use a Laplacian pyramid algorithm to implement fusion processing, by differentiating two adjacent layers of the Gaussian pyramid, decomposing the first image to be fused and the transformed second image to be fused into sub-images of different scales, performing weighted averaging on each sub-image to obtain the fusion result of each layer, and finally performing reverse reconstruction of the pyramid to obtain the final fused image.

[0097] In an embodiment of the present application, feature point detection is performed on the first image to be fused and the second image to be fused respectively to obtain the first feature point and the second feature point, and the first image feature and the second image feature corresponding to the first feature point and the second feature point are extracted from the first image to be fused and the second image to be fused respectively, and feature point matching is performed on the first feature point and the second feature point based on the first image feature and the second image feature, and based on the feature point matching result, the second homography matrix between the first image to be fused and the second image to be fused is calculated, and based on the second homography matrix, the second image to be fused is transformed, and the first image to be fused and the transformed second image to be fused are fused to obtain a fused image, which can accurately align the first image to be fused and the second image to be fused, reduce the misalignment and distortion between the images, and ensure that the transition between the images is smoother and more natural.

[0098] Optionally, according to the temporal relationship between the other images to be fused except the first image to be fused and the second image to be fused among the multiple images to be fused, the specific method of sequentially registering and fusing the fused image with the next image to be fused is similar to S310-S340 and will not be repeated here.

[0099] In one embodiment, Figure 4 As shown, a method for extracting image features is provided, and the method for extracting image features may include the following steps:

[0100] S410: For each first feature point, select at least two pairs of image blocks in a preset area centered on the first feature point in the first image to be fused.

[0101] The preset area can be understood as an area in the positive direction with the first feature point as the center and a side length of the preset side length, and the image block is a rectangular image block of a preset size randomly selected within the preset area.

[0102] Specifically, after determining the first feature point, the electronic device may randomly select at least two pairs of image blocks in a preset area centered on the first feature point in the first image to be fused for each first feature point.

[0103] S420, calculating the difference in average grayscale values ​​of pixels corresponding to each pair of image blocks.

[0104] Specifically, for each pair of image blocks, the electronic device may calculate the average pixel grayscale value of each of the two image blocks in the pair of image blocks, and then calculate the difference between the average pixel grayscale values ​​of the two image blocks. The specific formula is as follows:

[0105]

[0106] Among them, R(p1,s) and R(p2,s) represent a pair of image blocks with p1 and p2 as center points and a side length of s, f(x; p1, p2,s) represents the difference in the average grayscale values ​​of pixels corresponding to a pair of image blocks with p1 and p2 as center points and a side length of s in the preset area corresponding to the first feature point x, I(q) represents the grayscale value at pixel point q, and I(r) represents the grayscale value at pixel point r.

[0107] S430 , performing binary conversion on the difference of average grayscale values ​​of pixels corresponding to at least two pairs of image blocks to obtain a first image feature corresponding to a first feature point.

[0108] Specifically, after obtaining the difference in the average grayscale values ​​of pixels corresponding to each pair of image blocks in the preset area corresponding to the first feature point, the electronic device can perform binary conversion on the difference in the average grayscale values ​​of pixels corresponding to each pair of image blocks, and determine the vector composed of the binary conversion results corresponding to multiple pairs of image blocks as the first image feature corresponding to the first feature point.

[0109] In one embodiment, the electronic device may compare the obtained f(x; p1, p2, s) with the set threshold T to obtain h(x). If f(x; p1, p2, s) ≤ T, then determine that h(x) = 1; if f(x; p1, p2, s) > T, then determine that h(x) = -1, and then use the enhancement algorithm to selectively select a group of features to form a strong feature description, convert the {1, -1} output into a {1, 0} output, and obtain the first image feature corresponding to the first feature point.

[0110] In an embodiment of the present application, by selecting at least two pairs of image blocks in a preset area centered on the first feature point in the first image to be fused for each first feature point, calculating the difference in the average grayscale values ​​of the pixels corresponding to each pair of image blocks, and performing binary conversion on the difference in the average grayscale values ​​of the pixels corresponding to at least two pairs of image blocks, the first image feature corresponding to the first feature point is obtained, which can improve the image matching accuracy, reduce the execution time, and further enhance the user experience.

[0111] Figure 5 FIG. 1 is a structural block diagram of a panoramic image generating device in one embodiment. Figure 5 As shown, the panoramic image generating device 500 may include an acquisition module 510 , a screening module 520 and a fusion module 530 .

[0112] The acquisition module 510 is used to acquire a sequence of images to be processed, wherein the sequence of images includes a plurality of images to be processed obtained by acquiring the same scene multiple times when the image acquisition device moves along a target direction.

[0113] The screening module 520 is used to screen multiple images to be fused from the multiple images to be processed, wherein the multiple images to be fused include a first image to be processed, and the offset distance between adjacent images to be fused in the multiple images to be fused in the target direction is greater than or equal to a preset threshold, and the offset distance between the image to be processed between the adjacent images to be fused and the previous image to be fused in the target direction is less than the preset threshold.

[0114] The fusion module 530 is used to perform registration and fusion processing on the multiple images to be fused to obtain a panoramic image.

[0115] In an embodiment of the present application, it is possible to screen images to be fused with larger offset distances from the images to be processed according to the offset distances between the images to be processed, and then align and fuse these images to be fused to obtain a panoramic image, thereby reducing the number of images to be processed used to generate the panoramic image, and thereby reducing the computing power required to generate the panoramic image.

[0116] Optionally, the screening module 520 includes an acquisition unit, a calculation unit and a determination unit.

[0117] The acquisition unit is used to respectively acquire the down-sampled images corresponding to the multiple images to be processed.

[0118] The calculation unit is used to calculate, for each image to be processed except the first image to be processed in the image sequence, a first homography matrix between a down-sampled image corresponding to the image to be processed and a down-sampled image corresponding to a previous image to be fused.

[0119] A determining unit is used to determine, based on the first homography matrix, an offset distance between the image to be processed and the previous image to be fused in the target direction.

[0120] Optionally, the fusion module 530 includes a first fusion unit and a second fusion unit.

[0121] The first fusion unit is used to perform registration and fusion processing on the first image to be fused and the second image to be fused with the earliest acquisition time among the multiple images to be fused, so as to obtain a fused image.

[0122] The second fusion unit is used to perform registration and fusion processing on the fused image and the next image to be fused in sequence according to the time sequence relationship between the other images to be fused except the first image to be fused and the second image to be fused among the multiple images to be fused, and update the fused image based on the fusion result, and repeat the above fusion and update operations until the third image to be fused with the latest acquisition time among the multiple images to be fused is fused to obtain the panoramic image.

[0123] Optionally, the first fusion unit includes a detection subunit, an extraction subunit, a matching subunit, a calculation subunit, a transformation subunit and a fusion subunit.

[0124] The detection subunit is used to perform feature point detection on the first image to be fused and the second image to be fused respectively to obtain a first feature point and a second feature point.

[0125] The extraction subunit is used to extract the first image feature and the second image feature corresponding to the first feature point and the second feature point from the first image to be fused and the second image to be fused respectively.

[0126] A matching subunit is used to perform feature point matching on the first feature point and the second feature point based on the first image feature and the second image feature.

[0127] The calculation subunit is used to calculate a second homography matrix between the first image to be fused and the second image to be fused based on the feature point matching result.

[0128] The transformation subunit is used to transform the second image to be fused based on the second homography matrix.

[0129] The fusion subunit is used to perform fusion processing on the first image to be fused and the transformed second image to be fused to obtain the fused image.

[0130] Optionally, the first fusion unit also includes an optimization subunit.

[0131] The optimization subunit is used to optimize the feature point matching result based on a random sampling consensus algorithm.

[0132] The calculation subunit is specifically configured to calculate a second homography matrix between the first image to be fused and the second image to be fused based on the optimized feature point matching result.

[0133] Optionally, the extraction subunit is specifically used to: for each first feature point, select at least two pairs of image blocks in a preset area centered on the first feature point in the first image to be fused; calculate the difference in average grayscale values ​​of pixels corresponding to each pair of image blocks; and perform binary conversion on the difference in average grayscale values ​​of pixels corresponding to the at least two pairs of image blocks to obtain a first image feature corresponding to the first feature point.

[0134] Optionally, the fusion processing is implemented using a Laplace pyramid algorithm.

[0135] It should be noted that Figure 5 The panoramic image generation device shown can execute each step of the above method embodiment, and each process and effect of the above method embodiment will not be described in detail here.

[0136] For the specific definition of the panoramic image generation device, please refer to the definition of the panoramic image generation method above, which will not be repeated here. Each module in the above panoramic image generation device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the electronic device in the form of hardware, or can be stored in the memory of the electronic device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0137] The present application also provides an electronic device, which may be a terminal, and its internal structure diagram may be as shown in Figure 6As shown. The electronic device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, an operator network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a method for generating a panoramic image is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covered on the display screen, or a button, a trackball or a touch pad provided on the housing of the electronic device, or an external keyboard, touch pad or mouse, etc.

[0138] Those skilled in the art will understand that Figure 6 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0139] In one embodiment, the panoramic image generation device provided by the present application can be implemented in the form of a computer program. The computer program can be Figure 6 The memory of the electronic device may store various program modules constituting the panoramic image generating device, for example, Figure 5 The acquisition module, screening module and fusion module shown in the figure. The computer program composed of various program modules enables the processor to execute the steps of the panoramic image generation method of each embodiment of the present application described in this specification.

[0140] For example, Figure 6 The electronic device shown can be Figure 5 In the panoramic image generation device shown, the acquisition module executes step S110, the screening module executes step S120, and the fusion module executes step S130.

[0141] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: acquiring a sequence of images to be processed, the sequence of images including a plurality of images to be processed obtained by capturing the same scene multiple times when an image acquisition device moves along a target direction; screening a plurality of images to be fused from the plurality of images to be processed, wherein the plurality of images to be fused include a first image to be processed, and an offset distance between adjacent images to be fused in the plurality of images to be fused in the target direction is greater than or equal to a preset threshold, and an offset distance between an image to be processed between the adjacent images to be fused and a previous image to be fused in the target direction is less than the preset threshold; and registering and fusing the plurality of images to be fused to obtain a panoramic image.

[0142] In an embodiment of the present application, it is possible to screen images to be fused with a larger offset distance from the images to be processed according to the offset distance between the images to be processed, and then align and fuse these images to be fused to obtain a panoramic image, thereby reducing the number of images to be processed used to generate the panoramic image, and further reducing the computing power required to generate the panoramic image.

[0143] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in various forms, such as static random access memory (SRAM) and dynamic random access memory (DRAM).

[0144] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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.

[0145] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for generating a panoramic image, characterized in that: The method comprises: Acquire a sequence of images to be processed, wherein the sequence of images includes a plurality of images to be processed obtained by acquiring the same scene multiple times when the image acquisition device moves along a target direction; Screening a plurality of images to be fused from the plurality of images to be processed, wherein the plurality of images to be fused include a first image to be processed, and an offset distance between adjacent images to be fused in the plurality of images to be fused in the target direction is greater than or equal to a preset threshold, and an offset distance between an image to be processed between the adjacent images to be fused and a previous image to be fused in the target direction is less than the preset threshold; The multiple images to be fused are registered and fused to obtain a panoramic image.

2. The method according to claim 1, characterized in that The step of selecting a plurality of images to be fused from the plurality of images to be processed comprises: Respectively obtaining down-sampled images corresponding to the plurality of images to be processed; For each image to be processed except the first image to be processed in the image sequence, calculating a first homography matrix between a down-sampled image corresponding to the image to be processed and a down-sampled image corresponding to a previous image to be fused; Based on the first homography matrix, an offset distance between the image to be processed and the previous image to be fused in the target direction is determined.

3. The method according to claim 1, characterized in that The registering and fusing the multiple images to be fused to obtain a panoramic image includes: Performing registration and fusion processing on a first image to be fused and a second image to be fused that are acquired earliest among the multiple images to be fused, to obtain a fused image; According to the time sequence relationship between the other images to be fused except the first image to be fused and the second image to be fused among the multiple images to be fused, the fused image is sequentially registered and fused with the next image to be fused, and the fused image is updated based on the fusion result, and the above fusion and update operations are performed repeatedly until the third image to be fused with the latest acquisition time among the multiple images to be fused is fused to obtain the panoramic image.

4. The method according to claim 3, characterized in that The registering and fusing the first image to be fused and the second image to be fused with the earliest acquisition time among the multiple images to be fused to obtain a fused image comprises: Performing feature point detection on the first image to be fused and the second image to be fused respectively to obtain first feature points and second feature points; Extracting first image features and second image features corresponding to the first feature points and the second feature points from the first image to be fused and the second image to be fused respectively; Performing feature point matching on the first feature point and the second feature point based on the first image feature and the second image feature; Based on the feature point matching result, calculating a second homography matrix between the first image to be fused and the second image to be fused; Based on the second homography matrix, transform the second image to be fused; The first image to be fused and the transformed second image to be fused are fused to obtain the fused image.

5. The method according to claim 4, characterized in that After performing feature point matching on the first feature point and the second feature point based on the first image feature and the second image feature, the method further includes: Optimizing the feature point matching result based on a random sampling consensus algorithm; The calculating, based on the feature point matching result, a second homography matrix between the first image to be fused and the second image to be fused includes: Based on the optimized feature point matching result, a second homography matrix between the first image to be fused and the second image to be fused is calculated.

6. The method according to claim 4, characterized in that Extracting a first image feature corresponding to the first feature point from the first image to be fused includes: For each first feature point, selecting at least two pairs of image blocks in a preset area centered on the first feature point in the first image to be fused; Calculate the difference in average grayscale values ​​of pixels corresponding to each pair of image blocks; Binary conversion is performed on the difference between the average grayscale values ​​of the pixels corresponding to the at least two pairs of image blocks to obtain a first image feature corresponding to the first feature point.

7. The method according to any one of claims 1 to 6, characterized in that The fusion process is implemented by using the Laplace pyramid algorithm.

8. A panoramic image generation device, characterized in that: The device comprises: An acquisition module, used to acquire a sequence of images to be processed, wherein the sequence of images includes a plurality of images to be processed obtained by acquiring the same scene multiple times when the image acquisition device moves along a target direction; a screening module, configured to screen a plurality of images to be fused from the plurality of images to be processed, wherein the plurality of images to be fused include a first image to be processed, and an offset distance between adjacent images to be fused in the target direction is greater than or equal to a preset threshold, and an offset distance between an image to be processed between the adjacent images to be fused and a previous image to be fused in the target direction is less than the preset threshold; The fusion module is used to perform registration and fusion processing on the multiple images to be fused to obtain a panoramic image.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

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