A method for extracting features of appearance intelligent detection, computer system and storage medium
By importing and analyzing CAM data and automatically matching and generating detection templates, the problem of low appearance intelligent detection feature extraction efficiency in the existing technology is solved, and fast and accurate feature extraction and detection efficiency are achieved.
Patent Information
- Application Number
- CN202411441822.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-10-16
AI Technical Summary
The prior art cannot provide effective intelligent appearance detection feature extraction methods, resulting in long programming cycles and low production detection rate.
By importing the CAM data of the target image, performing graph analysis and magnification transformation, automatically matching the preset templates, and extracting the graphic elements of the target image. Generate detection templates to be calculated iteratively through training models to adapt to graphics of different sizes and shapes.
Automatic matching feature extraction is realized, simplifying the extraction of graphic element parameters in the early stage of programming, improving detection efficiency, and shortening the programming cycle and replacement cycle.
Smart Images

Figure CN118967679B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image information processing, and in particular relates to an appearance intelligent detection feature extraction method, a computer system and a storage medium. Background Art
[0002] As electronic products develop towards multifunctionality, intelligence and miniaturization, the components on PCBs are getting smaller and smaller, the installation density is getting higher and higher, and the requirements for the integration of PCBs are getting higher and higher. Traditional manual inspection methods have problems such as low efficiency, easy to miss inspections, and being greatly affected by subjective factors. Therefore, machine vision inspection technology has become an effective means to improve inspection efficiency and accuracy.
[0003] Machine vision inspection technology uses CCD or CMOS industrial cameras to capture images, and then uses computer software to perform image processing and pattern recognition to achieve automatic inspection of PCB boards. This method can improve the speed and accuracy of defect detection, reduce labor costs, and can work continuously for 24 hours, improving production efficiency. Although machine vision inspection technology has been widely used in PCB board inspection, it still faces the technical challenge of programming difficulties. Since operators need to let the camera extract various parameter values of PCB as program input in the early stage of programming, the current PCB parameter feature extraction is too complex and difficult, and cannot be adapted to more categories of products. The technical requirements for operators are extremely high, and product changeover is difficult, which seriously affects the detection rate of products and prolongs the programming project cycle. Therefore, it is necessary to propose an appearance intelligent detection feature extraction method, computer system and storage medium to meet production needs. Summary of the invention
[0004] The purpose of the present invention is to provide a method for extracting appearance intelligent detection features, a computer system and a storage medium, aiming to solve the problem that the prior art cannot provide an effective method for extracting appearance intelligent detection features, resulting in a long programming cycle and a low production detection rate.
[0005] In one aspect, the present invention provides a method for extracting features of appearance intelligent detection, the method comprising the following steps:
[0006] Import the CAM data of the target drawing;
[0007] Perform graphic analysis and magnification conversion on each target graphic in the target image file;
[0008] Automatically match the graphic elements of the target graphic to a preset template;
[0009] The graphic elements of the target graphic in the target image file are extracted through the preset template.
[0010] In the method for extracting features from appearance intelligent detection described in the present invention, the preset template is generated by the following steps:
[0011] Import standard CAM data and map the standard graphics files in it to the xy two-dimensional pixel coordinate system;
[0012] Graphic transformation: perform corresponding magnification transformation on the standard graphics of the standard drawing file in the standard CAM data;
[0013] Automatic graphic matching: analyzing the graphic elements of each standard graphic in the standard graphic file and presetting the correlation coefficient, and aligning the graphic elements of each standard graphic with the actual graphic elements on the camera image by matching the correlation coefficient;
[0014] Configure tolerance zone: set the allowable error between the actual product and the standard drawing;
[0015] Generate a test template: take each standard graphic element in the standard drawing as a training object according to the tolerance range of the tolerance zone and generate a standard template for each standard graphic element through iterative calculation of the training model;
[0016] Among them, graphic elements include shape, position, color, length and area.
[0017] In the appearance intelligent detection feature extraction method described in the present invention, the calculation formula of the correlation coefficient matching is as follows:
[0018] ;
[0019] Where R(x,y) represents the correlation coefficient of position (x,y);
[0020] I(x+i,y+j) is the pixel value of the actual image at position (x+i,y+j);
[0021] T(i,j) is the pixel value of the standard shape at position (i,j);
[0022] The value range of i is between zero and the total width of the graph, with the width direction being the X-axis direction;
[0023] The value range of j is between zero and the total height of the graph, and the height direction is the Y-axis direction;
[0024] is the average pixel value of the actual graphic input image area;
[0025] is the average pixel value of the standard graphic input image area;
[0026] M and N are the height and width of the standard graphics input image region, respectively.
[0027] The method for extracting features from appearance intelligent detection according to the present invention, wherein, after performing the automatic matching of graphics and before performing the configuration of tolerance zones, the steps further include:
[0028] Adaptive deformation: Calculate the contour point features of the corresponding elements of the standard graphics and the actual graphics of the camera image, squeeze or stretch the element contours, make the standard graphics overlap with the actual graphics contours, and automatically learn the actual color information of each contour of the actual graphics in the camera image;
[0029] Specifically, the deformation formula of contour overlap is as follows:
[0030]
[0031] Among them, E(u,v) is the energy function; is an integral function; and are all gradient vectors;
[0032] I( ) is the graphic outline of the standard drawing file;
[0033] T( ) is the actual graphic contour of the camera image;
[0034] u(x,y) and v(x,y) are the deformations of the image in the x and y directions;
[0035] w(x,y) is the weight function, which is related to the gradient of the image;
[0036] λ is the regularization parameter, which is used to control the strength of the smoothing term;
[0037] Ω is the domain of the image.
[0038] The method for extracting features of appearance intelligent detection described in the present invention, wherein the method of using each standard graphic element in the standard drawing as a training object according to the tolerance range of the tolerance zone and generating a standard template for each standard graphic element through iterative calculation of the training model specifically includes:
[0039] According to the tolerance range, each graphic element in the standard drawing is simulated to produce deformation, grayscale change, noise, shape distortion, position offset, and angle offset. The generated graphic contour and grayscale value are used as training objects, and the standard templates of each graphic element are iteratively calculated and generated;
[0040] Use the generated test template to test the sample;
[0041] The training model formula is:
[0042]
[0043] In the formula, x and y are pixel coordinates;
[0044] is the upper limit of grayscale of standard image;
[0045] is the lower limit of grayscale of standard image;
[0046] p(x, y) is the grayscale value of the image captured by the camera;
[0047] a u They are the upper limits of the difference between standard images;
[0048] a l is the lower limit of the difference between standard images;
[0049] b u is the upper limit of the difference between the standard image and the actual image;
[0050] b l is the lower limit of the difference between the standard image and the actual image;
[0051] The detection formula is:
[0052] >
[0053] <
[0054] Where C(x,y) is the grayscale value of the target product image.
[0055] On the other hand, the present invention also provides an appearance intelligent detection feature extraction control computer system, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method steps described above when executing the computer program.
[0056] On the other hand, the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described above are implemented.
[0057] The beneficial effects of the present invention are that it can adapt to graphics of different sizes and shapes and realize automatic matching, which greatly facilitates the extraction of parameters of various elements of the graphics in the early stage of programming, effectively solves the problem of programming difficulties in the early stage of detection, and improves the detection efficiency. Specifically, the programming cycle is increased from the traditional 1-2 hours to 1-3 minutes, and there are no special requirements for operators, which shortens the changeover cycle by more than three times. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 This is a logic diagram for implementing the appearance intelligent detection feature extraction method provided in the first embodiment of the present invention.
[0059] Figure 2 It is a schematic diagram of the tolerance zone configuration of the background control system of the appearance intelligent detection feature extraction method provided in the first embodiment of the present invention.
[0060] Figure 3 It is a structural diagram of the appearance intelligent detection feature extraction control computer device provided in the fifth embodiment of the present invention. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0062] The specific implementation of the present invention is described in detail below in conjunction with specific embodiments:
[0063] Embodiment 1:
[0064] Figure 1 The implementation logic of the appearance intelligent detection feature extraction method provided in the first embodiment of the present invention is shown. For the convenience of explanation, only the part related to the embodiment of the present invention is shown, which is described in detail as follows:
[0065] Import the CAM data of the target drawing, compatible with the mainstream CAM data on the market (Gerber / odb++ / DXF);
[0066] Perform graphic analysis and magnification conversion on each target graphic in the target drawing. The CAM data imported into the target drawing is compatible with the mainstream CAM data (Gerber / odb++ / DXF) on the market. The outline size of the top screw, solder mask, pad, circuit, opening and other elements in the drawing can be automatically adjusted according to the magnification of the current image. It can be imported separately by layer and functional area.
[0067] Automatically match the graphic elements of the target graphic with the preset template, analyze the characteristic information of each element in the image file (including but not limited to shape, position, color, length, area), and use correlation coefficient matching to align each graphic element with the corresponding element on the camera image;
[0068] The graphic elements of the target graphic in the target drawing file are extracted through the preset template.
[0069] The present invention can adapt to graphics of different sizes and shapes and realize automatic matching, which greatly facilitates the extraction of parameters of various elements of graphics in the early stage of programming, effectively solves the problem of programming difficulties in the early stage of detection, and improves the detection efficiency. Specifically, the programming cycle is increased from the traditional 1-2 hours to 1-3 minutes, and there are no special requirements for operators, which shortens the changeover cycle by more than three times.
[0070] In this embodiment, the preset template is generated by the following steps:
[0071] Import standard CAM data and map the standard graphics files in it to the xy two-dimensional pixel coordinate system;
[0072] Graphic transformation: perform corresponding magnification transformation on the standard graphics of the standard drawing files in the standard CAM data;
[0073] Automatic graphic matching: Analyze the graphic elements of each standard graphic in the standard drawing file and preset the correlation coefficient, and align the graphic elements of each standard graphic with the actual graphic elements on the camera image by matching the correlation coefficient;
[0074] Configure tolerance zone: Set the allowable error between the actual product and the standard drawing. You can manually set the allowable error between the actual product and the design drawing by opening the specification setting page of the background control system, such as Figure 2 As shown;
[0075] Generate inspection template: According to the tolerance range of the tolerance zone, each standard graphic element in the standard drawing is used as a training object and a standard template of each standard graphic element is generated through iterative calculation of the training model;
[0076] Among them, graphic elements include shape, position, color, length and area.
[0077] In this embodiment, the calculation formula for correlation coefficient matching is as follows:
[0078] ;
[0079] Where R(x,y) represents the correlation coefficient of position (x,y);
[0080] I(x+i,y+j) is the pixel value of the actual image at position (x+i,y+j);
[0081] T(i,j) is the pixel value of the standard shape at position (i,j);
[0082] The value range of i is between zero and the total width of the graph, with the width direction being the X-axis direction;
[0083] The value range of j is between zero and the total height of the graph, and the height direction is the Y-axis direction;
[0084] is the average pixel value of the actual graphic input image area;
[0085] is the average pixel value of the standard graphic input image area;
[0086] M and N are the height and width of the standard graphics input image region, respectively.
[0087] In this embodiment, after performing automatic graphics matching and before performing configuration of tolerance zones, the steps further include:
[0088] Adaptive deformation: Calculate the contour point features of the corresponding elements of the standard graphics and the actual graphics of the camera image, squeeze or stretch the element contours, make the standard graphics overlap with the actual graphics contours, and automatically learn the actual color information of each contour of the actual graphics in the camera image;
[0089] Specifically, the deformation formula of contour overlap is as follows:
[0090]
[0091] Among them, E(u,v) is the energy function; is an integral function; and are all gradient vectors;
[0092] I( ) is the graphic outline of the standard drawing file;
[0093] T( ) is the actual graphic contour of the camera image;
[0094] u(x,y) and v(x,y) are the deformations of the image in the x and y directions;
[0095] w(x,y) is the weight function, which is related to the gradient of the image;
[0096] λ is the regularization parameter, which is used to control the strength of the smoothing term;
[0097] Ω is the domain of the image.
[0098] In this embodiment, generating a detection module, that is, taking each standard graphic element in the standard drawing as a training object and generating a standard template of each standard graphic element through iterative calculation of the training model according to the tolerance range of the tolerance zone, specifically includes:
[0099] According to the tolerance range, each graphic element in the standard drawing is simulated to produce deformation, grayscale change, noise, shape distortion, position offset, and angle offset. The generated graphic contour and grayscale value are used as training objects, and the standard templates of each graphic element are iteratively calculated and generated;
[0100] Use the generated test template to test the sample;
[0101] The training model formula is:
[0102]
[0103] In the formula, x and y are pixel coordinates;
[0104] is the upper limit of grayscale of standard image;
[0105] is the lower limit of grayscale of standard image;
[0106] p(x, y) is the grayscale value of the image captured by the camera;
[0107] a u is the upper limit of the difference between standard images;
[0108] a l is the lower limit of the difference between standard images;
[0109] b u is the upper limit of the difference between the standard image and the actual image;
[0110] b l is the lower limit of the difference between the standard image and the actual image;
[0111] Simulation detection: Use the generated detection template to perform sample detection, provide fine-tuning parameters, correct the detection effect, and improve the detection rate;
[0112] Specifically, the detection formula is:
[0113] >
[0114] <
[0115] Where C(x,y) is the grayscale value of the target product image.
[0116] If the function value corresponding to the graphic element of the target product image is within the upper and lower limits of the standard image, that is, and When it is between, it means that the graphic elements of the target product can extract the positive parameters of the output, that is, the qualified parameters, while those not in the above range are unqualified. Through the above method steps, the various feature information of the graphic elements can be quickly classified and extracted with high efficiency and low operation difficulty.
[0117] Embodiment 2:
[0118] Figure 3 The fourth embodiment of the present invention provides an appearance intelligent detection feature extraction control computer device. For ease of description, only the parts related to the embodiment of the present invention are shown.
[0119] The appearance intelligent detection feature extraction method, computer system and storage medium control computer device of the embodiment of the present invention include a processor, a memory and a computer program stored in the memory and can be run on the processor. When the processor executes the computer program, the steps in each of the above-mentioned appearance intelligent detection feature extraction method embodiments are implemented.
[0120] Embodiment three:
[0121] In an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned embodiment of the method for extracting features from the intelligent appearance detection are implemented.
[0122] The computer-readable storage medium of the embodiment of the present invention may include any entity or device or recording medium capable of carrying computer program code, for example, ROM / RAM, magnetic disk, optical disk, flash memory and other memories.
[0123] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for extracting features of appearance intelligent detection, characterized in that: The method comprises the following steps: Import the CAM data of the target drawing; Perform graphic analysis and magnification conversion on each target graphic in the target image file; Automatically match the graphic elements of the target graphic to a preset template; Extracting the graphic elements of the target graphic in the target image file by using the preset template; The preset template is generated by the following steps: Import standard CAM data and map the standard graphics files in it to the xy two-dimensional pixel coordinate system; Graphic transformation: perform corresponding magnification transformation on the standard graphics of the standard drawing file in the standard CAM data; Automatic graphic matching: analyzing the graphic elements of each standard graphic in the standard graphic file and presetting the correlation coefficient, and aligning the graphic elements of each standard graphic with the actual graphic elements on the camera image by matching the correlation coefficient; Configure tolerance zone: set the allowable error between the actual product and the standard drawing; Generate a test template: take each standard graphic element in the standard drawing as a training object according to the tolerance range of the tolerance zone and generate a standard template for each standard graphic element through iterative calculation of the training model; Among them, graphic elements include shape, position, color, length and area; The calculation formula for correlation coefficient matching is as follows: ; Where R(x,y) represents the correlation coefficient of position (x,y); I(x+i,y+j) is the pixel value of the actual image at position (x+i,y+j); T(i,j) is the pixel value of the standard shape at position (i,j); The value range of i is between zero and the total width of the graph, with the width direction being the X-axis direction; The value range of j is between zero and the total height of the graph, and the height direction is the Y-axis direction; is the average pixel value of the actual graphic input image area; is the average pixel value of the standard graphic input image area; M and N are the height and width of the standard graphics input image region, respectively; The method of taking each standard graphic element in the standard drawing as a training object according to the tolerance range of the tolerance zone and generating a standard template of each standard graphic element through iterative calculation of the training model specifically includes: According to the tolerance range, each graphic element in the standard drawing is simulated to produce deformation, grayscale change, noise, shape distortion, position offset, and angle offset. The generated graphic contour and grayscale value are used as training objects, and the standard templates of each graphic element are iteratively calculated and generated; Use the generated test template to test the sample; The training model formula is: In the formula, x and y are pixel coordinates; is the upper limit of grayscale of standard image; is the lower limit of grayscale of standard image; p(x, y) is the grayscale value of the image captured by the camera; a u is the upper limit of the difference between standard images; a l is the lower limit of the difference between standard images; b u is the upper limit of the difference between the standard image and the actual image; b l is the lower limit of the difference between the standard image and the actual image; v(x,y) is the deformation of the image in the x and y directions; The detection formula is: > < Where C(x,y) is the grayscale value of the target product image.
2. The appearance intelligent detection feature extraction method according to claim 1, characterized in that: After executing the automatic matching of the graphics and before executing the configuration of the tolerance zone, the step further includes: Adaptive deformation: Calculate the contour point features of the corresponding elements of the standard graphics and the actual graphics of the camera image, squeeze or stretch the element contours, make the standard graphics overlap with the actual graphics contours, and automatically learn the actual color information of each contour of the actual graphics in the camera image; Specifically, the deformation formula of contour overlap is as follows: Among them, E(u,v) is the energy function; is an integral function; and are all gradient vectors; I( ) is the graphic outline of the standard drawing file; T( ) is the actual graphic contour of the camera image; u(x,y) and v(x,y) are the deformations of the image in the x and y directions; w(x,y) is the weight function, which is related to the gradient of the image; λ is the regularization parameter, which is used to control the strength of the smoothing term; Ω is the domain of the image.
3. A computer system for intelligent appearance detection feature extraction control, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 and 2 is implemented.
4. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 and 2 is implemented.
Citation Information
Patent Citations
Ceramic substrate appearance defect intelligent identification method based on target detection
CN115456944A
Chip appearance detection method and system based on machine vision
CN115980095A