CN109724988B - PCB defect positioning method based on multi-template matching - Google Patents

PCB defect positioning method based on multi-template matching Download PDF

Info

Publication number
CN109724988B
CN109724988B CN201910102845.4A CN201910102845A CN109724988B CN 109724988 B CN109724988 B CN 109724988B CN 201910102845 A CN201910102845 A CN 201910102845A CN 109724988 B CN109724988 B CN 109724988B
Authority
CN
China
Prior art keywords
image
template
matching
small
pcb
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910102845.4A
Other languages
Chinese (zh)
Other versions
CN109724988A (en
Inventor
魏登明
王华龙
张璐
张鹏中
张美杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Foshan Nanhai Guangdong Technology University CNC Equipment Cooperative Innovation Institute
Foshan Guangdong University CNC Equipment Technology Development Co. Ltd
Original Assignee
Foshan Nanhai Guangdong Technology University CNC Equipment Cooperative Innovation Institute
Foshan Guangdong University CNC Equipment Technology Development Co. Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Foshan Nanhai Guangdong Technology University CNC Equipment Cooperative Innovation Institute, Foshan Guangdong University CNC Equipment Technology Development Co. Ltd filed Critical Foshan Nanhai Guangdong Technology University CNC Equipment Cooperative Innovation Institute
Priority to CN201910102845.4A priority Critical patent/CN109724988B/en
Publication of CN109724988A publication Critical patent/CN109724988A/en
Application granted granted Critical
Publication of CN109724988B publication Critical patent/CN109724988B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Analysis (AREA)
  • Image Processing (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)

Abstract

The invention provides a PCB defect positioning method based on multi-template matching, which can greatly reduce the error in the traditional template matching by segmenting a template image and setting a corresponding matching template according to the characteristics of a segmented small template image, can further reduce the accumulated error caused by the deformation of an actual image by multi-template matching, and can carry out border-crossing judgment and automatic pixel filling processing on a matched area after template matching, thereby effectively solving the problem of defect detection deviation after border crossing; the method can improve the positioning precision of the PCB in the early detection period, reduce the accumulated deviation of the actual image and the template image, effectively improve the detection efficiency and the detection precision, and really realize a series of detection requirements such as high-precision positioning and matching of the PCB detection process.

Description

PCB defect positioning method based on multi-template matching
Technical Field
The invention relates to the technical field of detection equipment, in particular to a PCB defect positioning method based on multi-template matching.
Background
The method for detecting the surface defects of the PCB optical plate on line is an important part in PCB detection, the precision of the PCB detection is directly influenced, and the requirements on the precision and the accuracy of the PCB optical plate defect detection are higher and higher along with the upgrading and the transformation of PCB production equipment and production technology. The traditional machine vision detection algorithm is based on a characteristic matching method of a template and an image to be detected, the detection speed of the algorithm is low, more interference is generated when the image to be detected is deformed to form false detection, and the detection stability is poor.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a PCB defect positioning method based on multi-template matching, aiming at solving the problems of low efficiency, more interference, poor robustness and the like in the existing machine vision template matching algorithm; the precision and the speed of matching and positioning are optimized, and the accuracy of the next defect detection is improved.
In order to achieve the purpose, the invention adopts the following technical scheme:
a PCB defect positioning method based on multi-template matching is characterized by comprising the following steps:
s1, dividing the template image into N small template images;
s2, taking a small template image to carry out binarization processing;
s3, judging whether the small template image after binarization is completely black or completely white;
s4, assigning the coordinates of the small template image to (x, y) under the condition of full black or full white, and judging whether the binary small template image has an obvious outline or not under the condition of non-full black or full white;
s5, under the condition that the obvious outline exists in the step S4, the small template graph is used for creating a shape matching template;
s6, under the condition that no obvious contour exists in the step S4, a gray matching template is created by the small template picture;
s7, performing template matching search in the image to be detected according to the templates in the steps S5 and S6, if a matching region is found, assigning a return value (row1, column1) to (x, y), and if no matching region is found, (x1, y1) to (x, y);
s8, taking the coordinates (x, y) as the center, and deducting the image with the size of (N1+100) × (N2+100) on the image to be detected;
s9, judging whether the deducted image exceeds the boundary of the image to be detected, if not, not processing;
s10, if the boundary is out of range, filling the area beyond the boundary according to the gray value of the boundary pixel;
and S11, finally, carrying out difference processing on the deducted image and the small template image, and extracting defect information by combining a subsequent defect segmentation algorithm.
The PCB defect positioning method based on multi-template matching has the beneficial effects that: according to the invention, three matching methods of not creating the template, creating the shape template and creating the gray template are provided by judging the characteristics of the small template image, so that the image matching time is greatly reduced, and the matching precision is improved to a certain extent; in the image matching process, an out-of-range judgment and pixel automatic filling method is set for the size of an image to be detected, so that the accuracy of image boundary area matching is improved; the method improves the accuracy of image matching and positioning to a certain extent, can effectively reduce the matching error caused by the deformation of the image to be detected, and also provides guarantee for the extraction and segmentation of subsequent defect information.
Drawings
FIG. 1 is a schematic flow chart of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described clearly and completely with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by a person skilled in the art without making any inventive step are within the scope of the present invention.
Example (b): a PCB defect positioning method based on multi-template matching.
S1, dividing the grayed template graph Back _ gray into N small templates (each small template has an overlapping area with the adjacent small template) according to the fixed size N1 × N2;
s2, taking one small template image BackImage1 and center coordinates (x1 and y1), and carrying out binarization processing to obtain an image Binary _ BackImage 1;
s3, judging whether the Binary _ BackImage1 is completely black or completely white;
s4, judging whether the picture is completely black or completely white in the step S3, assigning (x1, y1) to (x, y), and judging whether a picture is obvious in the Binary _ Back image1 if the picture is not completely black or completely white;
s5, if the Binary _ BackImage1 has an obvious outline in the step S4, newly building a Shape template Shape _ Templet1 by the BackImage 1;
s6, in the step S4, if the Binary _ BackImage1 has no obvious outline, a Gray template Gray _ Templet1 is newly built by the BackImage 1;
s7, matching and searching in the grayed diagram Fore _ Gray to be detected according to a Shape template Shape _ Templet1 or a Gray template Gray _ Templet1, if a matching region is found, assigning a return value (row1, column1) to (x, y), and if the matching region is not found, (x1, y1) to (x, y);
s8, taking the coordinates (x, y) as the center, and deducting an image with the size of (N1+100) × (N2+100) on the Fore _ gray to be detected to obtain ForeImage 1;
s9, judging whether the ForeImage1 exceeds the boundary of the image Fore _ gray, and if not, not processing;
s10, if the step S9 judges that the boundary is out of range, filling the area of the ForeImage1 beyond the boundary of the Fore _ gray according to the gray value of the boundary pixel;
and S11, carrying out difference processing on the image ForeImage1 after the boundary crossing judgment and the small template image BackImage1, and extracting defect information by combining a subsequent defect segmentation algorithm.
In the technical scheme, firstly, a PCB gray template image is subjected to blocking processing, a large template image is divided into N small templates according to requirements, then the small templates are judged, whether the small templates are completely black or completely white is judged firstly, if yes, the small templates are scratched on an image to be detected according to the central coordinates (x1, y1) of the small templates, if not, whether an obvious contour exists is judged again, the small template image is used for newly building a shape template with the obvious contour, the small profile image is used for newly building a gray template without the obvious contour, and finally, the matching search is carried out on the image to be detected according to the template. And if the detected image is found, buckling the image in the to-be-detected image according to the center coordinate (row1, column1) returned by matching, if the detected image is not found, buckling the image in the to-be-detected image according to (x1, y1), judging whether the image exceeds the boundary of the to-be-detected image, if the image exceeds the boundary, performing border-crossing pixel filling processing, performing difference processing on the finally obtained detection small image and the template small image, and performing subsequent defect information segmentation and extraction.
The above description is only for the preferred embodiment of the present invention, but the present invention should not be limited to the embodiment and the disclosure of the drawings, and therefore, all equivalent or modifications that do not depart from the spirit of the present invention are intended to fall within the scope of the present invention.

Claims (1)

1. A PCB defect positioning method based on multi-template matching is characterized by comprising the following steps:
s1, dividing the template image into N small template images;
s2, taking a small template image to carry out binarization processing;
s3, judging whether the small template image after binarization is completely black or completely white;
s4, assigning the coordinates of the small template image to (x, y) under the condition of full black or full white, and judging whether the binary small template image has an obvious outline or not under the condition of non-full black or full white;
s5, under the condition that the obvious outline exists in the step S4, the small template graph is used for creating a shape matching template;
s6, under the condition that no obvious contour exists in the step S4, a gray matching template is created by the small template picture;
s7, performing template matching search in the image to be detected according to the templates in the steps S5 and S6, if a matching region is found, assigning a return value (row1, column1) to (x, y), and if no matching region is found, (x1, y1) to (x, y);
s8, taking the coordinates (x, y) as the center, and deducting the image with the size of (N1+100) × (N2+100) on the image to be detected;
s9, judging whether the deducted image exceeds the boundary of the image to be detected, if not, not processing;
s10, if the boundary is out of range, filling the area beyond the boundary according to the gray value of the boundary pixel;
and S11, finally, carrying out difference processing on the deducted image and the small template image, and extracting defect information by combining a subsequent defect segmentation algorithm.
CN201910102845.4A 2019-02-01 2019-02-01 PCB defect positioning method based on multi-template matching Active CN109724988B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910102845.4A CN109724988B (en) 2019-02-01 2019-02-01 PCB defect positioning method based on multi-template matching

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910102845.4A CN109724988B (en) 2019-02-01 2019-02-01 PCB defect positioning method based on multi-template matching

Publications (2)

Publication Number Publication Date
CN109724988A CN109724988A (en) 2019-05-07
CN109724988B true CN109724988B (en) 2021-05-18

Family

ID=66301250

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910102845.4A Active CN109724988B (en) 2019-02-01 2019-02-01 PCB defect positioning method based on multi-template matching

Country Status (1)

Country Link
CN (1) CN109724988B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110672617B (en) * 2019-09-14 2022-06-14 华南理工大学 Method for detecting defects of silk-screen area of glass cover plate of smart phone based on machine vision
CN111707667A (en) * 2020-05-06 2020-09-25 慧泉智能科技(苏州)有限公司 Die-cutting product detection method and software
CN114372980A (en) * 2022-03-21 2022-04-19 视睿(杭州)信息科技有限公司 Industrial defect detection method and system
CN115063618B (en) * 2022-08-17 2022-11-11 成都数之联科技股份有限公司 Defect positioning method, system, equipment and medium based on template matching

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101825581A (en) * 2010-04-16 2010-09-08 广东工业大学 Model-based method for detecting PCB defects
WO2014017337A1 (en) * 2012-07-27 2014-01-30 株式会社日立ハイテクノロジーズ Matching process device, matching process method, and inspection device employing same
CN106952248A (en) * 2017-01-20 2017-07-14 征图新视(江苏)科技有限公司 Automatic multimode board detecting method
CN107389701A (en) * 2017-08-22 2017-11-24 西北工业大学 A kind of PCB visual defects automatic checkout system and method based on image
CN107633507A (en) * 2017-09-02 2018-01-26 南京理工大学 LCD defect inspection methods based on contour detecting and characteristic matching
CN109035214A (en) * 2018-07-05 2018-12-18 陕西大中科技发展有限公司 A kind of industrial robot material shapes recognition methods

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4265183B2 (en) * 2002-09-13 2009-05-20 富士ゼロックス株式会社 Image defect inspection equipment
JP5557482B2 (en) * 2009-06-23 2014-07-23 株式会社日立製作所 Inspection property evaluation method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101825581A (en) * 2010-04-16 2010-09-08 广东工业大学 Model-based method for detecting PCB defects
WO2014017337A1 (en) * 2012-07-27 2014-01-30 株式会社日立ハイテクノロジーズ Matching process device, matching process method, and inspection device employing same
CN106952248A (en) * 2017-01-20 2017-07-14 征图新视(江苏)科技有限公司 Automatic multimode board detecting method
CN107389701A (en) * 2017-08-22 2017-11-24 西北工业大学 A kind of PCB visual defects automatic checkout system and method based on image
CN107633507A (en) * 2017-09-02 2018-01-26 南京理工大学 LCD defect inspection methods based on contour detecting and characteristic matching
CN109035214A (en) * 2018-07-05 2018-12-18 陕西大中科技发展有限公司 A kind of industrial robot material shapes recognition methods

Also Published As

Publication number Publication date
CN109724988A (en) 2019-05-07

Similar Documents

Publication Publication Date Title
CN109724988B (en) PCB defect positioning method based on multi-template matching
CN106960208B (en) Method and system for automatically segmenting and identifying instrument liquid crystal number
CN107045634B (en) Text positioning method based on maximum stable extremum region and stroke width
CN109767445B (en) High-precision PCB defect intelligent detection method
CN114140679A (en) Defect fusion method, device, recognition system and storage medium
CN109540925B (en) Complex ceramic tile surface defect detection method based on difference method and local variance measurement operator
CN106936964A (en) A kind of mobile phone screen angular-point detection method based on Hough transformation template matches
CN110533601B (en) Method for acquiring center position and contour of laser spot
CN111354047B (en) Computer vision-based camera module positioning method and system
CN111401449A (en) Image matching method based on machine vision
CN104331695A (en) Robust round identifier shape quality detection method
CN103942809A (en) Method for detecting joint fissures in rock images
CN105447489A (en) Character and background adhesion noise elimination method for image OCR system
CN107369162B (en) Method and system for generating insulator candidate target area
CN113888456B (en) Corner detection method based on contour
CN112419225B (en) SOP type chip detection method and system based on pin segmentation
CN113610052A (en) Tunnel water leakage automatic identification method based on deep learning
WO2020209046A1 (en) Object detection device
CN113393447A (en) Needle tip true position detection method and system based on deep learning
CN112926694A (en) Method for automatically identifying pigs in image based on improved neural network
CN114943710B (en) Method for positioning circle center of thin-wall circular tube type part by utilizing improved least square fitting
CN113378847B (en) Character segmentation method, system, computer device and storage medium
CN107742036A (en) A kind of shoe pattern automatic discharge system of processing
JP2010191767A (en) Device and method for recognizing character
CN109492685B (en) Target object visual detection method for symmetric characteristics

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant