A machine vision matching method based on focus features
By constructing a set of feature points and filtering benchmarks and auxiliary focus feature points, combined with ordinary template matching methods, the problem of inaccurate matching of traditional visual matching methods under deformation targets is solved, and higher matching accuracy and reliability are achieved.
Patent Information
- Application Number
- CN202510929884.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-07
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2045-07-07
AI Technical Summary
Traditional visual matching methods are difficult to accurately match the characteristics of users' interest when facing deformed targets, resulting in inaccurate matching results.
By extracting the first template image input by the user, a set of feature points is constructed, and the feature points are screened based on the reference focus feature, the first auxiliary focus feature and the second auxiliary focus feature, the reference focus feature point and the auxiliary focus feature point are determined, and the neighborhood matching is performed in combination with the preset ordinary template matching method, the feature center of gravity coordinates and angle difference value are calculated, and the optimal matching result is determined.
It achieves accurate matching of user attention features and improves the accuracy and reliability of matching.
Smart Images

Figure CN120431349B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of machine vision matching, and more specifically, to a machine vision matching method based on focus features. Background Art
[0002] Visual matching technology, at the core of machine vision, plays a key role in target identification and location, and is widely used in a variety of fields, including industrial inspection and logistics sorting. However, traditional visual matching methods have significant shortcomings when dealing with deformed targets. Due to the deformation of target feature contours, traditional methods struggle to accurately match the features of interest, and are prone to matching offsets, resulting in inaccurate matching results. Therefore, existing technologies are flawed and urgently need improvement. Summary of the Invention
[0003] In view of the above problems, the purpose of the present invention is to provide a machine vision matching method based on focus features, which can accurately match the features that the user is concerned about, effectively improving the accuracy and reliability of matching.
[0004] A first aspect of the present invention provides a machine vision matching method based on focus features, comprising:
[0005] Perform feature extraction on the first template image I0 input by the user and construct a feature point set P;
[0006] Screening the feature points in the feature point set P according to the reference focus feature, the first auxiliary focus feature, and the second auxiliary focus feature to determine the reference focus feature point, the first auxiliary focus feature point, and the second auxiliary focus feature point;
[0007] The search image input by the user is analyzed by the preset common template matching method to determine the rough position coordinates (x t ,y t ) and the overall rotation angle h t ;
[0008] The coordinates of the center of gravity of the first auxiliary focus feature (x) in the initial template T0 are calculated based on the first auxiliary focus feature point and the second auxiliary focus feature point. 0B ,y 0B ) and the second auxiliary focusing feature centroid coordinate (x 0C ,y 0C ), determine the initial angle h0;
[0009] Based on the overall rotation angle h t Perform neighborhood matching on the reference focus feature point, the first auxiliary focus feature point and the second auxiliary focus feature point respectively, and calculate the coordinates of the center of gravity of the first auxiliary focus feature (x 2B ,y 2B) and the second auxiliary focusing feature centroid coordinate (x 3C ,y 3C ), determine the equivalent angle h e ;
[0010] Calculate the equivalent angle h e The angle difference between the initial angle h0 and the actual angle h is determined r ;
[0011] Based on the actual angle h r , neighborhood matching is performed on the reference focus feature points using a preset common template matching method to determine the position coordinates (x, y) of the optimal reference focus feature matching result.
[0012] In this solution, the feature extraction of the first template image I0 input by the user and the construction of the feature point set P include:
[0013] Performing bilateral filtering on the first template image I0 to obtain a second template image I1;
[0014] Feature extraction is performed on the second template image I1, and the extracted feature points are added to the feature point set P.
[0015] In this solution, the feature points in the feature point set P are screened according to the reference focus feature, the first auxiliary focus feature, and the second auxiliary focus feature to determine the reference focus feature point, the first auxiliary focus feature point, and the second auxiliary focus feature point, including:
[0016] Visually displaying the feature point set P on a preset display interface, determining a feature that the user selects on the preset display interface and that is of greatest concern for matching accuracy as a reference focus feature, and determining two features at both ends of the template image selected by the user on the preset display interface as first auxiliary focus features and second auxiliary focus features, respectively;
[0017] The feature points belonging to the reference focus feature are added to the reference focus feature point set A, the feature points belonging to the first auxiliary focus feature are added to the first auxiliary focus feature point set B, and the feature points belonging to the second auxiliary focus feature are added to the second auxiliary focus feature point set C.
[0018] In this solution, the coordinates of the center of gravity of the first auxiliary focus feature in the initial template T0 (x 0B ,y 0B ) and the second auxiliary focusing feature centroid coordinate (x 0C ,y 0C ),include:
[0019] Get the coordinates (x) of the i-th first auxiliary focus feature point in the initial template T0 0Bi ,y 0Bi ) and the coordinates of the jth second auxiliary focusing feature point (x 0Cj ,y 0Cj );
[0020] According to the coordinates (x 0Bi ,y 0Bi ) and the coordinates of the jth second auxiliary focusing feature point (x 0Cj ,y 0Cj ) Calculate the coordinates of the center of gravity of the first auxiliary focusing feature in the initial template T0 (x 0B ,y 0B ) and the second auxiliary focusing feature centroid coordinate (x 0C ,y 0C );
[0021] ;
[0022] ;
[0023] ;
[0024] ;
[0025] Wherein, n is the total number of first auxiliary focus feature points in the initial template T0, and m is the total number of second auxiliary focus feature points in the initial template T0.
[0026] In this solution, determining the initial angle h0 includes:
[0027] According to the first auxiliary focusing feature center coordinates (x 0B ,y 0B ) and the second auxiliary focusing feature centroid coordinate (x 0C ,y 0C ) Calculate the initial angle h0:
[0028] .
[0029] In this solution, the overall rotation angle h t Performing neighborhood matching on the reference focus feature point, the first auxiliary focus feature point, and the second auxiliary focus feature point respectively includes:
[0030] According to the overall rotation angle h t and the preset angle range threshold t0 to determine the input matching angle range h t ±t0;
[0031] Based on the input matching angle range h t ±t0, perform neighborhood matching on the benchmark focus feature points using the preset common template matching method to determine the position coordinates of the benchmark focus feature matching result (x A_1 ,y A_1 ) and the first angle h1; performing neighborhood matching on the first auxiliary focus feature point by a preset ordinary template matching method to determine the position coordinates of the first auxiliary focus matching result (x B_1 ,y B_1 ) and the second angle h2; performing neighborhood matching on the second auxiliary focus feature point by a preset ordinary template matching method to determine the position coordinates of the second auxiliary focus matching result (x C_1 ,y C_1 ) and a third angle h3.
[0032] In this solution, the coordinates of the center of gravity of the first auxiliary focusing feature (x 2B ,y 2B ) and the second auxiliary focusing feature centroid coordinate (x 3C ,y 3C ),include:
[0033] Rotate the initial template T0 according to the second angle h2 to determine a second rotated template T2;
[0034] The coordinates of the center of gravity of the first auxiliary focusing feature (x 2B ,y 2B );
[0035] ;
[0036] ;
[0037] Among them, x 2Bi and y 2Bi are the horizontal and vertical coordinates of the i-th first auxiliary focus feature point in the second rotation template T2, n is the total number of first auxiliary focus feature points in the second rotation template T2, x b2 and y b2 is the reference value of the horizontal and vertical coordinates after the second rotation template T2 is cut, x B_1 and y B_1 are the horizontal and vertical coordinates of the first auxiliary focus matching result position, w t2 and h t2 are the width and height of the second rotating template T2 respectively;
[0038] Rotate the initial template T0 according to a third angle h3 to determine a third rotated template T3;
[0039] The coordinates of the center of gravity of the second auxiliary focusing feature (x 3C ,y 3C );
[0040] ;
[0041] ;
[0042] Among them, x 3Cj and y 3Cj are the horizontal and vertical coordinates of the jth second auxiliary focus feature point in the third rotation template T3, m is the total number of second auxiliary focus feature points in the third rotation template T3, x is the horizontal and vertical coordinates of the jth second auxiliary focus feature point in the third rotation template T3, c3 and y c3 is the reference value of the horizontal and vertical coordinates after the third rotation template T3 is cut, x C_1 and y C_1 are the horizontal and vertical coordinates of the second auxiliary focus matching result position, w t3 and h t3 are the width and height of the third rotation template T3 respectively.
[0043] In this solution, the determination of the equivalent angle h e ,include:
[0044] According to the first auxiliary focusing feature center coordinates (x 2B ,y 2B ) and the second auxiliary focusing feature centroid coordinate (x 3C ,y 3C ) Calculate the equivalent angle h e :
[0045] .
[0046] The present invention discloses a machine vision matching method based on focus features. The method includes: extracting features from a first template image to construct a feature point set; screening the feature point set to determine a baseline focus feature point and an auxiliary focus feature point; analyzing the search image using a preset common template matching method to determine rough position coordinates and an overall rotation angle; calculating the coordinates of the center of gravity of the auxiliary focus feature in the initial template to determine an initial angle; performing neighborhood matching on the baseline focus feature point and the auxiliary focus feature point based on the overall rotation angle, calculating the coordinates of the center of gravity of the auxiliary focus feature and determining an equivalent angle; calculating the angular difference between the equivalent angle and the initial angle to determine the actual angle; performing neighborhood matching on the baseline focus feature point to determine the position coordinates of the optimal baseline focus feature matching result. The present invention can accurately match features of interest to users, improving the accuracy and reliability of matching. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A flow chart of a machine vision matching method based on focus features provided by the present invention is shown;
[0048] Figure 2 The flowchart of the method for constructing the feature point set P provided by the present invention is shown;
[0049] Figure 3 A flow chart of a method for determining the coordinates of the first auxiliary focusing feature center of gravity and the second auxiliary focusing feature center of gravity provided by the present invention is shown. DETAILED DESCRIPTION
[0050] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features therein can be combined with each other.
[0051] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited to the specific embodiments disclosed below.
[0052] Figure 1 The flowchart of a machine vision matching method based on focus features provided by the present invention is shown.
[0053] like Figure 1 As shown, the present invention discloses a machine vision matching method based on focus features, comprising:
[0054] S102, extracting features from the first template image I0 input by the user to construct a feature point set P;
[0055] S104, screening feature points in the feature point set P according to the reference focus feature, the first auxiliary focus feature, and the second auxiliary focus feature to determine the reference focus feature point, the first auxiliary focus feature point, and the second auxiliary focus feature point;
[0056] S106, analyzing the search image input by the user through a preset common template matching method to determine the rough position coordinates (x t ,y t ) and the overall rotation angle h t ;
[0057] S108, calculate the coordinates (x) of the center of gravity of the first auxiliary focus feature in the initial template T0 according to the first auxiliary focus feature point and the second auxiliary focus feature point. 0B ,y 0B ) and the second auxiliary focusing feature centroid coordinate (x 0C ,y 0C), determine the initial angle h0;
[0058] S110, based on the overall rotation angle h t Perform neighborhood matching on the reference focus feature point, the first auxiliary focus feature point and the second auxiliary focus feature point respectively, and calculate the coordinates of the center of gravity of the first auxiliary focus feature (x 2B ,y 2B ) and the second auxiliary focusing feature centroid coordinate (x 3C ,y 3C ), determine the equivalent angle h e ;
[0059] S112, calculate the equivalent angle h e The angle difference from the initial angle h0 determines the actual angle h r ;
[0060] S114, based on the actual angle h r , the neighborhood matching of the benchmark focus feature points is performed by a preset ordinary template matching method to determine the position coordinates (x, y) of the optimal benchmark focus feature matching result.
[0061] According to an embodiment of the present invention, a bilateral filtering operation is first performed on the first template image I0 input by the user. Then, through methods such as high and low thresholds and non-maximum suppression, points with gradients greater than the system-preset gradient threshold are selected as feature points to construct a feature point set P. Then, based on the baseline focus feature, the first auxiliary focus feature, and the second auxiliary focus feature selected by the user, feature points are screened from the feature point set P. Feature points belonging to the baseline focus feature are added to the baseline focus feature point set A, feature points belonging to the first auxiliary focus feature are added to the first auxiliary focus feature point set B, and feature points belonging to the second auxiliary focus feature are added to the second auxiliary focus feature point set C. Afterwards, a search image input by the user is obtained, and the search image is analyzed according to a preset common template matching method (edge-based or shape-based matching algorithm, etc.) preset by the system to determine the rough position coordinates (x t ,y t ) and the overall rotation angle h t During the analysis process, the first template image I0 input by the user is used as the initial template T0, that is, the unrotated template. The feature points input during the matching process are all feature points in the feature point set P, including the baseline focus feature points, the first auxiliary focus feature points, the second auxiliary focus feature points, and all other feature points that do not belong to these three categories.
[0062] In the initial template T0, the coordinates of the first auxiliary focus feature center (x 0B ,y 0B), calculate the coordinates of the second auxiliary focusing feature center of gravity (x 0C ,y 0C ). Calculate the coordinates of the first auxiliary focusing feature center of gravity (x 0B ,y 0B ) and the second auxiliary focusing feature centroid coordinate (x 0C ,y 0C ) to determine the initial angle h0. According to the overall rotation angle h t and the preset angle range threshold t0 to determine the input matching angle range h t ±t0, in the input matching angle range h t Within ±t0, the neighborhood matching of the reference focus feature point, the first auxiliary focus feature point and the second auxiliary focus feature point is performed separately by the preset common template matching method to determine the corresponding reference focus feature matching result position coordinates (x A_1 ,y A_1 ) and the first angle h1, the first auxiliary focus matching result position coordinate (x B_1 ,y B_1 ) and the second angle h2, and the position coordinates of the second auxiliary focus matching result (x C_1 ,y C_1 ) and a third angle h3. The initial template T0 is rotated according to the second angle h2 to determine the second rotated template T2, and the coordinates of the center of gravity of the first auxiliary focusing feature (x 2B ,y 2B Similarly, the initial template T0 is rotated according to the third angle h3 to determine the third rotated template T3, and the coordinates of the center of gravity of the second auxiliary focus feature (x 3C ,y 3C ). Calculate the coordinates of the first auxiliary focusing feature center of gravity (x 2B ,y 2B ) and the second auxiliary focusing feature centroid coordinate (x 3C ,y 3C ) to determine the equivalent angle h e ; Calculate the equivalent angle h e The angle difference from the initial angle h0 determines the actual angle h r ;
[0063] .
[0064] Finally, fix the matching angle to the actual angle h r , whose matching neighborhood is the position coordinate of the benchmark focus feature matching result (x A_1 ,y A_1), the neighborhood of the benchmark focus feature point is matched separately by the preset ordinary template matching method. The search image input by the user is used as input, and the optimal benchmark focus feature matching result position coordinates (x, y) can be obtained by ordinary template matching calculation, and the actual angle h r As the final angle, machine vision matching is completed.
[0065] Figure 2 The flowchart of the method for constructing the feature point set P provided by the present invention is shown.
[0066] like Figure 2 As shown, according to an embodiment of the present invention, feature extraction is performed on the first template image I0 input by the user to construct a feature point set P, including:
[0067] S202, performing bilateral filtering on the first template image I0 to obtain a second template image I1;
[0068] S204 , extracting features from the second template image I1 , and adding the extracted feature points to a feature point set P.
[0069] It should be noted that bilateral filtering achieves denoising by calculating the weights of all pixels within each pixel's neighborhood. For each pixel in the first template image I0, the weights of all pixels within its neighborhood are calculated, with the weights determined by spatial distance and color difference. Pixels closer to the target pixel have greater weights, and pixels with colors more similar to the target pixel have greater weights. Using the calculated pixel weights, a weighted average is taken of the pixels within the neighborhood to obtain the filtered pixel value. Bilateral filtering can effectively remove noise while preserving the edges and details of the image.
[0070] For the second template image I1, high and low thresholds and non-maximum suppression are used to select points with gradients greater than the system preset gradient threshold as feature points and add them to the feature point set P.
[0071] According to an embodiment of the present invention, the feature points in the feature point set P are screened according to the reference focus feature, the first auxiliary focus feature, and the second auxiliary focus feature to determine the reference focus feature point, the first auxiliary focus feature point, and the second auxiliary focus feature point, including:
[0072] Visually display the feature point set P on a preset display interface, determine a feature that the user selects on the preset display interface and that is of greatest concern for matching accuracy as a reference focus feature, and determine two features at both ends of the template image selected by the user on the preset display interface as first auxiliary focus features and second auxiliary focus features, respectively;
[0073] The feature points belonging to the reference focus feature are added to the reference focus feature point set A, the feature points belonging to the first auxiliary focus feature are added to the first auxiliary focus feature point set B, and the feature points belonging to the second auxiliary focus feature are added to the second auxiliary focus feature point set C.
[0074] It should be noted that the preset display interface can be a terminal interface such as a computer monitor or display screen. All feature points within the feature point set P are visually displayed via the preset display interface. The user selects a feature point on the preset display interface. The feature selected by the user for most significant matching accuracy is determined as the baseline focus feature, with one baseline focus feature being the number. The feature of greatest importance for matching accuracy is the feature that the user is most concerned about and should be aligned with the actual image. It is typically a feature that is less prone to deformation and is generally located near the center of the template. Features selected by the user at both ends of the template image are determined as auxiliary focus features. There are two auxiliary focus features: a first auxiliary focus feature and a second auxiliary focus feature. The auxiliary focus features are typically selected from features located at both ends of the template and also exhibit relatively minimal deformation. After the baseline focus features and auxiliary focus features are selected, feature points belonging to the baseline focus feature are added to the baseline focus feature point set A, feature points belonging to the first auxiliary focus feature are added to the first auxiliary focus feature point set B, and feature points belonging to the second auxiliary focus feature are added to the second auxiliary focus feature point set C.
[0075] Figure 3 A flow chart of a method for determining the coordinates of the first auxiliary focusing feature center of gravity and the second auxiliary focusing feature center of gravity provided by the present invention is shown.
[0076] like Figure 3 As shown, according to an embodiment of the present invention, the coordinates of the center of gravity (x 0B ,y 0B ) and the second auxiliary focusing feature centroid coordinate (x 0C ,y 0C ),include:
[0077] S302, obtain the coordinates (x 0Bi ,y 0Bi ) and the coordinates of the jth second auxiliary focusing feature point (x 0Cj ,y 0Cj );
[0078] S304: Based on the coordinates (x 0Bi ,y 0Bi ) and the coordinates of the jth second auxiliary focusing feature point (x 0Cj,y 0Cj ) Calculate the coordinates of the center of gravity of the first auxiliary focusing feature in the initial template T0 (x 0B ,y 0B ) and the second auxiliary focusing feature centroid coordinate (x 0C ,y 0C );
[0079] ;
[0080] ;
[0081] ;
[0082] ;
[0083] Wherein, n is the total number of first auxiliary focus feature points in the initial template T0, and m is the total number of second auxiliary focus feature points in the initial template T0.
[0084] It should be noted that the coordinates of the center of gravity of the first auxiliary focus feature in the initial template T0 (x 0B ,y 0B Similarly, by calculating the average horizontal coordinates and the average vertical coordinates of all the second auxiliary focus feature points in the initial template T0, the coordinates of the center of gravity of the second auxiliary focus feature in the initial template T0 (x 0C ,y 0C ).
[0085] According to an embodiment of the present invention, determining the initial angle h0 includes:
[0086] According to the first auxiliary focusing feature center coordinate (x 0B ,y 0B ) and the second auxiliary focusing feature centroid coordinate (x 0C ,y 0C ) Calculate the initial angle h0:
[0087] .
[0088] It should be noted that the coordinates of the center of gravity of the first auxiliary focusing feature (x 0B ,y 0B ) and the second auxiliary focusing feature centroid coordinate (x 0C ,y 0C ) to calculate and determine the initial angle h0.
[0089] According to an embodiment of the present invention, based on the overall rotation angle h tNeighborhood matching is performed on the reference focus feature point, the first auxiliary focus feature point, and the second auxiliary focus feature point, respectively, including:
[0090] According to the overall rotation angle h t and the preset angle range threshold t0 to determine the input matching angle range h t ±t0;
[0091] Based on the input matching angle range h t ±t0, perform neighborhood matching on the benchmark focus feature points using the preset common template matching method to determine the position coordinates of the benchmark focus feature matching result (x A_1 ,y A_1 ) and the first angle h1; performing neighborhood matching on the first auxiliary focus feature point by a preset ordinary template matching method to determine the position coordinates of the first auxiliary focus matching result (x B_1 ,y B_1 ) and the second angle h2; performing neighborhood matching on the second auxiliary focus feature point by a preset ordinary template matching method to determine the position coordinates of the second auxiliary focus matching result (x C_1 ,y C_1 ) and a third angle h3.
[0092] It should be noted that for the reference focus feature, the feature points input in the ordinary matching are only the reference focus feature points, and the input matching angle range is h t -t0 to h t +t0. The preset angle range threshold t0 is set by the system, and the matching neighborhood is the rough position coordinate (x t ,y t ), and again using the search image input by the user as input, the position coordinates of the benchmark focus feature matching result (x A_1 ,y A_1 ) and the first angle h1. Similarly, by controlling the input feature points to be only the first auxiliary focus feature points and only the second auxiliary focus feature points, the first auxiliary focus matching result position coordinates (x B_1 ,y B_1 ) and the second angle h2, and the position coordinates of the second auxiliary focus matching result (x C_1 ,y C_1 ) and a third angle h3.
[0093] According to an embodiment of the present invention, the coordinates of the center of gravity of the first auxiliary focusing feature (x 2B ,y 2B ) and the second auxiliary focusing feature centroid coordinate (x 3C ,y 3C ),include:
[0094] Rotate the initial template T0 according to the second angle h2 to determine a second rotated template T2;
[0095] Calculate the coordinates of the center of gravity of the first auxiliary focusing feature (x 2B ,y 2B );
[0096] ;
[0097] ;
[0098] Among them, x 2Bi and y 2Bi are the horizontal and vertical coordinates of the i-th first auxiliary focus feature point in the second rotation template T2, n is the total number of first auxiliary focus feature points in the second rotation template T2, x b2 and y b2 is the reference value of the horizontal and vertical coordinates after the second rotation template T2 is cut, x B_1 and y B_1 are the horizontal and vertical coordinates of the first auxiliary focus matching result position, w t2 and h t2 are the width and height of the second rotating template T2 respectively;
[0099] Rotate the initial template T0 according to the third angle h3 to determine a third rotated template T3;
[0100] The coordinates of the center of gravity of the second auxiliary focusing feature (x 3C ,y 3C );
[0101] ;
[0102] ;
[0103] Among them, x 3Cj and y 3Cj are the horizontal and vertical coordinates of the jth second auxiliary focus feature point in the third rotation template T3, m is the total number of second auxiliary focus feature points in the third rotation template T3, x is the horizontal and vertical coordinates of the jth second auxiliary focus feature point in the third rotation template T3, c3 and y c3 is the reference value of the horizontal and vertical coordinates after the third rotation template T3 is cut, x C_1 and y C_1 are the horizontal and vertical coordinates of the second auxiliary focus matching result position, w t3 and h t3 are the width and height of the third rotation template T3 respectively.
[0104] It should be noted that the total number of first auxiliary focusing feature points in the second rotation template T2 is the same as the total number in the initial template T0, both of which are n first auxiliary focusing feature points; the total number of second auxiliary focusing feature points in the third rotation template T3 is the same as the total number in the initial template T0, both of which are m second auxiliary focusing feature points.
[0105] The reference value is set by the system and is a constant, usually set to 5, that is, x b2 、y b2 、x c3 and y c3 The value of is always 5. Cropping is based on the minimum x and y values of the feature. Taking the horizontal coordinate reference value as an example, if the minimum x value in the feature point set is 100 and the reference value is 5, then all x values are subtracted by 95 to make the minimum value 5.
[0106] According to an embodiment of the present invention, the equivalent angle h is determined e ,include:
[0107] According to the first auxiliary focusing feature center coordinates (x 2B ,y 2B ) and the second auxiliary focusing feature centroid coordinate (x 3C ,y 3C ) Calculate the equivalent angle h e :
[0108] .
[0109] It should be noted that the coordinates of the center of gravity of the first auxiliary focusing feature (x 2B ,y 2B ) and the second auxiliary focusing feature centroid coordinate (x 3C ,y 3C ) to calculate and determine the equivalent angle h e .
[0110] The information involved in this application (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals (including but not limited to signals transmitted between user terminals and other devices, etc.) are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the "first template image I0 input by the user" and the "search image input by the user" involved in this disclosure are all obtained with full authorization.
[0111] The present invention discloses a machine vision matching method based on focus features. The method includes: extracting features from a first template image to construct a feature point set; screening the feature point set to determine a baseline focus feature point and an auxiliary focus feature point; analyzing the search image using a preset common template matching method to determine rough position coordinates and an overall rotation angle; calculating the coordinates of the center of gravity of the auxiliary focus feature in the initial template to determine an initial angle; performing neighborhood matching on the baseline focus feature point and the auxiliary focus feature point based on the overall rotation angle, calculating the coordinates of the center of gravity of the auxiliary focus feature and determining an equivalent angle; calculating the angular difference between the equivalent angle and the initial angle to determine the actual angle; performing neighborhood matching on the baseline focus feature point to determine the position coordinates of the optimal baseline focus feature matching result. The present invention can accurately match features of interest to users, improving the accuracy and reliability of matching.
[0112] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0113] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed across multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0114] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0115] Those skilled in the art will appreciate that all or part of the steps of the above-mentioned method embodiments may be implemented by hardware associated with program instructions, and the aforementioned program may be stored in a computer-readable storage medium. When the program is executed, the program executes the steps of the above-mentioned method embodiments. The aforementioned storage medium includes various media that can store program codes, such as mobile storage devices, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks.
[0116] Alternatively, if the integrated units described above are implemented as software modules and sold or used as standalone products, they can also be stored on a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present invention, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product, stored on a storage medium, includes instructions for enabling a computer device (such as a personal computer, server, or network device) to execute all or part of the methods described in various embodiments of the present invention. The aforementioned storage media include various media capable of storing program code, such as removable storage devices, ROM, RAM, magnetic disks, or optical disks.
Claims
1. A machine vision matching method based on focus features, characterized in that: include: Perform feature extraction on the first template image I0 input by the user and construct a feature point set P; Screening the feature points in the feature point set P according to the reference focus feature, the first auxiliary focus feature, and the second auxiliary focus feature to determine the reference focus feature point, the first auxiliary focus feature point, and the second auxiliary focus feature point; The search image input by the user is analyzed by the preset common template matching method to determine the rough position coordinates (x t ,y t ) and the overall rotation angle h t ; The coordinates of the center of gravity of the first auxiliary focus feature (x) in the initial template T0 are calculated based on the first auxiliary focus feature point and the second auxiliary focus feature point. 0B ,y 0B ) and the second auxiliary focusing feature centroid coordinate (x 0C ,y 0C ), determine the initial angle h0; Based on the overall rotation angle h t Perform neighborhood matching on the reference focus feature point, the first auxiliary focus feature point and the second auxiliary focus feature point respectively, and calculate the coordinates of the center of gravity of the first auxiliary focus feature (x 2B ,y 2B ) and the second auxiliary focusing feature centroid coordinate (x 3C ,y 3C ), determine the equivalent angle h e ; Calculate the equivalent angle h e The angle difference between the initial angle h0 and the actual angle h is determined r ; Based on the actual angle h r , neighborhood matching is performed on the reference focus feature points using a preset common template matching method to determine the position coordinates (x, y) of the optimal reference focus feature matching result.
2. The machine vision matching method based on focus features according to claim 1, characterized in that: The step of extracting features from the first template image I0 input by the user and constructing a feature point set P includes: Performing bilateral filtering on the first template image I0 to obtain a second template image I1; Feature extraction is performed on the second template image I1, and the extracted feature points are added to the feature point set P.
3. The machine vision matching method based on focus features according to claim 1, characterized in that: The step of screening the feature points in the feature point set P according to the reference focus feature, the first auxiliary focus feature, and the second auxiliary focus feature to determine the reference focus feature point, the first auxiliary focus feature point, and the second auxiliary focus feature point includes: Visually displaying the feature point set P on a preset display interface, determining a feature that the user selects on the preset display interface and that is of greatest concern for matching accuracy as a reference focus feature, and determining two features at both ends of the template image selected by the user on the preset display interface as first auxiliary focus features and second auxiliary focus features, respectively; The feature points belonging to the reference focus feature are added to the reference focus feature point set A, the feature points belonging to the first auxiliary focus feature are added to the first auxiliary focus feature point set B, and the feature points belonging to the second auxiliary focus feature are added to the second auxiliary focus feature point set C.
4. The machine vision matching method based on focus features according to claim 1, characterized in that: The coordinates of the center of gravity of the first auxiliary focus feature (x) in the initial template T0 are calculated based on the first auxiliary focus feature point and the second auxiliary focus feature point. 0B ,y 0B ) and the second auxiliary focusing feature centroid coordinate (x 0C ,y 0C ),include: Get the coordinates (x) of the i-th first auxiliary focus feature point in the initial template T0 0Bi ,y 0Bi ) and the coordinates of the jth second auxiliary focusing feature point (x 0Cj ,y 0Cj ); According to the coordinates (x 0Bi ,y 0Bi ) and the coordinates of the jth second auxiliary focusing feature point (x 0Cj ,y 0Cj ) Calculate the coordinates of the center of gravity of the first auxiliary focusing feature in the initial template T0 (x 0B ,y 0B ) and the second auxiliary focusing feature centroid coordinate (x 0C ,y 0C ); ; ; ; ; Wherein, n is the total number of first auxiliary focus feature points in the initial template T0, and m is the total number of second auxiliary focus feature points in the initial template T0.
5. The machine vision matching method based on focus features according to claim 4, characterized in that: The determining of the initial angle h0 includes: According to the first auxiliary focusing feature center coordinates (x 0B ,y 0B ) and the second auxiliary focusing feature centroid coordinate (x 0C ,y 0C ) Calculate the initial angle h0: 。 6. The machine vision matching method based on focus features according to claim 1, characterized in that: Based on the overall rotation angle h t Performing neighborhood matching on the reference focus feature point, the first auxiliary focus feature point, and the second auxiliary focus feature point respectively includes: According to the overall rotation angle h t and the preset angle range threshold t0 to determine the input matching angle range h t ±t0; Based on the input matching angle range h t ±t0, perform neighborhood matching on the benchmark focus feature points using the preset common template matching method to determine the position coordinates of the benchmark focus feature matching result (x A_1 ,y A_1 ) and the first angle h1; performing neighborhood matching on the first auxiliary focus feature point by a preset ordinary template matching method to determine the position coordinates of the first auxiliary focus matching result (x B_1 ,y B_1 ) and the second angle h2; performing neighborhood matching on the second auxiliary focus feature point by a preset ordinary template matching method to determine the position coordinates of the second auxiliary focus matching result (x C_1 ,y C_1 ) and a third angle h3.
7. The machine vision matching method based on focus features according to claim 6, characterized in that: The calculation of the first auxiliary focusing feature center of gravity coordinate (x 2B ,y 2B ) and the second auxiliary focusing feature centroid coordinate (x 3C ,y 3C ),include: Rotate the initial template T0 according to the second angle h2 to determine a second rotated template T2; The coordinates of the center of gravity of the first auxiliary focusing feature (x 2B ,y 2B ); ; ; Among them, x 2Bi and y 2Bi are the horizontal and vertical coordinates of the i-th first auxiliary focus feature point in the second rotation template T2, n is the total number of first auxiliary focus feature points in the second rotation template T2, x b2 and y b2 is the reference value of the horizontal and vertical coordinates after the second rotation template T2 is cut, x B_1 and y B_1 are the horizontal and vertical coordinates of the first auxiliary focus matching result position, w t2 and h t2 are the width and height of the second rotating template T2 respectively; Rotate the initial template T0 according to a third angle h3 to determine a third rotated template T3; The coordinates of the center of gravity of the second auxiliary focusing feature (x 3C ,y 3C ); ; ; Among them, x 3Cj and y 3Cj are the horizontal and vertical coordinates of the jth second auxiliary focus feature point in the third rotation template T3, m is the total number of second auxiliary focus feature points in the third rotation template T3, x is the horizontal and vertical coordinates of the jth second auxiliary focus feature point in the third rotation template T3, c3 and y c3 is the reference value of the horizontal and vertical coordinates after the third rotation template T3 is cut, x C_1 and y C_1 are the horizontal and vertical coordinates of the second auxiliary focus matching result position, w t3 and h t3 are the width and height of the third rotation template T3 respectively.
8. The machine vision matching method based on focus features according to claim 7, characterized in that: Determining the equivalent angle h e ,include: According to the first auxiliary focusing feature center coordinates (x 2B ,y 2B ) and the second auxiliary focusing feature centroid coordinate (x 3C ,y 3C ) Calculate the equivalent angle h e : 。
Citation Information
Patent Citations
Apparatus and method for determining rotation angle of object, and computer-readable storage medium storing instructions to perform method for determining rotation angle of object
US20240202972A1
Visual tracking method of robot
WO2023236733A1