A PCB circuit board detection method based on machine vision
Through the PCB circuit board detection method based on machine vision, high-precision automatic alignment and automated detection of probes and PCB boards are realized, solving the shortcomings of manual detection in the prior art and improving the efficiency and accuracy of detection.
Patent Information
- Application Number
- CN202210527613.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-16
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2042-05-16
AI Technical Summary
The existing PCB circuit board detection methods rely on manual operation, which have problems such as fatigue, positioning difficulties, missed inspection and missed inspection and safety hazards, and are difficult to support the detection requirements of multiple PCB circuit boards.
Using machine vision-based detection methods, high-precision automatic alignment between the probe and the PCB board is achieved through camera calibration, sub-pixel-level positioning recognition and motion compensation, and intelligently identify the indicator lights in combination with machine vision.
It realizes high-precision automatic alignment and automated detection of PCB circuit board detection probes, improves the objectivity and stability of detection, reduces production costs, and improves production efficiency.
Smart Images

Figure CN114972224B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of PCB board detection, and in particular to a method for detecting a PCB circuit board based on machine vision Background Art
[0002] As an important control component of small household appliances, the quality of a PCB (printed circuit board) directly affects the use function of the product. During the production and processing of PCB circuit boards, due to production condition limitations, some defects are always inevitable. In order to ensure that the PCB boards put into use are intact, they must be detected. Since the functional units on the PCB circuit board are small, the defect points are also small. It is very difficult to directly check whether each functional unit has defects on a PCB circuit board with dense functional units. In the past, the detection method was to manually move the PCB circuit board and detect it in areas. This is prone to fatigue, inconvenient for positioning error codes, and unable to trace data. Using this method, it is overly dependent on the subjective judgment of technicians, and it is easy to miss detections and misdetections. Moreover, for PCB circuit boards with strong electricity, the exposed circuits are likely to pose a hazard to the safety of workers. In terms of automatic image stitching, the past methods mostly compared the position differences between the PCB master board and the daughter board. For this purpose, a special positioning mark had to be made on the PCB master board. Although the reliability was relatively high, the expandability was poor. It had a good effect on a single PCB circuit board and was insufficient to support the detection requirements of multiple PCB circuit boards. With the increasing density and output of PCB circuit boards, as well as the continuous increase in labor costs, the disadvantages of manual detection have become increasingly prominent
[0003] Machine vision detection is a detection method based on optical principles. It uses a variety of technologies, mainly involving image processing, computer, and automatic control technologies, to identify and detect the visible functions or markings on the appearance of the PCB circuit board. It is a new type of PCB circuit board detection technology. By applying machine vision technology, visual alignment of the PCB circuit board detection probe can be performed, and the working conditions of the PCB can be automatically identified by monitoring the indicator lights, thereby solving the problems of detection stability and detection efficiency. Therefore, it is very necessary to study a method for detecting a PCB circuit board based on machine vision Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method for detecting a PCB circuit board based on machine vision
[0005] To solve the above technical problem, the present invention provides a method for detecting a PCB circuit board based on machine vision, including the following steps
[0006] Step 1: Perform camera calibration to obtain the mapping relationship M between the pixel coordinates and the actual coordinates of the collected image
[0007] Step 2: Control the moving probe to the detection station, and record the motion parameters as the preset motion parameters;
[0008] Step 3: Collect the picture of the probe at the initial position of the detection station as the standard picture, perform sub-pixel level positioning and recognition on the probe, and record the preset position P of the probe in the image coordinates 0 and the position P of the edge line of the probe at the detection position 1 ;
[0009] Step 4: Move the probe according to the preset motion parameters for initial alignment;
[0010] Step 5: Collect the initial alignment image, perform the sub-pixel level positioning and recognition on the probe, identify the current probe position P i , calculate the pixel offset Y of the probe position i , and perform coordinate transformation using the mapping relationship M to obtain the physical offset Y of the probe position w ;
[0011] Step 6: Perform secondary supplementary alignment through the physical offset Y of the probe position w ;
[0012] Step 7: Visually identify and detect the working conditions of the PCB indicator lights.
[0013] Among them, the sub-pixel level positioning and recognition includes the following steps:
[0014] Step 3-1: Image preprocessing;
[0015] Step 3-2: Edge point extraction;
[0016] Step 3-3: Construct the Hough space and find the maximum value of the Hough space voting;
[0017] Step 3-4: Obtain the sub-pixel level contour of the probe through Hough transform.
[0018] Among them, the specific content of the step 3-1 is to use the threshold segmentation method to separate the target object and the background, and perform sobel filtering on the target image to enhance the edge contrast.
[0019] Among them, the specific content of the step 3-2 is to set two thresholds T 1 and T 2 , and T 2 ≥T 1 , detect any pixel point (i, j) of the edge image after sobel filtering. If its gray value M(i, j)≥T 2 , then this point is an edge point. If its gray value M(i, j)≤T 1 , then this point is a non-edge point.
[0020] Among them, step 3-3 specifically records the coordinates of the identified edge points, converts the coordinate system from the Cartesian rectangular coordinate system to the polar coordinate system, and for the edge point P i (x i , y i ), it is represented in polar coordinates, where
[0021] x i = ρ i cosθ i ,
[0022] y i = ρ i sinθ i ,
[0023] P i (x i , y i ) can be expressed as P i (ρ i cosθ i , ρ i sinθ i ). The coordinate relationship of points on the coordinate system can be expressed as:
[0024] x i cosθ i + y i sinθ i = ρ i ,
[0025] Convert each point represented in the polar coordinate system into a straight line in the Hough space. In the Hough space, the coordinate axes are ρ and θ respectively, and the above formula can be expressed as:
[0026] ρ = cosθx + sinθy,
[0027] Convert each extracted pixel point into a curve in the Hough space, construct the Hough space, and the intersection point of the curves in the Hough space is the fitting curve of several points in the original coordinate system. Find a point in the several curve intersection points in the Hough space through which the most curves pass.
[0028] Among them, step 3-4 specifically performs an inverse Hough space transformation on the point coordinates obtained by voting to obtain the best-fitting edge line of the probe profile of the actual coordinates.
[0029] Among them, step 7 includes the following steps:
[0030] Step 7-1: Collect the image of the indicator light for preprocessing and input the detection area range;
[0031] Step 7-2: Calculate the average brightness of the background area outside the lamp area;
[0032] Step 7-3: Enter the color and brightness characteristics of each indicator light under different working conditions;
[0033] Step 7-4: Judge the brightness and darkness of the current environment according to the average brightness of the background area;
[0034] Step 7-5: When all the indicator lights on the PCB indicator light are not lit, judge that the working condition of the indicator light is "not lit";
[0035] Step 7-6: When the PCB indicator light is in a bright / dark environment, the background brightness is L B , the brightness represented by the indicator light image is L, and the actual brightness of the indicator light is L R , and the calculation formula is:
[0036] L R = L - k * L B ,
[0037] where k is a compensation coefficient, which is obtained through actual tests during initialization;
[0038] Step 7-7: By comparing the actual brightness L of the indicator light R with the preset working condition brightness L 0 , judge the working condition of the indicator light.
[0039] Among them, the said Step 7-1 includes the following steps:
[0040] Step 7-1-1: Obtain three-channel grayscale images of RGB from the collected color image by channel to judge the color of the indicator light;
[0041] Step 7-1-2: Select a suitable channel image according to the color of the indicator light, and perform a local gray-scale maximization linear transformation on the indicator light area image;
[0042] Step 7-1-3: Perform threshold segmentation on the channel image after gray-scale transformation to distinguish the foreground and background, and find the indicator light.
[0043] Among them, the said local gray-scale maximization linear transformation is to calculate the minimum and maximum values of the gray-scale values of the original image, and scale the gray-scale values of the original image to the range of 0-255 in proportion.
[0044] Implementing the present invention has the following beneficial effects:
[0045] The sub-pixel level intelligent positioning algorithm based on machine vision realizes the compensation of the alignment deviation between the probe and the PCB workpiece, calculates the deviation between the actual position of the PCB board and the position of the detection probe, and then performs motion compensation according to the actual position deviation between the probe and the PCB interface, achieving the high-precision automatic alignment of the detection probe of the PCB circuit board. At the same time, combined with machine vision, the image of the indicator light display is captured, and the working condition of the indicator light is intelligently identified by analyzing the image features through an algorithm, realizing the automatic detection of the PCB circuit board, which is more objective and stable than manual judgment. It further reduces the production cost of enterprises in product detection and quality control, improves production efficiency, and reduces the dependence on manual labor. Brief Description of the Drawings
[0046] Figure 1 is the flow schematic diagram of the present invention; Detailed Description of the Preferred Embodiment
[0047] To make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings.
[0048] As Figure 1 shown, a method for detecting a PCB circuit board based on machine vision includes the following steps:
[0049] Step 1: Perform camera calibration to obtain the mapping relationship M between the pixel coordinates and the actual coordinates of the collected image.
[0050] Step 2: Control the moving probe to the detection station and record the motion parameters as the preset motion parameters.
[0051] Step 3: Collect the picture of the probe at the initial position in the detection station as the standard picture, perform sub-pixel level positioning and recognition on the probe, and record the preset position P of the probe in the image coordinates 0 and the position P of the edge line of the probe at the detection position 1 .
[0052] The sub-pixel level positioning and recognition includes the following steps:
[0053] Step 3-1: Image preprocessing;
[0054] Step 3-2: Edge point extraction;
[0055] Step 3-3: Construct the Hough space and find the maximum value of the Hough space voting;
[0056] Step 3-4: Obtain the sub-pixel level contour of the probe through Hough transform.
[0057] Step 3-1 specifically uses the threshold segmentation method to separate the target object and the background, and performs sobel filtering on the target image to enhance the edge contrast.
[0058] Sobel filtering is an efficient denoising filter. According to the probe position and whether the probe angle is vertical or horizontal, the operator in the x or y direction can be selected to perform filtering in the specified direction to enhance the gray-scale contrast of the probe edge. When the probe is in the vertical direction, the x-direction Sobel operator is selected, and the calculation formula is:
[0059]
[0060] When the probe is in the horizontal direction, the y-direction Sobel operator is selected to enhance the edge, and the calculation formula is:
[0061]
[0062] Among them, A is the original image, and Gx and Gy are the images after horizontal and vertical edge detections respectively.
[0063] Step 3-2 is specifically to set two thresholds T 1 and T 2 , and T 2 ≥T 1 . For any pixel point (i, j) in the edge image after Sobel filtering, if its gray value M(i, j)≥T 2 , then this point is an edge point; if its gray value M(i, j)≤T 1 , then this point is a non-edge point.
[0064] Step 3-3 is specifically to record the coordinates of the recognized edge points, convert the coordinate system from the Cartesian rectangular coordinate system to the polar coordinate system, and the edge point P i (x i , y i ) is represented in polar coordinates, where
[0065] x i =ρ i cosθ i ,
[0066] y i =ρ i sinθ i ,
[0067] P i (x i , y i ) is P i (ρ i cosθ i , ρ i sinθ i ). The coordinate relationship of points on the coordinate system can be expressed as:
[0068] x i cosθ i +yi sinθ i = ρ i ,
[0069] Convert each point represented in the polar coordinate system into a straight line in the Hough space. In the Hough space, the coordinate axes are ρ and θ respectively, and the above formula can be expressed as:
[0070] ρ = cosθx + sinθy,
[0071] Convert each extracted pixel point into a curve in the Hough space, construct the Hough space. The intersection point of the curves in the Hough space is the fitting curve of several points in the original coordinate system. Find a point in the several curve intersection points in the Hough space that has the most curves passing through it.
[0072] Step 3-4 specifically performs an inverse transformation of the Hough space on the point coordinates obtained by voting to obtain the best-fitting edge line of the probe contour with the actual coordinates.
[0073] Step 4: Move the probe according to the preset motion parameters for initial alignment;
[0074] Step 5: Collect the initial alignment image, perform sub-pixel level positioning and recognition on the probe, and identify the current probe position P i , calculate the pixel offset Y of the probe position i , and use the mapping relationship M to perform coordinate system conversion to obtain the physical offset Y of the probe position w .
[0075] Step 6: Perform secondary complementary alignment through the physical offset Y of the probe position w .
[0076] Based on the sub-pixel level intelligent positioning algorithm of machine vision, realize the compensation of the alignment deviation between the probe and the PCB workpiece, calculate the deviation between the actual position of the PCB board and the detected probe position, and then perform motion compensation according to the actual position deviation of the interface between the probe and the PCB, realizing the high-precision automatic alignment of the PCB circuit board detection probe.
[0077] Step 7: Visually identify and detect the working conditions of the PCB indicator lights.
[0078] Step 7 includes the following steps:
[0079] Step 7-1: Collect the indicator light image for preprocessing and enter the detection area range;
[0080] Step 7-2: Calculate the average brightness of the background area outside the lamp area;
[0081] Step 7-3: Enter the color and brightness characteristics of each indicator light under different working conditions;
[0082] Step 7-4: Determine the brightness of the current environment based on the average brightness of the background area;
[0083] Step 7-5: When all the indicators on the PCB indicator light are not lit, determine that the indicator light condition is "not lit";
[0084] Step 7-6: When the PCB indicator light is in a bright / dark environment, the background brightness is L B , the brightness represented by the indicator light image is L, and the actual brightness of the indicator light is L R , and the calculation formula is:
[0085] L R = L - k * L B ,
[0086] where k is a compensation coefficient, which is obtained through actual tests during initialization;
[0087] Step 7-7: By comparing the actual brightness L of the indicator light R with the preset working condition brightness L 0 , determine the working condition of the indicator light.
[0088] Step 7-1 includes the following steps:
[0089] Step 7-1-1: Obtain the grayscale images of the RGB three channels by separating the channels of the acquired image from a color image to determine the color of the indicator light;
[0090] Step 7-1-2: Select the appropriate channel image according to the color of the indicator light, and perform a local grayscale maximization linear transformation on the indicator light area image;
[0091] The local grayscale maximization linear transformation is to calculate the minimum and maximum values of the grayscale values of the original image, and scale the grayscale values of the original image to the range of 0-255 in proportion.
[0092] Step 7-1-3: Perform threshold segmentation on the channel image after grayscale transformation to distinguish the foreground and background, and find the indicator light.
[0093] Combined with machine vision, take images of the indicator light display, and intelligently identify the working condition of the indicator light by analyzing the image features through algorithms, realizing the automatic detection of the PCB circuit board, which is more objective and stable compared with manual judgment.
[0094] The above-disclosed is only a preferred embodiment of the present invention. Of course, it cannot be used to limit the scope of the rights of the present invention. Therefore, equivalent changes made according to the claims of the present invention still fall within the scope covered by the present invention.
Claims
1. A PCB circuit board detection method based on machine vision, characterized in that, it includes the following steps: Step 1: Perform camera calibration to obtain the mapping relationship M between the pixel coordinates and the actual coordinates of the acquired image: Step 2: Control the moving probe to the detection station and record the motion parameters as preset motion parameters; Step 3: Collect an image of the probe at the initial position of the detection station as a standard image, perform sub-pixel level positioning and recognition on the probe, and record the preset position P0 of the probe in the image coordinates and the position P of the edge line of the probe at the detection position 1 ; Step 4: Move the probe according to the preset motion parameters for initial alignment; Step 5: Collect the initial alignment image, perform sub-pixel level positioning and identification on the probe, and identify the current probe position P i , calculate the pixel offset Y of the probe position i , and perform coordinate system conversion using the mapping relationship M to obtain the physical offset Y of the probe position w ; Step 6: Perform secondary complementary alignment through the physical offset Y of the probe position w ; Step 7: Visually identify and detect the working conditions of the PCB indicator lights.
2. The PCB circuit board detection method based on machine vision according to claim 1, characterized in that, the sub-pixel level positioning and recognition includes the following steps: Step 3-1: Image preprocessing; Step 3-2: Edge point extraction; Step 3-3: Construct a Hough space and find the maximum vote in the Hough space; Step 3-4: Obtain the sub-pixel level contour of the probe through Hough transform.
3. The PCB circuit board detection method based on machine vision according to claim 2, characterized in that, the specific operation of Step 3-1 is to use the threshold segmentation method to separate the target object and the background, and perform sobel filtering on the target image to enhance the edge contrast.
4. The PCB circuit board detection method based on machine vision according to claim 2, characterized in that, Step 3-2 specifically sets two thresholds T 1 and T 2 , and T 2 ≥T 1 . Detect any pixel point (i, j) in the edge image after sobel filtering. If its gray value M(i, j)≥T 2 , then this point is an edge point. If its gray value M(i, j)≤T 1 , then this point is a non-edge point.
5. The PCB circuit board detection method based on machine vision according to claim 2, characterized in that, The specific operation of step 3-3 is to record the coordinates of the recognized edge points, convert the coordinate system from the Cartesian rectangular coordinate system to the polar coordinate system, and the edge point P i (x i , y i ) is represented in polar coordinates, where x i = ρ i cosθ i , y i = ρ i sin θ i , P i (x i ,y i ) can be expressed as P i (ρ i cosθ i ,ρ i sinθ i ), and the coordinate relationship of points on the coordinate system can be expressed as: x i cosθ i +y i sinθ i =ρ i , Convert each point represented in the polar coordinate system into a straight line in the Hough space. In the Hough space, the coordinate axes are ρ and θ respectively, and the above formula can be expressed as: ρ = cosθx + sinθy, Convert each extracted pixel point into a curve in the Hough space, construct the Hough space, and the intersection point of the curves in the Hough space is the fitting curve of several points in the original coordinate system. Find a point in the several curve intersection points in the Hough space that has the most curves passing through it.
6. The PCB circuit board detection method based on machine vision according to claim 2, characterized in that, the specific operation of Step 3-4 is to perform an inverse Hough transform on the point coordinates obtained by voting to obtain the best fitting edge line of the actual coordinate of the probe contour.
7. The PCB circuit board detection method based on machine vision according to claim 1, characterized in that, Step 7 includes the following steps: Step 7-1: Collect the indicator light image for preprocessing and input the detection area range; Step 7-2: Calculate the average brightness of the background area outside the lamp area; Step 7-3: Input the color and brightness characteristics of each indicator light under different working conditions; Step 7-4: Judge the brightness and darkness of the current environment according to the average brightness of the background area; Step 7-5: When all the indicator lights on the PCB are not lit, judge the working condition of the indicator light as "not lit"; Step 7-6: When the PCB indicator light is in a bright / dark environment, the background brightness is L B , the brightness represented by the indicator light image is L, and the actual brightness of the indicator light is L R , and the calculation formula is: L R = L - k*L B , where k is a compensation coefficient, which is obtained through actual tests during initialization; Step 7-7: By comparing the actual brightness L of the indicator light R with the brightness L under the preset working condition 0 , judge the working condition of the indicator light.
8. The PCB circuit board detection method based on machine vision according to claim 7, characterized in that, Step 7-1 includes the following steps: Step 7-1-1: Separate the acquired image from the color image to obtain three-channel grayscale images of RGB to judge the color of the indicator light; Step 7-1-2: Select an appropriate channel image according to the color of the indicator light, and perform local gray-scale maximization linear transformation on the indicator light area image; Step 7-1-3: Perform threshold segmentation on the channel image after gray-scale transformation to distinguish the foreground and background, and find the indicator light.
9. A PCB circuit board detection method based on machine vision according to claim 8, wherein, The local gray-scale maximization linear transformation is to scale the gray-scale value of the original image to the range of 0-255 in proportion by calculating the minimum and maximum values of the gray-scale value of the original image.
Citation Information
Patent Citations
Device and method for assembling and detecting charging equipment automatically
CN111015208A
Method of calibrating image measuring device
JP2008003000A