Method for detecting registered image in input image and related device and equipment

By matching feature points in the registration and input images and calculating the relationship matrix, the problem of insufficient small target registration and positioning capabilities in the existing technology is solved, and efficient and accurate registration image detection is achieved.

CN112884049BActive Publication Date: 2024-09-17ZHEJIANG SENSETIME TECH DEV CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202110210175.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-24
Publication Date
2024-09-17
Estimated Expiration
2041-02-24

AI Technical Summary

Technical Problem

Existing registration algorithms have limited positioning capabilities in small target image registration and require a large amount of calculation. They are difficult to deploy to edge devices and lack effective technical solutions.

Method used

By obtaining at least two registration feature points in the registration image and the corresponding feature points in the input image, the relationship matrix is ​​calculated, and the similarity is used to select the optimal matrix to locate the registration image, thereby improving the positioning accuracy and robustness.

Benefits of technology

It achieves accurate positioning of small target images, reduces the amount of positioning calculations, improves detection accuracy and reliability, and is suitable for edge devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112884049B
    Figure CN112884049B
Patent Text Reader

Abstract

The present application discloses a method for detecting a registered image in an input image and related devices and equipment, wherein the method comprises: obtaining at least two registered feature points in the registered image and at least two input feature points in the input image corresponding to the registered feature points; calculating a relationship matrix from the registered image to the input image according to the registered feature points and the input feature points corresponding to the registered feature points, and obtaining at least one relationship matrix; respectively obtaining corresponding point pairs between the input image and the registered image using the relationship matrix, calculating the similarity between the corresponding point pairs, and determining the relationship matrix corresponding to the maximum similarity as the optimal relationship matrix; detecting the registered image in the input image according to the optimal relationship matrix. It is possible to detect the position of a small-sized registered image in the input image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of registration algorithms, and in particular to a method for detecting a registered image in an input image and related devices and equipment. Background Art

[0002] Augmented Reality (AR) is a technology that cleverly integrates virtual information with the real world. Virtual Reality (VR) is a technology that integrates computers, electronic information, and simulation technology and uses computers to simulate virtual environments to give people a sense of environmental immersion. Augmented / virtual reality is a hot application in the field of computer vision. The algorithm uses a camera as an input device and processes image algorithms to digitize information about the surrounding environment, thereby obtaining an experience of interacting with the real environment.

[0003] Existing registration algorithms are divided into two categories: deep learning and feature point method. Among them, deep learning requires offline training. By giving a set of training data, it learns the surface features of the registered image and obtains the detection network model. When in use, the image is input into the detection network model to obtain the position of the registered image on the image. This type of method has a simple and efficient process and is an end-to-end design solution. However, this type of method has a large amount of calculation, is difficult to deploy on edge devices, and has limited detection capabilities for small targets.

[0004] Currently, there is no good technical solution in the industry for image registration and positioning of small targets. Summary of the invention

[0005] The present application provides a method for detecting a registered image in an input image and related devices and equipment.

[0006] In a first aspect, the present application provides a method for detecting a registered image in an input image, comprising: obtaining at least two registered feature points in the registered image, and at least two input feature points in the input image corresponding to the registered feature points; the registered feature points include registered feature point coordinates, and the input feature points include input feature point coordinates; according to the registered feature points and the input feature points corresponding to the registered feature points, a relationship matrix from the registered image to the input image is calculated to obtain at least one relationship matrix; corresponding point pairs between the input image and the registered image are obtained using the relationship matrices respectively, the similarity between the corresponding point pairs is calculated, and the relationship matrix corresponding to the maximum similarity is determined as the optimal relationship matrix; and the registered image is detected in the input image according to the optimal relationship matrix.

[0007] Therefore, first obtain at least two registered feature points in the registered image and at least two input feature points corresponding to the registered feature points in the input image; the registered feature points include the registered feature point coordinates, and the input feature points include the input feature point coordinates. By respectively obtaining the feature points on the registered image and the input image, positioning calculations are performed to reduce the amount of positioning calculations and to a certain extent ensure that the relationship matrix corresponding to the obtained registered feature points and the corresponding input feature points can locate the position of the registered image in the input image; then based on the registered feature points and the input feature points corresponding to the registered feature points, the relationship matrix from the registered image to the input image is calculated to obtain at least one relationship matrix; respectively use the relationship matrix to obtain the corresponding point pairs between the input image and the registered image, calculate the similarity between the corresponding point pairs, and determine the relationship matrix corresponding to the maximum similarity as the optimal relationship matrix; detect the registered image in the input image according to the optimal relationship matrix, and select the similarity of at least one relationship matrix to further eliminate the situation where the registered image is not accurately positioned in the input image, thereby improving the accuracy and reliability of detecting the registered image in the input image. The above scheme can realize the positioning of the registered image for small targets and improve the accuracy and robustness of detecting the registered image in the input image.

[0008] Among them, obtaining at least two registration feature points in the registration image and at least two input feature points in the input image corresponding to the registration feature points includes: obtaining at least two registration feature points in the registration image and at least two input feature points in the input image; matching each registration feature point with each input feature point to determine the input feature point corresponding to each registration feature point.

[0009] Therefore, by matching the acquired at least two registration feature points with the at least two input feature points, a corresponding relationship between each registration feature point and each input feature point is established, so that the registration image is positioned based on the corresponding relationship between each pair of two points.

[0010] Among them, obtaining the registered feature points in the registered image and the input feature points in the input image corresponding to the registered feature points includes: respectively obtaining at least two registered feature points and corresponding descriptors in the registered image and at least two input feature points and corresponding descriptors in the input image; comparing the descriptor of each registered feature point with the descriptor of each input feature point to obtain the difference between the descriptor of each registered feature point and the descriptor of each input feature point; and respectively determining the input feature points whose difference with the registered feature points is less than the difference threshold as the input feature points corresponding to the registered feature points.

[0011] Therefore, the descriptor of each registered feature point is compared with the descriptor of each input feature point to obtain the difference between the descriptor of each registered feature point and the descriptor of each input feature point, and the input feature point whose difference with the registered feature point is less than the difference threshold is determined as the input feature point corresponding to the registered feature point, so as to determine the correspondence between the registered feature point and the input feature point using the difference.

[0012] Among them, the relationship matrix includes a coordinate relationship matrix, a direction relationship matrix and a scale relationship matrix; according to the registered feature points and the input feature points corresponding to the registered feature points, the relationship matrix from the registered image to the input image is calculated, including: based on every two registered feature points and the two input feature points corresponding to the two registered feature points, the coordinate relationship matrix, the scale relationship matrix and the direction relationship matrix are calculated; according to the coordinate relationship matrix, the scale relationship matrix and the direction relationship matrix, the relationship matrix from the registered image to the input image is calculated.

[0013] Therefore, based on the two registered feature points and the two input feature points, the coordinate relationship matrix, the scale relationship matrix and the direction relationship matrix are solved, and then the relationship matrix from the registered image to the input image is calculated. In this way, the efficiency and speed of detecting the registered image in the input image are improved by calculating the relationship matrix using only two pairs of feature points.

[0014] Among them, the steps of calculating the coordinate relationship matrix, the scale relationship matrix and the direction relationship matrix based on the two registered feature points and the input feature points corresponding to the two registered feature points include: calculating the coordinate relationship matrix according to the midpoint coordinates of the two registered feature points and the midpoint coordinates of the two input feature points; calculating the scale relationship matrix according to the length of the line connecting the two registered feature points and the length of the line connecting the two input feature points; calculating the direction relationship matrix according to the vector formed by the two registered feature points and the vector formed by the two input feature points.

[0015] Therefore, by calculating the coordinate relationship matrix according to the midpoint coordinates of the two registered feature points and the midpoint coordinates of the two input feature points, calculating the scale relationship matrix according to the line length of the two registered feature points and the line length of the two input feature points, and calculating the direction relationship matrix according to the vector formed by the two registered feature points and the vector formed by the two input feature points, the registered image on the input image is positioned based on the two point pairs of registered feature points and the input feature points using the relationship matrix, and the accuracy and reliability of the positioning process are guaranteed to a certain extent.

[0016] The method further includes: calculating the midpoint coordinates, line length and vector of the two registered feature points according to the registered feature point coordinates of the two registered feature points; and calculating the midpoint coordinates, line length and vector of the two input feature points according to the input feature point coordinates of the two input feature points.

[0017] Therefore, the midpoint coordinates, line length and vector of the two registered feature points are calculated according to the registered feature point coordinates of the two registered feature points: the midpoint coordinates, line length and vector of the two input feature points are calculated according to the input feature point coordinates of the two input feature points to calculate the relationship matrix based on the above parameters.

[0018] Among them, the corresponding point pairs between the input image and the registered image are obtained by using the relationship matrix respectively, the similarity between the corresponding point pairs is calculated, and the relationship matrix corresponding to the maximum similarity is determined as the optimal relationship matrix, including: calculating the similarity between the corresponding point pairs according to the error square sum algorithm or the normalized cross-correlation.

[0019] Therefore, the similarity is calculated according to the error square sum algorithm or normalized cross-correlation to improve the accuracy and reliability of the registration image positioning.

[0020] Among them, detecting the registered image in the input image according to the optimal relationship matrix includes: if the similarity is less than a threshold, determining that there is no registered image in the input image; if the similarity is greater than or equal to the threshold, determining the position of the registered image in the input image according to the optimal relationship matrix.

[0021] Therefore, the optimal relationship matrix is ​​further judged by similarity so that the optimal relationship matrix can truly reflect the position of the registered image to ensure the reliability and accuracy of the optimal relationship matrix.

[0022] In a second aspect, the present application provides a device for detecting a registered image in an input image, comprising: an acquisition module, used to acquire at least two registered feature points in the registered image, and at least two input feature points in the input image corresponding to the registered feature points; the registered feature points include registered feature point coordinates, and the input feature points include input feature point coordinates; a processing module, used to calculate a relationship matrix from the registered image to the input image based on the registered feature points and the input feature points corresponding to the registered feature points, and obtain at least one relationship matrix; a calculation module, used to respectively use the relationship matrix to obtain corresponding point pairs between the input image and the registered image, calculate the similarity between the corresponding point pairs, and determine the relationship matrix corresponding to the maximum similarity as the optimal relationship matrix; a determination module, used to detect the registered image in the input image according to the optimal relationship matrix.

[0023] A third aspect of the present application provides an electronic device, comprising a memory and a processor coupled to each other, the processor being used to execute program instructions stored in the memory to implement the method of detecting a registered image in an input image in the first aspect.

[0024] A fourth aspect of the present application provides a computer-readable storage medium having program instructions stored thereon, which, when executed by a processor, implements the method of detecting a registered image in an input image in the first aspect.

[0025] The above scheme, the present application first obtains at least two registered feature points in the registered image and at least two input feature points in the input image corresponding to the registered feature points; the registered feature points include the registered feature point coordinates, and the input feature points include the input feature point coordinates, and the feature points on the registered image and the input image are respectively obtained to perform positioning calculations to reduce the amount of positioning calculations and to a certain extent ensure that the relationship matrix corresponding to the obtained registered feature points and their corresponding input feature points can locate the position of the registered image in the input image; then, based on the registered feature points and their corresponding input feature points, the relationship matrix from the registered image to the input image is calculated to obtain at least one relationship matrix; the corresponding point pairs between the input image and the registered image are respectively obtained using the relationship matrix, the similarity between the corresponding point pairs is calculated, and the relationship matrix corresponding to the maximum similarity is determined as the optimal relationship matrix; the registered image is detected in the input image according to the optimal relationship matrix, and the at least one relationship matrix is ​​selected for similarity to further eliminate the situation where the registered image is inaccurately positioned in the input image, thereby improving the accuracy and reliability of detecting the registered image in the input image. The above scheme locates the registered image based on the registered feature points and the input feature points, which can realize the positioning of the registered image for small targets and further improve the accuracy and robustness of detecting the registered image in the input image. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 It is a flowchart of an embodiment of a method for detecting a registered image in an input image of the present application;

[0027] Figure 2 is a flowchart of another embodiment of the method for detecting a registered image in an input image of the present application;

[0028] Figure 3 It is a schematic diagram of a framework of an embodiment of a device for detecting a registered image in an input image of the present application;

[0029] Figure 4 It is a schematic diagram of the framework of an embodiment of the electronic device of the present application;

[0030] Figure 5 A schematic diagram of a framework of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0031] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.

[0032] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0033] The terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is only a description of the association relationship of the associated objects. There can be three kinds of relationships. For example, A and / or B can be: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally means that the associated objects before and after are in an "or" relationship. In addition, "more" in this article means two or more than two.

[0034] See also Figure 1 , Figure 1 This is a flow chart of an embodiment of a method for detecting a registered image in an input image of the present application. Specifically, the method may include the following steps:

[0035] Step S11: acquiring at least two registration feature points in the registration image and at least two input feature points in the input image corresponding to the registration feature points; the registration feature points include registration feature point coordinates, and the input feature points include input feature point coordinates.

[0036] In a specific implementation scenario, the registered image may be an image template in the input image, and detecting the registered image in the input image may be finding the position of the image template on the input image.

[0037] The method for detecting the registered image in the input image can be used to search for the registered image of a small target. The size of the registered image of the small target can be a smaller size such as 5cm*5cm, which is not limited here. In other application scenarios, the method for detecting the registered image in the input image of this embodiment can also be used to search for registered images of other non-small targets, which is not limited here. Since the size of the registered image is small, in a specific implementation scenario, the registered image can be first assumed to be a specific shape, such as a rectangle, square or triangle, so as to simplify the method of detecting the registered image in the input image to finding the position of the shape in the input image.

[0038] At least two registered feature points in the registered image and at least two input feature points in the input image corresponding to the registered feature points are obtained, so as to determine the position of the registered image based on the at least two registered feature points and the at least two input feature points corresponding to the registered feature points. In a specific application scenario, 10, 20, and all registered feature points in the registered image can be obtained, and 10, 20, and all input feature points corresponding to the registered feature points in the input image can be obtained, so as to determine the position of the registered image based on the above registered feature points and input feature points. The number of registered feature points and input feature points is not limited here.

[0039] The registered feature points and the input feature points can be obtained by extracting ORB feature points on the registered image and the input image through the ORB (Oriented FAST and Rotated BRIEF) algorithm, or by extracting SIFT feature points on the registered image and the input image through the SIFT (Scale-invariant feature transform) algorithm, and can also be obtained by extracting SURF feature points on the registered image and the input image through the SURF (Speeded Up Robust Features) algorithm. The above feature extraction algorithm can extract the coordinates of the feature points of the image based on the image. In a specific application scenario, the feature extraction algorithm can be one or more of the ORB algorithm, SIFT algorithm, SURF algorithm or other feature extraction algorithms that can extract coordinate parameters, which are not limited here.

[0040] In a specific implementation scenario, at least one registered feature point in the acquired registered image includes the coordinates of the registered feature point, and at least one input feature point corresponding to the registered feature point in the acquired input image includes the coordinates of the input feature point.

[0041] Step S12: Calculate a relationship matrix from the registered image to the input image based on the registered feature points and the input feature points corresponding to the registered feature points to obtain at least one relationship matrix.

[0042] In the previous step, the registered feature points on the registered image and the input feature points on the input image are extracted by the feature extraction algorithm, wherein the registered feature points include the registered feature point coordinates. The input feature points include the input feature point coordinates. The relationship matrix from the registered image to the input image is calculated according to the registered feature point coordinates in the registered feature points and the input feature point coordinates in the input feature points corresponding to the registered feature points, and at least one relationship matrix is ​​obtained.

[0043] In a specific implementation scenario, after obtaining at least two registration feature points and at least two input feature points corresponding to the registration feature points, a relationship matrix is ​​calculated based on the relevant features of the at least two registration feature points and the at least two input feature points corresponding thereto. In a specific implementation scenario, after obtaining 10 registration feature points and 10 input feature points corresponding to each registration feature point, the relationship matrix from the registered image to the input image can be calculated based on the relevant features of every two registration feature points and the input feature points, respectively, to obtain 5 relationship matrices. In a specific implementation scenario, after obtaining 20 registration feature points and 20 input feature points corresponding to each registration feature point, the relationship matrix from the registered image to the input image can be calculated based on the relevant features of each registration feature point and the input feature point, respectively, to obtain 20 relationship matrices. The specific number of registration feature points and input feature points can be set according to the actual application and is not limited here.

[0044] Step S13: using the relationship matrix to obtain corresponding point pairs between the input image and the registered image, calculating the similarity between the corresponding point pairs, and determining the relationship matrix corresponding to the maximum similarity as the optimal relationship matrix.

[0045] After obtaining at least one relationship matrix, the corresponding point pairs between the input image and the registered image are obtained using each relationship matrix, and the similarity between the corresponding point pairs is calculated, and the relationship matrix corresponding to the maximum similarity is determined as the optimal relationship matrix.

[0046] In a specific implementation scenario, after obtaining 10 relationship matrices, corresponding point pairs on the input image and the registered image are found based on the 10 relationship matrices, and the similarity between the corresponding point pairs is calculated, and the relationship matrix corresponding to the input image and the registered image with the greatest similarity is used as the optimal relationship matrix.

[0047] In a specific implementation scenario, the similarity calculation can be performed by using methods such as the SSD error sum of squares algorithm (Sum of Squared Differences) or the NCC normalized cross correlation (Normalized Cross Correlation), which is not limited here.

[0048] Step S14: Detecting the registered image in the input image according to the optimal relationship matrix.

[0049] After the optimal relationship matrix is ​​obtained in the previous step, the position of the registered image is detected in the input image according to the optimal relationship matrix, thereby achieving the purpose of detecting the registered image in the input image.

[0050] Through the above manner, the method for detecting a registered image in an input image of the present embodiment first obtains at least two registered feature points in the registered image and at least two input feature points in the input image corresponding to the registered feature points; the registered feature points include registered feature point coordinates, and the input feature points include input feature point coordinates, and positioning calculations are performed by respectively obtaining feature points on the registered image and the input image to reduce the amount of positioning calculations and to a certain extent ensure that the relationship matrix corresponding to the obtained registered feature points and their corresponding input feature points can locate the position of the registered image in the input image; then, based on the registered feature points and their corresponding input feature points, a relationship matrix from the registered image to the input image is calculated to obtain at least one relationship matrix; corresponding point pairs between the input image and the registered image are obtained using the relationship matrix respectively, the similarity between the corresponding point pairs is calculated, and the relationship matrix corresponding to the maximum similarity is determined as the optimal relationship matrix; the registered image is detected in the input image according to the optimal relationship matrix, and the at least one relationship matrix is ​​selected for similarity to further eliminate the situation where the registered image is inaccurately positioned in the input image, thereby improving the accuracy and reliability of detecting the registered image in the input image. The above scheme locates the registered image based on two pairs of registered feature points and input feature points, which can realize the positioning of the registered image for small targets and further improve the accuracy and robustness of detecting the registered image in the input image.

[0051] See also Figure 2 , Figure 2 This is a flow chart of another embodiment of the method for detecting a registered image in an input image of the present application. Specifically, the method may include the following steps:

[0052] S21: Acquire at least two registration feature points in the registration image and at least two input feature points in the input image, match each registration feature point with each input feature point, and determine the input feature point corresponding to each registration feature point.

[0053] The registered image T is assumed to be a directed rectangle, and at least two registered feature points in the registered image T and at least two input feature points in the input image F are obtained, wherein the registered feature points include registered feature point coordinates, and the input feature points include input feature point coordinates. The registered feature points may be ORB feature points, SIFT feature points, SURF feature points, etc. in the registered image, and the input feature points may be ORB feature points, SIFT feature points, SURF feature points, etc. in the input image.

[0054] In a specific implementation scenario, the extraction of registered feature points and input feature points can be performed using one or more feature extraction algorithms such as the ORB (Oriented FAST and Rotated BRIEF) algorithm, the Scale-invariant feature transform (SIFT) algorithm, and the SURF (Speeded Up Robust Features) algorithm, without limitation here.

[0055] In a specific application scenario, after extracting at least two registered feature points in the registered image T and at least two input feature points on the input image through a feature extraction algorithm, each registered feature point can be matched with each input feature point to determine the input feature point corresponding to each registered feature point. In a specific application scenario, the matching method of the registered feature points and the input feature points can be performed by performing a one-to-one brute force matching descriptor on all the registered feature points and all the input feature points, thereby determining the input feature point corresponding to each registered feature point.

[0056] In another specific application scenario, at least two registered feature points and corresponding descriptors in the registered image and at least two input feature points and corresponding descriptors in the input image can also be obtained respectively, and the descriptor of each registered feature point is compared with the descriptor of each input feature point to obtain the difference between the descriptor of each registered feature point and the descriptor of each input feature point, and the input feature points whose difference with a certain registered feature point is less than the difference threshold are determined as the input feature points corresponding to the registered feature points, thereby obtaining the registered feature points and input feature points with corresponding relationships, and all the registered feature points corresponding to the input feature points are determined in turn by the above method. The specific value of the difference threshold can be set according to the actual situation and is not limited here.

[0057] When matching the feature descriptors of the registered feature points and the input feature points, multiple pairs of feature points with a difference less than a difference threshold may be obtained, and the registered feature points and the input feature points corresponding to every two pairs of feature points are taken as a group of point pairs for subsequent calculations.

[0058] In a specific application scenario, after brute-force matching descriptors for all registered feature points and all input feature points, multiple pairs of feature points with a difference less than a difference threshold are obtained, and all the point pairs are collected so that the subsequent calculation process is based on every two pairs of point pairs with a difference less than the difference threshold. Among them, the calculation efficiency of detecting the registered image in the input image can be improved by calculating every two pairs of point pairs with a difference less than the difference threshold.

[0059] In a specific application scenario, after assuming the registered image T as a directed rectangle, a rectangular representation (x m ,y m ,θ1,s1) represents the directed rectangle of the registered image T. m ,y m ) are the coordinates of the corresponding point of the center point of the registered image T, θ1 is the direction angle, which is the direction angle between the horizontal line of the directed rectangle and the x-axis on the rectangular coordinate axis; s1 is the scale of the rectangle, which can be the length or width of the rectangle, and is not limited here.

[0060] In a specific implementation scenario, when locating the position of the registered image T in the input image F, the directed rectangle representation (x m ,y m ,θ,s) represents the registered image T and the input image F. The two registered feature points in the registered image T obtained include the coordinates of the first registered feature point (P T x,0 , P T y,0 ) and the second registered feature point coordinates (P T x,1 , P T y,1 ) and obtain two input feature points in the input image T, including the coordinates of the first input feature point (P F x,0 , P F y,0 ) and the second input feature point coordinates (P F x,1 , P F y,1 ). Among them, the coordinates of the first registered feature point (P T x,0 , P T y,0 ) and the second registered feature point coordinates (P T x,1 , P T y,1 ) are the coordinates of the two registered feature points, the first input feature point coordinates (P F x,0 , P F y,0 ) and the second input feature point coordinates (P F x,1 , P F y,1 ) are the coordinates of the two input feature points.

[0061] S22: Based on every two registered feature points and the two input feature points corresponding to the two registered feature points, a coordinate relationship matrix, a scale relationship matrix and a direction relationship matrix are calculated, and according to the coordinate relationship matrix, the scale relationship matrix and the direction relationship matrix, a relationship matrix from the registered image to the input image is calculated.

[0062] Enumerate every two registered feature points and every two input feature points in the set obtained in the previous step, so as to use the two registered feature points and the two input feature points as point pairs for subsequent calculation. In a specific application scenario, after obtaining n pairs of registered feature points and input feature points whose difference is less than the difference threshold in the previous step, calculate the relationship matrix from the registered image T to the input image F according to the one-to-one correspondence between each two point pairs and the coordinates they contain, and obtain n / 2 relationship matrices.

[0063] The relationship matrix of this step includes a coordinate relationship matrix, a direction relationship matrix and a scale relationship matrix; and the coordinate relationship matrix is ​​related to the registered feature point coordinates and the input feature point coordinates. Specifically, the coordinate relationship matrix includes a first coordinate relationship matrix and a second coordinate relationship matrix, wherein the first coordinate relationship matrix is ​​related to the two registered feature point coordinates, the second coordinate relationship matrix is ​​related to the two input feature point coordinates, the direction relationship matrix is ​​related to the vector formed by the two registered feature points and the vector formed by the two input feature points, and the scale relationship matrix is ​​related to the length of the line connecting the two registered feature points and the length of the line connecting the two input feature points. The following will take the acquisition of a single relationship matrix as an example for explanation.

[0064] In a specific implementation scenario, the relationship matrix can be represented by a homography matrix, wherein a homography transformation is a transformation matrix used to describe the position mapping relationship between objects in various coordinate systems, and the transformation matrix corresponding to the homography transformation is called a homography matrix. In this embodiment, the process of detecting the position of the registered image T in the input image F will be described by taking the relationship matrix as the homography matrix H as an example. It can be understood that in other embodiments, the relationship matrix can be other transformation matrices used to describe the position mapping relationship between objects in various coordinate systems, which is not limited here.

[0065] The following will take the acquisition of a single relationship matrix, that is, the homography matrix H, as an example for explanation.

[0066] First obtain the coordinates of the first registered feature point of the two registered feature points (P T x,0 , P T y,0 ) and the second registered feature point coordinates (P T x,1 , P T y,1), and the first input feature point coordinates (P F x,0 , P F y,0 ) and the second input feature point coordinates (P F x,1 , P F y,1 ). The first registered feature point corresponds to the first input feature point, and the second registered feature point corresponds to the second input feature point, forming two groups of corresponding points.

[0067] Calculate the first coordinate homography matrix H according to the midpoint coordinates of the two registered feature points and the midpoint coordinates of the two input feature points r and the second coordinate homography matrix H l , where the first coordinate homography matrix H r and the second coordinate homography matrix H l The calculation formula is as follows:

[0068]

[0069]

[0070] The midpoint coordinates of the two registered feature points are obtained by connecting the first registered feature point and the second registered feature point, and the midpoint coordinates of the two input feature points are obtained by connecting the first input feature point and the second input feature point. Based on the midpoint coordinates, the first coordinate homography matrix H is calculated. r and the second coordinate homography matrix H l Perform calculations.

[0071] Since two registered feature points are connected to two input feature points respectively, a vector formed by the two registered feature points and a vector formed by the two input feature points are obtained, and the rotation angle between the directed rectangle and the input image F is obtained based on the angle between the two vectors. The specific formula is as follows:

[0072]

[0073] Since cosine can only represent angles from 0 to (-π), the directional homography matrix H R In the calculation of , the sine formula needs to be used to verify the positive and negative shape of the sign, so that the directional homography matrix H R The range of angles that can be represented is expanded to (-π) to π.

[0074] Directional homography matrix H R The calculation formula is as follows:

[0075]

[0076] By connecting the midpoints of the two sets of corresponding points, the length S between the corresponding points is calculated. The specific formula is as follows:

[0077]

[0078] Among them, the scale homography matrix H s The calculation formula is as follows:

[0079]

[0080] Then the calculation formula for calculating the homography matrix H in this step is:

[0081] H=H l H s H R H r (7)

[0082] Specifically:

[0083]

[0084] Through the above formula, the homography matrix H from the registered image T to the input image F can be calculated based on every two point pairs. By detecting and determining the coordinate positions of the registered image T and the input image F, the angle difference between the registered image T and the input image F, and the scale of the registered image T in the input image F, the position of the registered image T in the input image F is determined through the above parameters. Among them, the homography matrix H can be represented by a homography matrix.

[0085] When there are at least two point pairs whose corresponding homography matrices need to be calculated, the corresponding homography matrix H is also obtained by the calculation formula (1-8) above.

[0086] S23: using the relationship matrix to obtain corresponding point pairs between the input image and the registered image, calculating the similarity between the corresponding point pairs, and determining the relationship matrix corresponding to the maximum similarity as the optimal relationship matrix.

[0087] Among them, the method of calculating the similarity is to score the homography matrix H. In a specific application scenario, it can be obtained by SSD error square sum algorithm (Sum of Squared Differences), NCC normalized cross correlation (Normalized Cross Correlation), etc., and the homography matrix H corresponding to the maximum similarity is determined as the optimal homography matrix.

[0088] In a specific application scenario, after obtaining at least one homography matrix H, a single homography matrix H is used to obtain corresponding point pairs between the input image and the registered image, that is, a single registered feature point (x, y) and a corresponding single input feature point (x', y'), and further obtain the pixel intensity value T(x, y) of the single registered feature point (x, y) on the registered image T, and the pixel intensity value F(x', y') of the corresponding single input feature point (x', y') on the input image F. The homography matrix H is scored by the following calculation formula corresponding to the SSD error square sum algorithm.

[0089] SSD(T,F)=∑ x,y (T(x,y)-F(x′,y′)) 2 (8)

[0090] Where (x′, y′) is the corresponding point of a single registered feature point (x, y) on the registered image T on the input image F. The smaller the SSD value, the greater the similarity.

[0091] In a specific application scenario, after obtaining the homography matrix H, obtain the average pixel intensity value T of a single registered feature point (x, y) corresponding to the homography matrix H on the registered image T, and the average pixel intensity value F of a corresponding single input feature point (x', y') on the input image F. The homography matrix H is scored using the calculation formula corresponding to the following NCC normalized cross-correlation algorithm.

[0092]

[0093] The value range of NCC is [-1, 1]. The closer the score of the NCC function is to 1, the greater the similarity between the registered image T corresponding to the homography matrix H and the input image F.

[0094] According to the scoring method adopted, the homography matrix H corresponding to the maximum similarity is determined as the optimal homography matrix H best .

[0095] S24: If the similarity is less than the threshold, it is determined that there is no registered image in the input image; if the similarity is greater than or equal to the threshold, the position of the registered image in the input image is determined according to the optimal relationship matrix.

[0096] Determine whether the maximum similarity among the similarities corresponding to the homography matrices calculated in the previous step is less than the threshold. If the maximum similarity is less than the threshold, it is determined that there is no registered image T in the input image F; if the maximum similarity is greater than or equal to the threshold, then the optimal homography matrix H corresponding to the maximum similarity is used. bestDetermine the position of the registered image T in the input image F. The threshold is used to ensure the optimal homography matrix H best The reliability can be set according to the actual application and is not limited here.

[0097] The homography matrix H finally obtained in this embodiment best , that is, the relationship matrix can accurately determine the position of the registered image T in the input image F.

[0098] Through the above manner, the method for detecting a registered image in an input image of the present embodiment obtains at least two registered feature points in the registered image and at least two input feature points in the input image, matches each registered feature point with each input feature point, determines the input feature point corresponding to each registered feature point, thereby obtaining a plurality of point pairs whose difference satisfies the threshold, and calculates the relationship matrix between the registered image and the input image according to each two point pairs, obtains at least one relationship matrix, thereby increasing the relationship matrix between the registered image and the input image, so as to ensure to a certain extent that the relationship matrix corresponding to the acquired point pair can locate the position of the registered image in the input image. After obtaining at least one update matrix, the present embodiment calculates the similarity according to the error square sum algorithm or the normalized mutual correlation, and determines the relationship matrix corresponding to the maximum similarity as the optimal relationship matrix. Finally, it is determined whether the maximum similarity corresponding to the optimal relationship matrix is ​​less than the threshold. If the maximum similarity is less than the threshold, it is determined that there is no registered image in the input image. If the maximum similarity is greater than or equal to the threshold, the position of the registered image in the input image is determined according to the optimal relationship matrix. The above scheme ensures the accuracy and reliability of the optimal relationship matrix finally obtained through at least two pairs of registered feature points and input feature points and similarity judgment, thereby realizing the positioning of the registered image for small targets and improving the accuracy and robustness of detecting the registered image in the input image.

[0099] See also Figure 3 , Figure 3It is a schematic diagram of the framework of an embodiment of the device for detecting a registered image in an input image of the present application. The device 30 for detecting a registered image in an input image includes an acquisition module 31, a processing module 32, a calculation module 33 and a determination module 34. The acquisition module 31 is used to acquire at least two registered feature points in the registered image and at least two input feature points in the input image corresponding to the registered feature points; the registered feature points include registered feature point coordinates, and the input feature points include input feature point coordinates; the processing module 32 is used to calculate the relationship matrix from the registered image to the input image according to every two registered feature points and the two input feature points corresponding to the two registered feature points, and obtain at least one relationship matrix; the calculation module 33 is used to respectively use the relationship matrix to obtain the corresponding point pairs between the input image and the registered image, calculate the similarity between the corresponding point pairs, and determine the relationship matrix corresponding to the maximum similarity as the optimal relationship matrix; the determination module 34 is used to detect the registered image in the input image according to the optimal relationship matrix.

[0100] The above scheme first obtains at least two registered feature points in the registered image and at least two input feature points corresponding to the registered feature points in the input image; the registered feature points include the registered feature point coordinates, and the input feature points include the input feature point coordinates, and the feature points on the registered image and the input image are respectively obtained to perform positioning calculations to reduce the amount of positioning calculations and to a certain extent ensure that the relationship matrix corresponding to the obtained registered feature points and the corresponding input feature points can locate the position of the registered image in the input image; then the registered feature points and the input feature points corresponding to the registered feature points are used to calculate the relationship matrix from the registered image to the input image to obtain at least one relationship matrix; the corresponding point pairs between the input image and the registered image are respectively obtained using the relationship matrix, the similarity between the corresponding point pairs is calculated, and the relationship matrix corresponding to the maximum similarity is determined as the optimal relationship matrix; the registered image is detected in the input image according to the optimal relationship matrix, and the situation where the registered image is not accurately positioned in the input image is further eliminated by selecting the similarity of at least one relationship matrix, thereby improving the accuracy and reliability of detecting the registered image in the input image. The above scheme can realize the positioning of the registered image for small targets and improve the accuracy and robustness of detecting the registered image in the input image.

[0101] In some embodiments, the acquisition module 31 acquires at least two registration feature points in the registration image and at least two input feature points in the input image corresponding to the registration feature points, including: acquiring at least two registration feature points in the registration image and at least two input feature points in the input image; matching each registration feature point with each input feature point to determine the input feature point corresponding to each registration feature point.

[0102] Different from the aforementioned embodiment, at least two acquired registration feature points are matched with at least two input feature points to establish a correspondence between each registration feature point and each input feature point, thereby positioning the registration image based on the correspondence between every two point pairs.

[0103] In some embodiments, the acquisition module 31 acquires the registration feature points in the registration image and the input feature points in the input image corresponding to the registration feature points, including: respectively acquiring at least two registration feature points and corresponding descriptors in the registration image and at least two input feature points and corresponding descriptors in the input image; comparing the descriptor of each registration feature point with the descriptor of each input feature point to obtain the difference between the descriptor of each registration feature point and the descriptor of each input feature point; respectively determining the input feature points whose difference with the registration feature points is less than the difference threshold as the input feature points corresponding to the registration feature points.

[0104] Different from the aforementioned embodiment, the acquisition module 31 compares the descriptor of each registered feature point with the descriptor of each input feature point, obtains the difference between the descriptor of each registered feature point and the descriptor of each input feature point, and determines the input feature point whose difference with the registered feature point is less than the difference threshold as the input feature point corresponding to the registered feature point, thereby determining the correspondence between the registered feature point and the input feature point using the difference.

[0105] In some embodiments, the relationship matrix of the processing module 32 includes a coordinate relationship matrix, a direction relationship matrix and a scale relationship matrix; based on the registered feature points and the input feature points corresponding to the registered feature points, the relationship matrix from the registered image to the input image is calculated, including: based on every two registered feature points and the two input feature points corresponding to the two registered feature points, the coordinate relationship matrix, the scale relationship matrix and the direction relationship matrix are calculated; based on the coordinate relationship matrix, the scale relationship matrix and the direction relationship matrix, the relationship matrix from the registered image to the input image is calculated.

[0106] Different from the aforementioned embodiment, a coordinate relationship matrix, a scale relationship matrix and a direction relationship matrix are obtained based on two registered feature points and two input feature points, and then the relationship matrix from the registered image to the input image is calculated, so that the relationship matrix is ​​calculated using only two pairs of feature points to improve the efficiency and speed of detecting the registered image in the input image.

[0107] In some embodiments, the steps of calculating a coordinate relationship matrix, a scale relationship matrix, and a direction relationship matrix based on two registered feature points and the input feature points corresponding to the two registered feature points include: calculating the coordinate relationship matrix according to the midpoint coordinates of the two registered feature points and the midpoint coordinates of the two input feature points; calculating the scale relationship matrix according to the length of the line connecting the two registered feature points and the length of the line connecting the two input feature points; calculating the direction relationship matrix according to the vector formed by the two registered feature points and the vector formed by the two input feature points.

[0108] Different from the aforementioned embodiment, a coordinate relationship matrix is ​​calculated according to the midpoint coordinates of two registered feature points and the midpoint coordinates of two input feature points, a scale relationship matrix is ​​calculated according to the line length of the two registered feature points and the line length of the two input feature points, and a direction relationship matrix is ​​calculated according to the vector formed by the two registered feature points and the vector formed by the two input feature points. Thus, the positioning of the registered image on the input image is realized based on the relationship matrix of the registered feature points of two point pairs and the input feature points, and the accuracy and reliability of the positioning process are guaranteed to a certain extent.

[0109] In some embodiments, the method also includes: calculating the midpoint coordinates, line length and vector of the two registered feature points based on the registered feature point coordinates of the two registered feature points; calculating the midpoint coordinates, line length and vector of the two input feature points based on the input feature point coordinates of the two input feature points.

[0110] Different from the previous embodiment, the midpoint coordinates, line length and vector of the two registered feature points are calculated according to the registered feature point coordinates of the two registered feature points: the midpoint coordinates, line length and vector of the two input feature points are calculated according to the input feature point coordinates of the two input feature points, so as to calculate the relationship matrix based on the above parameters.

[0111] In some embodiments, detecting a registered image in an input image according to an optimal relationship matrix includes: if the similarity is less than a threshold, determining that there is no registered image in the input image; if the similarity is greater than or equal to the threshold, determining the position of the registered image in the input image according to the optimal relationship matrix.

[0112] In some embodiments, the relationship matrix is ​​used to obtain corresponding point pairs between the input image and the registered image, the similarity between the corresponding point pairs is calculated, and the relationship matrix corresponding to the maximum similarity is determined as the optimal relationship matrix, including: calculating the similarity between the corresponding point pairs according to the error square sum algorithm or the normalized cross-correlation.

[0113] Different from the above-mentioned embodiment, the processing module 33 calculates the similarity according to the error square sum algorithm or the normalized cross-correlation to improve the accuracy and reliability of the registration image positioning.

[0114] Different from the above-mentioned embodiment, the determination module 34 further judges the optimal relationship matrix by similarity, so that the optimal relationship matrix truly reflects the position of the registered image, thereby ensuring the reliability and accuracy of the optimal relationship matrix.

[0115] See also Figure 4 , Figure 4 4 is a schematic diagram of a framework of an embodiment of an electronic device of the present application. The electronic device 40 includes a memory 41 and a processor 42 coupled to each other, and the processor 42 is used to execute program instructions stored in the memory 41 to implement the steps of any of the above-mentioned method embodiments for detecting a registered image in an input image. In a specific implementation scenario, the electronic device 40 may include, but is not limited to: a microcomputer, a server, and in addition, the electronic device 40 may also include a mobile device such as a laptop computer and a tablet computer, which is not limited here.

[0116] Specifically, the processor 42 is used to control itself and the memory 41 to implement the steps of any of the above-mentioned method embodiments for detecting a registered image in an input image. The processor 42 may also be referred to as a CPU (Central Processing Unit). The processor 42 may be an integrated circuit chip having signal processing capabilities. The processor 42 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. In addition, the processor 42 may be implemented by an integrated circuit chip.

[0117] The above solution can improve the efficiency and accuracy of detecting the registered image in the input image.

[0118] See also Figure 5 , Figure 5 The computer-readable storage medium 50 stores program instructions 501 that can be executed by a processor, and the program instructions 501 are used to implement the steps of any of the above-mentioned method embodiments for detecting a registered image in an input image.

[0119] The above solution can improve the efficiency and accuracy of detecting the registered image in the input image.

[0120] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0121] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0122] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0123] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

Claims

1. A method for detecting a registered image in an input image, characterized in that: include: Acquire at least two registration feature points in the registration image, and at least two input feature points in the input image corresponding to the registration feature points; The registered feature point includes the registered feature point coordinates, and the input feature point includes the input feature point coordinates; Calculating a relationship matrix from the registered image to the input image according to the registered feature points and the input feature points corresponding to the registered feature points to obtain at least one relationship matrix; Using the relationship matrix to obtain corresponding point pairs between the input image and the registered image, respectively, calculating the similarity between the corresponding point pairs, and determining the relationship matrix corresponding to the maximum similarity as the optimal relationship matrix; Detecting the registered image in the input image according to the optimal relationship matrix; The relationship matrix includes a coordinate relationship matrix, a direction relationship matrix and a scale relationship matrix; and the calculation of the relationship matrix from the registered image to the input image according to the registered feature points and the input feature points corresponding to the registered feature points includes: The coordinate relationship matrix is ​​calculated according to the midpoint coordinates of the two registered feature points and the midpoint coordinates of the two input feature points; the scale relationship matrix is ​​calculated according to the length of the line connecting the two registered feature points and the length of the line connecting the two input feature points; the direction relationship matrix is ​​calculated according to the vector formed by the two registered feature points and the vector formed by the two input feature points; and the relationship matrix from the registered image to the input image is calculated according to the coordinate relationship matrix, the scale relationship matrix and the direction relationship matrix.

2. The method for detecting a registered image in an input image according to claim 1, characterized in that: The acquiring of the registration feature points in the registration image and the input feature points in the input image corresponding to the registration feature points includes: Acquire at least two registration feature points in the registration image and at least two input feature points in the input image; Each of the registered feature points is matched with each of the input feature points to determine the input feature point corresponding to each of the registered feature points.

3. The method for detecting a registered image in an input image according to claim 1, characterized in that: The acquiring of the registration feature points in the registration image and the input feature points in the input image corresponding to the registration feature points includes: Respectively acquiring at least two registration feature points and corresponding descriptors in the registration image and at least two input feature points and corresponding descriptors in the input image; Compare the descriptor of each registered feature point with the descriptor of each input feature point to obtain the difference between the descriptor of each registered feature point and the descriptor of each input feature point; Input feature points whose difference from the registered feature points is less than a difference threshold are respectively determined as input feature points corresponding to the registered feature points.

4. The method for detecting a registered image in an input image according to claim 1, characterized in that: The method further comprises: Calculate the midpoint coordinates, line length and vector of the two registered feature points based on their registered feature point coordinates: The midpoint coordinates, connecting line length and vector of two input feature points are calculated based on the input feature point coordinates of the two input feature points.

5. The method for detecting a registered image in an input image according to claim 1, characterized in that: The step of respectively using the relationship matrix to obtain corresponding point pairs between the input image and the registered image, calculating the similarity between the corresponding point pairs, and determining the relationship matrix corresponding to the maximum similarity as the optimal relationship matrix includes: The similarity between the corresponding point pairs is calculated according to a square error sum algorithm or a normalized cross-correlation.

6. The method for detecting a registered image in an input image according to claim 1, characterized in that: The detecting the registered image in the input image according to the optimal relationship matrix comprises: If the similarity is less than a threshold, determining that the registered image does not exist in the input image; If the similarity is greater than or equal to a threshold, the position of the registered image in the input image is determined according to the optimal relationship matrix.

7. A device for detecting a registered image in an input image, characterized in that include: An acquisition module, used to acquire at least two registration feature points in the registration image and at least two input feature points in the input image corresponding to the registration feature points; The registered feature point includes the registered feature point coordinates, and the input feature point includes the input feature point coordinates; A processing module, configured to calculate a relationship matrix from the registered image to the input image according to the registered feature points and the input feature points corresponding to the registered feature points, and obtain at least one relationship matrix; specifically, to calculate the coordinate relationship matrix according to the midpoint coordinates of two registered feature points and the midpoint coordinates of two input feature points; and to calculate the scale relationship matrix according to the length of a line connecting the two registered feature points and the length of a line connecting the two input feature points; Calculating the direction relationship matrix according to the vector formed by the two registered feature points and the vector formed by the two input feature points; Calculating a relationship matrix from the registered image to the input image according to the coordinate relationship matrix, the scale relationship matrix, and the direction relationship matrix; A calculation module, used to respectively obtain corresponding point pairs between the input image and the registered image using the relationship matrix, calculate the similarity between the corresponding point pairs, and determine the relationship matrix corresponding to the maximum similarity as the optimal relationship matrix; A determination module is used to detect the registered image in the input image according to the optimal relationship matrix.

8. An electronic device, characterized in that: The invention comprises a memory and a processor coupled to each other, wherein the processor is used to execute program instructions stored in the memory to implement the method for detecting a registered image in an input image as claimed in any one of claims 1 to 6.

9. A computer-readable storage medium having program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the method for detecting a registered image in an input image according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Face recognition method and device, computer device and storage medium

    CN108764031A

  • Image matching method and device, electronic equipment and readable storage medium

    CN110288034A

  • Feature matching algorithm based on ordered sampling

    CN111104922A

  • Augmented reality three-dimensional registration method and device

    CN112053447A

  • Space positioning method and three-dimensional reconstruction method applying space positioning method

    CN112085794A