Multi-scale machine vision matching method

Through the multi-scale machine vision matching method, pyramid sampling and scale factor calculation are used to solve the problem that traditional visual matching algorithms are difficult to identify scaling targets, and high accuracy positioning of multiple scale targets is achieved.

CN119649068AActive Publication Date: 2025-03-18SHENZHEN RUIDA TECH CO LTD

Patent Information

Application Number
CN202510174931.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-03-18
Estimated Expiration
2045-02-18

AI Technical Summary

Technical Problem

Traditional visual matching algorithms can only recognize targets of a single scale, and if the targets are scaled, it is difficult to identify and locate.

Method used

The multi-scale machine vision matching method is adopted to obtain the set of feature points of pyramids of each layer corresponding to different scale factors through pyramid sampling and scale factor calculation, and perform feature correction and similarity calculation to achieve effective positioning of multiple scale targets.

Benefits of technology

The accuracy of visual positioning is improved, and position recognition positioning with high accuracy and strong robustness can be achieved in search images containing multiple targets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119649068A_ABST
    Figure CN119649068A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-scale machine vision matching method, and belongs to the technical field of vision matching, and the method comprises the steps: determining an original scale template image I1 based on a search image I0 inputted by a user, and obtaining a template feature point set under each layer of pyramid of the original scale; calculating a template scale step s; calculating upper and lower limits of a template scale; calculating a scale factor set S; traversing the scale factor set S to obtain each layer of pyramid feature point set corresponding to different scale factors; performing feature correction on each layer of pyramid feature point set of which the scale factor is less than 1; calculating a pyramid image sequence set of a search image I0 input by a user; performing top layer template similarity calculation to obtain a top layer matching result; performing neighborhood suppression on all the top-layer matching results to obtain a top-layer matching result set; and traversing all pyramid layers by adopting a layer-by-layer approximation mode to obtain a final matching result. According to the invention, targets of multiple scales can be effectively positioned.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of visual matching, and in particular to a multi-scale machine vision matching method. Background Art

[0002] Visual matching technology is one of the key technologies for achieving target recognition and positioning. Through machine vision matching technology, industrial equipment can automatically adjust processing strategies to achieve flexible manufacturing. Visual image matching refers to the process of finding the same or similar areas in the target image as the template image by analyzing the similarity and consistency of features such as grayscale, edges, shape structure, and correspondence between the template image and the target image. The image pattern matching process generally includes two stages: learning and matching. In the learning stage, the algorithm extracts feature information for image matching from the template image and stores them in the template image in a searchable manner for later use.

[0003] Traditional visual matching algorithms can only identify targets of a single scale, and it is difficult to identify and locate targets if they are scaled.

[0004] Therefore, how to provide a multi-scale visual matching method that can effectively locate targets of multiple scales is a technical problem that needs to be urgently solved by those skilled in the art. Summary of the invention

[0005] To this end, the present invention provides a multi-scale machine vision matching method to solve the problem of inaccurate recognition and positioning caused by the fact that the visual matching algorithm can only recognize targets of a single scale in the prior art.

[0006] In order to achieve the above object, the present invention provides the following technical solutions: A multi-scale machine vision matching method comprises the following steps: Step S1: Based on the search image I0 input by the user, determine the original scale template image I1, and obtain the template feature point set under each layer of the pyramid in the original scale template image I1; Step S2: Calculate the template scale step s according to the distribution of the template feature points under the 0th layer pyramid in the original scale template image I1; Step S3: Calculate the template scale upper limit s based on the target scale upper and lower limits input by the user max and the lower limit s min ; Step S4: redundantly calculating a scale factor set S according to the upper and lower limits of the template scale and the scale step; Step S5: traverse the scale factor set S, and obtain the set of feature points of each layer of the pyramid corresponding to different scale factors according to the set of template feature points under each layer of the pyramid in the original scale template image I1 obtained in step S1; Step S6: traverse the scale factor set S, and perform feature correction on the pyramid feature point sets of each layer whose scale factor is less than 1; Step S7: Calculate a pyramid image sequence set of the search image I0 input by the user; Step S8: using the pyramid feature point sets corresponding to the corrected scale factors, perform top-layer template similarity calculation on the top-layer pyramid image in the search image I0 to obtain a top-layer matching result; Step S9: performing neighborhood suppression on all top-level matching results to obtain a top-level matching result set; Step S10: Based on the top-level matching result set, all pyramid layers are traversed in a layer-by-layer approximation manner, and the obtained matching result is the final matching result.

[0007] Furthermore, in the step S1, based on the search image I0 input by the user, the original scale template image I1 is determined, and a set of template feature points under each layer of the pyramid in the original scale template image I1 is obtained, which specifically includes: The user inputs a search image I0, and the original scale template image I1 is determined based on the ROI of any target input by the user and the search image I0; According to the number of pyramid layers n input by the user, pyramid sampling is performed on the original scale template image I1 to obtain an n-layer template pyramid image sequence set M; For each layer of template pyramid image M i , where i=0, 1, 2…n-1, grayscale and Gaussian blur processing are performed; Based on the processed pyramid image, an edge extraction algorithm is used to extract the edge, and the obtained edge points are used as template feature points and added to the template feature point set P corresponding to the pyramid layer. i where i=0, 1, 2…n-1.

[0008] Furthermore, in step S2, the template scale step s is calculated according to the distribution of the template feature points under the 0th layer pyramid in the original scale template image I1, specifically: Traverse all feature points in the 0th layer template feature point set P0, record the minimum x0 and maximum x1 of the feature point's x coordinate, and record the minimum y0 and maximum y1 of the feature point's y coordinate. The calculation formula of the template scale step s is: ; ; ; Among them, max() is the maximum value operation, which means taking the maximum value of the data in the brackets, c0 is the step constant, D x and Dy are the template differences in the x and y directions respectively, w is the width of the original scaled template image I1, and h is the height of the original scaled template image I1.

[0009] Furthermore, in step S3, the template scale upper limit s is calculated based on the target scale upper limit and lower limit input by the user. max and the lower limit s min , specifically: Template size lower limit min The calculation formula is: ; Template size upper limit max The calculation formula is: ; Among them, e0 is the upper limit of the target scale input by the user, e1 is the lower limit of the target scale input by the user, min() is the minimum value operation, and c1 is the scale constant.

[0010] Furthermore, in step S4, the scale factor set S is redundantly calculated according to the upper and lower limits of the template scale and the scale step, specifically including: At the upper limit of the template scale s max To the lower limit s min Within the following limits min is the starting scale, the scale is sampled at intervals of s, and the sampled scale factors are added to the scale factor set S; At the same time, redundant addition is performed, and an additional maximum scale factor e3 is added to the scale factor set S. The calculation formula of e3 is: ; Among them, e4 is the maximum scale factor in the scale factor set S.

[0011] Furthermore, in step S5, the scale factor set S is traversed, and the template feature point sets under each pyramid layer in the original scale template image I1 obtained in step S1 are used to obtain the pyramid feature point sets corresponding to different scale factors, specifically including: For the scale factor S j Corresponding to the nth layer of the pyramid, calculate the width w1 and height h1 of the template image corresponding to this layer of the pyramid, and the calculation formula is: ; ; Among them, w0 and h0 are the width and height of the original scale template image corresponding to the pyramid layer, round is the rounding function, S jThat is, the numerical value of the scale factor, j=0, 1, 2…m-1, m is the number of scale factors in the set S; According to the template feature point set P calculated in step S1 i , calculate the scale factor S j The corresponding pyramid feature point set Q j-i ; For Q j-i The coordinates of each point in , ), the calculation formula is: ; ; in,( , ) is the template feature point set P i Corresponding coordinates, k = 0, 1, 2…H-1, H is the set P i The total number of feature points in .

[0012] Furthermore, in step S6, the scale factor set S is traversed, and feature correction is performed on the pyramid feature point sets of each layer whose scale factor is less than 1, specifically: Get the scale factor S for each value less than 1 j For all feature point coordinates under each corresponding pyramid layer, if there are feature points with the same x and y coordinates after rounding, the average x and y coordinates of the feature points are calculated, the feature points are removed from the original feature point sets of each pyramid layer, and the average x and y coordinates are added to the original feature point sets of each pyramid layer.

[0013] Furthermore, in step S7, a pyramid image sequence set of the search image I0 input by the user is calculated, specifically: Grayscale the search image I0 input by the user to obtain a grayscale processed image I2, and downsample the grayscale processed image I2 according to the number of pyramid levels n input in step S1 to obtain a pyramid image sequence set N of the search image I0; In step S8, the top-layer template similarity calculation is performed on the top-layer pyramid image in the search image I0 using the set of pyramid feature points of each layer corresponding to each corrected scale factor to obtain the top-layer matching result, which specifically includes: Get the top pyramid image N in the search image I0 n-1 , while traversing each scale factor, for each scale factor S j , using the sliding window algorithm, calculate the feature points corresponding to the pyramid under the scale factor and the image N n-1 Template similarity of each region; The center coordinate value of the sliding window whose template similarity is greater than the similarity threshold t0, and its corresponding scale factor and similarity are taken as the top-level matching result.

[0014] Furthermore, in step S9, neighborhood suppression is performed on all top-level matching results to obtain a top-level matching result set, specifically: For each top-level matching result, record it as the first matching result, check whether there are other second matching results in the a×a neighborhood of the first matching result. If there are other second matching results, compare the similarity of the first matching result with the similarity of the second matching result, and remove the results with smaller similarity from the top-level matching results to obtain the top-level matching result set.

[0015] Furthermore, in step S10, based on the top-level matching result set, all pyramid layers are traversed in a layer-by-layer approximation manner, and the matching result obtained is the final matching result, which is specifically: Repeat steps S8-S9 to traverse the matching result sets of other n-1 layers of pyramids to obtain the best similarity; If the best similarity is greater than the similarity threshold t0, the matching result set corresponding to the best similarity replaces the previous matching result set, otherwise the previous matching result set is directly eliminated; Traverse all pyramid levels until n is 0, and the resulting matching result set is the final pixel-level result.

[0016] The present invention has the following advantages: The present invention determines the original scale template image I1 based on the search image I0 input by the user, and obtains the template feature point set under each layer of the pyramid in the original scale template image I1; calculates the template scale step s according to the distribution of the template feature points under the 0th layer of the pyramid in the original scale template image I1; calculates the template scale upper limit s based on the target scale upper limit and lower limit input by the user. max and the lower limit s min ; Redundantly calculate the scale factor set S according to the upper and lower limits of the template scale and the scale step; traverse the scale factor set S, and obtain the pyramid feature point sets corresponding to different scale factors according to the template feature point sets under each layer of the pyramid in the original scale template image I1 obtained in step S1; traverse the scale factor set S, and perform feature correction on the pyramid feature point sets of each layer whose scale factor is less than 1; calculate the pyramid image sequence set of the search image I0 input by the user; use the pyramid feature point sets of each layer corresponding to each corrected scale factor to calculate the top-level template similarity of the top-level pyramid image in the search image I0 to obtain the top-level matching result; perform neighborhood suppression on all top-level matching results to obtain the top-level matching result set; based on the top-level matching result set, adopt a layer-by-layer approximation method to traverse all pyramid layers, and the matching result obtained is the final matching result.

[0017] The present application obtains a set of pyramid feature points corresponding to different scale factors based on the original scale template image, and then obtains the corresponding scale factor based on the feature points in each pyramid layer in the search image, and performs visual positioning based on the scale factor and coordinate points to improve the accuracy of visual positioning. The present application can achieve high accuracy and strong robustness in position recognition and positioning in a search image containing multiple targets. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the implementation methods or the description of the prior art. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.

[0019] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.

[0020] Figure 1 A flowchart of a multi-scale machine vision matching method provided by the present invention; Figure 2 A search image containing multiple targets is provided for the present invention. DETAILED DESCRIPTION

[0021] The following is a description of the implementation of the present invention by specific embodiments. People familiar with the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0022] A multi-scale machine vision matching method, such as Figure 1 As shown, the following steps are included: Step S1: Based on the search image I0 containing multiple targets input by the user, the original scale template image I1 is determined, and the template feature point set under each layer of the pyramid in the original scale template image I1 is obtained, which specifically includes: The search image I0 containing multiple targets input by the user is as follows: Figure 2 As shown, the search image I0 is a search image containing three targets of different scales, and then the original scale template image I1 is determined in combination with the search image I0 according to the ROI of any target input by the user; According to the number of pyramid layers n input by the user, pyramid sampling is performed on the original scale template image I1 to obtain an n-layer template pyramid image sequence set M; For each layer of template pyramid image M i , where i=0, 1, 2…n-1, grayscale and Gaussian blur processing are performed; Based on the processed pyramid image, an edge extraction algorithm is used to extract the edge, and the obtained edge points are used as template feature points and added to the template feature point set P corresponding to the pyramid layer. i where i=0, 1, 2…n-1.

[0023] Step S2: Calculate the template scale step s according to the distribution of the template feature points under the 0th layer pyramid in the original scale template image I1, specifically including: Traverse all feature points in the 0th layer template feature point set P0, record the minimum x0 and maximum x1 of the feature point's x coordinate, and record the minimum y0 and maximum y1 of the feature point's y coordinate. The calculation formula of the template scale step s is: ; ; ; Among them, max() is the maximum value operation, which means taking the maximum value of the data in the brackets, c0 is the step constant, D x and D y are the template differences in the x and y directions respectively, w is the width of the original scaled template image I1, and h is the height of the original scaled template image I1.

[0024] Step S3: The upper and lower limits of the actual template scale are different from those input by the user. Based on the upper and lower limits of the target scale input by the user, the upper limit of the template scale s is calculated. max and the lower limit s min , including: Template size lower limit min The calculation formula is: ; Template size upper limit max The calculation formula is: ; Among them, e0 is the upper limit of the target scale input by the user, e1 is the lower limit of the target scale input by the user, min() is the minimum value operation, and c1 is the scale constant.

[0025] Step S4: redundantly calculate the scale factor set S according to the upper and lower limits of the template scale and the scale step, specifically including: At the upper limit of the template scale s max To the lower limit s min Within the following limits min is the starting scale, the scale is sampled at intervals of s, and the sampled scale factors are added to the scale factor set S; At the same time, redundant addition is performed, and an additional maximum scale factor e3 is added to the scale factor set S. The calculation formula of e3 is: ; Among them, e4 is the maximum scale factor in the scale factor set S.

[0026] Step S5: traverse the scale factor set S, and obtain the set of feature points of each layer of the pyramid corresponding to different scale factors according to the set of template feature points under each layer of the pyramid in the original scale template image I1 obtained in step S1, specifically including: For the scale factor S j Corresponding to the nth layer of the pyramid, calculate the width w1 and height h1 of the template image corresponding to this layer of the pyramid, and the calculation formula is: ; ; Among them, w0 and h0 are the width and height of the original scale template image corresponding to the pyramid layer, round is the rounding function, S j That is, the numerical value of the scale factor, j=0, 1, 2…m-1, m is the number of scale factors in the set S; According to the template feature point set P calculated in step S1 i , calculate the scale factor S j The corresponding pyramid feature point set Q j-i ; For Q j-i The coordinates of each point in , ), the calculation formula is: ; ; in,( , ) is the template feature point set P i Corresponding coordinates, k = 0, 1, 2…H-1, H is the set P i The total number of feature points in .

[0027] At this point, the features of each pyramid layer of each scale template have been preliminarily calculated.

[0028] Step S6: traverse the scale factor set S, and perform feature correction on the pyramid feature point sets of each layer whose scale factor is less than 1, specifically: Get the scale factor S for each value less than 1 j For all feature point coordinates under each corresponding pyramid layer, if there are feature points with the same x and y coordinates after rounding, the average x and y coordinates of the feature points are calculated, the feature points are removed from the original feature point sets of each pyramid layer, and the average x and y coordinates are added to the original feature point sets of each pyramid layer.

[0029] Step S7: Calculate the pyramid image sequence set of the search image I0 input by the user, specifically: Grayscale the search image I0 input by the user to obtain a grayscale processed image I2, and downsample the grayscale processed image I2 according to the number of pyramid levels n input in step S1 to obtain a pyramid image sequence set N of the search image I0; Step S8: Using the set of pyramid feature points corresponding to each scale factor after correction, perform top-level template similarity calculation on the top-level pyramid image in the search image I0 to obtain the top-level matching result. The top-level calculation only involves the top-level pyramid image N of the input search image. n-1 The templates corresponding to the top pyramid (n-1 layers) at each scale factor include: Get the top pyramid image N in the search image I0 n-1 , while traversing each scale factor, for each scale factor S j , using the sliding window algorithm, calculate the feature points corresponding to the pyramid under the scale factor and the image N n-1 Template similarity of each region; The center coordinate value of the sliding window whose template similarity is greater than the similarity threshold t0, and its corresponding scale factor and similarity are taken as the top-level matching result.

[0030] The value of template similarity is the sum of the similarities of each feature point and then the average. The value of the similarity of a single feature point is the value of the current template feature point and image N. n-1 The similarity calculation of the points corresponding to the sliding window in can be performed by using the traditional gradient direction calculation or the traditional edge gradient calculation.

[0031] Step S9: Perform neighborhood suppression on all top-level matching results to obtain a top-level matching result set, specifically: For each top-level matching result, record it as the first matching result, check whether there are other second matching results in the a×a neighborhood of the first matching result. If there are other second matching results, compare the similarity of the first matching result with the similarity of the second matching result, and remove the results with smaller similarity from the top-level matching results to obtain the top-level matching result set.

[0032] Step S10: Based on the top-level matching result set, all pyramid layers are traversed by layer-by-layer approximation, and the matching result obtained is the final matching result, which is specifically: Repeat steps S8-S9 to traverse the matching result sets of other n-1 layers of pyramids to obtain the best similarity; If the best similarity is greater than the similarity threshold t0, the matching result set corresponding to the best similarity replaces the previous matching result set, otherwise the previous matching result set is directly eliminated; Traverse all pyramid levels until n is 0, and the resulting matching result set is the final pixel-level result.

[0033] Step S8 only performs matching on the top pyramid level, and requires refined similarity calculations on other pyramid levels. For the nth pyramid level, traverse the results of matching at each scale on the other n-1 pyramid levels, specifically: for the current matching result R i , in the pyramid image Nn of the search image, with R i In the b×b neighborhood centered on the matching result, similarity calculation is performed again in the manner of step S8, and the highest similarity score in the neighborhood is selected as the best similarity calculated in this neighborhood.

[0034] If the best similarity is greater than the similarity threshold t0, the coordinates and similarities corresponding to the best similarity are replaced by R i Otherwise, remove R i Traverse all pyramid layers until n is 0, and the result is the final pixel-level result.

[0035] The present application obtains a set of pyramid feature points corresponding to different scale factors based on the original scale template image, and then obtains the corresponding scale factor based on the feature points in each pyramid layer in the search image, and performs visual positioning based on the scale factor and coordinate points to improve the accuracy of visual positioning. The present application can achieve high accuracy and strong robustness in position recognition and positioning in a search image containing multiple targets.

[0036] Although the present invention has been described in detail above by general description and specific embodiments, it is obvious to those skilled in the art that some modifications or improvements can be made to the present invention. Therefore, these modifications or improvements made without departing from the spirit of the present invention all belong to the scope of protection claimed by the present invention.

Claims

1. A multi-scale machine vision matching method, characterized in that: The following steps are involved: Step S1: Based on the search image I0 input by the user, determine the original scale template image I1, and obtain the template feature point set under each layer of the pyramid in the original scale template image I1; Step S2: Calculate the template scale step s according to the distribution of the template feature points under the 0th layer pyramid in the original scale template image I1; Step S3: Calculate the template scale upper limit s based on the target scale upper limit and lower limit input by the user max and the lower limit s min ; Step S4: redundantly calculating a scale factor set S according to the upper and lower limits of the template scale and the scale step; Step S5: traverse the scale factor set S, and obtain the set of feature points of each layer of the pyramid corresponding to different scale factors according to the set of template feature points under each layer of the pyramid in the original scale template image I1 obtained in step S1; Step S6: traverse the scale factor set S, and perform feature correction on the pyramid feature point sets of each layer whose scale factor is less than 1; Step S7: Calculate a pyramid image sequence set of the search image I0 input by the user; Step S8: using the pyramid feature point sets corresponding to the corrected scale factors, perform top-layer template similarity calculation on the top-layer pyramid image in the search image I0 to obtain a top-layer matching result; Step S9: performing neighborhood suppression on all top-level matching results to obtain a top-level matching result set; Step S10: Based on the top-level matching result set, all pyramid layers are traversed in a layer-by-layer approximation manner, and the obtained matching result is the final matching result.

2. The multi-scale machine vision matching method according to claim 1, characterized in that: In the step S1, based on the search image I0 input by the user, the original scale template image I1 is determined, and a set of template feature points under each layer of the pyramid in the original scale template image I1 is obtained, which specifically includes: The user inputs a search image I0, and the original scale template image I1 is determined based on the ROI of any target input by the user and the search image I0; According to the number of pyramid layers n input by the user, pyramid sampling is performed on the original scale template image I1 to obtain an n-layer template pyramid image sequence set M; For each layer of template pyramid image M i , where i=0, 1, 2…n-1, grayscale and Gaussian blur processing are performed; Based on the processed pyramid image, an edge extraction algorithm is used to extract the edge, and the obtained edge points are used as template feature points and added to the template feature point set P corresponding to the pyramid layer. i where i=0, 1, 2…n-1.

3. The multi-scale machine vision matching method according to claim 2, characterized in that: In step S2, the template scale step s is calculated according to the distribution of the template feature points under the 0th layer pyramid in the original scale template image I1, specifically: Traverse all feature points in the 0th layer template feature point set P0, record the minimum x0 and maximum x1 of the feature point's x coordinate, and record the minimum y0 and maximum y1 of the feature point's y coordinate. The calculation formula of the template scale step s is: ; ; ; Among them, max() is the maximum value operation, which means taking the maximum value of the data in the brackets, c0 is the step constant, D x and D y are the template differences in the x and y directions respectively, w is the width of the original scaled template image I1, and h is the height of the original scaled template image I1.

4. The multi-scale machine vision matching method according to claim 3, characterized in that: In step S3, the template scale upper limit s is calculated based on the target scale upper limit and lower limit input by the user. max and the lower limit s min , specifically: Template size lower limit min The calculation formula is: ; Template size upper limit max The calculation formula is: ; Among them, e0 is the upper limit of the target scale input by the user, e1 is the lower limit of the target scale input by the user, min() is the minimum value operation, and c1 is the scale constant.

5. The multi-scale machine vision matching method according to claim 4, characterized in that: In step S4, redundantly calculating a scale factor set S according to the template scale upper and lower limits and the scale step size specifically includes: At the upper limit of the template scale s max To the lower limit s min Within the following limits min is the starting scale, the scale is sampled at intervals of s, and the sampled scale factors are added to the scale factor set S; At the same time, redundant addition is performed, and an additional maximum scale factor e3 is added to the scale factor set S. The calculation formula of e3 is: ; Among them, e4 is the maximum scale factor in the scale factor set S.

6. The multi-scale machine vision matching method according to claim 5, characterized in that: In the step S5, the scale factor set S is traversed, and the template feature point sets under each pyramid layer in the original scale template image I1 obtained in step S1 are used to obtain the pyramid feature point sets corresponding to different scale factors, specifically including: For the scale factor S j Corresponding to the nth layer of the pyramid, calculate the width w1 and height h1 of the template image corresponding to this layer of the pyramid, and the calculation formula is: ; ; Among them, w0 and h0 are the width and height of the original scale template image corresponding to the pyramid layer, round is the rounding function, S j That is, the numerical value of the scale factor, j=0, 1, 2…m-1, m is the number of scale factors in the set S; According to the template feature point set P calculated in step S1 i , calculate the scale factor S j The corresponding pyramid feature point set Q j-i ; For Q j-i The coordinates of each point in , ), the calculation formula is: ; ; in,( , ) is the template feature point set P i Corresponding coordinates, k = 0, 1, 2…H-1, H is the set P i The total number of feature points in .

7. The multi-scale machine vision matching method according to claim 6, characterized in that: In step S6, the scale factor set S is traversed, and feature correction is performed on the pyramid feature point sets of each layer whose scale factor is less than 1, specifically: Get the scale factor S for each value less than 1 j For all feature point coordinates under each corresponding pyramid layer, if there are feature points with the same x and y coordinates after rounding, the average x and y coordinates of the feature points are calculated, the feature points are removed from the original feature point sets of each pyramid layer, and the average x and y coordinates are added to the original feature point sets of each pyramid layer.

8. The multi-scale machine vision matching method according to claim 7, characterized in that: In step S7, a pyramid image sequence set of the search image I0 input by the user is calculated, specifically: Grayscale the search image I0 input by the user to obtain a grayscale processed image I2, and downsample the grayscale processed image I2 according to the number of pyramid levels n input in step S1 to obtain a pyramid image sequence set N of the search image I0; In step S8, the top-layer template similarity calculation is performed on the top-layer pyramid image in the search image I0 using the set of pyramid feature points of each layer corresponding to each corrected scale factor to obtain the top-layer matching result, which specifically includes: Get the top pyramid image N in the search image I0 n-1 , while traversing each scale factor, for each scale factor S j , using the sliding window algorithm, calculate the feature points corresponding to the pyramid under the scale factor and the image N n-1 Template similarity of each region; The center coordinate value of the sliding window whose template similarity is greater than the similarity threshold t0, and its corresponding scale factor and similarity are taken as the top-level matching result.

9. The multi-scale machine vision matching method according to claim 8, characterized in that: In step S9, neighborhood suppression is performed on all top-level matching results to obtain a top-level matching result set, which is specifically: For each top-level matching result, record it as the first matching result, check whether there are other second matching results in the a×a neighborhood of the first matching result. If there are other second matching results, compare the similarity of the first matching result with the similarity of the second matching result, and remove the results with smaller similarity from the top-level matching results to obtain the top-level matching result set.

10. The multi-scale machine vision matching method according to claim 9, characterized in that: In step S10, based on the top-level matching result set, all pyramid layers are traversed in a layer-by-layer approximation manner, and the matching result obtained is the final matching result, which is specifically: Repeat steps S8-S9 to traverse the matching result sets of other n-1 layers of pyramids to obtain the best similarity; If the best similarity is greater than the similarity threshold t0, the matching result set corresponding to the best similarity replaces the previous matching result set, otherwise the previous matching result set is directly eliminated; Traverse all pyramid levels until n is 0, and the resulting matching result set is the final pixel-level result.

Citation Information

Patent Citations

  • Robust multi-scale template matching method based on nearest neighbor feature point matching

    CN111709434A

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

    CN113159103A

  • Image matching method and apparatus, electronic device, and storage medium

    WO2022179002A1

  • Template matching method and apparatus, computer device, and storage medium

    WO2022205614A1

Cited By

  • Generative machine vision matching method

    CN119850985A

  • A Generative Machine Vision Matching Method

    CN119850985B

  • Image matching method, computer equipment and storage medium

    CN120635502A