Image template matching method, monitoring system, device and storage medium
By using the image template matching method in PCB quality detection, the feature matching model and the homography matrix H are used to perform feature point pairing and degree of difference calculation, the problems of large calculation load and low efficiency in the prior art are solved, and fast and accurate defect detection is achieved to meet the real-time requirements of large-scale production.
Patent Information
- Application Number
- CN202411919523.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-25
AI Technical Summary
In PCB quality detection, the calculation load is large, the analysis efficiency is low, and the processing time is long in the process of image template matching, especially in complex situations, which cannot meet the real-time requirements of large-scale production.
An image template matching method is adopted, by obtaining the acquired image and template images, the first feature matching model and the second feature matching model are used to extract feature points, normalize and merge, and a homography matrix H is obtained using a random sampling consistency algorithm, pairing feature points and satisfying the optoelectrode geometric constraints, and finally the defect location is calculated by the degree of difference.
It reduces the calculation load, improves the analysis efficiency, shortens the processing time, and can detect the defect location of the PCB more quickly, meeting the real-time requirements of large-scale production.
Smart Images

Figure CN119888279A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer image analysis, and in particular to an image template matching method and a monitoring system, device, and storage medium. Background Art
[0002] With the development of the electronics industry, the complexity and density of electronic circuits carried by PCBs are increasing. The quality of the electronic circuits on PCBs needs to be tested before they leave the factory, but traditional manual testing methods can no longer meet the needs of modern production lines.
[0003] Automatic optical inspection (AOI) is an efficient and accurate inspection method that can be introduced into the quality inspection process of PCBs and has been widely used in the PCB manufacturing industry. Automatic optical inspection can obtain defective areas on the surface of the sampled image by collecting images of the PCB and analyzing the collected images and template images, thereby reminding quality inspectors to inspect the PCB. Among them, the existing analysis method for the collected images and template images is to use a feature extraction model to extract feature points in the collected images, and then associate the corresponding feature points with the feature points in the template image, and then compare them.
[0004] However, with the increasing complexity of PCB design and the continuous increase in production speed, the details of the PCB surface are numerous, resulting in omissions in the extraction of feature points. In addition, due to the existence of operations such as rotation and translation of the PCB, the matching processing load of the feature points is large, which cannot cope with the need for rapid detection of a large number of images in large-scale PCB production. Especially when dealing with complex situations, problems such as large amount of calculation and slow speed are prominent, which cannot meet the real-time requirements of large-scale production. Summary of the invention
[0005] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes an image template matching method and a monitoring system, device, and storage medium to reduce the computational load, improve the analysis efficiency, and shorten the processing time.
[0006] According to an embodiment of the first aspect of the present invention, an image template matching method includes: acquiring a captured image and a template image; extracting each feature point of the captured image respectively through at least a first feature matching model and a second feature matching model to obtain a first captured feature data set and a second captured feature data set; normalizing the feature point data in the first captured feature data set and the feature point data in the second captured feature data set and merging them into a captured feature data set; obtaining a homography matrix H using a random sampling consistency algorithm, and pairing each feature point in the captured feature data set with each feature point in the template feature data set according to the homography matrix H to obtain a plurality of matching point groups, wherein the matching point groups include points that satisfy epipolar geometry constraints. The feature points in the collection feature data collection and the feature points in the template feature data collection, wherein the feature points in the template feature data collection include feature point data in a first template feature data set and feature point data in a second template feature data set that are normalized and merged, the first template feature data set is obtained by extracting each feature point of the template image by a first feature matching model, and the second template feature data set is obtained by extracting each feature point of the template image by a second feature matching model; respectively, the difference degree of the feature points in the collection feature data collection and the feature points in the template feature data collection in each matching point group is calculated to obtain the difference degree information; the defect position is obtained according to the difference degree information, and the defect position is output.
[0007] An image template matching method according to an embodiment of the present invention has at least the following beneficial effects:
[0008] The image template matching method of the present invention, when acquiring a captured image, extracts each feature point of the captured image respectively through at least a first feature matching model and a second feature matching model, and then normalizes the extracted feature point data and merges them into a captured feature data collection, and uniformly pairs the feature points in the captured feature data collection with the feature points in the template feature data collection through a homography matrix H to form a matching point group, and then calculates the degree of difference between the feature points from the captured feature data collection and the feature points from the template feature data collection in the matching point group, if the difference is large, there is a defect, and the defect position is known, the design first narrows the matching range of the feature points through a random sampling consistency algorithm, so that the feature points that are paired with each other in the matching point group need to meet the epipolar geometry constraint, and then calculates the degree of difference, reduces the calculation load, improves the analysis efficiency, and shortens the processing time.
[0009] According to some embodiments of the present invention, the step of calculating the degree of difference between the feature points in the collected feature data collection and the feature points in the template feature data collection in each matching point group to obtain the degree of difference information includes: calculating the Euclidean distance values of the feature points in each group of mutually matching feature points in the collected feature data collection and the feature points in the template feature data collection; forming the degree of difference information according to the Euclidean distance values; and when the Euclidean distance value is greater than a distance threshold, obtaining the defect position according to the matching point group.
[0010] According to some embodiments of the present invention, the feature point data of the first acquisition feature data set and the second acquisition feature data set include each feature point and a descriptor corresponding to the feature point, wherein the descriptor includes a coordinate vector value of the feature point; the step of normalizing the feature point data in the first acquisition feature data set and the feature point data in the second acquisition feature data set and merging them into an acquisition feature data collection includes: normalizing the coordinate vector values of the descriptors in the first acquisition feature data set and the second acquisition feature data set to the same numerical specifications; merging each feature point of the first acquisition feature data set and the second acquisition feature data set to form a feature point list; and merging each coordinate vector value of the normalized first acquisition feature data set and the second acquisition feature data set to form a descriptor matrix.
[0011] According to some embodiments of the present invention, the step of pairing each feature point in the collected feature data collection with each feature point in the template feature data collection according to the homography matrix H to obtain multiple matching point groups includes a pairing step for each feature point in the collected feature data collection, wherein the pairing step includes: searching for a feature point P2 in the template feature data collection for a feature point P1 in the collected feature data collection according to the homography matrix H, the homogeneous coordinates of the feature point P1 are [x1, y1, 1], the homogeneous coordinates of the feature point P2 are [x2, y2, 1], and the paired feature points P1 in the collected feature data collection and P2 in the template feature data collection meet in, is the transposed matrix of the homogeneous coordinates of the feature point P2, and K is the epipolar geometry constraint threshold.
[0012] In searching the feature point P2 in the template feature data collection for the feature point P1 in the collected feature data collection according to the homography matrix H, the following steps are included:
[0013] Filter each feature point P2 in the template feature data collection;
[0014] when Then the feature point P2 is screened out;
[0015] when The feature point P2 and the feature point P1 form a matching point group.
[0016] According to some embodiments of the present invention, the acquisition of the acquisition image and the template image includes: constructing a world coordinate system based on the relationship between the line scan camera and the mobile platform for placing the object to be scanned; and converting the coordinates of the acquisition image and the coordinates of the template image into the world coordinate system.
[0017] According to some embodiments of the present invention, the initial transformation matrix of the world coordinate system is:
[0018]
[0019] Where W is the initial transformation matrix of the world coordinate system; R0 is the initial rotation matrix of the line scan camera relative to the object to be scanned, and D0 is the initial displacement matrix of the line scan camera relative to the object to be scanned;
[0020] When the mobile platform translates Δt at a speed v, the transformation matrix of the world coordinate system is:
[0021]
[0022] According to the second aspect of the present invention, the monitoring system includes: a mobile platform for carrying an object to be scanned; a line scan camera for scanning the object to be scanned and capturing an acquired image; a storage module for storing a template image; a control module connected to the line scan camera and the storage module, respectively, the control module executing the image template matching method disclosed in any of the above embodiments to obtain the defect position of the acquired image; and an output module, the control module being connected to the output module to output the defect position of the acquired image.
[0023] The monitoring system according to the embodiment of the present invention has at least the following beneficial effects:
[0024] The monitoring system of the present invention applies the image template matching method disclosed in any of the above embodiments to obtain the defect position of the collected image, reduce the calculation load, improve the analysis efficiency, and shorten the processing time.
[0025] According to the control device of the embodiment of the third aspect of the present invention, the control device includes a memory and a processor, the memory stores a computer program, and the processor implements the image template matching method disclosed in any of the above embodiments when executing the computer program.
[0026] According to the computer-readable storage medium of the fourth aspect of the present invention, the computer-readable storage medium stores a computer program, and is characterized in that when the computer program is executed by a processor, the image template matching method disclosed in any of the above embodiments is implemented.
[0027] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0029] Figure 1 A first flow chart of one embodiment of the image template matching method of the present invention;
[0030] Figure 2 A second flow chart of one embodiment of the image template matching method of the present invention;
[0031] Figure 3 It is a principle structure block diagram of one embodiment of the monitoring system of the present invention;
[0032] Figure 4 A schematic diagram of the structure of a line scan camera and a mobile platform of one embodiment of the monitoring system of the present invention;
[0033] Figure 5 This is a principle structural block diagram of one embodiment of the control device of the present invention.
[0034] Reference numerals:
[0035] Mobile platform 310 ; line scan camera 320 ; storage module 330 ; control module 400 ; output module 500 ; processor 610 ; memory 620 ; input / output interface 630 ; communication interface 640 ; bus 650 . DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0037] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0038] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0039] like Figure 1 As shown, an image template matching method according to an embodiment of the first aspect of the present invention includes:
[0040] S110, acquiring a captured image and a template image;
[0041] S120, extracting each feature point of the acquired image at least by using a first feature matching model and a second feature matching model, to obtain a first acquired feature data set and a second acquired feature data set;
[0042] S130, normalizing the feature point data in the first collected feature data set and the feature point data in the second collected feature data set and merging them into a collected feature data set;
[0043] S140, using a random sampling consistency algorithm to obtain a homography matrix H, and pairing each feature point in the collection feature data set with each feature point in the template feature data set according to the homography matrix H to obtain a plurality of matching point groups, wherein the matching point groups include feature points in the collection feature data set and feature points in the template feature data set that satisfy epipolar geometry constraints, wherein the feature points in the template feature data set include feature point data in a first template feature data set and feature point data in a second template feature data set that are normalized and merged, the first template feature data set is obtained by extracting each feature point of the template image using a first feature matching model, and the second template feature data set is obtained by extracting each feature point of the template image using a second feature matching model;
[0044] S150, respectively calculating the degree of difference between the feature points in the collection feature data set and the feature points in the template feature data set in each matching point group to obtain the degree of difference information;
[0045] S160. Determine the defect location based on the difference degree information and output the defect location.
[0046] Among them, this design can be applied to PCB inspection, and the surface image of the PCB is collected by a line scan camera. It can be understood that the template image is a standard PCB sample image, which is stored in the storage module. The control module analyzes the defect location of the PCB cost by comparing the collected image with the template image.
[0047] The image template matching method of the present invention, when acquiring a captured image, extracts each feature point of the captured image respectively through at least a first feature matching model and a second feature matching model, and then normalizes the extracted feature point data and merges them into a captured feature data collection, and uniformly pairs the feature points in the captured feature data collection with the feature points in the template feature data collection through a homography matrix H to form a matching point group, and then calculates the degree of difference between the feature points from the captured feature data collection and the feature points from the template feature data collection in the matching point group, if the difference is large, there is a defect, and the defect position is known, the design first narrows the matching range of the feature points through a random sampling consistency algorithm, so that the feature points that are paired with each other in the matching point group need to meet the epipolar geometry constraint, and then calculates the degree of difference, reduces the calculation load, improves the analysis efficiency, and shortens the processing time.
[0048] Since it is necessary to compare the feature points of the acquired image and the template image, and the object to be scanned may move or rotate during the sampling image shooting process, it is necessary to unify the acquired image and the template image to the same coordinates for processing. In some embodiments of the present invention, the acquiring of the acquired image and the template image includes:
[0049] A world coordinate system is constructed based on the relationship between the line scan camera and the mobile platform for placing the object to be scanned;
[0050] The coordinates of the acquired image and the template image are transformed into a unified world coordinate system.
[0051] Specifically, Figure 3 , 4 As shown, a line scan camera is used to scan a mobile platform on which an object to be scanned is placed. The coordinates of the camera A can be set as (x c ,y c , z c ); the line scan sensor coordinates are (r, c); the imaging plane coordinates are (u, v); the world coordinates are (x w ,y w , z w ).
[0052] Therefore, according to Figure 4 The relationship in is combined with the coordinates of camera A, the scanning sensor coordinates, and the imaging plane coordinates to establish the initial rotation matrix R0 of the line scan camera relative to the object to be scanned and the initial displacement matrix D0 of the line scan camera relative to the object to be scanned.
[0053] In some embodiments of the present invention, the initial transformation matrix of the world coordinate system is:
[0054]
[0055] Where W is the initial transformation matrix of the world coordinate system; R0 is the initial rotation matrix of the line scan camera relative to the object to be scanned, and D0 is the initial displacement matrix of the line scan camera relative to the object to be scanned;
[0056] When the mobile platform translates Δt at a speed v, the transformation matrix of the world coordinate system is:
[0057]
[0058] The rotation of the mobile platform increases the rotation amount in R0, which is not described in detail here. The subsequent coordinate calculations of the acquired image and the template image are all based on the world coordinate system.
[0059] In some embodiments of the present invention, Figure 2 As shown, the step of calculating the difference degree of the feature points in the collection feature data set and the feature points in the template feature data set in each matching point group to obtain the difference degree information includes:
[0060] S210, calculating the Euclidean distance value between the feature points in each set of mutually matching collected feature data and the feature points in the template feature data set;
[0061] S220, forming difference degree information according to the Euclidean distance value;
[0062] S230: When the Euclidean distance value is greater than the distance threshold, the defect position is obtained according to the matching point group.
[0063] The Euclidean distance value is calculated for the coordinates of the feature points in the collection of feature data collected within the matching point group and the coordinates of the feature points in the collection of template feature data. The distance threshold here can be set by the staff. The smaller the Euclidean distance value, the more similar the feature points of the collected image and the feature points of the template image are. When the Euclidean distance value is large, or even exceeds the distance threshold, it proves that the feature points of the collected image may have defects and are not similar to the feature points of the template image.
[0064] In some embodiments of the present invention, the first feature matching model may be a SURF feature matching model, which is a feature detection based on the determinant of the Hessian matrix, and uses a square filter response that approximates the second order and derivative of Hessian to find feature points. The SURF feature matching model tends to find corner and spot features with strong responses under the Hessian matrix framework. The second feature matching model may be an ORB feature matching model, which is based on a FA8T corner detector and runs FA8T on a multi-scale pyramid to find feature points with corner characteristics, such as corner structures with strong brightness contrast. There may be more feature matching models for extracting features from captured images, for example, a third feature matching model may also be set, such as a SIFT feature matching model.
[0065] In some embodiments of the present invention, the feature point data of the first collected feature data set and the second collected feature data set include each feature point and a descriptor corresponding to the feature point, wherein the descriptor includes a coordinate vector value of the feature point;
[0066] It should be noted that the first feature matching model and the second feature matching model need to perform feature extraction processing on the collected image and the template image. The first feature matching model processes the collected image to detect the feature point K in the image. SURF and descriptor H SURF , the first feature matching model processes the template image and detects the key point M in the image SURF and calculate the descriptor L SURF Similarly, the second feature matching model processes the collected image to detect the feature point K in the image ORB and descriptor H ORB , the first feature matching model processes the template image and detects the key point M in the image ORB and calculate the descriptor L ORB .
[0067] Since different feature matching models form coordinate vectors with different numerical scales, for example, the descriptor H corresponding to the feature points formed by the SURF feature matching model is SURF is a 64-dimensional floating point vector, and the descriptor H corresponding to the feature point formed by the ORB feature matching model ORB It is a 256-bit binary string.
[0068] Therefore, the step of normalizing the feature point data in the first collected feature data set and the feature point data in the second collected feature data set and merging them into a collection of collected feature data includes:
[0069] The coordinate vector values of the descriptors in the first acquisition feature data set and the second acquisition feature data set are normalized to the same numerical specifications; the 256-bit binary string can be normalized and converted into a floating-point vector, for example, if the binary string is 1, it is converted into (1, 0), and if the binary string is 0, it is converted into (0, 0).
[0070] Merging the feature points of the first collected feature data set and the second collected feature data set to form a feature point list. It can be understood that the feature points are marking points and can be placed one by one in the feature point list;
[0071] The normalized coordinate vector values of the first acquired feature data set and the second acquired feature data set are combined to form a descriptor matrix. Specifically, the combination can be understood as combining the coordinate vector values one by one into elements of the descriptor matrix.
[0072] In some embodiments of the present invention, the step of pairing each feature point in the collection of collected feature data with each feature point in the collection of template feature data according to the homography matrix H to obtain a plurality of matching point groups includes pairing each feature point in the collection of collected feature data, wherein the pairing step includes:
[0073] According to the homography matrix H, the feature point P1 of the collected feature data set is searched for the feature point P2 in the template feature data set. The homogeneous coordinates of the feature point P1 are [x1, y1, 1], and the homogeneous coordinates of the feature point P2 are [x2, y2, 1]. The paired feature points P1 of the collected feature data set and P2 of the template feature data set meet in, is the transposed matrix of the homogeneous coordinates of the feature point P2, and K is the epipolar geometry constraint threshold.
[0074] Among them, the homography matrix H is obtained using the random sampling consistency algorithm. Based on the epipolar geometry properties, we have when The closer it is to 0, the more the feature points in the matching point group can satisfy the epipolar geometry constraint. Therefore, according to actual needs, the staff can set the epipolar geometry constraint threshold of K, and use the homogeneous coordinates of the feature point P1 and the calculation of the homography matrix H to search for the feature point P2 that satisfies the epipolar geometry constraint threshold.
[0075] Specifically, searching for feature points P2 in the template feature data collection for feature points P1 in the collected feature data collection according to the homography matrix H includes:
[0076] Filter each feature point P2 in the template feature data collection;
[0077] when Then the feature point P2 is screened out;
[0078] when The feature point P2 and the feature point P1 form a matching point group.
[0079] According to the monitoring system of the second embodiment of the present invention, it includes: a mobile platform 310, used to carry an object to be scanned; a line scan camera 320, used to scan the object to be scanned and capture an acquired image; a storage module 330, used to store a template image; a control module 400, respectively connected to the line scan camera 320 and the storage module 330, the control module 400 executes the image template matching method disclosed in any of the above embodiments to obtain the defect position of the acquired image; an output module 500, the control module 400 is connected to the output module 500 to output the defect position of the acquired image.
[0080] The monitoring system of the present invention applies the image template matching method disclosed in any of the above embodiments to obtain the defect position of the collected image, reduce the calculation load, improve the analysis efficiency, and shorten the processing time.
[0081] According to the control device of the embodiment of the third aspect of the present invention, the control device includes a memory 620 and a processor 610, the memory 620 stores a computer program, and the processor 610 implements the image template matching method disclosed in any of the above embodiments when executing the computer program.
[0082] The control device can be any intelligent terminal including a central computer, a remote device terminal computer, etc.
[0083] like Figure 5 As shown, Figure 5 The hardware structure of the control device of another embodiment is also illustrated, and the control device comprises:
[0084] The processor 610 may be implemented by a general-purpose central processing unit 610 (CPU), a microprocessor 610, an application specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0085] The memory 620 may be implemented in the form of a read-only memory 620 (ROM), a static storage device, a dynamic storage device, or a random access memory 620 (RAM). The memory 620 may store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 620, and the processor 610 calls and executes the image template matching method of the embodiment of this application;
[0086] Input / output interface 630, used to implement information input and output;
[0087] Communication interface 640, used to realize communication interaction between the device and other devices, which can be realized through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);
[0088] bus 650 , which transmits information between the various components of the device (e.g., processor 610 , memory 620 , input / output interface 630 , and communication interface 640 );
[0089] The processor 610 , the memory 620 , the input / output interface 630 , and the communication interface 640 are connected to each other in communication within the device via a bus 650 .
[0090] According to the computer-readable storage medium of the fourth aspect of the present invention, the computer-readable storage medium stores a computer program, which is characterized in that when the computer program is executed by the processor 610, the image template matching method disclosed in any of the above embodiments is implemented.
[0091] The memory 620, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 620 may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0092] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0093] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0094] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0095] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0096] The terms "first", "second", "third", "fourth", etc. (if any) in the specification 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 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 comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0097] The preferred embodiments of the present application are described above with reference to the accompanying drawings, but the scope of the rights of the present application is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present application should be within the scope of the rights of the present application.
Claims
1. An image template matching method, characterized in that: include: Acquire a collection image and a template image; Extracting each feature point of the acquired image at least by using a first feature matching model and a second feature matching model, respectively, to obtain a first acquired feature data set and a second acquired feature data set; Normalize the feature point data in the first collected feature data set and the feature point data in the second collected feature data set and merge them into a collection of collected feature data; use a random sampling consistency algorithm to obtain a homography matrix H, and pair each feature point in the collection of collected feature data with each feature point in the collection of template feature data according to the homography matrix H to obtain a plurality of matching point groups, wherein the matching point groups include feature points in the collection of collected feature data and feature points in the collection of template feature data that satisfy epipolar geometry constraints, wherein the feature points in the collection of template feature data include feature point data in the first template feature data set and feature point data in the second template feature data set that are normalized and merged, the first template feature data set is obtained by extracting each feature point of the template image using a first feature matching model, and the second template feature data set is obtained by extracting each feature point of the template image using a second feature matching model; Calculating the degree of difference between the feature points in the collection feature data set and the feature points in the template feature data set in each matching point group to obtain the degree of difference information; The defect location is obtained based on the difference degree information and output.
2. The image template matching method according to claim 1, characterized in that: The step of calculating the difference degree of the feature points in the collection feature data set and the feature points in the template feature data set in each matching point group to obtain the difference degree information includes: Calculate the Euclidean distance between the feature points in each set of mutually matching collected feature data and the feature points in the template feature data set; Forming difference degree information based on Euclidean distance values; When the Euclidean distance value is greater than the distance threshold, the defect position is obtained based on the matching point group.
3. The image template matching method according to claim 1, characterized in that: The feature point data of the first collected feature data set and the second collected feature data set include each feature point and a descriptor corresponding to the feature point, wherein the descriptor includes a coordinate vector value of the feature point; The step of normalizing the feature point data in the first collected feature data set and the feature point data in the second collected feature data set and merging them into a collection of collected feature data includes: Normalizing the coordinate vector values of the descriptors in the first collected feature data set and the second collected feature data set to the same numerical specifications; Merging each feature point of the first collected feature data set and the second collected feature data set to form a feature point list; The normalized coordinate vector values of the first acquired feature data set and the second acquired feature data set are combined to form a descriptor matrix.
4. The image template matching method according to claim 1, characterized in that: The step of pairing each feature point in the collection of collected feature data with each feature point in the collection of template feature data according to the homography matrix H to obtain a plurality of matching point groups includes pairing each feature point in the collection of collected feature data, wherein the pairing step includes: According to the homography matrix H, the feature point P1 of the collected feature data set is searched for the feature point P2 in the template feature data set. The homogeneous coordinates of the feature point P1 are [x1, y1, 1], and the homogeneous coordinates of the feature point P2 are [x2, y2, 1]. The paired feature points P1 of the collected feature data set and P2 of the template feature data set meet in, is the transposed matrix of the homogeneous coordinates of the feature point P2, and K is the epipolar geometry constraint threshold.
5. The image template matching method according to claim 4, characterized in that: In searching the feature point P2 in the template feature data collection for the feature point P1 in the collected feature data collection according to the homography matrix H, the following is included: Filter each feature point P2 in the template feature data collection; when Then the feature point P2 is screened out; when The feature point P2 and the feature point P1 form a matching point group.
6. The image template matching method according to claim 1, characterized in that: The step of acquiring the acquisition image and the template image includes: A world coordinate system is constructed based on the relationship between the line scan camera and the mobile platform for placing the object to be scanned; The coordinates of the acquired image and the template image are transformed into a unified world coordinate system.
7. The image template matching method according to claim 6, characterized in that: The initial transformation matrix of the world coordinate system is: Where W is the initial transformation matrix of the world coordinate system; R0 is the initial rotation matrix of the line scan camera relative to the object to be scanned, and D0 is the initial displacement matrix of the line scan camera relative to the object to be scanned; When the mobile platform translates Δt at a speed v, the transformation matrix of the world coordinate system is:
8. A monitoring system, characterized in that: include: A mobile platform for carrying objects to be scanned; A line scan camera is used to scan an object to be scanned and capture an image; A storage module, used for storing template images; A control module, connected to the line scan camera and the storage module respectively, wherein the control module executes the image template matching method according to any one of claims 1 to 7 to obtain a defect position of the captured image; The control module is connected to the output module to output the defect position of the captured image.
9. A control device, characterized in that: include: one or more memories; One or more processors, used to execute one or more computer programs stored in the one or more memories, and also used to execute the image template matching method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The method comprises instructions which, when executed on a computer, enable the computer to execute the image template matching method as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Applique ceramic disc surface defect detection method based on image difference
CN110503633A
Feature matching method based on optical flow, intelligent terminal and computer storage medium
CN113554035A
Image alignment method and device, storage medium and electronic equipment
CN115731403A
Image target matching method and device based on local homography
CN119027470A
Multi-source image correspondence method and system based on heterogeneous model fitting
US12131517B1