A method for detecting a camera connector
Through the automated camera connector detection method, image processing technology is used to identify module defects, solving the problem of subjectivity and low efficiency of manual detection, and achieving high accuracy and low cost detection effects.
Patent Information
- Application Number
- CN202210677956.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-16
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2042-06-16
AI Technical Summary
The appearance inspection of existing camera modules relies on manual visual inspection, which is subjective and can easily lead to missed inspections and misjudgment, which increases the cost of after-sales maintenance in the later stage, and long-term repeated labor leads to low detection efficiency.
The camera connector detection method is adopted to obtain module images for template matching, threshold segmentation, connection domain analysis, rotation angle calculation and boundary detection, and automatically identify the shape and defects of the connector to reduce manual intervention.
It improves detection efficiency and accuracy, reduces the missed inspection and misjudgment rates, significantly reduces manual inspection costs, and effectively controls product failure rates and reduces after-sales maintenance costs.
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of module appearance detection equipment, and in particular to a detection method for a camera connector. Background Art
[0002] A camera is a video input device and a type of closed-circuit television. It is widely used in video conferencing, telemedicine and real-time monitoring. Cameras generally have basic functions such as video photography, transmission and static image capture. After the lens captures the image, the photosensitive component circuit and control component in the camera process the image and convert it into a digital signal that can be recognized by the computer. It is then connected through a parallel port or USB and input into the computer, where the software restores the image to form a picture.
[0003] After consulting the literature, we learned that the appearance inspection of existing camera modules mainly relies on appearance inspectors to visually inspect the appearance quality of the modules. However, the appearance inspectors' understanding of product defects is subjective, and long-term repetitive work can easily cause fatigue, which can easily lead to missed inspections and misjudgments of module products, resulting in problems such as after-sales maintenance costs in the later stage. Summary of the invention
[0004] In view of the deficiencies in the prior art, the present invention provides a method for detecting camera connectors, which improves the large amount of labor costs required for traditional camera module detection, reduces missed detections and misjudgments caused by manual detection, greatly improves the efficiency of camera module detection operations, and also reduces the disadvantages of deformation of the appearance of the camera module caused by operational errors during manual detection. It solves the problem that the appearance inspectors have a subjective understanding of product defects and are prone to fatigue due to long-term repetitive labor, which can easily lead to missed detections and misjudgments of module products, resulting in the problem of after-sales maintenance costs in the later stage.
[0005] To achieve the above-mentioned purpose, the present invention provides the following technical solution: a method for detecting a camera connector, comprising the following steps:
[0006] S1: Obtain the connector image of the camera module and perform template matching on the image to obtain Image;
[0007] S2: intercept the image segment including the detected connector to obtain ImageC;
[0008] S3: Perform threshold segmentation on the image ImageC according to the threshold m_thres to obtain a binary image DstC;
[0009] S4: Find the connected domain in DstC and get Blobs;
[0010] S5: Get the connector's Mark point in Blobs according to the area and position of the connected domain;
[0011] S6: Calculate the rotation angle of the connector according to the Mark point;
[0012] S7: Calculate Blobs1 after Blobs is rotated, and detect the border of the area;
[0013] S8: Blobs1 is divided into left pin L, right pin R, and exposed copper S according to Border;
[0014] S9: Detection of exposed copper S;
[0015] S10: Detection of the left pin L and the right pin R.
[0016] Preferably, based on the size difference of the products in S2, when the area is cut, the size of ImageC is appropriately enlarged to ensure that the connector is completely included in ImageC.
[0017] Preferably, based on the fact that m_thres in S3 is generally set to 200, the pin area is metal and is imaged as a highlight in the image. Through threshold segmentation, the pin area is distinguished from the background area. In order to eliminate background interference and connect similar areas, the segmented binary image is subjected to morphological filtering processing. First, an opening operation is performed to eliminate background interference, and then a closing operation is performed to connect similar areas to obtain the processed binary image DstC.
[0018] Preferably, based on the above S4, all blobs are counted in DstC to prepare for S7.
[0019] Preferably, based on the S5, the Mark point of the product used in this solution is located at the lower left corner of the connector in the image, the position x and y of the blob in Blobs are limited, and the x and y information of the Mark point is obtained by judging the area of the blob. The circle indicates the calculated Mark point.
[0020] Preferably, based on S6 in DstC, according to the position of the Mark point, a series of edge points Pts are found from bottom to top, and the conditions for satisfying the edge points are: the grayscale value of the adjacent left point is 0, the grayscale value of the adjacent right point is 255, and the grayscale value of the current position is 255. Pts is fitted into a straight line L to obtain the rotation angle angle of the connector.
[0021] Preferably, based on S7, each blob in Blobs is rotated according to angle to obtain Blobs1, and the center x, y and area of each blob in Blobs1 are calculated.
[0022] Preferably, based on the upper and lower boundaries, left and right boundaries and exposed copper boundary of the pin area in Border in S8, Blobs1 is divided into left pin L, right pin R and exposed copper S according to the positional relationship between x, y of the blob in Blobs1 and each boundary in Border.
[0023] Preferably, based on S9, if the area of the blob in the exposed copper S exceeds the threshold m_ce, the detection result is false, and the value of m_ce is set to 300.
[0024] Preferably, based on the S10, it is determined whether the number of blobs of the left pin L and the right pin R is less than the number of pins m_pin. If so, it is considered that the pins are soldered together, the detection result is false, and the m_pin is 15.
[0025] Compared with the prior art, the present invention provides a method for detecting a camera connector, which has the following beneficial effects:
[0026] 1. The detection method of the camera connector is that if the difference between yb and the reference m_pinspace is greater than m_dev, it is considered that the pin is deformed in the y direction, and the detection result is false. The m_pinspace value of the product of the present invention is 58, and the length of each blob in the left pin L and the right pin R is judged respectively. If the length exceeds the threshold m_pinlength, it is considered that the pin solder exceeds the specified length, and the detection result is false. The m_pinlength value of the product of the present invention is 120. Through the operation detection of the scheme, various appearance defects of the camera module connector can be effectively detected, and the detection accuracy rate reaches 99.7%, and the false detection rate is 0.3%. It can meet the detection requirements of the production line, thereby improving the large amount of labor costs required for traditional camera module detection, and reducing the missed detection and misjudgment caused by manual detection, greatly improving the efficiency of the operation of the camera module detection, and also reducing the disadvantages of deformation of the appearance of the camera module caused by manual detection.
[0027] 2. The detection method of the camera connector obtains the left boundary of the pin according to the edge point set Pts and the fitted straight line L, obtains the right boundary of the pin area according to the width of the left and right pins, and compares the y of the blob according to the left and right boundaries to obtain the upper and lower boundaries of the pin area. The left and right boundaries are extended outward by a certain distance ws to obtain the detection boundary of exposed copper. The ws in this solution adopts 80, thereby respectively obtaining the center x, y and area values of each blob, thereby improving the accuracy of camera module detection, effectively controlling product defective rate, and reducing the manufacturer's after-sales maintenance cost.
[0028] 3. The detection method of the camera connector performs threshold segmentation on the image ImageC according to the threshold m_thres to obtain a binary image DstC. m_thres is generally set to 200. The pin area is metal and is imaged as a highlight in the image. Through threshold segmentation, the pin area is distinguished from the background area. In order to eliminate background interference and connect similar areas, the segmented binary image is subjected to morphological filtering processing. First, an opening operation is performed to eliminate background interference, and then a closing operation is performed to connect similar areas to obtain the processed binary DstC. DETAILED DESCRIPTION
[0029] The following will be combined with 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.
[0030] When in use, a method for detecting a camera connector obtains an image of a connector of a camera module and performs template matching on the image to obtain Image. Next, an image segment including the detected connector is intercepted to obtain ImageC. Due to size differences among products, the size of ImageC is appropriately enlarged when intercepting an area to ensure that the connector is completely contained in ImageC. ImageC is threshold segmented according to a threshold value m_thres to obtain a binary image DstC. m_thres is generally set to 200. The pin area is metal and is imaged as a highlight in the image. Through threshold segmentation, the pin area is distinguished from the background area. In order to eliminate background interference and connect similar areas, the segmented binary image is subjected to morphological filtering processing. First, an opening operation is performed to eliminate background interference, and then a closing operation is performed to connect similar areas to obtain the processed binary DstC.
[0031] Furthermore, by finding the connected domain in DstC, Blobs are obtained, and all blobs are counted in DstC to prepare for the next step. The Mark point of the connector is obtained in Blobs according to the area and position of the connected domain. The Mark point of the product used in the present invention is located in the lower left corner of the connector in the image. The x and y positions of the blobs in Blobs are limited, and the x and y information of the Mark point is obtained by judging the area of the blob. The circle in the middle indicates the calculated Mark point.
[0032] Furthermore, by calculating the rotation angle angle of the connector according to the Mark point, in DstC, according to the position of the Mark point, a series of edge points Pts are found from bottom to top. The conditions for satisfying the edge points are: the grayscale value of the adjacent left point is 0, the grayscale value of the adjacent right point is 255, and the grayscale value of the current position is 255. Pts is fitted to a straight line L to obtain the rotation angle angle of the connector.
[0033] Furthermore, by calculating Blobs1 after Blobs is rotated, the border of the detection area Border is detected. According to angle, each blob in Blobs is rotated to obtain Blobs1, and the center x, y and area of each blob in Blobs1 are calculated. According to the edge point set Pts and the fitted straight line L, the left boundary of the pin is obtained. According to the width of the pins on the left and right sides, the right boundary of the pin area is obtained. According to the left boundary and the right boundary, the y of the blob is compared to obtain the upper and lower boundaries of the pin area. The left and right boundaries are extended outward by a certain distance ws to obtain the detection boundary of exposed copper. In this solution, ws is 80, so as to obtain the center x, y and area values of each blob respectively, thereby improving the accuracy of camera module detection, effectively controlling the product defect rate, and reducing the manufacturer's after-sales maintenance cost.
[0034] Further, Blobs1 is divided into left pin L, right pin R, and exposed copper S according to Border, and Border includes the upper and lower boundaries, left and right boundaries, and exposed copper boundary of the pin area. According to the positional relationship between the x and y of the blob in Blobs1 and the boundaries in Border, Blobs1 is divided into left pin L, right pin R, and exposed copper S. For the detection of exposed copper S, if the area of the blob in the exposed copper S exceeds the threshold m_ce, the detection result is false. The value of m_ce is set to 300 in the present invention. For the detection of left pin L and right pin R, the standard deviation of x of each blob in the left pin L and the right pin R is determined respectively. If the standard deviation is greater than m_dev, it is considered that the pin is deformed in the x direction, and the detection result is false. In the present invention, m_dev is set to 3. The degree of deviation of y of each blob in the left pin L and the right pin R is determined respectively. The difference yb of each adjacent two blobs in the y direction is calculated. If the difference between yb and the reference m_pinspace is greater than m_dev, It is considered that the pin is deformed in the y direction, and the detection result is false. The m_pinspace value of the product in the present invention is 58. The length of each blob in the left pin L and the right pin R is judged respectively. If the length exceeds the threshold m_pinlength, it is considered that the pin solder exceeds the specified length, and the detection result is false. The m_pinlength value of the product in the present invention is 120. Through the operation detection of the scheme, various appearance defects of the camera module connector can be effectively detected, and the detection accuracy rate reaches 99.7%, and the false detection rate is 0.3%. It can meet the detection requirements of the production line, thereby improving the large amount of labor costs required for traditional camera module detection, and reducing the missed detection and misjudgment caused by manual detection, greatly improving the efficiency of the camera module detection operation, and also reducing the disadvantages of deformation of the camera module appearance caused by manual detection.
[0035] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for detecting a camera connector, characterized in that: The steps include: S1: Obtain the connector image of the camera module and perform template matching on the image to obtain Image; S2: intercept the image segment including the detected connector to obtain ImageC; S3: Perform threshold segmentation on the image ImageC according to the threshold m_thres to obtain a binary image DstC; S4: Find the connected domain in DstC and get Blobs; S5: Get the connector's Mark point in Blobs according to the area and position of the connected domain; S6: Calculate the rotation angle of the connector according to the Mark point; S7: Calculate Blobs1 after Blobs is rotated, and detect the border of the area; S8: Blobs1 is divided into left pin L, right pin R, and exposed copper S according to Border; S9: Detection of exposed copper S; S10: Detection of the left pin L and the right pin R.
2. A camera connector detection method according to claim 1, characterized in that: Since S2 has size differences among products, the size of ImageC is appropriately enlarged when the area is cut to ensure that the connector is completely included in ImageC.
3. The method for detecting a camera connector according to claim 1, characterized in that: Based on the fact that m_thres in S3 is set to 200, the pin area is metal and is imaged as a highlight in the image. Through threshold segmentation, the pin area is distinguished from the background area. In order to eliminate background interference and connect similar areas, the segmented binary image is subjected to morphological filtering processing. First, an opening operation is performed to eliminate background interference, and then a closing operation is performed to connect similar areas to obtain the processed binary DstC.
4. The method for detecting a camera connector according to claim 1, characterized in that: Based on the above, S4 counts all blobs in DstC to prepare for S7.
5. The method for detecting a camera connector according to claim 1, characterized in that: Based on the fact that the Mark point of the product used in S5 is located at the lower left corner of the connector in the image, the position x and y of the blob in Blobs are limited, and the x and y information of the Mark point is obtained by judging the area of the blob. The circle indicates the calculated Mark point.
6. A camera connector detection method according to claim 1, characterized in that: Based on S6 in DstC, according to the position of the Mark point, a series of edge points Pts are found from bottom to top. The conditions for satisfying the edge points are: the grayscale value of the adjacent left point is 0, the grayscale value of the adjacent right point is 255, and the grayscale value of the current position is 255. Pts is fitted into a straight line L to obtain the rotation angle angle of the connector.
7. The method for detecting a camera connector according to claim 1, characterized in that: Based on S7, each blob in Blobs is rotated according to angle to obtain Blobs1, and the center x, y and area of each blob in Blobs1 are calculated.
8. The method for detecting a camera connector according to claim 1, characterized in that: Based on the upper and lower boundaries, left and right boundaries and exposed copper boundaries of the pin area in Border in S8, Blobs1 is divided into left pin L, right pin R and exposed copper S according to the positional relationship between x, y of the blob in Blobs1 and the boundaries in Border.
9. The method for detecting a camera connector according to claim 1, characterized in that: Based on S9, if the area of the blob in the exposed copper S exceeds the threshold m_ce, the detection result is false, and the value of m_ce is set to 300.
10. The method for detecting a camera connector according to claim 1, characterized in that: Based on S10, it is determined whether the number of blobs of the left pin L and the right pin R is less than the number of pins m_pin. If so, it is considered that the pins are soldered together, the detection result is false, and m_pin is 15.
