Method for acquiring optimal shooting area of defect
By fixing multiple cameras on the robot structure and determining the optimal shooting area for defects, the problem of waste of resources and insufficient identification accuracy in the prior art is solved, and efficient defect detection and quality inspection are achieved.
Patent Information
- Application Number
- CN202311145612.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-06
- Publication Date
- 2025-03-14
AI Technical Summary
The prior art is difficult to save resources in defect detection, reduce the number of points and pictures taken during quality inspection, and improve the accuracy of identification.
By fixing multiple cameras on the robot structure, adjusting their positions to image areas with clear images, demarcate the effective areas for the same defect, taking the union and intersection of these areas, and determining the optimal shooting area for the defect.
Effectively save resources, reduce shooting points and pictures, improve the recognition accuracy of AI defect detection, and complete comprehensive product appearance quality inspection.
Smart Images

Figure HDA0004435161860000011 
Figure HDA0004435161860000012 
Figure HDA0004435161860000013
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing methods, and in particular to a method for obtaining an optimal defect shooting area. Background Art
[0002] At present, with the maturity of AI visual inspection technology, it has a very wide range of applications in the field of defect detection image segmentation. The basic principle adopted is to perform convolution calculations through a large number of image training, find the convolution difference between the image data of defects and background (non-defects), and thus distinguish the defects from the background. The two important parameters closely related to the convolution effect are the image clarity and the contrast between the defect and the background. The clearer the image, the clearer the defect edge, the stronger the contrast, and the greater the convolution difference between the defect and the background. The better the parameters of the two are adjusted, the fewer training images are required for defects during image training, and the higher the AI's recognition of defects during image detection. Summary of the invention
[0003] The technical problem to be solved by the present invention is how to provide a method that can save resources, minimize the number of points and pictures taken during quality inspection, and improve the accuracy of recognition.
[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is: a method for obtaining the best defect shooting area, comprising the following steps:
[0005] Fix n cameras on a manipulator structure, adjust them so that the positions of n cameras relative to the surface of the product to be inspected are fixed, and the image of a certain area is clear;
[0006] Take pictures, and define the effective areas of n cameras for the same type of defects of the same sample in the area. Suppose the first defect of the first sample is the first defect 1, and the effective areas of the n cameras for the first defect 1 are effective areas 1, 2, ..., n respectively; the first defect of the second sample is the first defect 2, and the effective areas of the n cameras for the first defect 2 are effective areas n+1, n+2, ..., 2n respectively. By analogy, the first defect of the Nth sample is the first defect N, and the effective areas of the n cameras for the first defect N are N*n-(n-1), N*n-(n-2), ..., N*n respectively;
[0007] The union of valid areas 1, 2, ..., n is named as the first defect union field of view 1, the union of valid areas n+1, n+2, ..., 2n is named as the first defect union field of view 2, and so on, until the first defect union field of view N;
[0008] The intersection of all first defect union fields of view is taken as the best defect shooting area of the first defect, which is called the first defect intersection field of view;
[0009] Take another type of defect on the surface of the product to be inspected as the second defect, and find the intersection field of view of the second defect in the same way as the first defect. And so on, find the intersection field of view of all defects that need to be inspected;
[0010] The intersection of all defect views is taken again, and the view represented by the intersection is the best defect shooting area.
[0011] Preferably, the first defect is an oil crack defect.
[0012] Preferably, the second defect is a scratch defect.
[0013] The beneficial effect of adopting the above technical solution is that: the method is mainly used for quality inspection of defects of various types, uncertain quantities and random positions on products, assisting the camera to find excellent shooting points (or product placement positions), and confirming the minimum number of excellent shooting points to complete the comprehensive appearance quality inspection of the product, which can effectively save resources and improve the recognition accuracy of AI defect detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0015] Figure 1 is the effective visual field area 1 in the embodiment of the present invention;
[0016] Figure 2 It is the effective visual field area 2 in the embodiment of the present invention;
[0017] Figure 3 It is the effective visual field area 3 in the embodiment of the present invention;
[0018] Figure 4 It is the combined visual field area 1 in the embodiment of the present invention;
[0019] Figure 5 It is the effective visual field area 4 in the embodiment of the present invention;
[0020] Figure 6 It is the effective visual field area 5 in the embodiment of the present invention;
[0021] Figure 7 It is the effective visual field area 6 in the embodiment of the present invention;
[0022] Figure 8 It is the combined visual field area 2 in the embodiment of the present invention;
[0023] Fig. 9 It is the effective visual field area 7 in the embodiment of the present invention;
[0024] Fig.10is the effective visual field area 8 in the embodiment of the present invention;
[0025] Fig.11 It is the effective visual field area 9 in the embodiment of the present invention;
[0026] Fig.12 It is the combined visual field area 3 in the embodiment of the present invention;
[0027] Fig.13 is the effective field of view of the oil crack defect in the embodiment of the present invention;
[0028] Fig.14 is a diagram of the effective visual field area of a scratch defect in an embodiment of the present invention;
[0029] Fig.15 It is a common effective field of view of two defects in the embodiment of the present invention. DETAILED DESCRIPTION
[0030] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the drawings 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.
[0031] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0032] When the image-taking camera is placed perpendicular to the product, the position where the product image is clearest is the focal plane of the camera (a plane perpendicular to the central axis of the camera lens and at a distance from the lens equal to the focal length). The image-taking point of the camera relative to the product is an excellent shooting point. The clarity of the image can be determined based on open source algorithms on software such as opencv or by manual judgment. The clear area of the image needs to be manually calibrated and then converted into the actual physical area through the calibration plate. Finally, even if the product image is clear, the defects on it may not have a strong contrast with the background, resulting in missed detection. Therefore, the types of defects that can be detected by a single vertical camera are limited.
[0033] When the image-taking camera is an oblique camera, there is a certain angle between the focal plane and the surface of the product to be inspected, and the area where the camera can clearly image is also limited by another parameter - the depth of field of the lens. However, its advantage is that it can complement the vertical camera and detect some defects that are not strongly contrasted with the background when shooting with the vertical camera. Continuously increasing the parameter combinations of the angle and relative position between the camera and the product surface can increase the types of defects that can be detected. For example: product defects such as scratches have a weak contrast difference with the background in the imaging effect of the vertical camera, and are easily not detected by humans or AI. Under the imaging effect of the oblique camera, this type of defect has a clear contrast with the product background and is easy to be identified. We call the area in the clear area where the defect has a strong contrast with the background and can be identified by humans or AI as the effective area.
[0034] The types, quantity and location of appearance defects of products during the production process are random. During appearance quality inspection, the product needs to be manually rotated and observed in all directions. When using camera quality inspection, it is necessary to increase the shooting points at different angles and positions to completely cover the product surface to be inspected. The number of pictures is huge, so it is necessary to find some excellent shooting areas with high compatibility in camera quality inspection to reduce the redundancy of pictures.
[0035] In summary, the embodiment of the present invention discloses a method for obtaining an optimal defect shooting area, comprising the following steps:
[0036] Fix n cameras on a manipulator structure, adjust them so that the positions of n cameras relative to the surface of the product to be inspected are fixed, and the image of a certain area is clear;
[0037] Take pictures, and define the effective areas of n cameras for the same type of defects of the same sample in the area. Suppose the first defect of the first sample is the first defect 1, and the effective areas of the n cameras for the first defect 1 are effective areas 1, 2, ..., n respectively; the first defect of the second sample is the first defect 2, and the effective areas of the n cameras for the first defect 2 are effective areas n+1, n+2, ..., 2n respectively. By analogy, the first defect of the Nth sample is the first defect N, and the effective areas of the n cameras for the first defect N are N*n-(n-1), N*n-(n-2), ..., N*n respectively;
[0038] The union of valid areas 1, 2, ..., n is named as the first defect union field of view 1, the union of valid areas n+1, n+2, ..., 2n is named as the first defect union field of view 2, and so on, until the first defect union field of view N;
[0039] The intersection of all first defect union fields of view is taken as the best defect shooting area of the first defect, which is called the first defect intersection field of view;
[0040] Take another type of defect on the surface of the product to be inspected as the second defect, and find the intersection field of view of the second defect in the same way as the first defect. And so on, find the intersection field of view of all defects that need to be inspected;
[0041] The intersection of all defect views is taken again, and the view represented by the intersection is the best defect shooting area.
[0042] Calculate the length and width of the optimal defect shooting area, divide the length of the product inspection surface by the length of the intersection to get the length multiple s. If the two are not evenly divisible, s is the quotient of the two plus 1. Divide the width of the product inspection surface by the width of the intersection to get the width multiple t. If the two are not evenly divisible, t is the quotient of the two plus 1. s×t is the minimum number of shooting points required for the inspection surface, and the position corresponding to the shooting point is the best shooting point.
[0043] Wherein, n and N are both natural numbers greater than 2, preferably, n may be 3, the first defect may be an oil crack defect, and the second defect may be a scratch defect.
[0044] Camera A photographs the “oil crack 1” defect of battery cover 1, which is named “effective field of view area 1”. Figure 1 As shown in the figure, the camera B photographed the "oil crack 1" defect of the battery cover 1, which is named "effective field of view area 2". Figure 2 As shown; Camera C photographed the "oil crack 1" defect of battery cover 1, named "effective field of view area 3", as shown Figure 3 As shown in the figure, the defect "oil crack 1" of battery cover 1 captured by three cameras is taken as a union, which is named "union field of view area 1". Figure 4 shown.
[0045] Camera A photographs the “oil crack 2” defect of battery cover 1, which is named “effective field of view area 4”. Figure 5 As shown; Camera B photographed the "oil crack 2" defect of battery cover 1, named "effective field of view area 5", as shown Figure 6 As shown; Camera C photographed the "oil crack 2" defect of the battery cover 1, named "effective field of view area 6", as shown Figure 7 As shown in the figure, the "oil crack 2" defect of the battery cover 1 photographed by the three cameras A, B, and C is taken as a union, and named as "union field of view area 2". Figure 8 shown.
[0046] Camera A photographs the “oil crack 3” defect of battery cover 1, which is named “effective field of view area 7”. Fig. 9 As shown; Camera B photographed the "oil crack 3" defect of the battery cover 1, named "effective field of view area 8", as shown Fig.10 As shown; Camera C photographed the "oil crack 3" defect of the battery cover 1, named "effective field of view area 9", as shown Fig.11As shown in FIG. 1 , the “oil crack 3” defect of the battery cover 1 captured by the three cameras A, B, and C is taken as a union, and named as “union field of view area 3”. Fig.12 shown.
[0047] According to the above method, we find the "effective field of view area n" for all oil crack samples. Taking three as an example, we take the intersection of all the collected "union field of view areas n" and call this intersection "oil crack intersection field of view". Fig.13 shown.
[0048] According to the above method, the intersection field of view of the scratch defect is obtained, such as Fig.14 The best defect shooting area of battery cover 1 is the intersection of the two defect intersection fields, as shown in Fig.15 shown.
[0049] In summary, the method described in the present invention can assist the camera in finding the best shooting points (or product placement positions), as well as confirm the minimum number of best shooting points, to complete a comprehensive appearance quality inspection of the product, which can effectively save resources and improve the recognition accuracy of AI defect detection.
Claims
1. A method for obtaining the best defect shooting area, characterized in that The steps include: Fix n cameras on a manipulator structure, adjust them so that the positions of n cameras relative to the surface of the product to be inspected are fixed, and the image of a certain area is clear; Take pictures, and define the effective areas of n cameras for the same type of defects of the same sample in the area. Suppose the first defect of the first sample is the first defect 1, and the effective areas of the n cameras for the first defect 1 are effective areas 1, 2, ..., n respectively; the first defect of the second sample is the first defect 2, and the effective areas of the n cameras for the first defect 2 are effective areas n+1, n+2, ..., 2n respectively. By analogy, the first defect of the Nth sample is the first defect N, and the effective areas of the n cameras for the first defect N are N*n-(n-1), N*n-(n-2), ..., N*n respectively; The union of valid areas 1, 2, ..., n is named as the first defect union field of view 1, the union of valid areas n+1, n+2, ..., 2n is named as the first defect union field of view 2, and so on, until the first defect union field of view N; The intersection of all first defect union fields of view is taken as the best defect shooting area of the first defect, which is called the first defect intersection field of view; Take another type of defect on the surface of the product to be inspected as the second defect, and find the intersection field of view of the second defect in the same way as the first defect. And so on, find the intersection field of view of all defects that need to be inspected; The intersection of all defect views is taken again, and the view represented by the intersection is the best defect shooting area.
2. The method for obtaining the best defect shooting area according to claim 1, characterized in that: The method specifically comprises the following steps: Fix three cameras on a manipulator structure, adjust the positions of the three cameras relative to the surface of the product to be inspected to ensure that the image of a certain area is clear; Take pictures, and define the effective areas of the three cameras for the same type of defects of the same sample in the area. Suppose the first defect of the first sample is the first defect 1, and the effective areas of the three cameras for the first defect 1 are effective areas 1, 2, and 3 respectively; the first defect of the second sample is the first defect 2, and the effective areas of the three cameras for the first defect 2 are effective areas 4, 5, and 6 respectively. By analogy, the first defect of the Nth sample is the first defect N, and the effective areas of the three cameras for the first defect N are 3N-2, 3N-1, and 3N respectively; Take the union of valid areas 1, 2, and 3 and name it the first defect union field of view 1. Take valid areas 4, 5, and 6 and name the union area the first defect union field of view 2. And so on until the first defect union field of view N. The intersection of all first defect union fields of view is taken as the best defect shooting area of the first defect, which is called the first defect intersection field of view; Take another type of defect on the surface of the product to be inspected as the second defect, and find the intersection field of view of the second defect in the same way as the first defect. And so on, find the intersection field of view of all defects that need to be inspected; The intersection of the fields of view of all defects is taken, and the field of view represented by the intersection is an excellent imaging area for quality inspection defects.
3. The method for obtaining the best defect shooting area according to claim 1, characterized in that: The first defect is an oil crack defect.
4. The method for obtaining the best defect shooting area according to claim 1, characterized in that: The second defect is a scratch defect.