Image stitching method and device, storage medium, program product and computer device
By identifying overlapping areas in image stitching and dividing the image using the minimum bounding polygon, stitching and seam repair processing is performed, solving the problem of seam accumulation in the reference image, improving image quality and reducing computational resource consumption.
Patent Information
- Application Number
- CN202611216461.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-12
- Publication Date
- 2026-11-24
AI Technical Summary
Existing technologies, when stitching images, result in accumulated stitching seams in the reference image, leading to a decrease in visual coherence and realism, and also consume excessive computational resources.
By identifying the overlapping area between the reference image and the current image, and using the minimum bounding polygon to divide it into a reference area image and an image to be repaired, the image is stitched together and the stitch seam is repaired. The resulting stitched image is then fused with the reference area image to reduce the accumulation of stitch seams.
It effectively reduces the accumulation of stitching seams in the reference image, improves the visual coherence and realism of the image, and reduces the consumption of computing resources.
Smart Images

Figure CN123160340A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image stitching method, apparatus, storage medium, program product, and computer equipment. Background Technology
[0002] To enrich the information contained in an image, different images can be stitched together. However, when stitching different images, seams are easily created at the stitching points. When a new image is acquired, the previously acquired and stitched image can be called the reference image, and the new image can be stitched into the reference image, followed by seam repair processing. However, since the reference image formed after multiple stitchings is often large in size, directly treating the reference image and the new image as two independent frames and directly performing seam repair processing would consume enormous computational resources.
[0003] In related technologies, the previous frame used to stitch together a reference image can usually be used as the matching frame of the new image, and the matching frame and the new image are regarded as two independent images. Then, the stitching seam between the matching frame and the new image is repaired in the reference image.
[0004] However, while this can reduce the computational resources consumed during stitching and repair, after the new image is stitched into the reference image, in addition to forming stitching seams with the matching frame, it will also form stitching seams with other frames in the reference image (such as the previous frame of the matching frame). Since these stitching seams cannot be repaired, they will remain in the newly formed reference image, causing these stitching seams to continuously accumulate in the reference image, which will eventually seriously affect the visual coherence and realism of the image formed by subsequent stitching. Summary of the Invention
[0005] To address the aforementioned technical problems, this application proposes an image stitching method, apparatus, storage medium, program product, and computer equipment, which can reduce the computational resources consumed in stitching and repair while reducing the stitching seams left in the reference image.
[0006] In a first aspect, embodiments of this application provide an image stitching method, including: Acquire the baseline image and the current image; Based on the reference image and the current image, an overlapping region is determined in the reference image, and the minimum bounding polygon corresponding to the overlapping region is determined. Based on the minimum bounding polygon, the reference image is divided into a reference region image and an image to be repaired, wherein the image to be repaired includes the overlapping region; The image to be repaired and the current image are stitched together and the stitch seams are repaired to obtain a stitched image; The stitched image is fused with the reference region image to update the reference image.
[0007] Optionally, the step of stitching the image to be repaired and the current image together and repairing the stitching seams to obtain a stitched image includes: The image to be repaired and the current image are input into a pre-trained repair model, which performs the stitching and seam repair processing on the image to be repaired and the current image to obtain the stitched image.
[0008] Optionally, the minimum bounding polygon includes the minimum bounding rectangle.
[0009] Optionally, determining the overlapping region in the reference image based on the reference image and the current image includes: Determine the first estimated position of the current image in the reference image; Based on the first estimated position, at least one matching keyframe is determined from multiple frames of images corresponding to the reference image, wherein the reference image is generated at least based on the multiple frames of images; Based on the projection information formed by projecting each of the at least one matching keyframe onto the reference image, and the first estimated position, the second estimated position of the current image in the reference image is determined; Based on the second estimated position, the overlapping region is determined in the reference image.
[0010] Optionally, determining the first estimated position of the current image in the reference image includes: The reference image features of the reference image and the current image features of the current image are determined respectively; Feature matching is performed on the reference image features and the current image features to obtain feature point matching pairs; Homography estimation is performed based on the feature point matching pairs to obtain the first homography matrix; Based on the first homography matrix, the first estimated position of the current image in the reference image is estimated by homography transformation.
[0011] Optionally, the projection information includes a set of projection coordinates of matching points corresponding to each matching keyframe, wherein the set of projection coordinates of matching points includes at least one projection coordinate of a matching point, and the projection coordinates of the matching point are obtained by projecting the matching points of the matching keyframe onto the reference image. Determining the second estimated position of the current image in the reference image based on the projection information formed by projecting each of the at least one matching keyframe into the reference image, and the first estimated position, includes: Based on the set of projected coordinates of the matching points corresponding to each of the at least one matching keyframe, and the first estimated position, the reprojection error is determined; The second homography matrix is obtained by optimizing the solution based on the reprojection error. Based on the second homography matrix, the second estimated position of the current image in the reference image is estimated by homography transformation.
[0012] Secondly, embodiments of this application provide an image stitching device, including: The image acquisition module is used to acquire the reference image and the current image; The minimum bounding polygon determination module is used to determine an overlapping region in the reference image based on the reference image and the current image, and to determine the minimum bounding polygon corresponding to the overlapping region. A segmentation module is used to segment the reference image into a reference region image and an image to be repaired based on the minimum bounding polygon, wherein the image to be repaired includes the overlapping region; The repair module is used to stitch the image to be repaired and the current image together and repair the stitch seams to obtain a stitched image. The fusion module is used to fuse the stitched image with the reference region image to update the reference image.
[0013] Thirdly, embodiments of this application provide a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in any of the above-mentioned embodiments.
[0014] Fourthly, embodiments of this application provide a computer program product, including computer instructions that, when executed by a processor, implement the steps of the method described in any of the above-described embodiments.
[0015] Fifthly, embodiments of this application provide a computer device including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the steps of the method described in any of the preceding claims.
[0016] In summary, the embodiments of this application have at least the following beneficial effects: Using the embodiments of this application, a reference image and a current image are obtained; based on the reference image and the current image, an overlapping region is determined in the reference image, and the minimum bounding polygon corresponding to the overlapping region is determined; based on the minimum bounding polygon, the reference image is divided into a reference region image and an image to be repaired, wherein the image to be repaired includes the overlapping region; the image to be repaired and the current image are stitched together and the stitching seam is repaired to obtain a stitched image; the stitched image is fused with the reference region image to update the reference image. Thus, due to the minimum bounding polygon, the reference image is obtained. Since the bounding polygon can contain the entire overlapping region, the minimum bounding polygon can be used to extract the image to be repaired from the reference image, which contains the entire overlapping region. The image to be repaired is then stitched together with the current image, and the stitching seams are repaired. This results in a stitched image where all stitching seams near the overlapping region are repaired, reducing the stitching seams left in the subsequently updated reference image. Finally, the stitched image is merged back into the reference region image to update the reference image. Since the repair is performed on the extracted image to be repaired, rather than the entire reference image, the computational resources consumed by stitching and repair can be reduced. Attached Figure Description
[0017] Figure 1 This is a schematic diagram of image stitching provided by related technologies; Figure 2 This is a flowchart illustrating the image stitching method provided in an embodiment of this application; Figure 3 This is a schematic diagram of the splicing and splice seam repair process provided in the embodiments of this application; Figure 4 This is a schematic diagram of image stitching provided in an embodiment of this application; Figure 5 This is a schematic diagram of image stitching provided in an embodiment of this application; Figure 6 This is a schematic diagram of image stitching provided in an embodiment of this application; Figure 7 This is a schematic diagram of the image stitching device provided in the embodiments of this application; Figure 8 This is a schematic diagram of the computer device provided in the embodiments of this application. Detailed Implementation
[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments / examples are only a part of the embodiments / examples of this application, and not all of the embodiments / examples. Based on the embodiments / examples in this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0019] In the description of this application, the terms "first," "second," "third," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first," "second," "third," etc., may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "multiple" means two or more. In the description of this application, the term "comprising" and its variations are open-ended, meaning "including but not limited to." The term "based on" means "at least partially based on." The term "according to" means "at least partially according to." The term "one embodiment / example" means "at least one embodiment / example"; the term "another embodiment / example" means "at least one additional embodiment / example"; the term "some embodiments / examples" means "at least some embodiments / examples."
[0020] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection between two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0021] In the description of this application, it should be noted that, unless otherwise defined, all technical and scientific terms used in this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this application is for the purpose of describing specific embodiments only and is not intended to limit the application. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0022] In related technologies, the previous frame used to stitch together the reference image can typically be used as the new image (current frame). Matching frames The matching frame and the new image are treated as two independent images. Then, a seam repair model is used to repair the seam between the matching frame and the new image in the reference image. At this time, the model generally focuses on repairing the seam between the matching frame and the current frame. ,but Not only with It can also create seams with other areas in the reference image T. .
[0023] See also Figure 1Using three images according to Figure 1 The order in (Image 1) Image 2 Image 3 Let's take image stitching as an example for detailed analysis. and The intermediate results were obtained after splicing. Afterwards, in the future and During splicing, two different types of seams are typically created: the first is the seam between matching frames. As shown by the white lines in the image; the second type is the seam created between mismatched frames. As shown by the red line in the figure, the second type of splicing seam is usually difficult to detect and locate directly by the model, and is thus left in the reference image T, affecting the accuracy of subsequent processing.
[0024] These seam issues can accumulate gradually during the stitching process. Unnatural seams can lead to the loss of original features, significantly reducing the accuracy of subsequent image registration; residual seams can also overlap with newly generated seams, forming more complex seam structures and further increasing the difficulty of repair; this continuous accumulation of seams can cause the overall quality of the stitching result to decline continuously as the image sequence length increases, seriously affecting the visual coherence and realism of the final stitching effect.
[0025] If and While directly repairing the seams can theoretically solve the above problems, as the number of stitched images gradually increases, the baseline image... The size of the image will continue to grow. This growth in size brings a huge computational burden, and the entire stitching and restoration process may even fail when the image size exceeds the hardware's processing power threshold.
[0026] In view of the above, embodiments of this application provide an image stitching method, apparatus, storage medium, program product, and computer device, which aim to at least partially solve the shortcomings existing in the above-mentioned related technologies.
[0027] Firstly, see [the following] Figure 2 The diagram shows a flowchart of an image stitching method provided in an embodiment of this application. This image stitching method can be applied to a computer device with data processing capabilities. The method includes steps S201-S205, as detailed below.
[0028] S201, acquire the reference image and the current image.
[0029] In some examples, the reference image can be formed by stitching together a sequence of image frames, which may contain multiple subsequent frames. For example, the reference image can be as described above. .
[0030] In some examples, the “image” described in at least part of the embodiments of this application may include at least one of the following: images taken by drones, and remote sensing images.
[0031] S202, based on the reference image and the current image, determine the overlapping region in the reference image, and determine the minimum bounding polygon corresponding to the overlapping region.
[0032] In some examples, a reference image can be compared with the current image to determine the overlapping region between the reference and current images, and the overlapping region can be located in the reference image. The smallest bounding polygon can contain overlapping regions.
[0033] In some examples, the minimum bounding polygon can include the minimum bounding rectangle, the minimum bounding convex polygon, the minimum perimeter bounding rectangle, the minimum area bounding rectangle, the minimum bounding triangle, and the minimum bounding k-gon.
[0034] S203, based on the minimum bounding polygon, the reference image is divided into a reference region image and an image to be repaired, wherein the image to be repaired includes the overlapping region.
[0035] In some examples, the reference image can be cropped along the minimum bounding polygon to divide the reference image into a reference region image and an image to be repaired, so that the image to be repaired can contain overlapping regions and can also contain the minimum bounding polygon.
[0036] S204, perform splicing and seam repair processing on the image to be repaired and the current image to obtain a spliced image.
[0037] In some examples, the image to be repaired can be stitched together with the current image to obtain an initial stitched image. Then, the stitching seam is repaired on the initial stitched image to obtain the final stitched image. Here, the initial stitched image may contain stitching seams between the image to be repaired and the current image. It's easy to understand that since the image to be repaired contains overlapping areas, the stitching seams between the image to be repaired and the current image in the initial stitched image can be used to reflect the stitching seams formed between the reference image and the current image. Therefore, repairing the stitching seams in the initial stitched image can repair the stitching seams formed between the reference image and the current image.
[0038] S205, the stitched image is fused with the reference region image to update the reference image.
[0039] In some examples, see Figure 3 This diagram illustrates the splicing and seam repair process provided in an embodiment of this application. Based on the geometric characteristics of the minimum bounding polygon and / or the precise position / coordinate information retained during the segmentation of the reference image, the spliced image can be mapped onto the reference region image via spatial mapping. This allows the spliced image and the reference region image to be fused, and the reference image to be updated. Thus, this fusion can be accomplished through simple spatial mapping without additional image processing operations. This process can be represented as:
[0040] In the formula, It can represent a reference region image. It can represent stitched images. It can represent the updated baseline image.
[0041] The above process ensures that new seams are avoided as much as possible during the fusion process, while maintaining the overall continuity of the image. The fused image will then be seamless. It can be used as a new reference image for the continuous stitching process of subsequent image sequences.
[0042] In this embodiment, accurate location recording and a simple fusion strategy ensure that the restoration result can be seamlessly integrated into the original image.
[0043] In one optional implementation, the step of stitching the image to be repaired and the current image together and repairing the stitching seams to obtain a stitched image includes: The image to be repaired and the current image are input into a pre-trained repair model, which performs the stitching and seam repair processing on the image to be repaired and the current image to obtain the stitched image.
[0044] In some examples, the repair model can be trained using unsupervised loss based on a deep learning model / neural network model. The training process can be common in the field, and the embodiments of this application are not specifically limited here.
[0045] In one alternative implementation, the minimum bounding polygon includes the minimum bounding rectangle.
[0046] In some examples, the minimum bounding rectangle can contain the minimum perimeter bounding rectangle and the minimum area bounding rectangle.
[0047] In summary, in this embodiment, the Overall Region Integrity Optimization (ORIO) strategy can be used. The minimum bounding rectangle strategy can achieve complete coverage of the stitching seams, minimizing issues left behind. Furthermore, processing regions based on regular rectangular shapes simplify computational complexity and improve algorithm efficiency. Precise location recording and a simple fusion strategy ensure seamless integration of the repaired image into the original image. Therefore, this embodiment is particularly suitable for processing continuous stitching tasks of large-scale image sequences.
[0048] In one optional implementation, determining the overlapping region in the reference image based on the reference image and the current image includes: Determine the first estimated position of the current image in the reference image; Based on the first estimated position, at least one matching keyframe is determined from multiple frames of images corresponding to the reference image, wherein the reference image is generated at least based on the multiple frames of images; Based on the projection information formed by projecting each of the at least one matching keyframe onto the reference image, and the first estimated position, the second estimated position of the current image in the reference image is determined; Based on the second estimated position, the overlapping region is determined in the reference image.
[0049] In some examples, see Figure 3 It can be used This represents the second estimated position of the current image in the reference image. Thus, based on the second estimated position in the reference image... The process of determining the overlapping region can be defined by the following mathematical expression: .
[0050] Furthermore, the smallest bounding polygon corresponding to the overlapping region can be defined by the following mathematical expression:
[0051] in, This can be used to calculate the minimum bounding rectangle. This indicates the calculation of overlapping areas. This geometrically based positioning method not only improves the integrity of seam detection but also provides regular processing areas, which is beneficial for subsequent repair operations.
[0052] Following the example above, after obtaining the minimum bounding rectangle region, the reference image can be... Decompose (divide) into two complementary regions: and .in , can represent from Remove from The remaining region afterwards. It is understandable that this decomposition has the following theoretical implications: due to Region and They are independent of each other, therefore No new seams will appear in the area, thus it can serve as a stable reference area; and This includes all areas that require seam repair. Based on this, it can be... and Input the repair model (seam repair model) together to obtain the stitched image output by the repair model. This process can be represented by the following expression:
[0053] in, It can represent the repair model (joint repair model).
[0054] In related technologies, in multi-image stitching scenarios, stitching algorithms based on homography matrix accumulation often face a serious homography accumulation error problem. For example, when performing continuous projection transformations using the homography matrix obtained from coarse registration, the homography matrix of each image frame can be represented as... , This represents the homography matrix of the current image relative to the previous image. This results in the homography matrix of each image frame relative to the reference image depending on the homography matrix of the previous image relative to the reference image. This dependency causes the homography matrix to be continuously multiplied during the splicing process. However, each estimated homography matrix inevitably contains a certain error. During the continuous multiplication of the matrix, these tiny errors will expand rapidly, causing the registration accuracy to drop sharply, resulting in more splicing seams.
[0055] In actual image stitching, a keyframe-based structural consistency optimization (KSCO) strategy can be adopted, setting the first frame image as the reference image. All subsequent newly stitched image frames are expanded and stitched on the plane of this reference image, and dynamically updated. The embodiments of this application can adaptively select when to insert keyframes and accurately record key information of these keyframes relative to the reference image T, including the position coordinates of projection corner points (such as four corner points) and the homography matrix. Etc. See also Figure 4The diagram illustrates an image stitching method provided in an embodiment of this application, where the blue boxes (1, 3, 5, 7) represent... The gray boxes (2, 4, 6) represent defined keyframes, the gray boxes (2, 4, 6) represent normal frames, and the red boxes (8, 6) represent normal frames. This indicates the current frame (i.e., the current image). Specifically, during the keyframe selection process, a preset discrimination threshold can be used. This evaluates the overlap between the current frame and existing keyframes. If the maximum overlap between the current frame and all keyframes is below a threshold, the current frame can be added as a new keyframe. By setting a lenient threshold, we can ensure successful stitching while minimizing homography accumulation. Specifically, this can be expressed as follows:
[0056] in, This represents all current keyframes. Indicates the current frame (i.e., the current image). This indicates the calculation of the overlapping area.
[0057] In some implementations, when a current frame flows into the stitching frame, it can be directly matched and registered with the previous keyframe. While this strategy can reduce homography matrix accumulation by half or more to some extent, it places strict requirements on the image stitching order. For example, when... Figure 4 middle and In cases where there is absolutely no overlap, this strategy will result in stitching failure.
[0058] To overcome this limitation, a keyframe strategy based on global feature matching can be constructed to solve for the optimal homography transformation based on globally matched frames. This is achieved through a pre-set overlap rate threshold. For the current frame With all keyframes Perform overlap rate calculation, and include overlap rates exceeding [a certain threshold]. of Set to match keyframes ( This filtering mechanism can improve the reliability of subsequent feature matching. For example, the multi-frame images corresponding to the reference image can contain all keyframes. .
[0059] In one optional implementation, determining the first estimated position of the current image in the reference image includes: The reference image features of the reference image and the current image features of the current image are determined respectively; Feature matching is performed on the reference image features and the current image features to obtain feature point matching pairs; Homography estimation is performed based on the feature point matching pairs to obtain the first homography matrix; Based on the first homography matrix, the first estimated position of the current image in the reference image is estimated by homography transformation.
[0060] In some examples, see Figure 5 The diagram illustrates image stitching provided in this application embodiment. To obtain reliable feature correspondences, a combination of feature extraction and matching models can be used: the SuperPoint (SP) feature extraction model is used for feature extraction to obtain the features of the reference image and the current image, and the LightGlue (LG) feature matching model is used for feature point matching to obtain feature point matching pairs. The purpose is to find the current frame. and matching keyframes The correspondence between feature points in each image feature. This process can be expressed as the following formula:
[0061] in, Indicates the current frame With all matching keyframes The feature point matching pairs between them, this robust combination can provide more reliable data support for subsequent geometric constraints.
[0062] In one optional implementation, the projection information includes a set of matching point projection coordinates corresponding to each matching keyframe, wherein the set of matching point projection coordinates includes at least one matching point projection coordinate, and the matching point projection coordinate is obtained by projecting the matching point of the matching keyframe onto the reference image. Determining the second estimated position of the current image in the reference image based on the projection information formed by projecting each of the at least one matching keyframe into the reference image, and the first estimated position, includes: Based on the set of projected coordinates of the matching points corresponding to each of the at least one matching keyframe, and the first estimated position, the reprojection error is determined; The second homography matrix is obtained by optimizing the solution based on the reprojection error. Based on the second homography matrix, the second estimated position of the current image in the reference image is estimated by homography transformation.
[0063] In some examples, after obtaining the feature correspondence, the problem can be transformed into solving the current frame. The optimal homography matrix relative to the reference image This matrix can be used to view the current frame. Feature points projected to The corresponding coordinate position in the current frame. Specifically, for the current frame... any feature point Its projected coordinates can be represented by the following homogeneous coordinate transformation:
[0064] in, Indicates the homography transformation That is, it can be used to characterize the first estimated position obtained by homography transformation based on the first homography matrix.
[0065] However, since the matching points are distributed across different keyframes, it is necessary to consider the relationship between each keyframe and the reference image. Geometric transformations For the first Matching keyframes The matching point in, which is in The final projected coordinates in are It can be expressed as the following formula:
[0066] in, Indicates the first Matching keyframes Relative to the reference image Geometric transformations, Indicates the feature point matching pair with the first Matching keyframes The corresponding matching pair.
[0067] It should be noted that, Indicates the first indivual The set of projected coordinates of matching points in the keyframe, and the matching pairs of feature points corresponding to the same keyframe. Share the same .
[0068] The loss function for the optimization problem corresponding to the optimization solution can be defined as the reprojection error of the feature points, which can be expressed as follows:
[0069] in, Can be used for measurement and The squared Euclidean distance between them. To solve this problem efficiently, the Ceres optimizer can be used for fast iteration to complete the optimization solution, thereby obtaining the optimal homography matrix. This is used as the second homography matrix. Thus, after obtaining the second homography matrix, it can be used as... The homography transformation described above is used to perform the homography transformation in order to estimate the second estimated position.
[0070] In conjunction with the above-mentioned related embodiments, please refer to Figure 6 The diagram illustrates an image stitching method provided in an embodiment of this application. In the first stage, this application employs KSCO (Knowledge, Society, and Colour) to determine the initial homography matrix using global feature matching. In the second stage, it uses the ORIO (Organization, Interest, and Isolation) strategy to transform the general multi-step homography transformation into a direct single-step transformation, thereby effectively avoiding secondary homography accumulation. KSCO not only improves the structural consistency of the stitched image but also enhances the algorithm's robustness to the stitching order.
[0071] Secondly, correspondingly, this application also provides an image stitching device that can implement all the processes of the image stitching method provided in the above embodiments.
[0072] See Figure 7 The diagram shows a schematic representation of the image stitching device 700 provided in an embodiment of this application. The image stitching device 700 includes: Image acquisition module 701 is used to acquire a reference image and the current image; The minimum bounding polygon determination module 702 is used to determine an overlapping region in the reference image based on the reference image and the current image, and to determine the minimum bounding polygon corresponding to the overlapping region. The segmentation module 703 is used to segment the reference image into a reference region image and an image to be repaired based on the minimum bounding polygon, wherein the image to be repaired includes the overlapping region; Repair module 704 is used to perform splicing and splicing seam repair processing on the image to be repaired and the current image to obtain a spliced image; The fusion module 705 is used to fuse the stitched image with the reference region image to update the reference image.
[0073] In one optional implementation, the step of stitching the image to be repaired and the current image together and repairing the stitching seams to obtain a stitched image includes: The image to be repaired and the current image are input into a pre-trained repair model, which performs the stitching and seam repair processing on the image to be repaired and the current image to obtain the stitched image.
[0074] In one alternative implementation, the minimum bounding polygon includes the minimum bounding rectangle.
[0075] In one optional implementation, determining the overlapping region in the reference image based on the reference image and the current image includes: Determine the first estimated position of the current image in the reference image; Based on the first estimated position, at least one matching keyframe is determined from multiple frames of images corresponding to the reference image, wherein the reference image is generated at least based on the multiple frames of images; Based on the projection information formed by projecting each of the at least one matching keyframe onto the reference image, and the first estimated position, the second estimated position of the current image in the reference image is determined; Based on the second estimated position, the overlapping region is determined in the reference image.
[0076] In one optional implementation, determining the first estimated position of the current image in the reference image includes: The reference image features of the reference image and the current image features of the current image are determined respectively; Feature matching is performed on the reference image features and the current image features to obtain feature point matching pairs; Homography estimation is performed based on the feature point matching pairs to obtain the first homography matrix; Based on the first homography matrix, the first estimated position of the current image in the reference image is estimated by homography transformation.
[0077] In one optional implementation, the projection information includes a set of matching point projection coordinates corresponding to each matching keyframe, wherein the set of matching point projection coordinates includes at least one matching point projection coordinate, and the matching point projection coordinate is obtained by projecting the matching point of the matching keyframe onto the reference image. Determining the second estimated position of the current image in the reference image based on the projection information formed by projecting each of the at least one matching keyframe into the reference image, and the first estimated position, includes: Based on the set of projected coordinates of the matching points corresponding to each of the at least one matching keyframe, and the first estimated position, the reprojection error is determined; The second homography matrix is obtained by optimizing the solution based on the reprojection error. Based on the second homography matrix, the second estimated position of the current image in the reference image is estimated by homography transformation.
[0078] Thirdly, embodiments of this application provide a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in any of the above-mentioned embodiments.
[0079] Fourthly, embodiments of this application provide a computer program product, including computer instructions that, when executed by a processor, implement the steps of the method described in any of the above-described embodiments.
[0080] Fifthly, embodiments of this application provide a computer device including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the steps of the method described in any of the preceding claims.
[0081] See Figure 8 The computer device in this embodiment includes a processor 801, a memory 802, and a computer program, such as an image stitching program, stored in the memory 802 and executable on the processor 801. When the processor 801 executes the computer program, it implements the steps in the various image stitching method embodiments described above, for example... Figure 1 The steps S201-S205 are shown.
[0082] For example, the computer program may be divided into one or more modules / units, which are stored in the memory 802 and executed by the processor 801 to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the computer device.
[0083] The computer device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device may include, but is not limited to, a processor 801 and a memory 802. Those skilled in the art will understand that the schematic diagram is merely an example of a computer device and does not constitute a limitation on the computer device. It may include more or fewer components than illustrated, or combine certain components, or different components. For example, the computer device may also include input / output devices, network access devices, buses, etc.
[0084] The processor 801 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor, or processor 801 can be any conventional processor. The processor 801 is the control center of the computer device, connecting various parts of the entire computer device through various interfaces and lines.
[0085] The memory 802 can be used to store the computer programs and / or modules. The processor 801 implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory 802 and calling the data stored in the memory 802. The memory 802 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 802 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0086] Wherein, if the modules / units integrated into the computer device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a non-transitory computer-readable storage medium. When the computer program is executed by the processor 801, it can implement the steps of the various method embodiments described above. Wherein, the computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.
[0087] In summary, the embodiments of this application have at least the following beneficial effects: Using the embodiments of this application, a reference image and a current image are obtained; based on the reference image and the current image, an overlapping region is determined in the reference image, and the minimum bounding polygon corresponding to the overlapping region is determined; based on the minimum bounding polygon, the reference image is divided into a reference region image and an image to be repaired, wherein the image to be repaired includes the overlapping region; the image to be repaired and the current image are stitched together and the stitching seam is repaired to obtain a stitched image; the stitched image is fused with the reference region image to update the reference image. Thus, due to the minimum bounding polygon, the reference image is obtained. Since the bounding polygon can contain the entire overlapping region, the minimum bounding polygon can be used to extract the image to be repaired from the reference image, which contains the entire overlapping region. The image to be repaired is then stitched together with the current image, and the stitching seams are repaired. This results in a stitched image where all stitching seams near the overlapping region are repaired, reducing the stitching seams left in the subsequently updated reference image. Finally, the stitched image is merged back into the reference region image to update the reference image. Since the repair is performed on the extracted image to be repaired, rather than the entire reference image, the computational resources consumed by stitching and repair can be reduced.
[0088] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary hardware platforms, or it can be implemented entirely by hardware. Based on this understanding, all or part of the technical solutions of this application that contribute to the background technology can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM (Read-Only Memory) / RAM (Random Access Memory), magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0089] The above description is the preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications are also considered to be within the scope of protection of this application.
Claims
1. An image stitching method, characterized in that, include: Acquire the baseline image and the current image; Based on the reference image and the current image, an overlapping region is determined in the reference image, and the minimum bounding polygon corresponding to the overlapping region is determined. Based on the minimum bounding polygon, the reference image is divided into a reference region image and an image to be repaired, wherein the image to be repaired includes the overlapping region; The image to be repaired and the current image are stitched together and the stitch seams are repaired to obtain a stitched image; The stitched image is fused with the reference region image to update the reference image.
2. The method according to claim 1, characterized in that, The process of stitching the image to be repaired and the current image together and repairing the stitching seams to obtain a stitched image includes: The image to be repaired and the current image are input into a pre-trained repair model, which performs the stitching and seam repair processing on the image to be repaired and the current image to obtain the stitched image.
3. The method according to claim 1, characterized in that, The minimum bounding polygon includes the minimum bounding rectangle.
4. The method according to claim 1, characterized in that, The step of determining the overlapping region in the reference image based on the reference image and the current image includes: Determine the first estimated position of the current image in the reference image; Based on the first estimated position, at least one matching keyframe is determined from multiple frames of images corresponding to the reference image, wherein the reference image is generated at least based on the multiple frames of images; Based on the projection information formed by projecting each of the at least one matching keyframe onto the reference image, and the first estimated position, the second estimated position of the current image in the reference image is determined; Based on the second estimated position, the overlapping region is determined in the reference image.
5. The method according to claim 4, characterized in that, Determining the first estimated position of the current image in the reference image includes: The reference image features of the reference image and the current image features of the current image are determined respectively; Feature matching is performed on the reference image features and the current image features to obtain feature point matching pairs; Homography estimation is performed based on the feature point matching pairs to obtain the first homography matrix; Based on the first homography matrix, the first estimated position of the current image in the reference image is estimated by homography transformation.
6. The method according to claim 4, characterized in that, The projection information includes a set of projection coordinates of matching points corresponding to each matching keyframe, wherein the set of projection coordinates of matching points includes at least one projection coordinate of a matching point, and the projection coordinates of the matching point are obtained by projecting the matching point of the matching keyframe onto the reference image. Determining the second estimated position of the current image in the reference image based on the projection information formed by projecting each of the at least one matching keyframe into the reference image, and the first estimated position, includes: Based on the set of projected coordinates of the matching points corresponding to each of the at least one matching keyframe, and the first estimated position, the reprojection error is determined; The second homography matrix is obtained by optimizing the solution based on the reprojection error. Based on the second homography matrix, the second estimated position of the current image in the reference image is estimated by homography transformation.
7. An image stitching device, characterized in that, include: The image acquisition module is used to acquire the reference image and the current image; The minimum bounding polygon determination module is used to determine an overlapping region in the reference image based on the reference image and the current image, and to determine the minimum bounding polygon corresponding to the overlapping region. A segmentation module is used to segment the reference image into a reference region image and an image to be repaired based on the minimum bounding polygon, wherein the image to be repaired includes the overlapping region; The repair module is used to stitch the image to be repaired and the current image together and repair the stitch seams to obtain a stitched image. The fusion module is used to fuse the stitched image with the reference region image to update the reference image.
8. A non-transitory 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 method described in any one of claims 1-6.
9. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the method described in any one of claims 1-6.
10. A computer device, characterized in that, The method includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements the method of any one of claims 1-6.
