Mainboard image detection method, electronic device and storage medium based on machine vision

By collecting and analyzing images of normal motherboards under different light sources, obtaining normal parameters, and collecting global and partition defects of the test motherboard, the problem of inaccurate results of motherboard detection of special defects in the existing technology is solved, and a higher level of Inspection accuracy and reliability.

CN119147536BActive Publication Date: 2025-02-14SHENZHEN VOLT INTERNET OF THINGS TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411633081.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-02-14
Estimated Expiration
2044-11-15

AI Technical Summary

Technical Problem

When existing motherboard image detection technology detects motherboards with special defects, the reliability of the detection results is insufficient, resulting in inaccurate judgment of motherboard defects.

Method used

By collecting and analyzing the normal motherboard under different light sources, the normal motherboard parameters and normal reflection parameters are obtained, and then the image is collected for the test motherboard. The detection motherboard image is collected based on the normal parameters to obtain the motherboard reflection defect collection to obtain the motherboard collection .

Benefits of technology

It improves the accuracy and reliability of detection of special defect motherboards and enhances the comprehensive judgment of motherboard defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119147536B_ABST
    Figure CN119147536B_ABST
Patent Text Reader

Abstract

The invention discloses a mainboard image detection method, an electronic device and a storage medium based on machine vision, and relates to the technical field of image detection. By performing image acquisition and analysis on a normal mainboard under different light sources, normal mainboard parameters and normal reflection parameters are obtained, and then image acquisition is performed on a mainboard to be tested under different light sources to obtain a detection mainboard image and a detection reflection mainboard image. Based on the normal mainboard parameters and the normal reflection parameters, global defect acquisition and partition defect acquisition are performed on the detection mainboard image to obtain a mainboard reflection defect collection. The invention is used to solve the problem that when the existing mainboard image detection technology detects a mainboard with special defects, the detection result reliability is insufficient, resulting in inaccurate judgment of the mainboard defects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image detection, and in particular to a mainboard image detection method, electronic equipment and storage medium based on machine vision. Background Art

[0002] As the core component of the computer system, the motherboard is responsible for connecting and managing the various hardware components of the computer. Its stability and performance directly affect the operating efficiency of the entire machine. Therefore, regular inspection of the motherboard can timely discover and solve potential problems and ensure the normal operation of the computer system. With the rapid development of the electronics manufacturing industry, the inspection accuracy requirements for PCB boards and related components are getting higher and higher. Traditional inspection methods can no longer meet the needs of modern production lines.

[0003] In the application of motherboard image detection, the existing machine vision technology usually collects the real-time image of the motherboard, performs template matching on the real-time image and identifies the defects of the motherboard, and then uses other methods to determine whether the motherboard has performance defects. For example, in the patent application with the publication number CN117129480A, a computer motherboard component intelligent detection method and device based on machine vision are disclosed. The scheme collects the real-time image of the motherboard, and performs template matching and motherboard defect identification on the real-time image based on the machine vision scheme to determine whether the motherboard has surface defects, and performs motherboard performance detection on the complete motherboard without surface defects to determine whether the motherboard has performance defects. Finally, the motherboard without performance defects is powered on to detect the voltage data and temperature data of multiple components on the computer motherboard to finally determine whether the computer motherboard meets the product performance requirements. However, there are many types of defects on the surface of the motherboard. When encountering defects such as board bending that do not affect template matching and power-on detection, accurate detection results cannot be obtained. When the existing motherboard image detection technology detects motherboards with special defects, the reliability of the detection results is insufficient, resulting in inaccurate judgment of the defects of the motherboard. Summary of the invention

[0004] The present invention aims to solve one of the technical problems in the prior art to at least a certain extent, by acquiring and analyzing images of normal motherboards under different light sources to obtain normal motherboard parameters and normal reflection parameters, and then acquiring images of the motherboard to be tested under different light sources to obtain a detection motherboard image and a detection reflection motherboard image, and performing global defect acquisition and partition defect acquisition on the detection motherboard image based on the normal motherboard parameters and normal reflection parameters to obtain a collection of motherboard reflection defects, so as to solve the problem that the existing motherboard image detection technology has insufficient reliability of detection results when detecting motherboards with special defects, resulting in inaccurate defect judgment of the motherboard.

[0005] To achieve the above objectives, in a first aspect, the present application provides a motherboard image detection method based on machine vision, comprising the following steps:

[0006] Capture images of normal motherboards under different light sources to obtain normal motherboard images and normal reflection motherboard images;

[0007] Analyze the normal motherboard image to obtain the normal motherboard parameters;

[0008] Obtain component partitions of a normal reflection mainboard image based on normal mainboard parameters to obtain a number of normal reflection area images;

[0009] Analyze each normal reflection area image to obtain normal reflection parameters;

[0010] Capture images of the motherboard to be tested under different light sources to obtain a detection motherboard image and a detection reflection motherboard image;

[0011] Perform global defect collection on the inspection motherboard image to obtain a global defect collection;

[0012] The component partitions of the detection reflection mainboard image are obtained to obtain a number of detection reflection area images, and the partition defects of each detection reflection area image are collected based on the global defect collection to obtain the mainboard reflection defect collection.

[0013] Furthermore, collecting images of the normal mainboard under different light sources to obtain the normal mainboard image and the normal reflection mainboard image includes the following sub-steps:

[0014] Setting a mainboard image acquisition device, wherein the mainboard image acquisition device is fixed directly above the acquisition area;

[0015] Set a surface light source, place a normal motherboard in the acquisition area under the surface light source, use a motherboard image acquisition device to take a picture of the motherboard under the surface light source, and obtain a normal motherboard image;

[0016] A point light source is set, and the point light source is fixed at any corner point of the acquisition area. The normal motherboard image is placed in the acquisition area under the point light source, and the motherboard under the point light source is photographed using a motherboard image acquisition device to obtain a normal reflection motherboard image.

[0017] Further, analyzing the normal motherboard image to obtain the normal motherboard parameters includes the following sub-steps:

[0018] grayscale processing is performed on the normal mainboard image to obtain a grayscale image of the normal mainboard image;

[0019] Performing grayscale contour extraction on the grayscale image of the normal mainboard image to obtain component contours and circuit contours of several normal mainboard images, setting the component contour of the normal mainboard image as the component normal contour, and setting the circuit contour of the normal mainboard image as the circuit normal contour;

[0020] The grayscale contour extraction includes: dividing the area with the same grayscale value of two or more pixels in the grayscale image into a group of divided areas, marked as divided areas Yn, where n is the number of groups of divided areas, and sequentially placing the divided areas Yn in a plane rectangular coordinate system;

[0021] In the plane rectangular coordinate system, the gray value of the pixel points outside the divided area Yn is set to X, and the gray value inside the divided area Yn is set to Y. The pixel points where the gray value of the point Y intersects with the gray value of the point X in the plane rectangular coordinate system are recorded as contour edge points. All contour edge points are connected end to end, and the obtained contour is recorded as the area contour;

[0022] Obtaining a substrate pixel value, and setting a region contour having a pixel value identical to the substrate pixel value as a substrate contour;

[0023] Obtain the standard width of the circuit in a normal motherboard from the database, change the length and width of the pixel points of the grayscale image to the standard width, and remove the outline of the substrate to obtain a standard grayscale image; for any pixel point in the standard grayscale image, obtain the eight-neighborhood pixel points of the pixel point, and when the pixel values ​​of any three or more of the eight-neighborhood pixel points of the pixel point are the same as the pixel value of the pixel point, set the pixel point as a component pixel point, otherwise set the pixel point as a circuit pixel point;

[0024] The area outline including the pixel points of the component is set as the element outline, and the area outline including the pixel points of the line is set as the line outline;

[0025] For all normal contours of components, they are named normal component 1 to normal component n from left to right and from top to bottom. For any normal contour of lines, they are named normal line 1 to normal line m from left to right and from top to bottom.

[0026] The areas of normal components 1 to normal components n are obtained respectively, and are set as normal component parameters 1 to normal component parameters n; the areas of normal lines 1 to normal lines m are obtained respectively, and are set as normal line parameters 1 to normal line parameters m;

[0027] The normal component parameters 1 to normal component parameters n and the normal line parameters 1 to normal line parameters m are collectively referred to as normal mainboard parameters.

[0028] Further, obtaining component partitions of the normal reflection mainboard image based on the normal mainboard parameters to obtain a plurality of normal reflection area images includes the following sub-steps:

[0029] Use the partition acquisition method to obtain the component partition of the normal reflection motherboard image;

[0030] The partition acquisition method includes setting a rectangular partition for any component outline or line outline, wherein the length and width of the rectangular partition are both twice the length and width of the component outline or line outline, and the geometric center of the rectangular partition coincides with the geometric center of the component outline or line outline, and setting the rectangular partition as the component partition of the component outline or line outline;

[0031] Acquire the image within each component partition and set it as the normal reflection area image.

[0032] Furthermore, analyzing each normal reflection region image to obtain normal reflection parameters includes the following sub-steps:

[0033] Obtain any normal reflection area image, perform grayscale processing on the normal reflection area image, obtain a grayscale value image of the normal reflection area image, and set it as a normal reflection grayscale image;

[0034] Perform reflection analysis on the normal reflection grayscale image to obtain highlight blocks and shadow blocks;

[0035] The reflection analysis includes: obtaining all pixel points with a pixel value of 0 from the grayscale image and setting them as shadow pixel points, and obtaining all pixel points with a pixel value of 255 from the grayscale image and setting them as highlight pixel points;

[0036] The area consisting of interconnected shadow pixels is set as a shadow block, and the area consisting of interconnected highlight pixels is set as a highlight block;

[0037] Obtain all shadow blocks in the normal reflection area image, and set the number of pixels of each shadow block as the normal reflection shadow parameter; obtain all highlight blocks in the normal reflection area image, and set the number of pixels of each highlight block as the normal reflection highlight parameter;

[0038] The normal reflection shadow parameters and the normal reflection highlight parameters are collectively referred to as normal reflection parameters.

[0039] Furthermore, the global defect collection of the detection mainboard image is performed to obtain the global defect collection, which includes the following sub-steps:

[0040] Grayscale processing is performed on the detection mainboard image to obtain a grayscale image of the detection mainboard image;

[0041] Performing grayscale contour extraction on the grayscale image of the detection mainboard image to obtain the component contour and the circuit contour of the detection mainboard image, setting the component contour of the detection mainboard image as the component detection contour, and setting the circuit contour of the detection mainboard image as the circuit detection contour;

[0042] For the component detection contours of the detection mainboard image, from left to right and from top to bottom, they are named detection element 1 to detection element k, and for the line detection contours of the detection mainboard image, from left to right and from top to bottom, they are named detection line 1 to detection line l;

[0043] The areas of detection element 1 to detection element k and detection circuit 1 to detection circuit l are obtained; they are respectively set as detection element 1 parameters to detection element k parameters and detection circuit 1 parameters to detection circuit l parameters, collectively referred to as detection mainboard parameters;

[0044] Compare the normal motherboard parameters of the normal motherboard image with the detection motherboard parameters;

[0045] When the parameters of the detected mainboard are the same as those of the normal mainboard, it is determined that the image of the detected mainboard has no defects;

[0046] When the detection mainboard parameters are different from the normal mainboard parameters, the detection mainboard image is judged to be defective, and the detection elements or detection circuits with different parameters are marked as defective elements or defective circuits, and marked in the detection mainboard image. The defective elements and defective circuits are collectively referred to as a global defect collection.

[0047] Furthermore, obtaining the component partition of the detection reflection mainboard image to obtain a plurality of detection reflection area images, performing partition defect collection on each detection reflection area image based on the global defect collection, and obtaining the mainboard reflection defect collection includes the following sub-steps:

[0048] Use the partition acquisition method to obtain the component partitions in the detection reflection mainboard image, obtain the image in each component partition, and set it to detect the reflection area image;

[0049] Performing partition parameter acquisition on the detection reflection area image to obtain secondary test reflection parameters;

[0050] The partition parameter acquisition includes: obtaining the component partition corresponding to the defective component or defective circuit in the global defect collection, and marking it as the defective reflection area image in the detection reflection area image; removing the defective reflection area image from the detection reflection area image to obtain a secondary test reflection area image; obtaining any secondary test reflection area image, performing grayscale processing on the secondary test reflection area image, obtaining a grayscale value image of the secondary test reflection area image, and setting it as a secondary test reflection grayscale image; performing reflection analysis on the secondary test reflection grayscale image to obtain a highlight block and a shadow block of the secondary test reflection grayscale image, setting the highlight block of the secondary test reflection grayscale image as a secondary test highlight block, and setting the shadow block of the secondary test reflection grayscale image as a secondary test shadow block; obtaining the number of pixels of the secondary test highlight block and the secondary test shadow block in the secondary reflection area image, and setting them as secondary test highlight parameters and secondary test shadow parameters, collectively referred to as secondary test reflection parameters;

[0051] Obtain normal reflection parameters corresponding to the secondary test reflection area image, and compare them with the secondary test reflection parameters;

[0052] When the secondary test reflection parameter is the same as the normal state reflection parameter, it is determined that the image of the secondary test reflection area has no defects;

[0053] When the secondary test reflection parameter is different from the normal reflection parameter, it is determined that the image of the secondary test reflection area is defective;

[0054] All defective secondary test reflection area images are set as defect images and marked in the inspection mainboard image to obtain a collection of mainboard reflection defects.

[0055] In a second aspect, the present application provides an electronic device, including a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the above method are performed.

[0056] In a third aspect, the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the above method are performed.

[0057] Beneficial effects of the present invention: The present invention first collects images of a normal motherboard under different light sources to obtain a normal motherboard image and a normal reflection motherboard image; the advantage is that there are many types of motherboard materials, and different materials perform differently under different light sources, so collecting normal motherboard images under different light sources can fully show the normal state of the motherboard;

[0058] The present invention obtains normal mainboard parameters by analyzing the normal mainboard image; obtains component partitions of the normal reflection mainboard image based on the normal mainboard parameters to obtain a plurality of normal reflection area images; and analyzes each normal reflection area image to obtain normal reflection parameters. The advantages of the present invention are that the normal mainboard parameters reflect the mainboard performance of a normal mainboard under ordinary light sources, and the normal reflection parameters reflect the mainboard performance of a normal mainboard under special light sources. The performance of the normal mainboard is obtained from multiple aspects, which can improve the comprehensiveness and accuracy of the comparison data. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 is a flow chart of the method steps of the present invention;

[0060] Figure 2 It is a schematic diagram of the surface light source arrangement of the present invention;

[0061] Figure 3 A schematic diagram of the point light source arrangement of the present invention;

[0062] Figure 4 It is a reflection analysis schematic diagram of the present invention;

[0063] Figure 5 It is a schematic structural diagram of the electronic device of the present invention. DETAILED DESCRIPTION

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

[0065] Example 1, please refer to Figure 1 As shown, the present application provides a motherboard image detection method based on machine vision, comprising the following steps:

[0066] S1: Capture images of a normal motherboard under different light sources to obtain a normal motherboard image and a normal reflection motherboard image;

[0067] See also Figure 2 and Figure 3 As shown, step S1 includes the following sub-steps:

[0068] S101: Setting a mainboard image acquisition device, wherein the mainboard image acquisition device is fixed directly above the acquisition area;

[0069] S102: Setting a surface light source, placing a normal motherboard in a collection area under the surface light source, and using a motherboard image collection device to photograph the motherboard under the surface light source to obtain a normal motherboard image; in the specific implementation process, the light generated by the surface light source is parallel light, and the parallel light can provide stable exposure conditions during the collection process due to its consistent direction and uniform light intensity distribution, so that the collected motherboard image has high accuracy and clarity;

[0070] S103: Set a point light source, which is fixed at any corner point of the acquisition area, place a normal motherboard image in the acquisition area under the point light source, and use a motherboard image acquisition device to photograph the motherboard under the point light source to obtain a normal reflection motherboard image; in the specific implementation process, the light source generated by the point light source is non-parallel light, which can form light and dark contrast and shadow effects on the surface of the object, thereby reflecting the outline and layering of the motherboard components.

[0071] S2: Analyze the normal motherboard image to obtain the normal motherboard parameters;

[0072] Step S2 includes the following sub-steps:

[0073] S201: grayscale processing is performed on the normal mainboard image to obtain a grayscale image of the normal mainboard image. In a specific implementation process, the grayscale processing simplifies the image from color to grayscale, which greatly reduces the complexity and calculation amount of data processing;

[0074] S202: extracting grayscale contours of the grayscale image of the normal mainboard image to obtain component contours and circuit contours of several normal mainboard images, setting the component contours of the normal mainboard image as component normal contours, and setting the circuit contours of the normal mainboard image as circuit normal contours;

[0075] Grayscale contour extraction includes: dividing an area with the same grayscale value of two or more pixels in a grayscale image into a group of divided areas, marked as divided areas Yn, where n is the number of groups of divided areas, and sequentially placing the divided areas Yn in a plane rectangular coordinate system; in the plane rectangular coordinate system, setting the grayscale value of the pixel points outside the divided area Yn to X, setting the grayscale value within the divided area Yn to Y, recording the pixel points where the point with the grayscale value Y and the point with the grayscale value X in the plane rectangular coordinate system intersect as contour edge points, connecting all contour edge points end to end, and recording the obtained contour as a region contour; obtaining a substrate pixel value, and setting the region contour with the same pixel value as the substrate pixel value as the substrate contour;

[0076] The standard width of the circuit in a normal motherboard is obtained from the database, the length and width of the pixel points of the grayscale image are changed to the standard width, and the substrate outline is removed to obtain a standard grayscale image; for any pixel point in the standard grayscale image, the eight-neighborhood pixel points of the pixel point are obtained, and when the pixel values ​​of any three or more pixel points in the eight-neighborhood pixel points of the pixel point are the same as the pixel value of the pixel point, the pixel point is set as a component pixel point, otherwise the pixel point is set as a line pixel point; usually, a component is a block of an area, and a circuit is a line. When the length and width of the pixel points of the grayscale image are changed to the standard width, any pixel point in the line outline has only one or two adjacent pixels. This method can be used to distinguish the component outline and the circuit outline well;

[0077] The area outline including the pixel points of the component is set as the element outline, and the area outline including the pixel points of the line is set as the line outline;

[0078] S203: For all normal contours of components, they are named normal component 1 to normal component n from left to right and from top to bottom, and for any normal contour of a line, they are named normal line 1 to normal line m from left to right and from top to bottom;

[0079] S204: respectively obtain the areas of normal components 1 to normal components n, and set them as normal component parameters 1 to normal component parameters n; respectively obtain the areas of normal lines 1 to normal lines m, and set them as normal line parameters 1 to normal line parameters m; normal component parameters 1 to normal component parameters n and normal line parameters 1 to normal line parameters m are collectively referred to as normal mainboard parameters.

[0080] S3: obtaining component partitions of a normal reflection mainboard image based on normal mainboard parameters, and obtaining a plurality of normal reflection area images;

[0081] Step S3 includes the following sub-steps:

[0082] S301: using a partition acquisition method to acquire component partitions of a normal reflection mainboard image;

[0083] The partition acquisition method includes setting a rectangular partition for any component outline or line outline, wherein the length and width of the rectangular partition are both twice the length and width of the component outline or line outline, and the geometric center of the rectangular partition coincides with the geometric center of the component outline or line outline, and setting the rectangular partition as the component partition of the component outline or line outline; in a specific implementation process, for example, if the length of a component outline is 2 cm and the width is 1.5 cm, the length of the rectangular partition of the component outline is 4 cm and the width is 3 cm;

[0084] S302: Acquire the image in each component partition and set it as a normal reflection area image.

[0085] S4: Analyze each normal reflection area image to obtain normal reflection parameters;

[0086] Step S4 includes the following sub-steps: Step S401: acquiring any normal reflection area image, performing grayscale processing on the normal reflection area image, obtaining a grayscale value image of the normal reflection area image, and setting it as a normal reflection grayscale image;

[0087] Step S402: performing reflection analysis on the normal reflection grayscale image to obtain highlight blocks and shadow blocks;

[0088] See also Figure 4 As shown, the reflection analysis includes: obtaining all pixel points with a pixel value of 0 from the grayscale image and setting them as shadow pixel points, and obtaining all pixel points with a pixel value of 255 from the grayscale image and setting them as highlight pixel points; in the specific implementation process, the light-dark contrast in the normal reflection area image is large, and after the normal reflection area image is grayscale processed, the pixel value of the metal part on the mainboard is 255, while the pixel value of the shadow part is 0;

[0089] The area consisting of interconnected shadow pixels is set as a shadow block, and the area consisting of interconnected highlight pixels is set as a highlight block;

[0090] Step S403: Obtain all shadow blocks in the normal reflection area image, and set the number of pixels of each shadow block as the normal reflection shadow parameter; obtain all highlight blocks in the normal reflection area image, and set the number of pixels of each highlight block as the normal reflection highlight parameter; the normal reflection shadow parameter and the normal reflection highlight parameter are collectively referred to as the normal reflection parameter.

[0091] S5: Capturing images of the motherboard to be tested under different light sources to obtain a detection motherboard image and a detection reflection motherboard image.

[0092] S6: performing global defect collection on the inspection mainboard image to obtain a global defect collection;

[0093] Step S6 includes the following sub-steps: Step S601: grayscale the detection mainboard image to obtain a grayscale image of the detection mainboard image;

[0094] Step S602: extracting grayscale contours of the grayscale image of the detection mainboard image to obtain component contours and circuit contours of the detection mainboard image, setting the component contour of the detection mainboard image as the component detection contour, and setting the circuit contour of the detection mainboard image as the circuit detection contour;

[0095] Step S603: for the component detection contours of the detection mainboard image, they are named detection component 1 to detection component k from left to right and from top to bottom, and for the line detection contours of the detection mainboard image, they are named detection line 1 to detection line l from left to right and from top to bottom;

[0096] Step S604: obtaining the areas of detection element 1 to detection element k and detection circuit 1 to detection circuit l; setting them as detection element 1 parameters to detection element k parameters and detection circuit 1 parameters to detection circuit l parameters, collectively referred to as detection mainboard parameters;

[0097] Step S605: comparing the normal motherboard parameters of the normal motherboard image with the detection motherboard parameters;

[0098] When the parameters of the detected mainboard are the same as those of the normal mainboard, it is determined that the image of the detected mainboard has no defects;

[0099] When the detection mainboard parameters are different from the normal mainboard parameters, the detection mainboard image is judged to be defective, and the detection components or detection circuits with different parameters are marked as defective components or defective circuits, and marked in the detection mainboard image. The defective components and defective circuits are collectively referred to as the global defect collection.

[0100] S7: Obtain component partitions of the detection reflection mainboard image to obtain a plurality of detection reflection area images, perform partition defect collection on each detection reflection area image based on the global defect collection to obtain the mainboard reflection defect collection;

[0101] Step S7 includes the following sub-steps: Step S701: using a partition acquisition method to acquire component partitions in the detection reflection mainboard image, acquiring an image within each component partition, and setting it to detect the reflection area image;

[0102] Step S702: collecting partition parameters of the detection reflection area image to obtain secondary test reflection parameters;

[0103] Partition parameter acquisition includes: obtaining component partitions corresponding to defective components or defective lines in the global defect collection, and marking them as defective reflection area images in the detection reflection area image;

[0104] The defect reflection area image is removed from the detection reflection area image to obtain a secondary test reflection area image; in the specific implementation process, the defect part in the global defect collection is removed to reduce the processing amount of partition defect collection and improve the processing efficiency;

[0105] Obtain any secondary test reflection area image, perform grayscale processing on the secondary test reflection area image, obtain a grayscale value image of the secondary test reflection area image, and set it as the secondary test reflection grayscale image;

[0106] Perform reflection analysis on the secondary test reflection grayscale image to obtain the highlight block and shadow block of the secondary test reflection grayscale image, set the highlight block of the secondary test reflection grayscale image as the secondary test highlight block, and set the shadow block of the secondary test reflection grayscale image as the secondary test shadow block; obtain the number of pixels of the secondary test highlight block and the secondary test shadow block in the secondary reflection area image, set them as the secondary test highlight parameter and the secondary test shadow parameter, collectively referred to as the secondary test reflection parameter;

[0107] Step S703: obtaining the normal reflection parameters corresponding to the secondary test reflection area image, and comparing them with the secondary test reflection parameters; in the specific implementation process, the global defect detection can only detect defects in the plane direction, so it is necessary to compare the parameters of the secondary test reflection area image to determine whether defects appear in the vertical direction;

[0108] When the secondary test reflection parameter is the same as the normal state reflection parameter, it is determined that the image of the secondary test reflection area has no defects;

[0109] When the secondary test reflection parameter is different from the normal reflection parameter, it is determined that the image of the secondary test reflection area is defective;

[0110] Step S704: all defective secondary test reflection area images are set as defect images and marked in the detection mainboard image to obtain a mainboard reflection defect collection. The global defect collection and the mainboard reflection defect collection are collectively referred to as mainboard defects.

[0111] Example 2, please refer to Figure 5 As shown, Figure 5 The structural schematic diagram of an electronic device is illustrated, and the electronic device may include: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus. The memory stores computer-readable instructions, and the processor can call the instructions in the memory. When the computer-readable instructions are executed by the processor, the steps in the motherboard image detection method based on machine vision are executed to achieve the following functions: by performing image acquisition and analysis on normal motherboards under different light sources, normal motherboard parameters and normal reflection parameters are obtained, and then image acquisition is performed on the motherboard to be tested under different light sources to obtain the detection motherboard image and the detection reflection motherboard image, and global defect acquisition and partition defect acquisition are performed on the detection motherboard image based on the normal motherboard parameters and the normal reflection parameters to obtain a collection of motherboard reflection defects.

[0112] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0113] Embodiment 3. The present application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the motherboard image detection method based on machine vision provided by the above methods, and the method includes: acquiring and analyzing images of normal motherboards under different light sources to obtain normal motherboard parameters and normal reflection parameters, and then acquiring images of the motherboard to be tested under different light sources to obtain a detection motherboard image and a detection reflection motherboard image, and performing global defect acquisition and partitioned defect acquisition on the detection motherboard image based on the normal motherboard parameters and normal reflection parameters to obtain a collection of motherboard reflection defects.

[0114] Embodiment 4, the present application also provides a computer-readable storage medium, the present application provides a storage medium, on which a computer program is stored, and when the computer program is executed by the processor, the steps in the motherboard image detection method based on machine vision are executed. Through the above technical scheme, when the computer program is executed by the processor, the method in any optional implementation of the above embodiment is executed to achieve the following functions: by performing image acquisition and analysis on the normal motherboard under different light sources, normal motherboard parameters and normal reflection parameters are obtained, and then image acquisition is performed on the motherboard to be tested under different light sources to obtain the detection motherboard image and the detection reflection motherboard image, and global defect acquisition and partition defect acquisition are performed on the detection motherboard image based on the normal motherboard parameters and normal reflection parameters to obtain a collection of motherboard reflection defects.

[0115] Through the description of the above implementation methods, the embodiments of the present invention can be provided as methods, systems or computer program products. Based on such an understanding, the above technical solutions can be essentially or partly contributed to the prior art in the form of software products, which can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and include several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0116] In the embodiments provided in the present application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of systems, modules and units can be electrical, mechanical or other forms.

[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A motherboard image detection method based on machine vision, characterized in that: The steps include: Capture images of normal motherboards under different light sources to obtain normal motherboard images and normal reflection motherboard images; Analyze the normal motherboard image to obtain the normal motherboard parameters; Obtain component partitions of a normal reflection mainboard image based on normal mainboard parameters to obtain a number of normal reflection area images; Analyze each normal reflection area image to obtain normal reflection parameters; Capture images of the motherboard to be tested under different light sources to obtain a detection motherboard image and a detection reflection motherboard image; Perform global defect collection on the inspection motherboard image to obtain a global defect collection; Obtain component partitions of the detection reflection mainboard image to obtain a number of detection reflection area images, perform partition defect collection on each detection reflection area image based on the global defect collection, and obtain the mainboard reflection defect collection; Capturing images of a normal motherboard under different light sources to obtain a normal motherboard image and a normal reflection motherboard image includes the following sub-steps: Setting a mainboard image acquisition device, wherein the mainboard image acquisition device is fixed directly above the acquisition area; Set a surface light source, place a normal motherboard in the acquisition area under the surface light source, use a motherboard image acquisition device to take a picture of the motherboard under the surface light source, and obtain a normal motherboard image; A point light source is set, and the point light source is fixed at any corner point of the acquisition area. A normal motherboard image is placed in the acquisition area under the point light source, and a motherboard image acquisition device is used to photograph the motherboard under the point light source to obtain a normal reflection motherboard image; Analyzing the normal motherboard image to obtain the normal motherboard parameters includes the following sub-steps: grayscale processing is performed on the normal mainboard image to obtain a grayscale image of the normal mainboard image; Performing grayscale contour extraction on the grayscale image of the normal mainboard image to obtain component contours and circuit contours of several normal mainboard images, setting the component contour of the normal mainboard image as the component normal contour, and setting the circuit contour of the normal mainboard image as the circuit normal contour; The grayscale contour extraction includes: dividing the area with the same grayscale value of more than two pixels in the grayscale image into a group of divided areas, marked as divided areas Yn, where n is the number of groups of divided areas, and sequentially placing the divided areas Yn in a plane rectangular coordinate system; In the plane rectangular coordinate system, the gray value of the pixel points outside the divided area Yn is set to X, and the gray value inside the divided area Yn is set to Y. The pixel points where the gray value of the point Y intersects with the gray value of the point X in the plane rectangular coordinate system are recorded as contour edge points. All contour edge points are connected end to end, and the obtained contour is recorded as the area contour; Obtaining a substrate pixel value, and setting a region contour having a pixel value identical to the substrate pixel value as a substrate contour; Obtain the standard width of the circuit in a normal motherboard from the database, change the length and width of the pixel point of the grayscale image to the standard width, and remove the outline of the substrate to obtain a standard grayscale image; for any pixel point in the standard grayscale image, obtain the eight neighboring pixel points of the pixel point, and when the pixel values ​​of any three or more pixel points in the eight neighboring pixel points of the pixel point are the same as the pixel value of the pixel point, set the pixel point as a component pixel point, otherwise set the pixel point as a circuit pixel point; The area outline including the pixel points of the component is set as the element outline, and the area outline including the pixel points of the line is set as the line outline; For all normal contours of components, they are named normal component 1 to normal component n from left to right and from top to bottom. For any normal contour of lines, they are named normal line 1 to normal line m from left to right and from top to bottom. The areas of normal components 1 to normal components n are obtained respectively, and are set as normal component parameters 1 to normal component parameters n; the areas of normal lines 1 to normal lines m are obtained respectively, and are set as normal line parameters 1 to normal line parameters m; The normal component parameters 1 to normal component parameters n and normal line parameters 1 to normal line parameters m are collectively referred to as normal mainboard parameters; Obtaining component partitions of a normal reflection mainboard image based on normal mainboard parameters to obtain a plurality of normal reflection area images includes the following sub-steps: Use the partition acquisition method to obtain the component partition of the normal reflection motherboard image; The partition acquisition method includes setting a rectangular partition for any component outline or line outline, wherein the length and width of the rectangular partition are both twice the length and width of the component outline or line outline, and the geometric center of the rectangular partition coincides with the geometric center of the component outline or line outline, and setting the rectangular partition as the component partition of the component outline or line outline; Obtain the image within each component partition and set it as a normal reflection area image; Analyzing each normal reflection area image to obtain normal reflection parameters includes the following sub-steps: Obtain any normal reflection area image, perform grayscale processing on the normal reflection area image, obtain a grayscale value image of the normal reflection area image, and set it as a normal reflection grayscale image; Perform reflection analysis on the normal reflection grayscale image to obtain highlight blocks and shadow blocks; The reflection analysis includes: obtaining all pixel points with a pixel value of 0 from the grayscale image and setting them as shadow pixel points, and obtaining all pixel points with a pixel value of 255 from the grayscale image and setting them as highlight pixel points; The area consisting of interconnected shadow pixels is set as a shadow block, and the area consisting of interconnected highlight pixels is set as a highlight block; Obtain all shadow blocks in the normal reflection area image, and set the number of pixels of each shadow block as the normal reflection shadow parameter; obtain all highlight blocks in the normal reflection area image, and set the number of pixels of each highlight block as the normal reflection highlight parameter; The normal reflection shadow parameters and the normal reflection highlight parameters are collectively referred to as normal reflection parameters.

2. The method for detecting motherboard images based on machine vision according to claim 1, characterized in that: The global defect collection of the inspection motherboard image to obtain the global defect collection includes the following sub-steps: Grayscale processing is performed on the detection mainboard image to obtain a grayscale image of the detection mainboard image; Performing grayscale contour extraction on the grayscale image of the detection mainboard image to obtain the component contour and the circuit contour of the detection mainboard image, setting the component contour of the detection mainboard image as the component detection contour, and setting the circuit contour of the detection mainboard image as the circuit detection contour; For the component detection contours of the detection mainboard image, from left to right and from top to bottom, they are named detection element 1 to detection element k, and for the line detection contours of the detection mainboard image, from left to right and from top to bottom, they are named detection line 1 to detection line l; Obtaining the areas of detection element 1 to detection element k and detection circuit 1 to detection circuit l; They are set as detection element 1 parameters to detection element k parameters and detection circuit 1 parameters to detection circuit l parameters, collectively referred to as detection mainboard parameters; Compare the normal motherboard parameters of the normal motherboard image with the detection motherboard parameters; When the parameters of the detected mainboard are the same as those of the normal mainboard, it is determined that the image of the detected mainboard has no defects; When the detection mainboard parameters are different from the normal mainboard parameters, the detection mainboard image is judged to be defective, and the detection elements or detection circuits with different parameters are marked as defective elements or defective circuits, and marked in the detection mainboard image. The defective elements and defective circuits are collectively referred to as a global defect collection.

3. The method for detecting motherboard images based on machine vision according to claim 2, characterized in that: Obtaining the component partition of the detection reflection mainboard image to obtain a number of detection reflection area images, performing partition defect collection on each detection reflection area image based on the global defect collection, and obtaining the mainboard reflection defect collection includes the following sub-steps: Use the partition acquisition method to obtain the component partitions in the detection reflection mainboard image, obtain the image in each component partition, and set it to detect the reflection area image; Performing partition parameter acquisition on the detection reflection area image to obtain secondary test reflection parameters; The partition parameter acquisition includes: obtaining the component partition corresponding to the defective component or defective circuit in the global defect collection, and marking it as the defective reflection area image in the detection reflection area image; removing the defective reflection area image from the detection reflection area image to obtain a secondary test reflection area image; obtaining any secondary test reflection area image, performing grayscale processing on the secondary test reflection area image, obtaining a grayscale value image of the secondary test reflection area image, and setting it as a secondary test reflection grayscale image; performing reflection analysis on the secondary test reflection grayscale image to obtain a highlight block and a shadow block of the secondary test reflection grayscale image, setting the highlight block of the secondary test reflection grayscale image as a secondary test highlight block, and setting the shadow block of the secondary test reflection grayscale image as a secondary test shadow block; obtaining the number of pixels of the secondary test highlight block and the secondary test shadow block in the secondary reflection area image, and setting them as secondary test highlight parameters and secondary test shadow parameters, collectively referred to as secondary test reflection parameters; Obtain normal reflection parameters corresponding to the secondary test reflection area image, and compare them with the secondary test reflection parameters; When the secondary test reflection parameter is the same as the normal state reflection parameter, it is determined that the image of the secondary test reflection area has no defects; When the secondary test reflection parameter is different from the normal reflection parameter, it is determined that the image of the secondary test reflection area is defective; All defective secondary test reflection area images are set as defect images and marked in the inspection mainboard image to obtain a collection of mainboard reflection defects.

4. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the method according to any one of claims 1 to 3 are executed.

5. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are performed.

Citation Information

Patent Citations

  • Computer mainboard component intelligent detection method and device based on machine vision

    CN117129480A

  • Equipment and combined light source device for product appearance defect detection and method based on product appearance defect detection

    CN109991166A

  • Circuit board defect detection device and system

    CN111650221A