Vision-based accessory appearance defect detection method and system
By calculating multi-dimensional feature difference degree and Euclidean distance, the problem of low-contrast defects being difficult to distinguish on highly reflective curved iron soleplates by traditional methods is solved, and high-precision defect detection is achieved.
Patent Information
- Application Number
- CN202511881511.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-15
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2045-12-15
AI Technical Summary
Traditional methods for detecting appearance defects have difficulty distinguishing between low-contrast defects and normal textures on workpieces with highly reflective curved surfaces and complex geometric structures, leading to missed detections and misjudgments, especially on the soleplates of electric irons.
By calculating multi-dimensional feature differences, including edge probability, contour features and gradient distribution, and combining Euclidean distance and defect matching degree, defects such as tiny pits, steam pore deformation and surface scratches can be accurately identified, avoiding misjudgment of highly reflective areas.
Accurately identifying low-contrast defects in complex backgrounds improves the robustness and accuracy of detection, avoiding false detections and missed detections.
Smart Images

Figure CN121329969A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of image processing. In particular, it relates to a vision-based accessory appearance defect detection method and system. BACKGROUND
[0002] Traditional appearance defect detection methods mainly rely on gray threshold segmentation, template matching and connected component analysis based on artificial rule algorithm. Such methods have certain detection ability for high-contrast and simple structure defects under ideal lighting and stable working conditions.
[0003] However, on workpieces such as electric iron bottom plates with high light-reflecting curved surfaces and complex geometric structures (such as steam holes and flow guide pits), the surface reflection characteristics are easily affected by light source angle, environmental light changes and material differences of different production batches, resulting in significant non-uniform pixel distribution in the normal area of the image. At the same time, defects such as shallow scratches, micro pits, slight deformation of steam holes or local deformation of flow guide pits are common in actual production, and the contrast is extremely low, which is difficult to distinguish from normal texture or light reflection artifacts, making it difficult for traditional rule algorithms to establish a stable and robust discrimination boundary, resulting in a large number of missed detections and inaccurate appearance defect detection results. SUMMARY
[0004] To solve the above technical problems, the present application provides solutions in the following aspects.
[0005] In a first aspect, a vision-based accessory appearance defect detection method includes: collecting a target image of an iron and a historical defect label corresponding to the target image, the target image being any historical bottom plate gray image, and obtaining a to-be-detected bottom plate gray image; obtaining a connected component of the target image, and obtaining a connected component of the to-be-detected bottom plate gray image in the same way, obtaining a defect connected component of the target image according to the actual defect position of the target image, and calculating the feature difference between the connected component of the to-be-detected bottom plate gray image and the defect connected component; taking the connected component of the target image other than the defect connected component as a general domain, calculating the Euclidean distance between the centroid of the defect connected component and the centroid of the general domain, and calculating the first distance standard deviation of all Euclidean distances in the target image, obtaining the second distance standard deviation of the to-be-detected bottom plate gray image in the same way according to the calculation method of the first distance standard deviation, and calculating the defect matching degree between the to-be-detected bottom plate gray image and the target image based on the first distance standard deviation, the second distance standard deviation and the feature difference, to complete defect detection.
[0006] Preferably, the acquiring the connected domain of the target image comprises: taking any pixel point in the target image as a research point; calculating a first discriminant of the target image; calculating a second ratio of the pixel value of the research point and a maximum pixel value in the target image, and taking a standard deviation of all second ratios as a second discriminant of the target image; calculating a first standard deviation of the first ratio of the research point in all preset directions, and obtaining the first standard deviation of each pixel point in the 8-neighbor domain of the research point, and taking a mean value of all first standard deviations as a first edge probability of the research point; taking a standard deviation of the second ratio of each pixel point in the 8-neighbor domain centered on the research point as a second edge probability of the research point; calculating a final edge probability of the research point based on the first discriminant, the second discriminant, the first edge probability and the second edge probability; traversing to obtain the normalized final edge probability of each pixel point in the target image, taking the pixel point with the normalized final edge probability greater than a preset threshold as an edge pixel point, and connecting the edge pixel points to obtain the connected domain of the target image.
[0007] Preferably, the calculating the first discriminant of the target image comprises: taking any preset direction as a research direction, and the preset direction is 0 degree, 45 degree, 90 degree and 135 degree; calculating a gradient value of the research point in the research direction, obtaining a maximum gradient value in the research direction, calculating a first ratio of the gradient value of the research point in the research direction and the maximum gradient value, traversing to obtain the first ratio of each pixel point in the research direction, calculating a ratio standard deviation of all ratios, traversing to obtain the ratio standard deviation of each preset direction, and taking a mean value of all ratio standard deviations as the first discriminant of the target image.
[0008] Preferably, the calculating the final edge probability of the research point comprises: calculating a third ratio of a sum of the first discriminant of all historical base plate grayscale images and a sum of the second discriminant of all historical base plate grayscale images, and calculating a fourth ratio of the sum of the second discriminant of all historical base plate grayscale images and the sum of the first discriminant of all historical base plate grayscale images; calculating a first product of the third ratio and the first edge probability, and calculating a second product of the fourth ratio and the second edge probability; and taking a sum of the first product and the second product as the final edge probability of the research point.
[0009] Preferably, the feature difference degree comprises: taking any connected domain in the to-be-detected board gray image as a to-be-detected domain, taking the curvature standard deviation of all edge pixel points in the to-be-detected domain as a first contour feature value; taking the standard deviation of the gradient amplitude of all edge pixel points in the to-be-detected domain as a second contour feature value; taking any preset direction as a research direction, the preset direction being 0 degrees, 45 degrees, 90 degrees and 135 degrees, taking the average gradient of all pixel points in the to-be-detected domain in the research direction as a first distribution feature value, and obtaining the first distribution feature value of each preset direction to obtain the minimum first distribution feature value and the maximum first distribution feature value of the to-be-detected domain; obtaining a defect connected domain of the target image according to the actual defect position of the target image, and obtaining the first contour feature value, the second contour feature value, the minimum first distribution feature value and the maximum first distribution feature value of the defect connected domain in the same way; calculating a first difference value of the first contour feature value of the to-be-detected domain and the first contour feature value of the defect connected domain, calculating a second difference value of the second contour feature value of the to-be-detected domain and the second contour feature value of the defect connected domain, and calculating a first product absolute value of the first difference value and the second difference value; calculating a third difference value of the maximum first distribution feature value of the to-be-detected domain and the maximum first distribution feature value of the defect connected domain, calculating a fourth difference value of the minimum first distribution feature value of the to-be-detected domain and the minimum first distribution feature value of the defect connected domain, and calculating a second product absolute value of the third difference value and the fourth difference value; and taking the sum of the first product absolute value and the second product absolute value as the feature difference degree.
[0010] Preferably, the feature difference degree further comprises: for any preset direction, calculating a fifth difference value of the first distribution feature value of the to-be-detected domain and the first distribution feature value of the defect connected domain, obtaining the fifth difference value of each preset direction, and calculating a fifth difference value average; calculating a first absolute difference value of the fifth difference value and the fifth difference value average in any preset direction, and calculating an absolute difference value accumulation value of all preset directions; and taking the sum of the first product absolute value and the absolute difference value accumulation value as the feature difference degree.
[0011] Preferably, the calculating of the defect matching degree of the to-be-detected board gray image and the target image comprises: constructing the defect connected domains in the historical board gray images with the same historical defect label into a defect set, and taking any defect set as a to-be-matched set; for any defect connected domain in the to-be-matched set, obtaining the feature difference degree of the connected domain of the to-be-detected board gray image and any defect connected domain; calculating a second absolute difference value of the first distance standard deviation and the second distance standard deviation, calculating a third product of the second absolute difference value and the feature difference degree, obtaining the third product of each defect connected domain in the to-be-matched set, calculating a third product average of all third products, and taking the exponential value of the negative of the third product average as the defect matching degree.
[0012] In a second aspect, a visual-based accessory appearance defect detection system comprises a processor and a memory storing computer program instructions that, when executed by the processor, implement any of the visual-based accessory appearance defect detection methods.
[0013] The present application has the following effects: The present application can finely distinguish low-contrast micro pits, steam hole deformations and surface scratches and the like defects by calculating feature differences in multiple dimensions, including edge probability, contour features, gradient distribution and the like, while avoiding misjudgment of normal structures in high-reflectivity regions.
[0014] The multiple features of gray value, gradient response and geometric morphology are comprehensively considered, so that real defects can still be accurately identified in complex backgrounds and low-contrast conditions, especially when steam holes and flow guide pits and the like structures are prone to misjudgment, abnormal defects and normal structures can be accurately distinguished. By considering the spatial distribution characteristics of the defects, the reliability of defect type determination is further improved, and the high robustness and precision of the detection results are ensured. BRIEF DESCRIPTION OF DRAWINGS
[0015] Figure 1 is a flowchart of the visual-based accessory appearance defect detection method of the embodiments of the present application. DETAILED DESCRIPTION
[0016] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments of the present application.
[0017] The specific embodiments of the present application will be described in detail below with reference to the drawings.
[0018] Reference Figure 1 The visual-based accessory appearance defect detection method comprises steps S1-S3, and specifically as follows: S1: Collect a target image of an iron and a historical defect label corresponding to the target image, the target image is any historical base plate gray image, and obtain a to-be-detected base plate gray image.
[0019] In an embodiment, a high-resolution industrial camera is used to collect RGB (red green blue) images of defect iron base plate samples with known defect types and clear defect positions under controlled lighting conditions. All collected RGB images are grayed to obtain historical base plate gray images to reduce data dimensions and highlight structural and brightness change features. Among them, the defects are the defect labels of each gray image, and thus a plurality of historical base plate gray images and historical defect labels corresponding to each historical base plate gray image can be obtained.
[0020] The defect samples cover three typical defects: surface scratches, local dimple deformations (such as guide dimple collapse or pressure damage), and steam hole geometric deformations (such as irregular hole diameter, edge collapse, etc.), and each defect substrate only contains one type of defect to ensure the clarity of the sample label and the pertinence of subsequent model training. Similarly, the gray-scale image of the substrate to be detected is obtained.
[0021] S2: Obtain the connected domain of the target image, and obtain the connected domain of the gray-scale image of the substrate to be detected in the same way. According to the actual defect position of the target image, the defect connected domain of the target image is obtained, and the feature difference between the connected domain of the gray-scale image of the substrate to be detected and the defect connected domain is calculated.
[0022] It should be noted that in the appearance defect detection of the electric iron substrate accessory, the substrate is usually made of high-reflective metal material, and the surface is regularly distributed with circular steam holes and guide dimples and other inherent structures. These normal structures will produce complex light and dark distribution and edge response in the gray-scale image due to light reflection, curved geometry and changes in viewing angle. Especially when there are low-contrast defects such as shallow scratches, small dimples or local deformations of steam holes, the gray-scale value and gradient feature of the outline pixels are highly similar to the surrounding normal structures (such as hole edges and dimple transition zones), resulting in a blurred boundary between the defect area and the background and a very low degree of differentiation. The prior art usually uses global or local thresholding to binarize the gray-scale image, and performs defect discrimination based on connected domain analysis, but only relies on absolute pixel values, ignoring the relative gray-scale difference and gradient change trend of defects and normal structures in the local neighborhood. Therefore, it is easy to misjudge the normal steam holes or guide dimples in the high-reflective area as abnormal defects, and at the same time, it is possible to miss or misjudge the real steam hole deformation, guide dimple collapse and other defects as normal structures due to the close gray-scale of the defect area and the background.
[0023] In one embodiment, any pixel point in the target image is taken as a research point, and any preset direction is taken as a research direction, the preset direction being 0 degrees, 45 degrees, 90 degrees and 135 degrees; the gradient value of the research point in the research direction is calculated, the maximum value of the gradient value in the research direction is obtained, the first ratio of the gradient value of the research point in the research direction to the maximum value of the gradient value is calculated, the first ratio of each pixel point in the research direction is obtained by iteration, the ratio standard deviation of all ratios is calculated, the ratio standard deviation of each preset direction is obtained by iteration, and the mean value of all ratio standard deviations is taken as the first degree of differentiation of the target image.
[0024] The second ratio of the pixel value of the research point to the maximum value of the pixel value in the target image is calculated, and the standard deviation of all second ratios is taken as the second degree of differentiation of the target image.
[0025] The first standard deviation of the first ratio of the research point in all preset directions is calculated, and the first standard deviation of each pixel point in the 8-neighborhood of the research point is obtained. The mean of all first standard deviations is taken as the first edge probability of the research point.
[0026] The standard deviation of the second ratio of each pixel point in the 8-neighborhood of the research point is taken as the second edge probability of the research point.
[0027] The third ratio of the sum of the first discriminant of all historical background grayscale images to the sum of the second discriminant of all historical background grayscale images is calculated, and the fourth ratio of the sum of the second discriminant of all historical background grayscale images to the sum of the first discriminant of all historical background grayscale images is calculated. The first product of the third ratio and the first edge probability is calculated, and the second product of the fourth ratio and the second edge probability is calculated. The sum of the first product and the second product is taken as the final edge probability of the research point.
[0028] The logic of the final edge probability: the first discriminant and the second discriminant respectively represent the difference degree between the local area and the surrounding background in the gray value dimension and the gradient amplitude dimension; the ratio of the two is used to quantify the relative strength relationship of the difference in the two dimensions. When the discriminant of a certain dimension is significantly higher than that of another dimension, it means that the dimension is more discriminative in expressing the edge feature in the current region. The greater the discriminant, the stronger the discriminative contribution of the dimension to the edge pixel, so it should be given a higher weight in the subsequent edge fusion or threshold decision, which helps to more accurately filter out the real edge points and extract more accurate and complete connected domains. At the same time, the first edge probability and the second edge probability respectively reflect the confidence of a pixel point being judged as an edge pixel based on the gray change feature and the gradient response feature, i.e. the possibility of the point belonging to the edge in the respective dimension. By comprehensively considering the discriminant ratio and the double-dimensional edge probability, adaptive weighted fusion of edge pixels can be realized, effectively suppressing false positives and false negatives caused by high reflectivity, complex structure or low contrast defects, and improving the robustness and accuracy of defect region connected domain extraction.
[0029] The normalized final edge probability of each pixel point in the target image is obtained by traversing, and the pixel points with normalized final edge probability greater than a preset threshold are taken as edge pixel points. The edge pixel points are connected to obtain the connected domain of the target image. Similarly, the connected domain of the to-be-detected background grayscale image is obtained, and the defect connected domain of the target image is obtained according to the actual defect position of the target image.
[0030] Any connected domain in the to-be-detected background grayscale image is taken as a to-be-detected domain, and the standard deviation of the curvature of all edge pixel points in the to-be-detected domain is taken as the first profile feature value. The standard deviation of the gradient amplitude of all edge pixel points in the to-be-detected domain is taken as the second profile feature value.
[0031] The mean value of the gradient of all pixel points in the to-be-detected domain in the research direction is taken as a first distribution characteristic value, and the first distribution characteristic value of each preset direction is obtained through traversal to obtain the minimum first distribution characteristic value and the maximum first distribution characteristic value of the to-be-detected domain.
[0032] The first profile characteristic value, the second profile characteristic value, the minimum first distribution characteristic value and the maximum first distribution characteristic value of the defect connected domain are obtained according to the actual defect position of the target map.
[0033] The first difference value between the first profile characteristic value of the to-be-detected domain and the first profile characteristic value of the defect connected domain is calculated, the second difference value between the second profile characteristic value of the to-be-detected domain and the second profile characteristic value of the defect connected domain is calculated, and the first product absolute value of the first difference value and the second difference value is calculated; the third difference value between the maximum first distribution characteristic value of the to-be-detected domain and the maximum first distribution characteristic value of the defect connected domain is calculated, the fourth difference value between the minimum first distribution characteristic value of the to-be-detected domain and the minimum first distribution characteristic value of the defect connected domain is calculated, and the second product absolute value of the third difference value and the fourth difference value is calculated; and the sum of the first product absolute value and the second product absolute value is taken as the feature difference degree.
[0034] It needs to be explained that in the appearance defect detection of the bottom plate accessory of the electric iron, since the bottom plate is made of high-reflective metal material, and the surface is regularly distributed with circular steam holes and flow guide pits and other inherent structures, some defects (such as local collapse of the steam hole, edge deformation or slight deformation of the flow guide pit) are highly similar to normal structures in terms of traditional pixel value and gradient amplitude, and it is difficult to effectively distinguish them through the conventional gray difference or edge intensity difference.
[0035] At the same time, the area, shape and position of the defect region in different defect samples have great differences, further increasing the complexity of detection. The existing technology usually relies on the pixel value difference of the edge points in the connected domain or a single gradient feature to distinguish defects, but this method ignores the high similarity between the steam hole deformation defect and the normal steam hole in terms of edge gradient intensity and the subtle difference in the contour geometry, and is easy to misjudge the slightly deformed steam hole as a normal structure, or misidentify linear defects such as scratches as circular structure abnormalities, causing missed detection or type misjudgment.
[0036] In view of this problem, the present application extracts the edge profile of the suspected defect connected domain, and then quantitatively analyzes it from two key dimensions: one is to calculate the curvature standard deviation of the edge pixel points to represent the regularity of the profile shape (such as the curvature of the circular structure is stable, while the curvature of the scratch or deformation structure fluctuates greatly); the second is to calculate the standard deviation of the gradient amplitude of the edge points to reflect the uniformity of the local pixel response. In addition, further combined with the gradient change trend in multiple directions (such as horizontal, vertical and diagonal), the scratch with directionality and the circular structure (such as steam hole) with isotropy are distinguished.
[0037] In another embodiment, the feature difference degree further comprises: for any preset direction, calculating a fifth difference value of the first distribution feature value of the to-be-detected domain and the first distribution feature value of the defect connected domain, obtaining the fifth difference value of each preset direction, and calculating a fifth difference value mean; calculating a first absolute difference value of the fifth difference value and the fifth difference value mean in any preset direction, and calculating an absolute difference value accumulation value of all preset directions; and taking the sum of the first product absolute value and the absolute difference value accumulation value as the feature difference degree.
[0038] It should be noted that the first contour feature value is used to quantify the geometric shape difference of the connected domain contour itself, and the deviation from the standard circular structure (such as a normal steam hole) is measured by the curvature change. The more irregular the contour is, the larger the feature value is, indicating that it is more likely to be a scratch, a tear, or an asymmetric deformation. The second contour feature value focuses on the pixel characteristic difference of the connected domain contour adjacent region, that is, the stability of the gradient distribution, which reflects the abnormal degree of the defect region and its surrounding background in the imaging performance; the larger the value is, the more different the contour surrounding pixels are from the normal structure region, which helps to identify low-contrast but structurally abnormal micro-pits or edge collapse. In addition, the first distribution feature value captures the direction sensitivity of the connected domain by analyzing the pixel intensity or gradient energy distribution difference of the connected domain in multiple directions (such as horizontal, vertical, diagonal, etc.): a scratch usually presents a significant linear distribution characteristic in a certain main direction, while a circular structure deformation is relatively uniform in all directions.
[0039] S3: Taking the connected domain other than the defect connected domain in the target image as a general domain, calculating the Euclidean distance between the centroid of the defect connected domain and the centroid of the general domain, and calculating a first distance standard deviation of all Euclidean distances in the target image; obtaining a second distance standard deviation of the to-be-detected base plate gray image according to the same method of calculating the first distance standard deviation; calculating the defect matching degree of the to-be-detected base plate gray image and the target image based on the first distance standard deviation, the second distance standard deviation, and the feature difference degree, and completing the defect detection.
[0040] It should be noted that in the design of the electric iron base plate, the positions of the steam holes and the flow guide pits are not randomly arranged, but are precisely arranged according to the steam flow path and the heat conduction efficiency, with a highly fixed geometric distribution rule and a clear spacing relationship, to ensure that the steam can uniformly and efficiently cover the entire ironing surface. In contrast, defects generated during manufacturing or use exhibit different spatial distribution characteristics: scratches usually have a random direction, with no fixed position or direction; abnormal pits (such as indentations or collapses) may appear in specific areas, but their positions, numbers, and arrangement do not follow the structural rules between the steam holes and the flow guide pits.
[0041] However, the existing defect detection technology often only focuses on local pixels or contour features when performing type discrimination, ignoring the essential difference in the overall spatial distribution pattern between defects and normal structures. For example, when a smooth pit in a non-standard position appears in a bottom plate area that should have no structure, the system may misjudge it as a normal structure due to its similar shape and size to the flow guide pit, thereby missing the defect. Although such misjudgment is visually reasonable, it may cause clothes to hook, stretch or even burn due to local protrusions or depressions in actual use, seriously affecting product safety.
[0042] In one embodiment, the defect connected domains in the historical bottom plate gray images with the same historical defect label are constructed into defect sets, and any defect set is taken as a to-be-matched set. For any defect connected domain in the to-be-matched set, the feature difference degree of the connected domain of the to-be-detected bottom plate gray image and any defect connected domain is obtained.
[0043] The second absolute difference value of the first distance standard deviation and the second distance standard deviation is calculated, the third product of the second absolute difference value and the feature difference degree is calculated, the third product of each defect connected domain in the to-be-matched set is obtained, the third product mean of all third products is calculated, and the exponential value of the negative of the third product mean is taken as the defect matching degree.
[0044] The calculation logic of the defect matching degree: by calculating the Euclidean distance distribution of the to-be-detected connected domain and its adjacent structure or a preset template in the position space, and counting the density characteristics of the structure points in the unit area, whether it conforms to the density law of the normal steam hole-flow guide pit layout can be effectively quantified. The density characteristics of the normal structure are consistent with the template height, and the Euclidean distance is small; while the local density of the scratch or random pit is low due to the lack of systematic arrangement, which leads to a significant increase in the Euclidean distance between the normal distribution template. Therefore, taking the Euclidean distance as the distribution density consistency criterion can effectively assist in distinguishing random defects from regular functional structures, further improving the accuracy of defect type matching in the case of similar pixel and contour features, avoiding misjudgment of abnormal pits as flow guide pits, and thus ensuring ironing safety and detection reliability.
[0045] At this point, the defect matching degree of the to-be-detected bottom plate gray image and the historical bottom plate gray image under different defects can be obtained, and in response to the defect matching degree being greater than a preset threshold, the defect type of the to-be-detected bottom plate gray image can be determined, and the defect type contained in the to-be-detected bottom plate gray image can be multiple, that is, there are multiple defect matching degrees greater than the preset threshold.
[0046] The system includes a processor and a memory, and the memory stores computer program instructions which, when executed by the processor, implement the visual-based appearance defect detection method for accessories according to the first aspect of the application.
[0047] The system also comprises other components well known to those skilled in the art, such as a communication bus and a communication interface, whose arrangement and functioning are known in the art and therefore will not be described here.
[0048] It should be noted that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the inventive concept, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application patent should be subject to the appended claims.
Claims
1. A vision-based method for detecting appearance defects in accessories, characterized in that, include: Collect the target image of the iron and the corresponding historical defect labels. The target image is any historical grayscale image of the substrate, and obtain the grayscale image of the substrate to be inspected. Obtain the connected components of the target image, and similarly obtain the connected components of the grayscale image of the substrate to be detected. Obtain the defect connected components of the target image based on the actual defect location, and calculate the feature difference between the connected components of the grayscale image of the substrate to be detected and the defect connected components. The connected regions in the target image other than the defect connected region are taken as general regions. The Euclidean distance between the centroid of the defect connected region and the centroid of the general region is calculated. The first standard deviation of all Euclidean distances in the target image is calculated. The second standard deviation of the grayscale image of the substrate to be inspected is obtained by the same method as the calculation of the first standard deviation. The degree of defect matching between the grayscale image of the substrate to be inspected and the target image is calculated based on the first standard deviation, the second standard deviation and the feature difference degree, and the defect detection is completed.
2. The vision-based method for detecting appearance defects in accessories according to claim 1, characterized in that, The connected components of the target graph include: Take any pixel in the target image as the research point; Calculate the first discrimination of the target image; Calculate the second ratio between the pixel value of the study point and the maximum pixel value in the target image, and use the standard deviation of all second ratios as the second discrimination index of the target image; Calculate the first standard deviation of the first ratio of the study point in all preset directions, and obtain the first standard deviation of each pixel in the 8 neighborhood of the study point. Use the mean of all first standard deviations as the first edge probability of the study point. The standard deviation of the second ratio of each pixel within an 8-neighborhood of the study point is used as the second marginal probability of the study point. The final marginal probability of the study point is calculated based on the first discriminant, the second discriminant, the first marginal probability, and the second marginal probability. The normalized final edge probability of each pixel in the target image is obtained by traversing the graph. Pixels with a normalized final edge probability greater than a preset threshold are taken as edge pixels. The edge pixels are then connected to obtain the connected components of the target image.
3. The vision-based method for detecting appearance defects in accessories according to claim 2, characterized in that, The first distinguishing metric of the calculated target map includes: Take any preset direction as the research direction. The preset directions are 0 degrees, 45 degrees, 90 degrees and 135 degrees. Calculate the gradient value of the study point in the study direction, obtain the maximum gradient value in the study direction, calculate the first ratio of the gradient value of the study point in the study direction to the maximum gradient value, iterate to obtain the first ratio of each pixel in the study direction, calculate the standard deviation of the ratio of all ratios, iterate to obtain the standard deviation of the ratio of each preset direction, and use the mean of all standard deviations of the ratios as the first discrimination of the target image.
4. The vision-based method for detecting appearance defects in accessories according to claim 2, characterized in that, The final marginal probability of the calculated study point includes: Calculate the third ratio of the sum of the first discrimination of all historical background grayscale images to the sum of the second discrimination of all historical background grayscale images, and calculate the fourth ratio of the sum of the second discrimination of all historical background grayscale images to the sum of the first discrimination of all historical background grayscale images. Calculate the first product of the third ratio and the first marginal probability, and calculate the second product of the fourth ratio and the second marginal probability. The sum of the first and second products is taken as the final marginal probability of the research point.
5. The vision-based method for detecting appearance defects in accessories according to claim 1, characterized in that, The feature difference includes: Take any connected region in the grayscale image of the substrate to be detected as the detection region, and take the standard deviation of the curvature of all edge pixels in the detection region as the first contour feature value. The standard deviation of the gradient magnitude of all edge pixels in the detection domain is used as the second contour feature value. Take any preset direction as the research direction, where the preset directions are 0 degrees, 45 degrees, 90 degrees and 135 degrees. Take the average gradient of all pixels in the detection domain in the research direction as the first distribution feature value. Iterate through each preset direction to obtain the first distribution feature value, so as to obtain the minimum first distribution feature value and the maximum first distribution feature value of the detection domain. Based on the actual defect location in the target image, the defect connected region of the target image is obtained. Similarly, the first contour feature value, the second contour feature value, the minimum first distribution feature value, and the maximum first distribution feature value of the defect connected region are obtained. Calculate the first difference between the first contour feature value of the domain to be detected and the first contour feature value of the defect connected domain; calculate the second difference between the second contour feature value of the domain to be detected and the second contour feature value of the defect connected domain; and calculate the absolute value of the first product of the first difference and the second difference. Calculate the third difference between the maximum first distribution eigenvalue of the domain to be detected and the maximum first distribution eigenvalue of the defect connected domain; calculate the fourth difference between the minimum first distribution eigenvalue of the domain to be detected and the minimum first distribution eigenvalue of the defect connected domain; and calculate the absolute value of the second product of the third difference and the fourth difference. The sum of the absolute values of the first and second products is used as the feature difference.
6. The vision-based method for detecting appearance defects in accessories according to claim 5, characterized in that, The feature difference degree also includes: For any preset direction, calculate the fifth difference between the first distribution feature value of the domain to be detected and the first distribution feature value of the defect connected domain, iterate through each preset direction to obtain the fifth difference value, and calculate the average of the fifth differences. Calculate the first absolute difference between the fifth difference and the mean of the fifth differences in any preset direction, and calculate the cumulative value of the absolute differences in all preset directions; The sum of the absolute value of the first product and the cumulative value of the absolute difference is used as the feature difference degree.
7. The vision-based method for detecting appearance defects in accessories according to claim 1, characterized in that, The calculation of the defect matching degree between the grayscale image of the substrate to be inspected and the target image includes: Construct a defect set from the connected components of the historical base grayscale image with the same historical defect label, and use any defect set as the set to be matched. For any connected component of a defect in the set to be matched, obtain the feature difference degree between the connected component of the grayscale image of the substrate to be detected and any connected component of a defect; Calculate the second absolute difference between the first and second standard deviations of the distance, calculate the third product of the second absolute difference and the feature difference degree, iterate through each defect connected region in the set to be matched to obtain the third product, calculate the mean of the third products of all the third products, and take the exponent of the inverse of the mean of the third products as the defect matching degree.
8. A vision-based component appearance defect detection system, characterized in that, include: A processor and a memory, the memory storing computer program instructions that, when executed by the processor, implement the vision-based accessory appearance defect detection method according to any one of claims 1-7.
Citation Information
Patent Citations
Image feature template matching method being applied to detection of mobile phone screen defects
CN105894036A
Wafer appearance defect detection method based on machine vision
CN116012292A
Optical film surface flaw detection method and system, product and medium
CN119919387A
Defect detection method and system for automotive upholstery
CN120355720A
Operating panel sheet printing positioning method based on machine vision
CN120726128A
Cited By
AOI defect detection method and system based on industrial vision
CN121837267A