Template matching method, template matching device and computer storage medium

By dynamically updating the template matching method of template feature point set, the problem that traditional template matching methods cannot accurately match the target in a changing environment is solved, and higher stability and applicability are achieved.

CN119919689APending Publication Date: 2025-05-02ZHEJIANG HUARAY TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411785271.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

Traditional template matching methods cannot accurately match the target when environmental conditions, appearance of target objects or lighting conditions change, resulting in insufficient positioning accuracy and speed, affecting the success of the application.

Method used

A template matching method is proposed. By obtaining several template feature points sets of matching templates, using each template feature point set to match the image to be matched, the highest matching score of the template feature points set in each template feature point set is obtained, the matching result is determined based on these matching scores, and the template feature point set is dynamically updated during the matching process.

Benefits of technology

It improves the stability and applicability of template matching, can adapt to various changes in the scenario, and enhances the matching accuracy and efficiency in changing environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119919689A_ABST
    Figure CN119919689A_ABST
Patent Text Reader

Abstract

The invention provides a template matching method, a template matching device and a computer storage medium. The template matching method comprises the steps that a plurality of template feature point sets of a matching template are obtained, and each template feature point set at least comprises one template feature point; matching each template feature point set with an image to be matched; obtaining the highest matching score of the template feature points in each template feature point set at each matching position, and taking the highest matching score as the matching score of each template feature point set; and determining a matching result at each matching position based on the matching scores of the plurality of template feature point sets. Through the template matching method, the template matching stability is improved by utilizing the added template feature points, various changes in a scene can be adapted, and the template matching applicability is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of machine vision technology, and in particular to a template matching method, a template matching device and a computer storage medium. Background Art

[0002] Template matching is one of the core algorithms of machine vision. Matching positioning is the first step in machine vision applications. The accuracy and speed of positioning determine the key to the success of the application.

[0003] Traditional template matching methods usually use fixed templates, which means that once the environmental conditions, the appearance of the target object or the lighting conditions change, the template may not accurately match the target. Summary of the invention

[0004] In order to solve the above technical problems, the present application proposes a template matching method, a template matching device and a computer storage medium.

[0005] In order to solve the above technical problems, the present application proposes a template matching method, which includes:

[0006] Acquire a plurality of template feature point sets of a matching template, wherein the template feature point sets include at least one template feature point;

[0007] Use each template feature point set to match the image to be matched;

[0008] At each matching position, obtaining the highest matching score of the template feature points in each template feature point set as the matching score of each template feature point set;

[0009] A matching result is determined at each matching position based on the matching scores of the plurality of template feature point sets.

[0010] Wherein, the matching of each template feature point set with the image to be matched includes:

[0011] Obtaining a matching score between each template feature point in the template feature point set and an image feature point at a matching position of the image to be matched;

[0012] In response to the matching score between the image feature point and the template feature point being greater than or equal to a preset threshold, the image feature point is added to a template feature point set where the template feature point is located.

[0013] Wherein, after obtaining the matching score between each template feature point in the template feature point set and the image feature point of the to-be-matched image at the matching position, the template matching method further comprises:

[0014] In response to the absence of the image feature point, or the existence of the image feature point and the matching score of the template feature point being less than the preset threshold, continue searching for other image feature points within a preset range of the image to be matched along the gradient direction of the template feature point.

[0015] Wherein, adding the image feature point to the template feature point set where the template feature point is located comprises:

[0016] Determine whether the number of feature points in the template feature point set where the template feature point is located reaches a preset number threshold;

[0017] If not, the image feature point is added to the template feature point set where the template feature point is located.

[0018] Wherein, adding the image feature point to the template feature point set where the template feature point is located comprises:

[0019] In response to the number of feature points in the template feature point set where the template feature point is located reaching the preset number threshold, obtaining the activity level of each template feature point in the template feature point set;

[0020] removing the template feature point with the lowest activity level from the template feature point set;

[0021] The image feature point is added to the template feature point set where the template feature point is located.

[0022] The activity level of each template feature point is determined according to the number of times the template feature point is inactive; and the template feature point is determined to be inactive if the matching score calculated during the matching process is less than the preset threshold.

[0023] Wherein, the template matching method further includes:

[0024] Obtain the number of inactivity durations of each template feature point in each template feature point set;

[0025] The template feature points whose inactivity duration times are greater than or equal to a preset times threshold are removed from the template feature point set.

[0026] The removing of the template feature points whose inactivity duration times is greater than or equal to a preset times threshold from the template feature point set includes:

[0027] The template feature points whose inactivity duration times are greater than or equal to a preset times threshold and are not initial feature points are removed from the template feature point set.

[0028] To solve the above technical problems, the present application also proposes a template matching device, which includes a memory and a processor coupled to the memory; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the template matching method as described above.

[0029] In order to solve the above technical problems, the present application also proposes a computer storage medium, wherein the computer storage medium is used to store program data, and when the program data is executed by a computer, it is used to implement the above template matching method.

[0030] Compared with the prior art, the beneficial effects of the present application are as follows: the template matching device obtains several template feature point sets of the matching template, wherein the template feature point set includes at least one template feature point; each template feature point set is used to match the image to be matched; the highest matching score of the template feature points in each template feature point set is obtained at each matching position as the matching score of each template feature point set; and the matching result is determined at each matching position based on the matching scores of the several template feature point sets. Through the above template matching method, the template matching stability is improved by using the added template feature points, and it can adapt to various changes in the scene and improve the applicability of template matching. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0032] in:

[0033] Figure 1 It is a schematic diagram of the flow chart of the first embodiment of the template matching method provided by the present application;

[0034] Figure 2 is a schematic diagram of an embodiment of a target image provided by the present application;

[0035] Figure 3 yes Figure 2 Schematic diagram of edge features of the target image shown;

[0036] Figure 4 is a reference schematic diagram of the template matching pyramid provided in this application;

[0037] Figure 5 It is a schematic diagram of the flow chart of the second embodiment of the template matching method provided by the present application;

[0038] Figure 6is a schematic diagram of the flow chart of the third embodiment of the template matching method provided by the present application;

[0039] Figure 7 is a schematic diagram of the flow chart of the fourth embodiment of the template matching method provided by the present application;

[0040] Figure 8 is a structural schematic diagram of an embodiment of a template matching device provided by the present application;

[0041] Fig. 9 It is a structural diagram of an embodiment of a computer storage medium provided by the present application. DETAILED DESCRIPTION

[0042] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0043] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0044] The usual template matching consists of two stages. The first stage is offline template training, which is to select the image target to be matched. In this stage, feature extraction and feature information storage can be completed. The second stage is online template matching, which searches and locates the posture of the template trained in the first stage in the matching image. The posture information includes position coordinates, rotation angle, and scaling.

[0045] According to the different features selected, it can be divided into: template matching based on edge features; template matching method based on correlation; template matching method based on feature points. Template matching method based on edge features, because edge features themselves can be extracted with very high sub-pixel accuracy, the final matching positioning accuracy can reach 1 / 40 pixel positioning accuracy. Matching methods based on edge features are also the most widely used in the field of machine vision.

[0046] Template matching is widely used in target positioning, target recognition, image registration, and robot guidance. Template matching returns the target's position coordinates, angle, scale, and matching score. Positioning guidance can be performed based on the template position information, and the actual matching results can also be used to determine whether the matching target in the current scene is abnormal. For example, positioning on the assembly line determines whether the workpiece is missing (based on the score); whether the direction is consistent (based on the angle); and whether products of other specifications are mixed in (based on the scale).

[0047] The present application mainly provides a method for dynamically updating template feature points for template matching based on edge features, allowing the template to be adjusted according to the actual matching results, thereby improving the applicability and robustness in a changing environment.

[0048] Specifically, the dynamic template update method of the present application provides a more flexible, efficient and adaptive solution for machine vision systems, which is particularly suitable for real-time processing scenarios with ever-changing applications. The innovation of this method is that it can optimize its performance autonomously without human intervention, thereby improving accuracy while reducing operational complexity and cost.

[0049] Please refer to Figure 1 , Figure 1 It is a flowchart of the first embodiment of the template matching method provided in this application.

[0050] The template matching method of the present application is applied to a template matching device, wherein the template matching device of the present application can be a server, a terminal device, or a system in which a server and a terminal device cooperate with each other. Accordingly, the various parts included in the template matching device, such as various units, subunits, modules, and submodules, can all be set in the server, can all be set in the terminal device, or can be set in the server and the terminal device respectively.

[0051] Furthermore, the above-mentioned server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules, such as software or software modules used to provide distributed servers, or it can be implemented as a single software or software module, which is not specifically limited here.

[0052] like Figure 1 As shown, the specific steps are as follows:

[0053] Step S11: obtaining a plurality of template feature point sets of a matching template, wherein the template feature point set includes at least one template feature point.

[0054] In the embodiment of the present application, the template matching device extracts a plurality of template feature point sets of the matching template, wherein each template feature point set includes one or more template feature points.

[0055] Specifically, the template feature point set referred to in this application is the initial feature points obtained by template training, which are further matched with other image feature points in the subsequent template matching process to combine the initial feature points and other image feature points to form the template feature point set.

[0056] Compared with the prior art, in which each position in the matching template has only one template feature point, the contribution of the template feature point to the matching cannot be reflected in the following two situations: 1. The position corresponding to the image to be matched is blocked; 2. The acquisition parameters or environmental parameters change, resulting in changes in the performance of the same target on the image.

[0057] The main improvement of the present application is that in the template matching process, the successfully matched image feature points are added to the template feature point set to adapt to the different performances of the same target in different scenes.

[0058] Specifically, template matching includes two stages: template training and template matching. In the template training stage, the template matching device extracts the target image (such as Figure 2 The edge features are shown in Figure 2, and the extracted feature map is shown in Figure 2. Figure 3 As shown. Among them, Figure 2 is a schematic diagram of an embodiment of a target image provided by the present application, Figure 3 yes Figure 2 Schematic diagram of edge features of the target image shown.

[0059] The template matching device calculates the gradient information of each edge point (m x ,m y ), and normalize it Get the edge point features, that is, the initial feature points.

[0060] Step S12: Use each template feature point set to match the image to be matched.

[0061] In the embodiment of the present application, the template matching device matches each template feature point set with the image to be matched.

[0062] Specifically, the template matching process of this application is as follows:

[0063] Usually the template matching process follows the order of the pyramid, from top to bottom, from coarse to fine matching, and continuously searches for more accurate poses of the target at the bottom of the pyramid based on the candidate target. Figure 4 (Refer to halcon documentation), Figure 4 This is a reference diagram of the template matching pyramid provided by this application:

[0064] When the template matching device traverses the search on each layer of the pyramid (position, angle, scale), it is necessary to calculate the similarity between the template and the search image. Usually, shape-based template matching uses the cosine angle method to calculate:

[0065]

[0066] Wherein, n is the number of feature points of the matching template, that is, the number of template feature point sets; A is the template feature point, and B is the image feature point.

[0067] When the angle is smaller, the score is higher. When the angle is 0, the score is 1, indicating that the current search parameters (position, angle, scale) of the template have a high similarity with the search image.

[0068] The hierarchical structure of the pyramid is a necessary strategy to accelerate the matching algorithm. The top-level pyramid quickly screens out candidate targets, which are then judged layer by layer by the bottom-level pyramid and finally output as matching results.

[0069] However, in actual applications, various complex scenarios will arise, and relying solely on theoretical formula calculations cannot solve the problems encountered in actual production. This application proposes a solution for application scenarios where the background of the matching target is fixed, and improves the matching stability and matching performance of the template matching algorithm. Shape-based template matching uses gradient as the matching feature, and the gradient feature information is saved in the training template. The gradient feature map also needs to be calculated in the matching image, and then the template is traversed in the matching gradient image to calculate the matching scores under different positions, angles, and scale parameter spaces.

[0070] Step S13: obtaining the highest matching score of the template feature points in each template feature point set at each matching position as the matching score of each template feature point set.

[0071] In the embodiment of the present application, since in the template matching process of step S12, the template matching device uses the template feature point set for matching, and each template feature point set contributes only one matching score to the entire template. The template matching device obtains the matching score of each template feature point in the template feature point set, and then uses the highest matching score as the matching score contributed by the template feature point set.

[0072] Among them, the matching score is the similarity score between the template feature point and the image feature point.

[0073] It should be noted that if a template feature point cannot be searched for an image feature point within the search range, the matching score of the template feature point is 0.

[0074] Step S14: determining a matching result at each matching position based on the matching scores of the plurality of template feature point sets.

[0075] In the embodiment of the present application, the template matching device combines the matching scores of all template feature point sets at each matching position of the image to be matched to obtain the similarity between the matching template and the regional image of the image to be matched at the matching position. Finally, the template matching device marks the regional image whose similarity reaches a preset threshold as an area where a candidate target exists. If the similarity does not reach the preset threshold, there is no candidate target in the regional image.

[0076] In the present application, the template matching device obtains several template feature point sets of the matching template, wherein the template feature point set includes at least one template feature point; uses each template feature point set to match with the image to be matched; obtains the highest matching score of the template feature points in each template feature point set at each matching position as the matching score of each template feature point set; and determines the matching result at each matching position based on the matching scores of the several template feature point sets. Through the above template matching method, the stability of template matching is improved by using the added template feature points, and it can adapt to various changes in the scene and improve the applicability of template matching.

[0077] Furthermore, this application also provides a corresponding update strategy for the above template feature point set, please refer to Figure 5 , Figure 5 It is a flowchart of the second embodiment of the template matching method provided in this application.

[0078] In the template matching method of the embodiment of the present application, when the template matching device successfully matches the template feature point to the corresponding image feature point during the template matching process, the image feature point can be added to the template feature point set to become a new template feature point. The condition for the successful matching of the template feature point and the image feature point is that the matching score of the template feature point and the image feature point is higher than the preset score threshold T.

[0079] It should be noted that, in order to facilitate the maintenance of the template feature point set, the template matching device can also limit the maximum number of template feature point sets. For example, when the template matching device learns that the number of feature points in the template feature point set where the template feature point is located has not reached the maximum number, the successfully matched image feature point can be directly added to the template feature point set where the template feature point is located. When the number of feature points in the template feature point set where the template feature point is located reaches the maximum number, it is necessary to remove some of the template feature points in the template feature point set, and then add the successfully matched image feature point to the template feature point set where the template feature point is located.

[0080] like Figure 5As shown, the specific steps are as follows:

[0081] Step S21: Obtaining a matching score between each template feature point in the template feature point set and an image feature point at a matching position of the image to be matched.

[0082] Step S22: in response to the matching score between the image feature point and the template feature point being greater than or equal to a preset threshold, the image feature point is added to the template feature point set where the template feature point is located.

[0083] Step S23: In response to the absence of image feature points, or the matching score between the existing image feature points and the template feature points is less than a preset threshold, continue searching for other image feature points within a preset range of the image to be matched along the gradient direction of the template feature points.

[0084] In the embodiment of the present application, when the matching score between the template feature point and the corresponding image feature point is less than the threshold T, the template matching device needs to search for possible matching feature points around the current image point. The specific search strategy is as follows:

[0085] Search in both the positive and negative directions along the gradient direction of the template feature point. The specific search range can be set by parameters. If an image feature point that meets the matching score threshold is found, the point is added to the current template point.

[0086] In the actual matching process, each template feature point in the template feature point set needs to participate in the matching, and the matching score of the template feature point with the highest matching score is selected as the matching score of the current template feature point set.

[0087] From this, it can be seen that the template matching method of the present application is different from the traditional template matching, and each template feature point is expanded into a template feature point set. Here, it is assumed that the maximum number of template feature point sets corresponding to each template feature point is 3. The initial situation of the template feature point set is that the number of point sets is 1, that is, it only contains the initial feature points obtained by template training.

[0088] For more information about the template feature point set update strategy, please continue to refer to Figure 6 , Figure 6 It is a flowchart of the third embodiment of the template matching method provided in this application. Figure 6 The template matching method of defines a set of updating strategies for the template feature point set. Only the template feature points that have been active will be retained, and the template feature points that have not been selected for a long time need to be removed from the point set. It should be noted here that the template feature point set needs to contain at least one template feature point.

[0089] like Figure 6 As shown, the specific steps are as follows:

[0090] Step S31: in response to the number of feature points in the template feature point set where the template feature point is located reaching a preset number threshold, the activity level of each template feature point in the template feature point set is obtained.

[0091] In the embodiment of the present application, when the template feature point set does not reach the maximum number, the template matching device only adds template feature points and does not remove template feature points.

[0092] The condition for adding a template feature point is that the remaining template feature points in the current template feature point set do not meet the threshold score T, the currently searched image feature point meets the threshold score, and the current image feature point is added to the template feature point set.

[0093] It should be noted here that the initial training template feature points come from the training image and are fixed, and new template feature points can only be obtained from the matching image.

[0094] When the feature points in the template point set reach the upper limit of the point set, the template matching device needs to be updated according to the activity level of the feature points.

[0095] Step S32: removing the template feature point with the lowest activity level from the template feature point set.

[0096] In the embodiment of the present application, it is assumed that the current template feature point set contains three template feature points, a1, a2, and a3, and N is set as the number of inactive durations. When the template feature point a1 fails to meet the matching threshold after N consecutive matches, the template feature point a1 is removed from the template feature point set. If the template feature point is inactive for less than N times, as long as there is a match that meets the threshold condition, the number of active times of the template feature point is recounted (the count is reset to zero).

[0097] It should be noted that, if the number of consecutive inactivity times of all template feature points in the current template feature point set does not reach the threshold, the template matching device may also remove the template feature point with the largest number of consecutive inactivity times.

[0098] Step S33: adding the image feature point to the template feature point set where the template feature point is located.

[0099] In the embodiment of the present application, after removing at least one template feature point, the template matching device can add the image feature point to the template feature point set where the template feature point is located as a new template feature point.

[0100] Above Figure 6 This paper implements the update strategy of the template feature point set in the template matching process. This application also provides the update strategy of the template feature point set in the daily maintenance process. Please refer to Figure 7 , Figure 7It is a flowchart of the fourth embodiment of the template matching method provided in this application.

[0101] like Figure 7 As shown, the specific steps are as follows:

[0102] Step S41: Obtain the inactivity duration times of each template feature point in each template feature point set.

[0103] Step S42: removing template feature points whose inactivity duration times are greater than or equal to a preset times threshold from the template feature point set.

[0104] In the embodiment of the present application, during routine maintenance, the template matching device can actively monitor the number of inactivity durations of each template feature point in the template feature point set. If the number of inactivity durations of a template feature point is greater than or equal to a preset number threshold, the template matching device can actively remove the template feature point from the template feature point set.

[0105] The advantage of the above-mentioned updating strategy for the template feature point set is that it can adapt to changes in the scene and improve the stability of template matching by adding template points. At the same time, it reduces unnecessary feature points in the template file to achieve the purpose of improving computing performance.

[0106] The beneficial effects of the template matching method of the present application are specifically manifested as follows:

[0107] Improved adaptability: Dynamically updated templates can self-adjust according to changing environmental conditions or target appearance, adapt to changing scenarios such as different lighting, seasons or background changes, and maintain stable matching performance.

[0108] Improve efficiency: Fixed templates often require more computing resources to try to match when processing complex or changing images, which reduces processing speed and efficiency. Dynamic templates can reduce invalid matching attempts and improve matching efficiency by optimizing the selection and use of feature points.

[0109] Reduced maintenance costs: Dynamic templates reduce the need for manual updates and automatically adapt to new matching conditions, reducing system maintenance costs and complexity in the long run.

[0110] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0111] In order to implement the above template matching method, this application also proposes a template matching device, please refer to Figure 8 , Figure 8 It is a structural diagram of an embodiment of a template matching device provided in the present application.

[0112] The template matching device 500 of this embodiment includes a processor 51 , a memory 52 , an input / output device 53 , and a bus 54 .

[0113] The processor 51 , the memory 52 , and the input / output device 53 are respectively connected to the bus 54 . The memory 52 stores program data, and the processor 51 is used to execute the program data to implement the template matching method described in the above embodiment.

[0114] In the embodiment of the present application, the processor 51 may also be referred to as a CPU (Central Processing Unit). The processor 51 may be an integrated circuit chip having the ability to process signals. The processor 51 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or the processor 51 may also be any conventional processor, etc.

[0115] This application also provides a computer storage medium, please continue to refer to Fig. 9 , Fig. 9 It is a schematic diagram of the structure of an embodiment of a computer storage medium provided in the present application. The computer storage medium 600 stores a computer program 61. When the computer program 61 is executed by a processor, it is used to implement the template matching method of the above embodiment.

[0116] When the embodiments of the present application are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.

[0117] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A template matching method, characterized in that: The template matching method comprises: Acquire a plurality of template feature point sets of a matching template, wherein the template feature point sets include at least one template feature point; Use each template feature point set to match the image to be matched; At each matching position, obtaining the highest matching score of the template feature points in each template feature point set as the matching score of each template feature point set; A matching result is determined at each matching position based on the matching scores of the plurality of template feature point sets.

2. The template matching method according to claim 1, characterized in that: The method of using each template feature point set to match the image to be matched includes: Obtaining a matching score between each template feature point in the template feature point set and an image feature point at a matching position of the image to be matched; In response to the matching score between the image feature point and the template feature point being greater than or equal to a preset threshold, the image feature point is added to a template feature point set where the template feature point is located.

3. The template matching method according to claim 2, characterized in that: After obtaining the matching score between each template feature point in the template feature point set and the image feature point of the to-be-matched image at the matching position, the template matching method further comprises: In response to the absence of the image feature point, or the existence of the image feature point and the matching score of the template feature point being less than the preset threshold, continue searching for other image feature points within a preset range of the image to be matched along the gradient direction of the template feature point.

4. The template matching method according to claim 2, characterized in that: The adding the image feature point to the template feature point set where the template feature point is located comprises: Determine whether the number of feature points in the template feature point set where the template feature point is located reaches a preset number threshold; If not, the image feature point is added to the template feature point set where the template feature point is located.

5. The template matching method according to claim 4, characterized in that: The adding the image feature point to the template feature point set where the template feature point is located comprises: In response to the number of feature points in the template feature point set where the template feature point is located reaching the preset number threshold, obtaining the activity level of each template feature point in the template feature point set; removing the template feature point with the lowest activity from the template feature point set; The image feature point is added to the template feature point set where the template feature point is located.

6. The template matching method according to claim 5, characterized in that: The activity level of each template feature point is determined according to the number of times the template feature point has been inactive; wherein, the template feature point is determined to be inactive if the matching score calculated during the matching process is less than the preset threshold.

7. The template matching method according to claim 1, characterized in that: The template matching method further includes: Obtain the number of inactivity durations of each template feature point in each template feature point set; The template feature points whose inactivity duration times are greater than or equal to a preset times threshold are removed from the template feature point set.

8. The template matching method according to claim 7, characterized in that: The removing the template feature points whose inactivity duration times are greater than or equal to a preset times threshold from the template feature point set includes: The template feature points whose inactivity duration times are greater than or equal to a preset times threshold and are not initial feature points are removed from the template feature point set.

9. A template matching device, characterized in that: The template matching device includes a memory and a processor coupled to the memory; The memory is used to store program data, and the processor is used to execute the program data to implement the template matching method according to any one of claims 1 to 8.

10. A computer storage medium, characterized in that: The computer storage medium is used to store program data, and when the program data is executed by a computer, it is used to implement the template matching method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Machine vision matching method capable of customizing weight

    CN120182643A