Image matching method and device based on edge information

Through the image matching method based on edge information, edge gradient information is extracted using pyramid hierarchy and rotation step size, the image matching accuracy and speed problems in the prior art are solved, and high-precision matching positioning in complex scenarios is achieved.

CN114119952BActive Publication Date: 2024-11-05HEBEI HANGUANG HEAVY IND
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111190561.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-13
Publication Date
2024-11-05
Estimated Expiration
2041-10-13

AI Technical Summary

Technical Problem

When facing factors such as lighting, noise, and occlusion, the matching accuracy is not high, the speed is not fast, and the stability is poor. Especially when the target image to be tested is different in size and angle, the matching result is inaccurate.

Method used

Using an image matching method based on edge information, the edge gradient information of the template image and the target image to be measured is extracted through pyramid layering and rotation step setting, and the similarity is calculated. The number of pyramid layers and rotation step length are used to reduce the calculation amount and improve the matching. Speed ​​and robustness, and determine the matching angle through polynomial fit to improve matching accuracy.

Benefits of technology

Fast, stable and high-precision image matching positioning in complex scenarios such as scaling, rotation, occlusion, and lighting changes, improving the accuracy and stability of matching and reducing the computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114119952B_ABST
    Figure CN114119952B_ABST
Patent Text Reader

Abstract

The present invention provides an image matching method based on edge information, the method comprising pyramid stratification of a template image and a target image to be measured; setting the rotation step of each layer of the template image; rotating the template image under each pyramid layer; obtaining edge gradient information of each image in a rotation image set; obtaining edge gradient information of each pyramid layer image in the target image to be measured; setting a search range of the current pyramid layer based on the result with the greatest similarity in the matching information of the previous layer of the current pyramid layer; matching based on the search range of the current pyramid layer to obtain matching information of the current pyramid layer; the current pyramid layer is the bottommost pyramid layer, and the matching information of the current pyramid layer is recorded as the final matching position of the target. The method can realize fast, stable and high-precision matching positioning in the case of scaling, rotation, occlusion, uneven illumination, cluttered background and the like of the target image to be measured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and in particular to an image matching method and device based on edge information. Background Art

[0002] Image matching is the process of finding image regions similar to the template image in a target image. Existing image matching algorithms can be roughly divided into the following categories: grayscale-based matching algorithms, feature-based matching algorithms, transform domain-based matching algorithms, and model-based matching algorithms.

[0003] Among them, the grayscale-based matching algorithm achieves matching by calculating the grayscale value similarity between the template image and the target image to be measured. This matching algorithm can achieve relatively satisfactory results under good lighting conditions, but it is sensitive to noise. When external conditions change or the target image is damaged or blocked, the matching accuracy will be greatly affected. The feature-based matching algorithm first extracts the features of the template image, and then matches the template image and the target image to be measured by the similarity of the features. The features extracted by this matching algorithm include point features, edge features, and regional features. The matching algorithm based on the transform domain refers to matching images in the frequency domain. The frequency domain transforms mainly include Fourier transform and wavelet transform. The progress of this matching algorithm is relatively slow. The model-based matching algorithm first establishes a motion model, then estimates the target transformation parameters, and finally obtains the matching position through Kalman filtering. In this type of matching algorithm, accurately establishing a motion model is the key to the correct matching results, but the calculation analysis and model update are relatively complex and the real-time performance is poor.

[0004] In actual scenarios, feature-based matching algorithms are widely used. However, the objects in the target image to be measured and the objects in the template image may be of different sizes and angles, resulting in the target image and the template image not being able to completely match each other. In addition, the target image to be measured is easily affected by lighting, occlusion, noise, etc., and the image matching results are often inaccurate, slow, and unstable. Summary of the invention

[0005] In order to solve the above technical problems, the present invention proposes an image matching method and device based on edge information, which are used to solve the technical problems of low accuracy, low speed and poor stability of image matching results in the prior art.

[0006] According to a first aspect of the present invention, there is provided an image matching method based on edge information, the method comprising the following steps:

[0007] Step S101: setting the number of pyramid layers, and performing pyramid stratification on the template image and the target image to be measured respectively;

[0008] Step S102: setting the rotation step of each layer of the template image; rotating the template image under each pyramid layer according to the rotation step within a circumference, and obtaining a rotated image each time the rotation is performed; obtaining a set of rotated images M of each pyramid layer in ; Where i represents the pyramid layer, and n represents the number of rotated images in the i-th layer;

[0009] Step S103: Obtain the rotated image set M in The edge gradient information of each image in;

[0010] Step S104: obtaining edge gradient information of each pyramid layer image in the target image to be measured;

[0011] Step S105: taking the topmost pyramid layer of the target image to be measured as the current pyramid layer, searching for a template image in the current pyramid layer, calculating the similarity between the template image and the target image to be measured, and obtaining first matching information;

[0012] Step S106: If the current pyramid layer is the bottommost pyramid layer, the matching information of the current pyramid layer is recorded as the final matching position of the target (u final ,v final ,θ final ), the method ends; otherwise, the next layer of the current pyramid layer is set as the current pyramid layer; where u final ,v final ,θ final are respectively the x-coordinate of the final matching position, the y-coordinate of the final matching position, and the rotation angle value of the template image corresponding to the final matching position;

[0013] Step S107: Based on the matching information of the previous layer of the current pyramid layer, the result with the greatest similarity (u i+1 ,v i +1 ,θ i+1 ), set the search range of the current pyramid layer (u i+1 ±Δu,v i+1 ±Δv,θ i+1 ±AngleStep i+1 ); where (u i+1 ,v i+1 ) is the coordinate information of the matching point with the greatest similarity in the previous layer of the current pyramid layer, θ i+1 is the angle information of the previous layer of the current pyramid layer, Δu and Δv are the coordinate differences set according to the image size, AngleStep i+1 is the rotation step length of the previous layer of the current pyramid layer; matching is performed based on the search range of the current pyramid layer to obtain matching information of the current pyramid layer; and step S106 is entered.

[0014] According to a second aspect of the present invention, there is provided an image matching device based on edge information, the device comprising:

[0015] Initialization module: configured to set the number of pyramid layers, and perform pyramid stratification on the template image and the target image to be tested respectively;

[0016] Rotation module: configured to set the rotation step of each layer of the template image; within a circumference, according to the rotation step, the template image under each pyramid layer is rotated, and a rotated image is obtained each time it is rotated; and a rotation image set M of each pyramid layer is obtained. in ; Where i represents the pyramid layer, and n represents the number of rotated images in the i-th layer;

[0017] Edge gradient acquisition module: configured to acquire the rotation image set M in The edge gradient information of each image in;

[0018] The target edge gradient acquisition module is configured to acquire edge gradient information of each pyramid layer image in the target image;

[0019] A first matching module: configured to use the topmost pyramid layer of the target image to be measured as the current pyramid layer, search for a template image in the current pyramid layer, calculate the similarity between the template image and the target image to be measured, and obtain first matching information;

[0020] Judgment module: If the current pyramid layer is the bottom pyramid layer, the matching information of the current pyramid layer is recorded as the final matching position of the target (u final ,v final ,θ final ), the method ends; otherwise, the next layer of the current pyramid layer is set as the current pyramid layer; where u final ,v final ,θ final are respectively the x-coordinate of the final matching position, the y-coordinate of the final matching position, and the rotation angle value of the template image corresponding to the final matching position;

[0021] Similarity calculation module: configured to be based on the result with the greatest similarity among the matching information of the previous layer of the current pyramid layer (u i+1 ,v i+1 ,θ i+1 ), set the search range of the current pyramid layer (u i+1 ±Δu,v i+1 ±Δv,θ i+1 ±AngleStep i+1 ); where (u i+1 ,v i+1) is the coordinate information of the matching point with the greatest similarity in the previous layer of the current pyramid layer, θ i+1 is the angle information of the previous layer of the current pyramid layer, Δu and Δv are the coordinate differences set according to the image size, AngleStep i+1 is the rotation step length of the previous layer of the current pyramid layer; matching is performed based on the search range of the current pyramid layer to obtain the matching information of the current pyramid layer; and the judgment module is triggered.

[0022] According to a third aspect of the present invention, there is provided an image matching system based on edge information, comprising:

[0023] A processor, which is used to execute multiple instructions;

[0024] A memory for storing a plurality of instructions;

[0025] The plurality of instructions are used to be stored in the memory, and loaded and executed by the processor to implement the image matching method based on edge information as described above.

[0026] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein a plurality of instructions are stored in the storage medium; the plurality of instructions are used for a processor to load and execute the image matching method based on edge information as described above.

[0027] According to the above scheme of the present invention, the template image is described by using edge gradient features, which can reduce the amount of calculation during image matching, reduce the matching time, and has strong robustness in terms of noise resistance, occlusion, etc. The present invention automatically calculates the number of image pyramid layers according to the image size and the number of feature points, and sets different angle rotation steps in different feature layers of the template image pyramid, which can solve the calculation complexity problem caused by angle-by-angle enumeration in the existing matching method, and can cope with various complex scenes more quickly and stably. The method sets the coefficient b in the termination condition calculation of the similarity measurement, which can meet the requirements of the matching score of each layer of the image pyramid, thereby improving the accuracy and stability of the matching. When determining the matching angle, the method records the sub-angle value as the final matching angle through polynomial fitting, which further improves the accuracy of the matching. It can achieve fast, stable and high-precision matching positioning when the target image to be measured is scaled, rotated, occluded, unevenly illuminated, and has a cluttered background.

[0028] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention and implement it according to the contents of the specification, the following is a detailed description of the preferred embodiments of the present invention in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention, and the present invention is described by providing the following accompanying drawings. In the accompanying drawings:

[0030] Figure 1 A schematic diagram of a flow chart of an image matching method based on edge information according to an embodiment of the present invention;

[0031] Figure 2 A schematic diagram of image matching based on edge information according to an embodiment of the present invention;

[0032] Figure 3 The figure is a schematic diagram of the structure of an image matching device based on edge information according to an embodiment of the present invention. DETAILED DESCRIPTION

[0033] First combine Figure 1 An image matching method based on edge information according to an embodiment of the present invention is described. Figure 1-2 As shown, the image matching method based on edge information includes:

[0034] Step S101: setting the number of pyramid layers, and performing pyramid stratification on the template image and the target image to be measured respectively;

[0035] Step S102: setting the rotation step of each layer of the template image; rotating the template image under each pyramid layer according to the rotation step within a circumference, and obtaining a rotated image each time the rotation is performed; obtaining a set of rotated images M of each pyramid layer in ; Where i represents the pyramid layer, and n represents the number of rotated images in the i-th layer;

[0036] Step S103: Obtain the rotated image set M in The edge gradient information of each image in;

[0037] Step S104: obtaining edge gradient information of each pyramid layer image in the target image to be measured;

[0038] Step S105: taking the topmost pyramid layer of the target image to be measured as the current pyramid layer, searching for a template image in the current pyramid layer, calculating the similarity between the template image and the target image to be measured, and obtaining first matching information;

[0039] Step S106: If the current pyramid layer is the bottommost pyramid layer, the matching information of the current pyramid layer is recorded as the final matching position of the target (u final ,v final ,θ final ), the method ends; otherwise, the next layer of the current pyramid layer is set as the current pyramid layer; where u final ,v final,θ final are respectively the x-coordinate of the final matching position, the y-coordinate of the final matching position, and the rotation angle value of the template image corresponding to the final matching position;

[0040] Step S107: Based on the matching information of the previous layer of the current pyramid layer, the result with the greatest similarity (u i+1 ,v i +1 ,θ i+1 ), set the search range of the current pyramid layer (u i+1 ±Δu,v i+1 ±Δv,θ i+1 ±AngleStep i+1 ); where (u i+1 ,v i+1 ) is the coordinate information of the matching point with the greatest similarity in the previous layer of the current pyramid layer, θ i+1 is the angle information of the previous layer of the current pyramid layer, Δu and Δv are the coordinate differences set according to the image size, AngleStep i+1 is the rotation step length of the previous layer of the current pyramid layer; matching is performed based on the search range of the current pyramid layer to obtain matching information of the current pyramid layer; and step S106 is entered.

[0041] The step S101: performing pyramid stratification on the template image and the target image to be measured respectively to obtain the required number of pyramid layers, including:

[0042] Step S1011: Obtain the length and width of the image after reduction:

[0043] L i =L / k i

[0044] (Formula 1)

[0045] Where i represents the i-th pyramid layer; L represents the initial length and width of the image, that is, the length and width of the bottom layer of the pyramid; L i represents the length and width of the i-th layer of the pyramid; k represents the multiple of image reduction, k≥2;

[0046] Step S1012: Obtain the required number of pyramid layers i according to the reduced length and width of the image c :

[0047] The Sobel operator is used to extract the feature points of each pyramid layer. If the i-th c +1 The number of feature points of the image layer is less than or equal to the preset feature point number threshold. c The number of feature points of the layer image is greater than the preset feature point number threshold, and the i-thc The number of feature points of the layer image is 0th to ith c The number of pyramid layers required for the template image is determined as i. c Layer; Set the number of pyramid layers of the target image to be tested to i c layer.

[0048] For example, if the number of feature points of the 4th layer image in the template image pyramid is less than the preset feature point number threshold of 20, and the number of feature points of the 3rd layer image is greater than the preset feature point number threshold of 20, the number of layers of the template image pyramid is determined to be 3. Similarly, the number of layers of the target image pyramid to be tested is also 3.

[0049] Furthermore, before step S101, the template image and the target image to be measured are preprocessed, and the preprocessing process is: according to the image imaging quality, a suitable filtering method is selected, such as Gaussian filtering, and the image edge is smoothed by filtering to remove noise in the image background and reduce the influence of interference factors, so as to improve the matching efficiency and accuracy.

[0050] The step S102: setting the rotation step of each layer of the template image; rotating the template image under each pyramid layer according to the rotation step within a circumference, and obtaining a rotated image each time the rotation is performed; obtaining a set of rotated images M of each pyramid layer in ,in:

[0051] The rotation step length AngleStep of the template image at layer i i for:

[0052] AngleStep i =s i (Formula 2)

[0053] Where s≥2, the value of s corresponds to the image reduction factor k to better adapt to changes in image scaling and rotation. For example, if s=2, the rotation step size of each pyramid layer is: AngleStep0=1, AngleStep1=2, AngleStep2=4.

[0054] Rotating each pyramid layer of the template image according to the rotation step size includes:

[0055] According to the rotation step, each pyramid layer of the template image is rotated clockwise or counterclockwise, and each pyramid layer generates a template image of multiple angles. For example: the rotation step of the 0th layer template image is 1, and the original 0° template is rotated clockwise by 1°, 2°...358°, 359°, respectively. At this time, the 0th layer pyramid has a total of 360 template images of different angles. The rotation step of the 1st layer template image is 2, and the original 0° template is rotated clockwise by 2°, 4°...356°, 358°, respectively. At this time, the 1st layer pyramid has a total of 180 template images of different angles. The rotation step of the 2nd layer template image is 4, and the original 0° template is rotated clockwise by 4°, 8°...352°, 356°, respectively. At this time, the 2nd layer pyramid has a total of 90 template images of different angles.

[0056] In each layer of the pyramid, the rotated template images at different angles are recorded as the rotated image set M of that layer. in , n represents the number of template images with different angles in the i-th layer's rotation image set, num represents the element subscript in the i-th layer's rotation image set, num=0,1,2……ceil((360 / AngleStep i )-1), ceil represents the upward rounding function. For example: when i=0, num=0,1,2...359, it means that the set of rotated images at the 0th layer is {M 00 ,M 01 ……M 0359}; when i=1, num=0,1,2...179, indicating that the first layer rotation image set is {M 10 ,M 11 ……M 1179}; when i=2, num=0,1,2...89, indicating that the second layer rotation image set is {M 20 ,M 21 ……M 289}.

[0057] The step S103: obtaining the rotated image set M in The edge gradient information of each image in the image, wherein: the edge gradient information includes the x-direction gradient information And y-direction gradient information Among them, (x j ,y j ) represents the coordinates of the jth edge point in the template image. In this embodiment, the Sobel operator is used to extract the edge gradient information.

[0058] The step S104: obtaining edge gradient information of each pyramid layer image in the target image to be tested; wherein: the edge gradient information includes x-direction gradient information And y-direction gradient information Wherein, (x, y) represents the coordinates of the edge point in the target image to be measured. In this embodiment, the Sobel operator is used to extract the edge gradient information.

[0059] In step S105, the similarity calculation formula is:

[0060]

[0061] Among them, m represents the total number of feature points of the template image at a certain angle in the i-th pyramid layer; and They represent the template image with the index num in the i-th layer pyramid rotation image set in (x j ,y j ) along the x and y directions; and Respectively represent the target image to be tested at the i-th layer in (u+x j ,v+y j ) along the x and y directions; Indicates that the template with the index num in the i-th layer pyramid rotation image set is in (x j ,y j ) at the point where Indicates that the target image to be tested at the i-th layer is (u+x j ,v+y j ), that is,

[0062]

[0063]

[0064] in, The template image with the index num in the i-th layer pyramid rotation image set is in (x j ,y j ) along the x direction, The template image with the index num in the i-th layer pyramid rotation image set is in (x j ,y j ) along the y direction, The target image to be tested in the i-th layer is (u+x j , v+y j ) along the x direction, The target image to be tested in the i-th layer is (u+x j , v+y j ) along the y direction.

[0065] The template images at all angles of the pyramid layer are calculated similarly to the target image to be tested, and the maximum similarity value can be obtained.

[0066] In formula 3, Score inum Indicates the similarity between the template image and the search area of ​​the target image to be tested, with a value of 0 to 1. inum =1, it means that the template image completely matches the search area of ​​the target image to be tested. inum The larger the value, the higher the matching degree, indicating that the template image is more similar to the search area of ​​the target image to be tested. In this embodiment, the normalization method is used in the similarity measurement formula, so it has illumination invariance.

[0067] Furthermore, the acceleration termination condition of the similarity measurement is set. If the template image has m feature points at a certain angle in a pyramid layer, the sum of the similarities of a (a≤m) feature points is calculated. inuma , the acceleration termination condition is shown in Formula 6:

[0068]

[0069] In formula 6, Score inuma represents the sum of similarities of a (a≤m) feature points; a represents the number of calculated feature points of the template image; s min represents the set minimum matching score; g represents the set greediness, ranging from 0 to 1; b represents the set minimum matching score s min The coefficient of b is in the range of 0 to 1; the sum of the similarities of a feature points Score inuma The formula is shown in Formula 7:

[0070]

[0071] If Score inuma If the accelerated termination condition of the similarity measurement is met, the similarities of the remaining (ma) feature points are no longer calculated, and the similarity measurement calculation is terminated at the current position.

[0072] In this embodiment, usually, the minimum matching score s is only performed once in the termination condition. min However, in actual scenarios, when the image pyramid performs similarity measurement at each layer, only a fixed score s is used. min is unreasonable. At the high level of the pyramid, the similarity between the template image and the target image is not high, and the score obtained may be small. Therefore, at each level of the image pyramid, the minimum matching score is set to b·s min The setting of coefficient b can meet the requirements of image matching scores at each layer in the image pyramid to be tested, and can further improve the accuracy and stability of matching.

[0073] Step S105: taking the topmost pyramid layer of the target image to be measured as the current pyramid layer, searching for a template image in the current pyramid layer, calculating the similarity between the template image and the target image to be measured, and obtaining first matching information, wherein:

[0074] When matching at the top level, each rotated template image obtains a matching result, and the result with the greatest similarity (u i+1 ,v i+1 ,θ i+1 ), set the search range of the second top pyramid layer of the target image to be tested to (u i+1 ±Δu,v i+1 ±Δv,θ i+1 ±AngleStep i+1 ), where (u i+1 ,v i+1 ) is the coordinate information of the matching point obtained in the top-level pyramid, θ i+1 is the angle information obtained from the top pyramid, Δu and Δv are the pixel differences that can be set manually, and can be set according to the image size, for example, set to 5 pixels. i+1 is the rotation step size obtained in the topmost pyramid.

[0075] Step S106: If the current pyramid layer is the bottommost pyramid layer, the matching information of the current pyramid layer is recorded as the final matching position of the target (u final ,v final ,θ final ), the method ends; otherwise, the next layer of the current pyramid layer is set as the current pyramid layer, where:

[0076] In order to obtain a more accurate matching angle value, the bottom-level matching information (u final ,v final ,θ final ), calculate θ respectively final +AngleStep1 and θ final -AngleStep1 matches the similarity scores at two angles, and then uses the quadratic curve y=a1x 2 +a2x+a3 fitting θ final ,θ final +AngleStep1,θ final -AngleStep1 Three matching angles and their corresponding matching scores, where θ corresponds to x in the quadratic curve and the matching score corresponds to y in the quadratic curve, thereby solving the sub-angle value corresponding to the maximum similarity score on the quadratic curve and recording the sub-angle value as the final matching angle θ final .

[0077] In this embodiment, the matching process involves sorting and screening. The sorting can select a suitable algorithm according to the amount of data. When the amount of data is large, a quick sorting algorithm can be used for sorting to improve the processing speed.

[0078] The embodiment of the present invention further provides an image matching device based on edge information, such as Figure 3 As shown, the device comprises:

[0079] Initialization module: configured to set the number of pyramid layers, and perform pyramid stratification on the template image and the target image to be tested respectively;

[0080] Rotation module: configured to set the rotation step of each layer of the template image; within a circumference, according to the rotation step, the template image under each pyramid layer is rotated, and a rotated image is obtained each time it is rotated; and a rotation image set M of each pyramid layer is obtained. in ; Where i represents the pyramid layer, and n represents the number of rotated images in the i-th layer;

[0081] Edge gradient acquisition module: configured to acquire the rotation image set M in The edge gradient information of each image in;

[0082] The target edge gradient acquisition module is configured to acquire edge gradient information of each pyramid layer image in the target image;

[0083] A first matching module: configured to use the topmost pyramid layer of the target image to be measured as the current pyramid layer, search for a template image in the current pyramid layer, calculate the similarity between the template image and the target image to be measured, and obtain first matching information;

[0084] Judgment module: If the current pyramid layer is the bottom pyramid layer, the matching information of the current pyramid layer is recorded as the final matching position of the target (u final ,v final ,θ final ), the method ends; otherwise, the next layer of the current pyramid layer is set as the current pyramid layer; where u final ,v final ,θ final are respectively the x-coordinate of the final matching position, the y-coordinate of the final matching position, and the rotation angle value of the template image corresponding to the final matching position;

[0085] Similarity calculation module: configured to be based on the result with the greatest similarity among the matching information of the previous layer of the current pyramid layer (u i+1 ,v i+1 ,θ i+1 ), set the search range of the current pyramid layer (u i+1 ±Δu,vi+1 ±Δv,θ i+1 ±AngleStep i+1 ); where (u i+1 ,v i+1 ) is the coordinate information of the matching point with the greatest similarity in the previous layer of the current pyramid layer, θ i+1 is the angle information of the previous layer of the current pyramid layer, Δu and Δv are the coordinate differences set according to the image size, AngleStep i+1 is the rotation step length of the previous layer of the current pyramid layer; matching is performed based on the search range of the current pyramid layer to obtain the matching information of the current pyramid layer; and the judgment module is triggered.

[0086] The embodiment of the present invention further provides an image matching system based on edge information, including:

[0087] A processor, which is used to execute multiple instructions;

[0088] A memory for storing a plurality of instructions;

[0089] The plurality of instructions are used to be stored in the memory, and loaded and executed by the processor to implement the image matching method based on edge information as described above.

[0090] The embodiment of the present invention further provides a computer-readable storage medium, in which a plurality of instructions are stored; the plurality of instructions are used for a processor to load and execute the image matching method based on edge information as described above.

[0091] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0092] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple 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 an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0093] 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 multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0094] In addition, each functional unit in each embodiment of the present invention 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 hardware plus software functional units.

[0095] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a physical server, or a network cloud server, etc., which needs to be installed with Windows or Windows Server operating system) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (RandomAccess Memory, RAM), disk or optical disk and other media that can store program codes.

[0096] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention still falls within the scope of the technical solution of the present invention.

Claims

1. An image matching method based on edge information, It is characterized in that The method comprises: Step S101: setting the number of pyramid layers, and performing pyramid stratification on the template image and the target image to be measured respectively; Step S102: setting the rotation step of each layer of the template image; rotating the template image under each pyramid layer according to the rotation step within a circumference, and obtaining a rotated image each time the rotation is performed; obtaining a set of rotated images M of each pyramid layer in ; Where i represents the pyramid layer, and n represents the number of rotated images in the i-th layer; Step S103: Obtain the rotated image set M in The edge gradient information of each image in; Step S104: obtaining edge gradient information of each pyramid layer image in the target image to be measured; Step S105: taking the topmost pyramid layer of the target image to be measured as the current pyramid layer, searching for a template image in the current pyramid layer, calculating the similarity between the template image and the target image to be measured, and obtaining first matching information; Step S106: If the current pyramid layer is the bottommost pyramid layer, the matching information of the current pyramid layer is recorded as the final matching position of the target (u final , v final ,θ final ), the method ends; otherwise, the next layer of the current pyramid layer is set as the current pyramid layer; where u final , v final ,θ final are respectively the x-coordinate of the final matching position, the y-coordinate of the final matching position, and the rotation angle value of the template image corresponding to the final matching position; Step S107: Based on the matching information of the previous layer of the current pyramid layer, the result with the greatest similarity (u i+1 , v i+1 ,θ i+1 ), set the search range of the current pyramid layer (u i+1 ±Δu,v i+1 ±Δv,θ i+1 ±AngleStep i+1 ); where (u i +1 , v i+1 ) is the coordinate information of the matching point with the greatest similarity in the previous layer of the current pyramid layer, θ i+1 is the angle information of the previous layer of the current pyramid layer, Δu and Δv are the coordinate differences set according to the image size, AngleStep i+1 is the rotation step length of the previous layer of the current pyramid layer; matching is performed based on the search range of the current pyramid layer to obtain matching information of the current pyramid layer; and step S106 is entered; The step S101: performing pyramid stratification on the template image and the target image to be measured respectively to obtain the required number of pyramid layers, including: Step S1011: Obtain the length and width of the image after reduction: L i =L / k i (Formula 1) Where i represents the i-th pyramid layer; L represents the initial length and width of the image, that is, the length and width of the bottom layer of the pyramid; L i represents the length and width of the i-th layer of the pyramid; k represents the multiple of image reduction, k≥2; Step S1012: Obtain the required number of pyramid layers i according to the reduced length and width of the image c : The Sobel operator is used to extract the feature points of each pyramid layer. If the i-th c +1 The number of feature points of the image layer is less than or equal to the preset feature point number threshold. c The number of feature points of the layer image is greater than the preset feature point number threshold, and the i-th c The number of feature points of the layer image is 0th to ith c The number of pyramid layers required for the template image is determined as i. c Layer; Set the number of pyramid layers of the target image to be tested to i c layer.

2. The image matching method based on edge information as claimed in claim 1, It is characterized in that The step S102: setting the rotation step of each layer of the template image; rotating the template image under each pyramid layer according to the rotation step within a circumference, and obtaining a rotated image each time the rotation is performed; obtaining a set of rotated images M of each pyramid layer in ,in: The rotation step length AngleStep of the template image at layer i i for: AngleStep i =s i (Formula 2) Among them, s≥2.

3. The image matching method based on edge information as claimed in claim 2, It is characterized in that In step S105, the similarity calculation formula is: Among them, m represents the total number of feature points of the template image at a certain angle in the i-th pyramid layer; and They represent the template image with the index num in the i-th layer pyramid rotation image set in (x j ,y j ) along the x and y directions; and They represent the target image to be tested at the i-th layer in (u+x j , v+y j ) along the x and y directions; Indicates that the template with the index num in the i-th layer pyramid rotation image set is in (x j ,y j ) at the point where Indicates that the target image to be tested at the i-th layer is (u+x j , v+y j ), that is, in, The template image with the index num in the i-th layer pyramid rotation image set is in (x j ,y j ) along the x direction, The template image with the index num in the i-th layer pyramid rotation image set is in (x j ,y j ) along the y direction, The target image to be tested in the i-th layer is (u+x j , v+y j ) along the x direction, The target image to be tested in the i-th layer is (u+x j , v+y j ) along the y direction.

4. The image matching method based on edge information as claimed in claim 3, It is characterized in that Set the acceleration termination condition of the similarity measurement. If the template image has m feature points at a certain angle in a pyramid layer, the sum of the similarities of a feature points is calculated. inuma , where a≤m, the acceleration termination condition is: Among them, Score inuma represents the sum of similarities of a feature points; a represents the number of calculated feature points of the template image; s min Indicates the set minimum matching score; g indicates the set greediness, ranging from 0 to 1; b indicates the set minimum matching score sm in The coefficient of b is in the range of 0 to 1; the sum of the similarities of a feature points Score inuma The formula is: If Score inuma If the accelerated termination condition of the similarity measurement is met, the similarities of the remaining (ma) feature points are no longer calculated, and the similarity measurement calculation is terminated at the current position.

5. An image matching device based on edge information, It is characterized in that The device comprises: Initialization module: configured to set the number of pyramid layers, and perform pyramid stratification on the template image and the target image to be tested respectively; Rotation module: configured to set the rotation step of each layer of the template image; within a circumference, according to the rotation step, the template image under each pyramid layer is rotated, and a rotated image is obtained each time it is rotated; and a rotation image set M of each pyramid layer is obtained. in ; Where i represents the pyramid layer, and n represents the number of rotated images in the i-th layer; Edge gradient acquisition module: configured to acquire the rotation image set M in The edge gradient information of each image in; The target edge gradient acquisition module is configured to acquire edge gradient information of each pyramid layer image in the target image; A first matching module: configured to use the topmost pyramid layer of the target image to be measured as the current pyramid layer, search for a template image in the current pyramid layer, calculate the similarity between the template image and the target image to be measured, and obtain first matching information; Judgment module: If the current pyramid layer is the bottom pyramid layer, the matching information of the current pyramid layer is recorded as the final matching position of the target (u final , v final ,θ final ), the method ends; otherwise, the next layer of the current pyramid layer is set as the current pyramid layer; where u final , v final ,θ final are respectively the x-coordinate of the final matching position, the y-coordinate of the final matching position, and the rotation angle value of the template image corresponding to the final matching position; Similarity calculation module: configured to be based on the result with the greatest similarity among the matching information of the previous layer of the current pyramid layer (u i+1 , v i+1 ,θ i+1 ), set the search range of the current pyramid layer (u i+1 ±Δu,v i+1 ±Δv,θ i+1 ±AngleStep i+1 ); where (u i+1 , v i+1 ) is the coordinate information of the matching point with the greatest similarity in the previous layer of the current pyramid layer, θ i+1 is the angle information of the previous layer of the current pyramid layer, Δu and Δv are the coordinate differences set according to the image size, AngleStep i+1 is the rotation step length of the previous layer of the current pyramid layer; matching is performed based on the search range of the current pyramid layer to obtain the matching information of the current pyramid layer; triggering the judgment module; The step of performing pyramid stratification on the template image and the target image to be measured to obtain the required number of pyramid layers includes: Get the length and width of the image after reduction: L i =L / k i (Formula 1) Where i represents the i-th pyramid layer; L represents the initial length and width of the image, that is, the length and width of the bottom layer of the pyramid; L i represents the length and width of the i-th layer of the pyramid; k represents the multiple of image reduction, k≥2; According to the reduced length and width of the image, the required number of pyramid layers i is obtained. c : The Sobel operator is used to extract the feature points of each pyramid layer. If the i-th c +1 The number of feature points of the image layer is less than or equal to the preset feature point number threshold. c The number of feature points of the layer image is greater than the preset feature point number threshold, and the i-th c The number of feature points of the layer image is 0th to ith c The number of pyramid layers required for the template image is determined as i. c Layer; Set the number of pyramid layers of the target image to be tested to i c layer.

6. An image matching system based on edge information, include: A processor, which is used to execute multiple instructions; A memory for storing a plurality of instructions; The plurality of instructions are used to be stored in the memory, and loaded and executed by the processor to implement the image matching method based on edge information as described in any one of claims 1 to 4.

7. A computer-readable storage medium, wherein a plurality of instructions are stored in the storage medium; the plurality of instructions are used for a processor to load and execute the image matching method based on edge information as described in any one of claims 1 to 4.