CN116797513A - Defect detection method and device, electronic equipment and storage medium - Google Patents

Defect detection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116797513A
CN116797513A CN202210252416.7A CN202210252416A CN116797513A CN 116797513 A CN116797513 A CN 116797513A CN 202210252416 A CN202210252416 A CN 202210252416A CN 116797513 A CN116797513 A CN 116797513A
Authority
CN
China
Prior art keywords
image
distance
detected
template
template image
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.)
Pending
Application number
CN202210252416.7A
Other languages
Chinese (zh)
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.)
Hefei Sineva Intelligent Machine Co Ltd
Original Assignee
Hefei Sineva Intelligent Machine 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 Hefei Sineva Intelligent Machine Co Ltd filed Critical Hefei Sineva Intelligent Machine Co Ltd
Priority to CN202210252416.7A priority Critical patent/CN116797513A/en
Publication of CN116797513A publication Critical patent/CN116797513A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Analysis (AREA)

Abstract

The invention provides a defect detection method, a device, electronic equipment and a storage medium, relates to the technical field of defect detection, and solves the technical problems that a method for detecting defects by means of manual identification in the related art possibly causes long time period for detecting the defects and influences the efficiency of defect detection. The method comprises the following steps: performing image scanning processing on the circuit board to be detected to obtain at least one scanning image; determining at least one region image to be detected from a plurality of images to be identified included in each of the at least one scanned image, wherein the similarity between one region image to be detected and the first template image is greater than or equal to a similarity threshold; and carrying out contrast analysis based on the first to-be-detected area image and the first template image, and determining whether a defect exists in the first to-be-detected area image, wherein the first to-be-detected area image is one of the at least one to-be-detected area image.

Description

Defect detection method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of defect detection technologies, and in particular, to a defect detection method, a defect detection device, an electronic device, and a storage medium.
Background
At present, during the production, manufacture, packaging and transportation of circuit boards, certain defects such as short circuit, circuit breaking, scratch, breakage and the like of the circuit boards can be caused by improper operation of related personnel. The prior art can detect which areas or parts of the circuit board have defects by means of manual identification.
However, the above method for detecting defects by means of manual identification may result in a longer period of time for detecting defects, which affects the efficiency of defect detection.
Disclosure of Invention
The invention provides a defect detection method, a device, electronic equipment and a storage medium, which solve the technical problems that the method for detecting defects by a manual identification mode in the related art can cause long time period for detecting the defects and influence the efficiency of defect detection.
In a first aspect, the present invention provides a defect detection method, including: carrying out image scanning processing on a circuit board to be detected to obtain at least one scanning image, wherein one scanning image comprises a plurality of images to be identified; determining at least one region image to be detected from a plurality of images to be identified included in each of the at least one scanned image, wherein the similarity between one region image to be detected and the first template image is greater than or equal to a similarity threshold; and carrying out contrast analysis based on the first to-be-detected area image and the first template image, and determining whether a defect exists in the first to-be-detected area image, wherein the first to-be-detected area image is one of the at least one to-be-detected area image.
Optionally, performing image scanning processing on the circuit board to be detected to obtain at least one scanned image specifically includes: and carrying out at least one image scanning process on the circuit board to be detected based on a preset sequence and a preset step length to obtain at least one scanning image, wherein one image scanning process corresponds to one scanning image, and the width of each scanning image in the at least one scanning image is the same as the preset step length.
Optionally, the defect detection method further includes: determining a first distance and a second distance, wherein the first distance is a linear distance between a center point of the first template image and a first edge, the first edge is a left side edge of the first template image, the second distance is a linear distance between the center point of the first template image and a second edge, and the second edge is a right side edge of the first template image; determining a third distance and a fourth distance, wherein the third distance is a linear distance between a center point of the first area to be detected image and a third edge, the third edge is a left side edge of a first scanning image, the first scanning image is a scanning image corresponding to the first area to be detected image, the fourth distance is a linear distance between the center point of the first area to be detected image and a fourth edge, and the fourth edge is a right side edge of the first scanning image; the determining whether the first region image to be detected has a defect specifically includes: and when the first distance is smaller than or equal to the third distance and the second distance is smaller than or equal to the fourth distance, performing differential processing on the first to-be-detected area image and the first template image to determine whether a defect exists in the first to-be-detected area image.
Optionally, the determining whether the first area image to be detected has a defect specifically further includes: when the first distance is greater than the third distance or the second distance is greater than the fourth distance, performing clipping operation on the first template image to obtain a second template image; and carrying out differential processing on the first to-be-detected area image and the second template image to determine whether defects exist in the first to-be-detected area image.
Optionally, it is determined that the similarity between the first to-be-detected region image and the first template image satisfies the following formula:
wherein S represents the similarity between the first image to be identified and the first template image, n represents the number of pixel points included in the first template image, and f i Representing the pixel value, mu, of the ith pixel point included in the first image to be identified f Represents a first average value, t i Representing the pixel value, mu, of the ith pixel point included in the first template image t Representing a second average value, sigma f Represents a first standard deviation, sigma t The first average value is the average value of the pixel values of all the pixels included in the first image to be identified, the second average value is the average value of the pixel values of all the pixels included in the first template image, the first standard deviation is the standard deviation of the pixel values of all the pixels included in the first image to be identified, the second standard deviation is the standard deviation of the pixel values of all the pixels included in the first template image, 1.ltoreq.i.ltoreq.n.n.ltoreq.2.
In a second aspect, the present invention provides a defect detection apparatus comprising: the processing module and the determining module; the processing module is used for carrying out image scanning processing on the circuit board to be detected to obtain at least one scanning image, wherein one scanning image comprises a plurality of images to be identified; the determining module is used for determining at least one to-be-detected area image from a plurality of to-be-identified images included in each of the at least one scanning image, wherein the similarity between one to-be-detected area image and the first template image is larger than or equal to a similarity threshold value; the determining module is further configured to determine whether a defect exists in the first to-be-detected area image based on a comparison analysis of the first to-be-detected area image and the first template image, where the first to-be-detected area image is one of the at least one to-be-detected area image.
In a third aspect, the present invention provides an electronic device comprising: a processor and a memory configured to store processor-executable instructions; wherein the processor is configured to execute the instructions to implement any of the optional defect detection methods of the first aspect described above.
In a fourth aspect, the present invention provides a computer readable storage medium having instructions stored thereon which, when executed by an electronic device, enable the electronic device to perform any one of the above-described optional defect detection methods of the first aspect.
According to the defect detection method, the defect detection device, the electronic equipment and the storage medium, the electronic equipment can perform image scanning processing on the circuit board to be detected to obtain at least one scanning image, and at least one area image to be detected is determined from a plurality of images to be identified included in each scanning image in the at least one scanning image; the electronic device may then perform a contrast analysis based on the first region image to be detected (i.e., one of the at least one region image to be detected) and the first template image to determine whether a defect exists in the first region image to be detected. In the invention, as the similarity between each region image to be detected in the at least one region image to be detected and the first template image is greater than or equal to the similarity threshold, the first template image is an image which is generated by electronic equipment and has no defects. In this way, the electronic device may perform a comparison analysis based on the first template image and each to-be-detected area image, so as to determine whether a difference exists between each to-be-detected area image and the first template image, so as to determine whether each to-be-detected area image has a defect. The time period for determining whether a certain area has a defect can be shortened, and the defect detection efficiency can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a schematic hardware diagram of an electronic device according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a defect detection method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating another defect detection method according to an embodiment of the present invention;
fig. 4 is a schematic diagram of an overall image corresponding to a circuit board to be detected according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating another defect detection method according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a first template image according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a first scanned image according to an embodiment of the present invention;
fig. 8 is a schematic diagram of an image of a region to be detected according to an embodiment of the present invention;
FIG. 9 is a flowchart of another defect detection method according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of a second template image according to an embodiment of the present invention;
FIG. 11 is a schematic diagram of another second template image according to an embodiment of the present invention;
FIG. 12 is a schematic diagram of a defect detecting device according to an embodiment of the present application;
fig. 13 is a schematic structural diagram of another defect detecting device according to an embodiment of the present application.
Detailed Description
The defect detection method, device, electronic equipment and storage medium provided by the embodiment of the application are described in detail below with reference to the accompanying drawings.
The terms "first" and "second" and the like in the description and the drawings of the present application are used for distinguishing between different objects and not for describing a particular sequential order of objects, e.g., a first distance and a second distance, etc. are used for distinguishing between different distances and not for describing a particular sequential order of distances.
Furthermore, references to the terms "comprising" and "having" and any variations thereof in the description of the present application are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed but may optionally include other steps or elements not listed or inherent to such process, method, article, or apparatus.
It should be noted that, in the embodiments of the present application, words such as "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g." in an embodiment of the present application is not to be taken as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
The term "and/or" as used herein includes the use of either or both of these methods.
In the description of the present application, unless otherwise indicated, the meaning of "a plurality" means two or more.
Based on the description in the background art, since the method for detecting the defect by means of manual identification in the related art may result in a longer period of time for detecting the defect, which affects the efficiency of defect detection. Based on this, the embodiment of the application provides a defect detection method, a device, an electronic apparatus and a storage medium, wherein the similarity between each to-be-detected area image in at least one to-be-detected area image and a first template image is greater than or equal to a similarity threshold, and the first template image is an image which is generated by the electronic apparatus and does not have defects. In this way, the electronic device may perform a comparison analysis based on the first template image and each to-be-detected area image, so as to determine whether a difference exists between each to-be-detected area image and the first template image, so as to determine whether each to-be-detected area image has a defect. The time period for determining whether a certain area has a defect can be shortened, and the defect detection efficiency can be improved.
The electronic device for performing the defect detection method provided by the embodiment of the present invention may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (personal digital assistant, PDA), an augmented reality (augmented reality, AR) \virtual reality (VR) device, or the like, and the specific form of the electronic device is not particularly limited. The system can perform man-machine interaction with a user through one or more modes of a keyboard, a touch pad, a touch screen, a remote controller, voice interaction or handwriting equipment and the like.
Fig. 1 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention. As shown in fig. 1, the electronic device 10 includes a processor 101, a memory 102, a network interface 103, and the like.
The processor 101 is a core component of the electronic device 10, and the processor 101 is configured to run an operating system of the electronic device 10 and applications (including a system application and a third party application) on the electronic device 10, so as to implement a defect detection method of the electronic device 10.
In an embodiment of the present invention, the processor 101 may be a central processing unit (central processing unit, CPU), microprocessor, digital signal processor (digital signal processor, DSP), application-specific integrated circuit (application-specific integrated circuit, ASIC), field programmable gate array (field programmable gate array, FPGA) or other programmable logic device, transistor logic device, hardware components, or any combination thereof, capable of implementing or executing the various exemplary logic blocks, modules and circuits described in connection with the disclosure of embodiments of the present invention; a processor may also be a combination that performs computing functions, e.g., including one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
Optionally, the processor 101 of the electronic device 10 includes one or more CPUs, either single-core or multi-core.
Memory 102 includes, but is not limited to, random access memory (random access memory, RAM), read Only Memory (ROM), erasable Programmable Read Only Memory (EPROM), flash memory, optical memory, or the like. The memory 102 stores the code of the operating system.
Alternatively, the processor 101 implements the defect detection method in the embodiment of the present invention by reading the instruction stored in the memory 102, or the processor 101 implements the defect detection method provided in the embodiment of the present invention by the instruction stored internally. In the case where the processor 101 implements the defect detection method provided by the embodiment of the present invention by reading the execution stored in the memory, the instruction for implementing the defect detection method provided by the embodiment of the present invention is stored in the memory.
The network interface 103 is a wired interface such as a fiber optic distributed data interface (fiber distributed data interface, FDDI), gigabit Ethernet (GE) interface. Alternatively, the network interface 103 is a wireless interface. The network interface 103 is used for the electronic device 10 to communicate with other devices.
The memory 102 is configured to store a plurality of images to be identified included in each of the at least one scanned image. The at least one processor 101 further performs the methods described in embodiments of the present invention based on a plurality of images to be identified included in each of the at least one scanned image stored in the memory 102. For more details on the implementation of the above-described functions by the processor 101, reference is made to the description of the various method embodiments described below.
Optionally, the electronic device 10 further comprises a bus, and the processor 101 and the memory 102 are connected to each other via the bus 104, or connected to each other in other manners.
Optionally, the electronic device 10 further comprises an input-output interface 105, the input-output interface 105 being configured to connect with an input device, and to receive a defect detection request input by a user through the input device. Input devices include, but are not limited to, a keyboard, touch screen, microphone, and the like. The input/output interface 105 is further configured to be connected to an output device, and output a defect detection result (i.e. whether a defect exists in the image of the area to be detected) of the processor 101. Output devices include, but are not limited to, displays, printers, and the like.
The defect detection method, the device, the electronic equipment and the storage medium provided by the embodiment of the invention are applied to an application scene of defect detection of a circuit board. The defect detection method provided by the embodiment of the invention can detect the defect of a certain circuit board to be detected, in particular to detect whether the circuit board to be detected has the defects of short circuit, circuit breaking, scratch, breakage and the like.
As shown in fig. 2, the defect detection method provided in the embodiment of the present invention may include S101-S103.
S101, the electronic equipment performs image scanning processing on the circuit board to be detected to obtain at least one scanning image.
Wherein one scanned image includes a plurality of images to be identified.
It should be understood that the size of each image to be identified in the plurality of images to be identified is the same as the size of the first template image, specifically, the linear distance between the center point of one image to be identified and any edge of the image to be identified is equal to the linear distance between the center point of the first template image and any edge of the first template image. For example, the straight line distance between the center point of the image to be recognized and any edge of the image to be recognized may be 100 pixels.
Referring to fig. 2, as shown in fig. 3, in an implementation manner of the embodiment of the present invention, the image scanning process is performed on the circuit board to be detected to obtain at least one scanned image, which specifically includes S1011.
S1011, the electronic equipment performs at least one image scanning process on the circuit board to be detected based on a preset sequence and a preset step length to obtain at least one scanning image.
Wherein one image scan corresponds to one scan image, and the width of each scan image in the at least one scan image is the same as the preset step length.
It should be understood that the preset sequence may be a sequence from top to bottom, or may be a sequence from left to right, or may be a combination of a sequence from top to bottom and a sequence from left to right, so long as the preset sequence can be completely scanned to the circuit board to be detected.
It can be understood that the preset step length is the maximum width that can be scanned in the process of scanning the image of the circuit board to be detected, and the width is the same as the width of each scanned image. The preset step size may be, for example, 5 μm (micrometers).
The electronic device may perform image scanning processing on the circuit board to be detected through the line scanning camera.
S102, the electronic equipment determines at least one area image to be detected from a plurality of images to be identified included in each of at least one scanned image.
The similarity between one region image to be detected and the first template image is larger than or equal to a similarity threshold value.
It should be understood that after the electronic device performs the image scanning process on the circuit board to be detected, an overall image for characterizing the overall situation of the circuit board to be detected may be obtained. The overall image includes the at least one scanned image, one scanned image including a plurality of images to be identified.
Specifically, the electronic device may determine a similarity between each of the plurality of images to be identified (for example, the first image to be identified) included in the respective scanned images and the first template image, and when the similarity between the first image to be identified and the first template image is greater than or equal to the similarity threshold, the electronic device may determine that the first image to be identified is an image of the region to be detected.
Optionally, the electronic device may use a single light emitting diode (light emitting diode, LED) as a basic unit based on a design drawing file of the circuit board to be detected, and expand an area of 100 pixels around with a center of the single light emitting diode to generate the first template image. The base unit may also be understood as a circle included in the first template image.
In one implementation manner of the embodiment of the present invention, the electronic device may determine that the similarity between the first area to be detected image and the first template image satisfies the following formula:
wherein S represents the similarity between the first image to be identified and the first template image, n represents the number of pixel points included in the first template image, and f i Representing the pixel value, mu, of the ith pixel point included in the first image to be identified f Represents a first average value, t i Representing the pixel value, mu, of the ith pixel point included in the first template image t Representing a second average value, sigma f Represents a first standard deviation, sigma t Representing a second standard deviation, the first average value being the firstThe second average value is the average value of the pixel values of all the pixel points included in the first template image, the first standard deviation is the standard deviation of the pixel values of all the pixel points included in the first image to be identified, the second standard deviation is the standard deviation of the pixel values of all the pixel points included in the first template image, i is more than or equal to 1 and less than or equal to n, and n is more than or equal to 2.
It should be appreciated that the first area image to be detected is one of the at least one area image to be detected described above.
Optionally, the electronic device may determine a normalized cross-correlation (normalized cross correlation, NCC) between the first region image to be detected and the first template image as a similarity between the first region image to be detected and the first template image.
In one implementation, the electronic device may further determine a feature vector of the first to-be-detected region image according to a radius of a circle included in the first to-be-detected region image and a perimeter of a square, and determine the feature vector of the first template image according to the radius of the circle included in the first template region image and the perimeter of the square. And then determining the similarity between the feature vector of the first region image to be detected and the feature vector of the first template image as the similarity between the first region image to be detected and the first template image.
Fig. 4 illustrates an example of image scanning of a circuit board to be detected, so as to obtain at least one image of a region to be detected, provided by the embodiment of the present invention. As shown in fig. 4, the above-mentioned whole image includes 4 scan images, that is, a scan image 201, a scan image 202, a scan image 203, and a scan image 204, wherein each scan image may include 12 area images to be detected. Specifically, the scanned image 204 includes an area image 2041 to be detected. I.e. an image of the area to be detected is a combination of a circle and a square in the figure, and a block of a predetermined size (i.e. the dashed box shown in the figure) is combined. It should be understood that each of the 4 scan images includes each region image to be detected that is identical or similar in shape and size to the region image to be detected 2041, which is not shown in fig. 4.
In addition, when the electronic device performs image scanning on the circuit board to be detected, the step size is based on the distance between the point a and the point B (which can be understood as the distance between the point D and the point E, the distance between the point F and the point G, or the distance between the point H and the point I), that is, the width of the scanned image 201 is the distance between the point a and the point B, and the scanned image 201 is a rectangle formed by the point a, the point B, the point C, and the point D. The electronic device scans the circuit board to be detected in the area corresponding to the scanned image 201 according to the sequence from top to bottom (i.e. the direction of arrow 205), so as to obtain the scanned image 201. The scan image 202 is a rectangle formed by the points D, E, B and F, and the electronic device scans the circuit board to be detected in the area corresponding to the scan image 202 in the order from bottom to top (i.e. the direction of arrow 206), so as to obtain the scan image 202.
It should be noted that, the scanning process of the scanned image 203 (i.e. the rectangle formed by the points F, G, E and H) is the same as or similar to the scanning process of the scanned image 201, and the scanning process of the scanned image 204 (i.e. the rectangle formed by the points H, I, G and J) is the same as or similar to the scanning process of the scanned image 202, which will not be repeated here.
In one implementation manner of the embodiment of the present invention, during the image scanning process of the circuit board to be detected, a partial area of the circuit board to be detected may not be scanned due to some reasons. Based on this, the overlap area can be increased in two adjacent scanning processes. For example, when the area corresponding to the scanning area 204 in fig. 4 is scanned, the pixel value may be shifted to the left by 50 pixels, so as to ensure that the whole area of the circuit board to be detected can be scanned.
And S103, the electronic equipment performs contrast analysis based on the first area image to be detected and the first template image to determine whether defects exist in the first area image to be detected.
In connection with the description of the above embodiments, it should be understood that the first area image to be detected is one of the at least one area image to be detected.
Specifically, the first template image is an image which is generated by the electronic device and has no defect, and the electronic device performs comparison analysis based on the first detection area image and the first template image, so as to determine whether a difference exists between the first area image to be detected and the first template image. When there is no difference between the first to-be-detected area image and the first template image, the electronic device can determine that the first to-be-detected area image is not defective; otherwise, the electronic device may determine that the first area image to be detected is defective, that is, when there is a difference between the first area image to be detected and the first template image.
The technical scheme provided by the embodiment at least has the following beneficial effects: S101-S103, the electronic device may perform image scanning processing on the circuit board to be detected to obtain at least one scanned image, and determine at least one area image to be detected from a plurality of images to be identified included in each scanned image in the at least one scanned image; the electronic device may then perform a contrast analysis based on the first region image to be detected (i.e., one of the at least one region image to be detected) and the first template image to determine whether a defect exists in the first region image to be detected. In the embodiment of the invention, since the similarity between each to-be-detected area image in the at least one to-be-detected area image and the first template image is greater than or equal to the similarity threshold, the first template image is an image which is generated by electronic equipment and has no defects. In this way, the electronic device may perform a comparison analysis based on the first template image and each to-be-detected area image, so as to determine whether a difference exists between each to-be-detected area image and the first template image, so as to determine whether each to-be-detected area image has a defect. The time period for determining whether a certain area has a defect can be shortened, and the defect detection efficiency can be improved.
Referring to fig. 3, as shown in fig. 5, the defect detection method provided in the embodiment of the present invention may further include S104-S105.
S104, the electronic device determines a first distance and a second distance.
The first distance is a linear distance between a center point of the first template image and a first edge, the first edge is a left edge of the first template image, the second distance is a linear distance between the center point of the first template image and a second edge, and the second edge is a right edge of the first template image.
Exemplary, as shown in fig. 6, an example of the first template image provided in the embodiment of the present invention is shown. Wherein point O 1 Representing the center point, point O, of the first template image 1 The linear distance from point M (i.e. L 1 ) For the first distance, point O 1 The linear distance from the point N (i.e. L 2 ) Is the second distance.
S105, the electronic device determines the third distance and the fourth distance.
The third distance is a linear distance between a center point of the first to-be-detected area image and a third edge, the third edge is a left edge of the first scanning image, the first scanning image is a scanning image corresponding to the first to-be-detected area image, the fourth distance is a linear distance between the center point of the first to-be-detected area image and a fourth edge, and the fourth edge is a right edge of the first scanning image.
It should be understood that the first area image to be detected is an area image to be detected included in the first scan image.
Exemplary, as shown in fig. 7, an example of a first scanned image is provided in an embodiment of the present invention. Wherein point O 2 Representing the center point, point O, of the first region image to be detected 2 The linear distance from point P (i.e. L 3 ) For the third distance, point O 2 The linear distance from point Q (i.e. L 4 ) Is the fourth distance. The linear distance between point P and point Q (i.e., L 3 +L 4 ) I.e. the width of the first scanned image.
In an implementation manner of the embodiment of the present invention, the electronic device may further determine coordinates of a center point of the at least one area image to be detected (including the first area image to be detected) based on coordinates of a center point of the first template image, so as to determine the third distance, the fourth distance, and so on.
Specifically, the electronic device may determine an initial position of the first template image on the circuit board to be detected, coordinates of a center point of the first template image when the first template image is at the initial position, and a size of a preset sliding window (for example, sliding 1 pixel to the right each time, sliding 1 pixel downward each time, etc.). The first template image can obtain an image to be identified, which has the same size as the first template, when sliding on the circuit board to be detected according to the preset sliding window every time. When the similarity between a certain image to be identified and the first template image is greater than or equal to a similarity threshold value, the image to be identified is an image of a region to be detected, and at the moment, when the first template image is at the current position, the coordinate of the center point of the first template image is the coordinate of the center point of the image of the region to be detected.
Continuing to refer to fig. 5, the above-mentioned comparing analysis based on the first to-be-detected area image and the first template image determines whether the first to-be-detected area image has a defect, which may specifically include S1031.
S1031, when the first distance is smaller than or equal to the third distance and the second distance is smaller than or equal to the fourth distance, the electronic device performs differential processing on the first to-be-detected area image and the first template image to determine whether a defect exists in the first to-be-detected area image.
It should be understood that when the first distance is less than or equal to the third distance and the second distance is less than or equal to the fourth distance, it is indicated that the first to-be-detected area image has been completely scanned during the image scanning process of the to-be-detected circuit board, and specifically, the size of the first to-be-detected area image is the same as the size of the first template image. The electronic device can perform differential processing on the first to-be-detected area image and the first template image so as to determine whether a defect exists in the first to-be-detected area image.
In the embodiment of the present invention, the first distance is less than or equal to the third distance, which is also understood as that the difference between the first distance and the third distance is less than or equal to 0, and the second distance is less than or equal to the fourth distance, which is also understood as that the difference between the second distance and the fourth distance is less than or equal to 0.
In an alternative implementation manner, the foregoing differential processing is performed on the first to-be-detected area image and the first template image to determine whether a defect exists in the first to-be-detected area image, which may specifically include S1031a-S1031d.
S1031a, the electronic device performs differential processing on the first to-be-detected area image and the first template image, and determines a difference value between a pixel value of each pixel point included in the first to-be-detected area image and a pixel value of each pixel point included in the first template image.
S1031b, the electronic device determines whether the difference between the pixel value of the first pixel point and the pixel value of the second pixel point is greater than or equal to a difference threshold.
The first pixel point is a pixel point in the first to-be-detected area image, and the second pixel point is a pixel point corresponding to the first pixel point in the first template image.
It should be understood that the second pixel point is a pixel point corresponding to the first pixel point in the first template image, and may also be understood that the position of the second pixel point in the first template image is the same as the position of the first pixel point in the first area image to be detected.
S1031c, when the difference between the pixel value of the first pixel point and the pixel value of the second pixel point is greater than or equal to the difference threshold, the electronic device determines that the first area image to be detected has a defect.
Specifically, the electronic device may determine that a defect exists in a position (or an area) corresponding to the first pixel point in the first area image to be detected.
And S1031d, when the difference value between the pixel value of the first pixel point and the pixel value of the second pixel point is smaller than the difference value threshold value, the electronic device determines that the first area image to be detected is free of defects.
For example, as shown in fig. 8, the electronic device may determine that the upper right corner of the region image 301 to be detected is defective.
Referring to fig. 5, as shown in fig. 9, in an implementation manner of the embodiment of the present invention, the comparing analysis is performed based on the first to-be-detected area image and the first template image to determine whether a defect exists in the first to-be-detected area image, which may specifically further include S1032-S1033.
S1032, when the first distance is larger than the third distance or the second distance is larger than the fourth distance, the electronic device performs clipping operation on the first template image to obtain a second template image.
It should be understood that when the first distance is greater than the third distance or the second distance is greater than the fourth distance, it is indicated that the first area to be detected image is not completely scanned in the process of scanning the circuit board to be detected, specifically, the size of the first area to be detected image is smaller than the size of the first template image, and at this time, a cropping operation may be performed on the first template image to obtain the second template image.
In one case, when the first distance is greater than the third distance, it is indicated that the left part area of the first area to be detected is reduced compared to the first template image, and at this time, a clipping operation may be performed on the left part area of the first template, specifically clipping from left to right based on a fifth distance, which is a difference between the first distance and the third distance.
Exemplary, as shown in FIG. 10, the distance between points R and T (i.e., L 5 ) For the fifth distance, the electronic device is based on the L 5 And performing clipping operation on the first template image from left to right to obtain a second template image.
In another case, when the second distance is greater than the fourth distance, it is indicated that the right-side portion area of the first area to be detected is reduced as compared with the first template image, and at this time, a clipping operation may be performed on the right-side portion area of the first template, specifically, clipping from right to left based on a sixth distance, which is a difference between the second distance and the fourth distance.
Exemplary, as shown in FIG. 11, the distance between points U and V (i.e., L 6 ) For the sixth distance, the electronic device is based on the L 6 And performing cutting operation on the first template image from right to left to obtain a second template image.
S1033, the electronic equipment performs differential processing on the first to-be-detected area image and the second template image to determine whether the first to-be-detected area image has defects.
It should be noted that, the process of performing differential processing on the first to-be-detected area image and the second template image by the electronic device to determine whether the first to-be-detected area image has a defect is the same or similar to the process of performing differential processing on the first to-be-detected area image and the first template image by the electronic device to determine whether the first to-be-detected area image has a defect. For the specific procedure of S1033, reference may be made to S1031a-S1031d, which are not repeated here.
The embodiment of the invention can divide the functional modules of the electronic equipment and the like according to the method example, for example, each functional module can be divided corresponding to each function, and two or more functions can be integrated in one processing module. The integrated modules may be implemented in hardware or in software functional modules. It should be noted that, in the embodiment of the present invention, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation.
In the case of dividing the respective functional modules with the respective functions, fig. 12 shows a schematic diagram of one possible configuration of the defect detecting apparatus related to the above-described embodiment, and as shown in fig. 12, the defect detecting apparatus 40 may include: a processing module 401 and a determining module 402.
The processing module 401 is configured to perform image scanning processing on a circuit board to be detected to obtain at least one scanned image, where the scanned image includes a plurality of images to be identified.
A determining module 402, configured to determine at least one to-be-detected area image from a plurality of to-be-identified images included in each of the at least one scanned image, where a similarity between one to-be-detected area image and the first template image is greater than or equal to a similarity threshold.
The determining module 402 is further configured to determine whether a defect exists in the first to-be-detected area image based on a comparison analysis of the first to-be-detected area image and the first template image, where the first to-be-detected area image is one of the at least one to-be-detected area image.
Optionally, the processing module 401 is specifically configured to perform at least one image scanning process on the circuit board to be detected based on a preset sequence and a preset step length, so as to obtain the at least one scanned image, where the one image scanning process corresponds to one scanned image, and a width of each scanned image in the at least one scanned image is the same as the preset step length.
Optionally, the determining module 402 is further configured to determine a first distance and a second distance, where the first distance is a linear distance between a center point of the first template image and a first edge, the first edge is a left edge of the first template image, the second distance is a linear distance between the center point of the first template image and a second edge, and the second edge is a right edge of the first template image.
The determining module 402 is further configured to determine a third distance and a fourth distance, where the third distance is a linear distance between a center point of the first to-be-detected area image and a third edge, the third edge is a left edge of the first scan image, the first scan image is a scan image corresponding to the first to-be-detected area image, the fourth distance is a linear distance between a center point of the first to-be-detected area image and a fourth edge, and the fourth edge is a right edge of the first scan image.
The determining module 402 is specifically configured to perform differential processing on the first to-be-detected area image and the first template image to determine whether a defect exists in the first to-be-detected area image when the first distance is less than or equal to the third distance and the second distance is less than or equal to the fourth distance.
Optionally, the processing module 401 is further configured to perform a cropping operation on the first template image to obtain a second template image when the first distance is greater than the third distance or the second distance is greater than the fourth distance.
The determining module 402 is specifically further configured to perform differential processing on the first to-be-detected area image and the second template image, so as to determine whether a defect exists in the first to-be-detected area image.
Optionally, the determining module 402 is further configured to determine that the similarity between the first to-be-detected region image and the first template image satisfies the following formula:
wherein S represents the similarity between the first image to be identified and the first template image, n represents the number of pixel points included in the first template image, and f i Representing the pixel value, mu, of the ith pixel point included in the first image to be identified f Represents a first average value, t i Representing the pixel value, mu, of the ith pixel point included in the first template image t Representing a second average value, sigma f Represents a first standard deviation, sigma t The first average value is the average value of the pixel values of all the pixels included in the first image to be identified, the second average value is the average value of the pixel values of all the pixels included in the first template image, the first standard deviation is the standard deviation of the pixel values of all the pixels included in the first image to be identified, the second standard deviation is the standard deviation of the pixel values of all the pixels included in the first template image, 1.ltoreq.i.ltoreq.n.n.ltoreq.2.
In the case of an integrated unit, fig. 13 shows a schematic diagram of one possible configuration of the defect detection device involved in the above-described embodiment. As shown in fig. 13, the defect detecting device 50 may include: a processing module 501 and a communication module 502. The processing module 501 may be used to control and manage the operation of the defect detection device 50. The communication module 502 may be used to support communication of the defect detection device 50 with other entities. Optionally, as shown in fig. 13, the defect detection apparatus 50 may further include a storage module 503 for storing program code and data of the defect detection apparatus 50.
The processing module 501 may be a processor or a controller (e.g., may be the processor 101 described above and shown in fig. 1). The communication module 502 may be a transceiver, a transceiver circuit, a communication interface, or the like (e.g., may be the network interface 103 described above and shown in fig. 1). The storage module 503 may be a memory (e.g., may be the memory 102 described above and shown in fig. 1).
Where the processing module 501 is a processor, the communication module 502 is a transceiver, and the storage module 503 is a memory, the processor, the transceiver, and the memory may be connected by a bus. The bus may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus or an extended industry standard architecture (extended industry standard architecture, EISA) bus, or the like. The buses may be divided into address buses, data buses, control buses, etc.
It should be understood that, in various embodiments of the present invention, the sequence numbers of the foregoing processes do not mean the order of execution, and the order of execution of the processes should be determined by the functions and internal logic thereof, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using a software program, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in accordance with embodiments of the present invention are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber terminal line (Digital Subscriber Line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device including one or more servers, data centers, etc. that can be integrated with the medium. The usable medium may be a magnetic medium (e.g., a floppy Disk, a hard Disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a Solid State Disk (SSD)), or the like.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (12)

1. A defect detection method, comprising:
carrying out image scanning processing on a circuit board to be detected to obtain at least one scanning image, wherein one scanning image comprises a plurality of images to be identified;
determining at least one region image to be detected from a plurality of images to be identified included in each of the at least one scanned image, wherein the similarity between one region image to be detected and the first template image is greater than or equal to a similarity threshold;
and carrying out contrast analysis based on a first to-be-detected area image and the first template image, and determining whether a defect exists in the first to-be-detected area image, wherein the first to-be-detected area image is one of the at least one to-be-detected area image.
2. The method for detecting defects according to claim 1, wherein the performing image scanning processing on the circuit board to be detected to obtain at least one scanned image includes:
And carrying out at least one image scanning process on the circuit board to be detected based on a preset sequence and a preset step length to obtain at least one scanning image, wherein one image scanning process corresponds to one scanning image, and the width of each scanning image in the at least one scanning image is the same as the preset step length.
3. The defect detection method of claim 2, wherein the method further comprises:
determining a first distance and a second distance, wherein the first distance is a linear distance between a center point of the first template image and a first edge, the first edge is a left side edge of the first template image, the second distance is a linear distance between the center point of the first template image and a second edge, and the second edge is a right side edge of the first template image;
determining a third distance and a fourth distance, wherein the third distance is a linear distance between a central point of the first area image to be detected and a third edge, the third edge is a left side edge of a first scanning image, the first scanning image is a scanning image corresponding to the first area image to be detected, the fourth distance is a linear distance between the central point of the first area image to be detected and a fourth edge, and the fourth edge is a right side edge of the first scanning image;
The determining whether a defect exists in the first to-be-detected area image based on the comparison analysis of the first to-be-detected area image and the first template image includes:
and when the first distance is smaller than or equal to the third distance and the second distance is smaller than or equal to the fourth distance, performing differential processing on the first to-be-detected area image and the first template image to determine whether a defect exists in the first to-be-detected area image.
4. The defect detection method of claim 3, wherein the determining whether a defect exists in the first region image to be detected based on the comparison analysis of the first region image to be detected and the first template image further comprises:
when the first distance is larger than the third distance or the second distance is larger than the fourth distance, cutting the first template image to obtain a second template image;
and carrying out differential processing on the first to-be-detected area image and the second template image to determine whether defects exist in the first to-be-detected area image.
5. The defect detection method of any of claims 1-4, wherein determining a similarity between the first region image to be detected and the first template image satisfies the following formula:
Wherein S represents the similarity between the first image to be identified and the first template image, n represents the number of pixel points included in the first template image, and f i Representing the pixel value, mu, of the ith pixel point included in the first image to be identified f Represents a first average value, t i Representing the pixel value, mu, of the ith pixel point included in the first template image t Representing a second average value, sigma f Represents a first standard deviation, sigma t The first average value is the average value of the pixel values of all the pixel points included in the first image to be identified, the second average value is the average value of the pixel values of all the pixel points included in the first template image, the first standard deviation is the standard deviation of the pixel values of all the pixel points included in the first image to be identified, the second standard deviation is the standard deviation of the pixel values of all the pixel points included in the first template image, i is more than or equal to 1 and less than or equal to n, and n is more than or equal to 2.
6. A defect detection apparatus, comprising: the processing module and the determining module;
the processing module is used for carrying out image scanning processing on the circuit board to be detected to obtain at least one scanning image, wherein one scanning image comprises a plurality of images to be identified;
The determining module is configured to determine at least one to-be-detected area image from a plurality of to-be-identified images included in each of the at least one scan image, where a similarity between the to-be-detected area image and the first template image is greater than or equal to a similarity threshold;
the determining module is further configured to determine whether a defect exists in the first to-be-detected area image based on a comparison analysis of the first to-be-detected area image and the first template image, where the first to-be-detected area image is one of the at least one to-be-detected area image.
7. The defect detecting apparatus of claim 6, wherein,
the processing module is specifically configured to perform at least one image scanning process on the circuit board to be detected based on a preset sequence and a preset step length, so as to obtain at least one scanned image, where the one image scanning process corresponds to one scanned image, and a width of each scanned image in the at least one scanned image is the same as the preset step length.
8. The defect detecting apparatus of claim 7, wherein,
the determining module is further configured to determine a first distance and a second distance, where the first distance is a linear distance between a center point of the first template image and a first edge, the first edge is a left edge of the first template image, the second distance is a linear distance between the center point of the first template image and a second edge, and the second edge is a right edge of the first template image;
The determining module is further configured to determine a third distance and a fourth distance, where the third distance is a linear distance between a center point of the first to-be-detected area image and a third edge, the third edge is a left edge of a first scan image, the first scan image is a scan image corresponding to the first to-be-detected area image, the fourth distance is a linear distance between a center point of the first to-be-detected area image and a fourth edge, and the fourth edge is a right edge of the first scan image;
the determining module is specifically configured to perform differential processing on the first to-be-detected area image and the first template image when the first distance is less than or equal to the third distance and the second distance is less than or equal to the fourth distance, so as to determine whether a defect exists in the first to-be-detected area image.
9. The defect detecting apparatus of claim 8, wherein,
the processing module is further configured to perform a cropping operation on the first template image to obtain a second template image when the first distance is greater than the third distance or the second distance is greater than the fourth distance;
The determining module is specifically further configured to perform differential processing on the first to-be-detected area image and the second template image, so as to determine whether a defect exists in the first to-be-detected area image.
10. The defect detection apparatus according to any one of claims 6 to 9, wherein,
the determining module is further configured to determine that a similarity between the first to-be-detected region image and the first template image satisfies the following formula:
wherein S represents the similarity between the first image to be identified and the first template image, n represents the number of pixel points included in the first template image, and f i Representing the pixel value, mu, of the ith pixel point included in the first image to be identified f Represents a first average value, t i Representing the pixel value, mu, of the ith pixel point included in the first template image t Representing a second average value, sigma f Represents a first standard deviation, sigma t The first average value is the average value of the pixel values of all the pixel points included in the first image to be identified, the second average value is the average value of the pixel values of all the pixel points included in the first template image, the first standard deviation is the standard deviation of the pixel values of all the pixel points included in the first image to be identified, the second standard deviation is the standard deviation of the pixel values of all the pixel points included in the first template image, i is more than or equal to 1 and less than or equal to n, and n is more than or equal to 2.
11. An electronic device, the electronic device comprising:
a processor;
a memory configured to store the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the defect detection method of any of claims 1-5.
12. A computer readable storage medium having instructions stored thereon, which, when executed by an electronic device, cause the electronic device to perform the defect detection method of any of claims 1-5.
CN202210252416.7A 2022-03-15 2022-03-15 Defect detection method and device, electronic equipment and storage medium Pending CN116797513A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210252416.7A CN116797513A (en) 2022-03-15 2022-03-15 Defect detection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210252416.7A CN116797513A (en) 2022-03-15 2022-03-15 Defect detection method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116797513A true CN116797513A (en) 2023-09-22

Family

ID=88038967

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210252416.7A Pending CN116797513A (en) 2022-03-15 2022-03-15 Defect detection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116797513A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117237347A (en) * 2023-11-14 2023-12-15 深圳思谋信息科技有限公司 PCB defect detection method and device, storage medium and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117237347A (en) * 2023-11-14 2023-12-15 深圳思谋信息科技有限公司 PCB defect detection method and device, storage medium and electronic equipment
CN117237347B (en) * 2023-11-14 2024-03-29 深圳思谋信息科技有限公司 PCB defect detection method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
WO2022042365A1 (en) Method and system for recognizing certificate on basis of graph neural network
US10885626B2 (en) Identifying apparatus, identifying method, and program
CN109308463B (en) Video target identification method, device and equipment
US20220253631A1 (en) Image processing method, electronic device and storage medium
KR102435365B1 (en) Certificate recognition method and apparatus, electronic device, computer readable storage medium
CN111507958A (en) Target detection method, training method of detection model and electronic equipment
EP3916634A2 (en) Text recognition method and device, and electronic device
CN113436100B (en) Method, apparatus, device, medium, and article for repairing video
US20220027661A1 (en) Method and apparatus of processing image, electronic device, and storage medium
CN112991180A (en) Image splicing method, device, equipment and storage medium
CN104268512A (en) Method and device for recognizing characters in image on basis of optical character recognition
CN116797513A (en) Defect detection method and device, electronic equipment and storage medium
CN116844177A (en) Table identification method, apparatus, device and storage medium
CN112241739A (en) Method, device, equipment and computer readable medium for identifying text errors
CN110232381B (en) License plate segmentation method, license plate segmentation device, computer equipment and computer readable storage medium
CN109444905B (en) Dynamic object detection method and device based on laser and terminal equipment
CN110147765A (en) A kind of image processing method and device
CN114187488B (en) Image processing method, device, equipment and medium
CN115830608A (en) Text recognition method and device, storage medium and electronic equipment
CN113221519B (en) Method, apparatus, device, medium and product for processing form data
CN115359502A (en) Image processing method, device, equipment and storage medium
CN111680628B (en) Text frame fusion method, device, equipment and storage medium
CN115115857A (en) Image matching method and device and computer equipment
CN114429628A (en) Image processing method and device, readable storage medium and electronic equipment
CN113255629A (en) Document processing method and device, electronic equipment and computer readable storage medium

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