Image alignment method and device, equipment, storage medium

By acquiring and processing reference objects in the image, the image is automatically rotated and aligned, solving the problem of increased shooting time caused by shaky hands or misalignment, and improving the shooting experience.

CN115564657BActive Publication Date: 2026-06-26XIAN WINGTECH INFORMATION TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
XIAN WINGTECH INFORMATION TECH CO LTD
Filing Date
2022-09-28
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

When taking photos, shaky hands or misalignment of the subject increase shooting time and negatively impact the user experience, as current technology cannot automatically align the image.

Method used

Automatic image alignment is achieved by acquiring candidate reference objects in the original image, determining the target reference object, and rotating the image based on its offset angle.

Benefits of technology

It saves users shooting time and improves the shooting experience by using automatic rotation alignment technology to reduce the offset angle of the target reference object in the image relative to the center point.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115564657B_ABST
    Figure CN115564657B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose an image alignment method and device, equipment and storage medium. The method comprises: obtaining a candidate reference in an original image; determining a target reference from the candidate reference based on coordinate information of each candidate reference relative to a center point of the original image; and performing a rotation process on the original image based on an offset angle of the target reference relative to the center point of the original image to obtain a target image, wherein an offset angle of the target reference in the target image relative to a center point of the target image is less than an offset angle of the target reference in the original image relative to the center point of the original image. In this way, automatic rotation alignment of a captured image can be achieved, thereby saving the shooting time of a user and improving the shooting experience of the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to image processing technology, including but not limited to an image alignment method, apparatus, device, and storage medium. Background Technology

[0002] In daily use of mobile devices, users often take pictures. However, when taking pictures, users may experience shaky hands or take pictures randomly, resulting in misalignment of the subject. In such cases, to take a picture that is aligned, users often need to judge whether the subject is aligned with their eyes or turn on the 9-grid reference line to help them judge whether the subject is aligned with the reference. This increases the shooting time and makes the user's shooting experience less enjoyable. Summary of the Invention

[0003] In view of this, the image alignment method, apparatus, device, and storage medium provided in the embodiments of this application can achieve automatic rotation and alignment of captured images, thereby saving users' shooting time and improving their shooting experience. The image alignment method, apparatus, device, and storage medium provided in the embodiments of this application are implemented as follows:

[0004] The image alignment method provided in this application includes:

[0005] Obtain candidate reference objects from the original image;

[0006] Based on the coordinate information of each candidate reference object relative to the center point of the original image, the target reference object is determined from the candidate reference objects;

[0007] Based on the offset angle of the target reference object relative to the center point of the original image, the original image is rotated to obtain the target image. The offset angle of the target reference object in the target image relative to the center point of the target image is smaller than the offset angle of the target reference object relative to the center point of the original image.

[0008] In some embodiments, the offset angle of the candidate reference object relative to the center point of the original image is less than a threshold.

[0009] In some embodiments, determining the target reference object from the candidate reference objects based on the coordinate information of each candidate reference object relative to the center point of the original image includes:

[0010] Based on the coordinate information of each candidate reference object relative to the center point of the original image, the confidence level of each candidate reference object is determined. The confidence level is used to characterize the probability value of the candidate reference object as the rotation standard of the original image.

[0011] Based on the confidence level of each candidate reference, the candidate reference with the highest confidence level is selected as the target reference.

[0012] In some embodiments, the confidence level of each candidate reference object is determined based on the coordinate information of the center point of the original image relative to each candidate reference object, including:

[0013] Based on the coordinate information of each candidate reference object, the target parameters of each candidate reference object relative to the center point of the original image are determined.

[0014] The target parameters of each candidate reference are weighted to obtain the confidence level of each candidate reference.

[0015] In some embodiments, the target parameters include the relative height, relative width, offset angle of each candidate reference relative to the center point of the original image, and / or the image proportion of each candidate reference relative to the original image.

[0016] In some embodiments, the original image is rotated based on the offset angle of the target reference to obtain the target image, including:

[0017] Based on the coordinate information of the target reference object, determine the weight of each edge line in the target reference object;

[0018] The edge line with the highest weight is determined as the target edge line;

[0019] Based on the offset angle of the target edge line relative to the center point of the original image, the original image is rotated to obtain the target image. The offset angle of the target edge line in the target image relative to the center point of the target image is smaller than the offset angle of the target edge line relative to the center point of the original image.

[0020] In some embodiments, the original image is a preview image or the original image obtained by taking the photo.

[0021] The image alignment device provided in this application embodiment includes:

[0022] The acquisition module is used to acquire candidate reference objects from the original image;

[0023] The determination module is used to determine the target reference object from the candidate reference objects based on the coordinate information of each candidate reference object relative to the center point of the original image;

[0024] The processing module is used to rotate the original image based on the offset angle of the target reference object relative to the center point of the original image to obtain the target image. The offset angle of the target reference object in the target image relative to the center point of the target image is smaller than the offset angle of the target reference object relative to the center point of the original image.

[0025] In some embodiments, the determining module is specifically used for:

[0026] Based on the coordinate information of each candidate reference object relative to the center point of the original image, the confidence level of each candidate reference object is determined. The confidence level is used to characterize the probability value of the candidate reference object as the rotation standard of the original image.

[0027] Based on the confidence level of each candidate reference, the candidate reference with the highest confidence level is selected as the target reference.

[0028] In some embodiments, the determining module is specifically used for:

[0029] Based on the coordinate information of each candidate reference object, the target parameters of each candidate reference object relative to the center point of the original image are determined.

[0030] The target parameters of each candidate reference are weighted to obtain the confidence level of each candidate reference.

[0031] In some embodiments, the processing module is specifically used for:

[0032] Based on the coordinate information of the target reference object, determine the weight of each edge line in the target reference object;

[0033] The edge line with the highest weight is determined as the target edge line;

[0034] Based on the offset angle of the target edge line relative to the center point of the original image, the original image is rotated to obtain the target image. The offset angle of the target edge line in the target image relative to the center point of the target image is smaller than the offset angle of the target edge line relative to the center point of the original image.

[0035] The computer device provided in this application includes a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it implements the method described in this application.

[0036] The computer-readable storage medium provided in this application embodiment stores a computer program thereon, which, when executed by a processor, implements the method provided in this application embodiment.

[0037] The image alignment method, apparatus, computer device, and computer-readable storage medium provided in this application acquire candidate reference objects from the original image; determine a target reference object from the candidate reference objects based on the coordinate information of each candidate reference object relative to the center point of the original image; and rotate the original image based on the offset angle of the target reference object relative to the center point of the original image to obtain a target image, such that the offset angle of the target reference object in the target image relative to the center point of the target image is smaller than the offset angle of the target reference object in the original image relative to the center point of the original image. This enables automatic rotation and alignment of captured images, thereby saving users' shooting time, improving the user's shooting experience, and solving the technical problems mentioned in the background art. Attached Figure Description

[0038] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the technical solutions of this application.

[0039] Figure 1 An example flowchart illustrating the implementation process of an image alignment method provided in this application embodiment;

[0040] Figure 2 A schematic diagram of an original image provided for an embodiment of this application;

[0041] Figure 3 This application provides a schematic diagram of an implementation process for determining a target reference object from candidate reference objects in an embodiment of the present application.

[0042] Figure 4 A schematic diagram illustrating the implementation process for determining the confidence level of a candidate reference object, provided in an embodiment of this application;

[0043] Figure 5 Comparison diagrams showing the results of an image alignment method provided in this application embodiment;

[0044] Figure 6 A schematic diagram illustrating the implementation process of an image alignment method provided in an embodiment of this application;

[0045] Figure 7 This is a schematic diagram of the structure of the image alignment device provided in the embodiments of this application;

[0046] Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0047] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the specific technical solutions of this application will be further described in detail below with reference to the accompanying drawings of the embodiments of this application. The following embodiments are used to illustrate this application, but are not intended to limit the scope of this application.

[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0049] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0050] It should be noted that the terms "first, second, third" used in the embodiments of this application are used to distinguish similar or different objects and do not represent a specific order of objects. It can be understood that "first, second, third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0051] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.

[0052] Convolutional Neural Networks (CNNs) are a class of feedforward neural networks that incorporate convolutional computations and have a deep structure. They are one of the representative algorithms of deep learning. CNNs possess representation learning capabilities, enabling them to perform shift-invariant classification of input information according to their hierarchical structure; therefore, they are also known as Shift-Invariant Artificial Neural Networks (SIANNs).

[0053] Currently, when a camera performs a photo-taking function, even if the reference object in the captured image is tilted, it cannot automatically correct and align the captured image. Instead, the user needs to use their eyes to judge whether the image is aligned with the reference object, or turn on the 9-grid reference line to help judge whether the image is aligned with the reference object and try to take a photo that is aligned with the reference object. This increases the shooting time and makes the user's shooting experience poor.

[0054] In view of this, embodiments of this application provide an image alignment method, which is applied to an electronic device. This electronic device can be of various types with image processing capabilities. For example, the electronic device may include a personal computer, laptop, PDA, or server; the electronic device may also be a mobile terminal application, such as a mobile phone, in-vehicle computer, tablet computer, or projector. The function implemented by this method can be achieved by a processor in the electronic device calling program code. Of course, the program code can be stored in a computer storage medium. Therefore, the electronic device includes at least a processor and a storage medium.

[0055] Figure 1 This is a schematic diagram illustrating the implementation process of the image alignment method provided in this application embodiment, which can automatically rotate and align captured images, thereby saving users' shooting time and improving their shooting experience.

[0056] like Figure 1 As shown, the method may include the following steps 101 to 104:

[0057] Step 101: Obtain candidate reference objects from the original image.

[0058] In the embodiments of this application, the obtained original image can be either a preview image or the original image captured, and there is no limitation on this.

[0059] Accordingly, taking a tilted image as an example, if the original image is a preview image, it means that the image presented to the user is not processed by the image alignment method; that is, it is still a tilted image, not a rotated and corrected image. In some embodiments, a prompt message can be provided on the preview image display interface for the user to choose whether to select automatic correction. If the user does perform automatic correction of the preview image, the terminal device can continue to perform subsequent steps such as detecting whether there are candidate reference objects in the acquired original image.

[0060] If the original image is the original image captured by the camera, the terminal device can automatically trigger the subsequent image alignment operation after acquiring the original image. In this way, what is presented to the user is the target image that has been rotated and calibrated, and the target image is the aligned image.

[0061] In this embodiment, the type and number of candidate reference objects are not limited. For example, the number of candidate reference objects in an original image can be one or more; the type of candidate reference object can be any type such as rectangle, triangle, circle or ellipse. Figure 2 A schematic diagram of the original image is provided. Figure 2 In this context, the display 1 can be a candidate reference object, the chandelier 2 can also be a candidate reference object, and the beam 3 can also be a candidate reference object.

[0062] In a preferred embodiment, each candidate reference has an edge line that can serve as an alignment standard, and the edge line can be a straight line.

[0063] In this application, the method for detecting whether candidate reference objects exist in the acquired original image is not limited. For example, in some embodiments, candidate reference objects in the original image can be identified using a deep learning image classification method based on a convolutional neural network.

[0064] It should be noted that if no candidate reference is detected in the original image, the image alignment process ends.

[0065] Step 102: Based on the coordinate information of each candidate reference object relative to the center point of the original image, determine the target reference object from the candidate reference objects.

[0066] In this embodiment, the specific type of coordinate information of the candidate reference object relative to the center point of the original image is not limited. For example, if the candidate reference object is a rectangle, the coordinate information of its four corner points relative to the center point of the original image can be determined; if the candidate reference object is a circle or an ellipse, the coordinate information of the endpoints of its diameter relative to the center point of the original image can be determined; if the candidate reference object is a triangle, the coordinate information of its three vertices relative to the center point of the original image can be determined, and so on.

[0067] In some embodiments, to prevent the problem that the tilted original image was intentionally captured by the user and that performing rotation correction on the original image is not the user's true intention, before performing step 102, the offset angle of each candidate reference object relative to the center point of the original image can be determined based on the coordinate information of each candidate reference object relative to the center point of the original image; if the offset angle of the candidate reference object is less than the threshold, then step 102 is performed.

[0068] Here, when determining whether to continue performing subsequent rotation and alignment operations on the original image based on the offset angle of the candidate reference object relative to the center point of the original image, it can be that when the offset angle of each candidate reference object is less than the threshold, it can be that when the offset angle of some candidate reference objects is less than the threshold, it can be that when the offset angle of some candidate reference objects is less than the threshold, it can be that when the offset angle of some candidate reference objects is less than the threshold, it can be that when the offset angle of some candidate reference objects is less than the threshold, this embodiment does not limit this.

[0069] Of course, if the number of candidate references in the original image is 1, after determining that the original image needs to be aligned, the candidate reference can be directly determined as the target reference, and the original image can be rotated and aligned based solely on the offset angle of the unique candidate reference relative to the center point of the original image.

[0070] In some embodiments, such as Figure 3 As shown, step 102 can be achieved by performing the following steps 301 to 302, namely, determining the target reference object from the candidate reference objects:

[0071] Step 301: Determine the confidence level of each candidate reference object based on the coordinate information of the center point of each candidate reference object relative to the original image.

[0072] Here, the confidence score is used to characterize the probability value of a candidate reference as the standard for rotation of the original image. That is, the confidence score of each candidate reference is used to represent the likelihood of determining it as the standard for rotation alignment of the original image based on it.

[0073] Furthermore, in some embodiments, such as Figure 4 As shown, to determine the confidence level of each candidate reference, steps 401 to 402 can be performed as follows:

[0074] Step 401: Based on the coordinate information of each candidate reference object, determine the target parameters of each candidate reference object relative to the center point of the original image.

[0075] In the embodiments of this application, the specific type of the target parameter is not limited. For example, the target parameter may include the relative height, relative width, offset angle of each candidate reference object relative to the center point of the original image, and / or the image proportion of each candidate reference object relative to the original image.

[0076] Specifically, in a feasible embodiment, the candidate reference is used as... Figure 2 Taking the display 1 shown in the figure as an example, after determining the coordinate information of the four corner points of the display 1, the area of ​​the display 1 can be calculated based on the coordinate information of the four corner points. Then, the image ratio of the display 1 relative to the original image can be determined based on the area of ​​the display 1 and the area of ​​the original image.

[0077] In addition, after determining the coordinate information of the four corner points of the display 1, the offset angle of the display 1 relative to the center point of the original image can be calculated based on the coordinate information of any two adjacent corner points; and the relative width of the display 1 relative to the center point of the original image can be calculated based on the coordinate information of the two angles of the display 1 in the horizontal direction, and the relative height of the display 1 relative to the center point of the original image can be calculated based on the coordinate information of the two angles of the display 1 in the vertical direction.

[0078] Step 402: Weight the target parameters of each candidate reference to obtain the confidence level of each candidate reference.

[0079] After obtaining multiple target parameters for each candidate reference, a weighted average can be performed on the multiple target parameters corresponding to the Nth candidate reference. The result is used as the confidence level of the Nth candidate reference, which represents the probability that the Nth candidate reference is determined as the standard for rotation alignment of the original image based on it.

[0080] Understandably, the closer a candidate reference is to the center of the original image and the larger its proportion relative to the original image, the higher the confidence level of the candidate reference.

[0081] Step 302: Based on the confidence level of each candidate reference, determine the candidate reference with the highest confidence level as the target reference.

[0082] Step 103: Based on the offset angle of the target reference object relative to the center point of the original image, rotate the original image to obtain the target image. The offset angle of the target reference object in the target image relative to the center point of the target image is smaller than the offset angle of the target reference object relative to the center point of the original image.

[0083] In a preferred embodiment, after determining the target reference object, in order to accurately rotate the original image, the rotation can be performed not based on the offset angle of the entire target reference object relative to the center point of the original image, but on a target edge line determined in the target reference object, and the rotation is performed based on the offset angle of the target edge line relative to the center point of the original image.

[0084] Specifically, based on the coordinate information of the target reference object, the weight of each edge line in the target reference object is determined; the edge line with the largest weight is determined as the target edge line; based on the offset angle of the target edge line relative to the center point of the original image, the original image is rotated to obtain the target image, and the offset angle of the target edge line in the target image relative to the center point of the target image is smaller than the offset angle of the target edge line in the original image relative to the center point of the original image.

[0085] Using the target reference point as Figure 2 Taking display 1 as an example, the weight of each edge line of the display can be calculated. For instance, the weight of a horizontal edge line is greater than that of a vertical edge line. Based on the weight of each edge line, the edge line with the largest weight is determined as the target edge line. If the target edge line is edge line 1, then the original image is rotated based on the offset angle of edge line 1 relative to the center point of the original image. Figure 5 As shown, a comparison diagram of the original image and the target image is presented. It can be seen that the target image processed by the above image alignment method has achieved image alignment with the original image.

[0086] In this embodiment, the presence of candidate reference objects in the acquired original image is detected. If a candidate reference object is found, a target reference object is determined from the candidate reference objects based on the coordinate information of each candidate reference object relative to the center point of the original image. Based on the offset angle of the target reference object relative to the center point of the original image, the original image is rotated to obtain the target image, such that the offset angle of the target reference object in the target image relative to the center point of the target image is smaller than the offset angle of the target reference object in the original image relative to the center point of the original image. This enables automatic rotation and alignment of the captured image, thereby saving the user's shooting time and improving the user's shooting experience.

[0087] The following describes an exemplary application of the embodiments of this application in a real-world application scenario.

[0088] Figure 6 The overall flow of the image alignment method provided in the embodiments of this application is as follows. Figure 6 As shown, the method includes the following steps 601 to 605:

[0089] Step 601: Detect whether there are any alignable reference objects (i.e., candidate reference objects) in the original image.

[0090] Thus, when detecting the presence of alignable reference objects, deep learning image classification using convolutional neural networks (CNNs) can be employed. A key feature of CNNs is the use of convolutional layers, which mimic the human visual nervous system. A single neuron can only respond to specific image features, such as horizontal or vertical edges, which are inherently simple. However, these simple neurons form a layer, and with a sufficient number of layers, a rich set of features can be acquired.

[0091] Step 602: Calculate the offset angle of each alignable reference object relative to the center point of the original image. Check if the offset angle is within the set range. If it is, perform automatic alignment. If it is not within the set range, ignore it.

[0092] Step 603: Calculate the position information of the edge line of each alignable reference (including relative height, relative width, relative position, and center coordinates).

[0093] Step 604: Determine the corresponding confidence level based on the positional information of each alignable reference object, i.e., select the factors to consider when choosing a reference object. The factors considered for a reference object consist of multiple aspects, including relative height, relative width, relative position, offset angle from the standard position, and the proportion of the image it occupies, which are then weighted and averaged. The resulting weighted average value is used as the confidence level of the reference object. The closer the reference object is to the center and the larger its area, the higher its confidence level. A confidence threshold is set; reference objects with a confidence level below the threshold can be ignored.

[0094] Step 605: Select the alignment reference with the highest confidence level for alignment. The alignment operation involves calculating the angular deviation between the edge line of the alignment reference and the desired alignment direction, and then rotating the entire image.

[0095] Line alignment means selecting the line (edge) with the highest weight in the image as a reference.

[0096] The alignment operation can be selected as either post-image alignment or pre-image alignment. Post-image alignment refers to alignment by rotating and cropping the image after imaging; pre-image alignment refers to alignment based on reference objects selected from the statistical preview image information before imaging.

[0097] It should be understood that, although Figure 1 , Figures 3 to 4 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 1 , Figures 3 to 4 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0098] Based on the foregoing embodiments, this application provides an image alignment device, which includes various modules and units included in each module, and can be implemented by a processor; of course, it can also be implemented by specific logic circuits; in the implementation process, the processor can be a central processing unit (CPU), microprocessor (MPU), digital signal processor (DSP) or field programmable gate array (FPGA), etc.

[0099] Figure 7 This is a schematic diagram of the image alignment device provided in the embodiments of this application, such as... Figure 7 As shown, the device 700 includes an acquisition module 701, a determination module 702, and a processing module 703, wherein:

[0100] The acquisition module is used to acquire candidate reference objects from the original image;

[0101] The determination module is used to determine the target reference object from the candidate reference objects based on the coordinate information of each candidate reference object relative to the center point of the original image;

[0102] The processing module is used to rotate the original image based on the offset angle of the target reference object relative to the center point of the original image to obtain the target image. The offset angle of the target reference object in the target image relative to the center point of the target image is smaller than the offset angle of the target reference object relative to the center point of the original image.

[0103] In some embodiments, the determining module is specifically used for:

[0104] Based on the coordinate information of each candidate reference object relative to the center point of the original image, the confidence level of each candidate reference object is determined. The confidence level is used to characterize the probability value of the candidate reference object as the rotation standard of the original image.

[0105] Based on the confidence level of each candidate reference, the candidate reference with the highest confidence level is selected as the target reference.

[0106] In some embodiments, the determining module is specifically used for:

[0107] Based on the coordinate information of each candidate reference object, the target parameters of each candidate reference object relative to the center point of the original image are determined.

[0108] The target parameters of each candidate reference are weighted to obtain the confidence level of each candidate reference.

[0109] In some embodiments, the processing module is specifically used for:

[0110] Based on the coordinate information of the target reference object, determine the weight of each edge line in the target reference object;

[0111] The edge line with the highest weight is determined as the target edge line;

[0112] Based on the offset angle of the target edge line relative to the center point of the original image, the original image is rotated to obtain the target image. The offset angle of the target edge line in the target image relative to the center point of the target image is smaller than the offset angle of the target edge line relative to the center point of the original image.

[0113] In this embodiment, the presence of candidate reference objects in the acquired original image is detected. If a candidate reference object is found, a target reference object is determined from the candidate reference objects based on the coordinate information of each candidate reference object relative to the center point of the original image. Based on the offset angle of the target reference object relative to the center point of the original image, the original image is rotated to obtain the target image, such that the offset angle of the target reference object in the target image relative to the center point of the target image is smaller than the offset angle of the target reference object in the original image relative to the center point of the original image. This enables automatic rotation and alignment of the captured image, thereby saving the user's shooting time and improving the user's shooting experience.

[0114] The descriptions of the above device embodiments are similar to those of the above method embodiments, and have similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0115] It should be noted that, in the embodiments of this application... Figure 7 The module division of the image alignment device shown is illustrative and represents only one logical functional division; in actual implementation, other division methods may be used. Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, exist as separate physical units, or be integrated into one unit by two or more units. The integrated units described above can be implemented in hardware, as software functional units, or in a combination of software and hardware.

[0116] It should be noted that, in the embodiments of this application, if the above-described methods are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.

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

[0118] This application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method provided in the above embodiments.

[0119] This application provides a computer program product containing instructions that, when run on a computer, cause the computer to perform the steps in the method provided in the above-described method embodiments.

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

[0121] In one embodiment, the image alignment device provided in this application can be implemented as a computer program, which can be implemented as follows: Figure 8It runs on the computer device shown. The computer device's memory can store the various program modules that make up the sampling device, for example, Figure 7 The acquisition module, determination module, and processing module are shown. The computer program, comprised of these modules, causes the processor to execute the steps in the image alignment methods of the various embodiments of this application described in this specification.

[0122] It should be noted that the descriptions of the storage medium and device embodiments above are similar to the descriptions of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium, storage medium, and device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0123] It should be understood that the phrases "one embodiment," "an embodiment," or "some embodiments" mentioned throughout the specification mean that a specific feature, structure, or characteristic related to an embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment," "in one embodiment," or "in some embodiments" appearing throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely for descriptive purposes and do not represent the superiority or inferiority of the embodiments. The descriptions of the various embodiments above tend to emphasize the differences between the various embodiments; their similarities or commonalities can be referred to mutually, and for the sake of brevity, they will not be repeated here.

[0124] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three kinds of relationships. For example, object A and / or object B can represent three situations: object A exists alone, object A and object B exist simultaneously, and object B exists alone.

[0125] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0126] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple modules or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or modules can be electrical, mechanical, or other forms.

[0127] The modules described above as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules. They may be located in one place or distributed across multiple network units. Some or all of the modules may be selected to achieve the purpose of this embodiment according to actual needs.

[0128] In addition, each functional module in the various embodiments of this application can be integrated into one processing unit, or each module can be a separate unit, or two or more modules can be integrated into one unit; the integrated modules can be implemented in hardware or in the form of hardware plus software functional units.

[0129] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.

[0130] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0131] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0132] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0133] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.

[0134] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. An image alignment method, characterized in that, The method includes: Obtain candidate reference objects from the original image; Based on the coordinate information of each candidate reference object relative to the center point of the original image, the target reference object is determined from the candidate reference objects; Based on the offset angle of the target reference object relative to the center point of the original image, the original image is rotated to obtain the target image. The offset angle of the target reference object in the target image relative to the center point of the target image is smaller than the offset angle of the target reference object relative to the center point of the original image. The step of determining the target reference object from the candidate reference objects based on the coordinate information of each candidate reference object relative to the center point of the original image includes: Based on the coordinate information of each candidate reference object relative to the center point of the original image, the confidence level of each candidate reference object is determined, and the confidence level is used to characterize the probability value of the candidate reference object as the rotation standard of the original image. Based on the confidence level of each candidate reference, the candidate reference with the highest confidence level is determined as the target reference.

2. The method according to claim 1, characterized in that, The offset angle of the candidate reference object relative to the center point of the original image is less than a threshold.

3. The method according to claim 1, characterized in that, The step of determining the confidence level of each candidate reference object based on the coordinate information of the center point of each candidate reference object relative to the original image includes: Based on the coordinate information of each candidate reference object, the target parameters of each candidate reference object relative to the center point of the original image are determined. The target parameters of each candidate reference are weighted to obtain the confidence level of each candidate reference.

4. The method according to claim 3, characterized in that, The target parameters include the relative height, relative width, offset angle of each candidate reference object relative to the center point of the original image, and / or the image proportion of each candidate reference object relative to the original image.

5. The method according to claim 1, characterized in that, The process of rotating the original image based on the offset angle of the target reference to obtain the target image includes: Based on the coordinate information of the target reference object, the weight of each edge line in the target reference object is determined; The edge line with the highest weight is determined as the target edge line; Based on the offset angle of the target edge line relative to the center point of the original image, the original image is rotated to obtain the target image, wherein the offset angle of the target edge line in the target image relative to the center point of the target image is smaller than the offset angle of the target edge line in the original image relative to the center point of the original image.

6. The method according to any one of claims 1 to 5, characterized in that, The original image is either a preview image or the original image obtained from taking the photo.

7. An image alignment device, characterized in that, include: The acquisition module is used to acquire candidate reference objects from the original image; The determination module is used to determine the target reference object from the candidate reference objects based on the coordinate information of each candidate reference object relative to the center point of the original image; The processing module is used to rotate the original image based on the offset angle of the target reference object relative to the center point of the original image to obtain a target image, wherein the offset angle of the target reference object in the target image relative to the center point of the target image is smaller than the offset angle of the target reference object in the original image relative to the center point of the original image. The determining module is specifically used to determine the confidence level of each candidate reference object based on the coordinate information of each candidate reference object relative to the center point of the original image. The confidence level is used to characterize the probability value of the candidate reference object as the rotation standard of the original image. Based on the confidence level of each candidate reference, the candidate reference with the highest confidence level is determined as the target reference.

8. A computer device comprising a memory and a processor, the memory storing a computer program executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.