Visual inspection and grading evaluation method for product bulge defects

By using a grayscale statistical distribution model and an adaptive threshold generation mechanism, combined with multi-view image acquisition and morphological weight scoring, the problem of insufficient sensitivity in detecting protrusion defects caused by edge glue injection and fasteners is solved. This enables quantitative classification and stable detection of protrusion defects, improving the consistency of detection results and the efficiency of automated production.

CN121998977APending Publication Date: 2026-05-08FREESENSE IMAGE TECH
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FREESENSE IMAGE TECH
Filing Date
2026-04-09
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing technologies for detecting protrusion defects caused by edge glue injection and fasteners suffer from insufficient sensitivity, poor environmental adaptability, reliance on human experience for judgment criteria, and difficulty in achieving refined classification. This makes it difficult to guarantee the stability and accuracy of detection and to meet the needs of quality classification control and process parameter optimization.

Method used

By employing a grayscale statistical distribution model and an adaptive threshold generation mechanism, images are acquired using a multi-view area array camera combined with a motor-driven adjustable support. An adaptive segmentation algorithm based on grayscale median and median absolute deviation is used to construct a bright/dark region segmentation model. A comprehensive scoring model combining defect grayscale features and region shape weights is then used to achieve quantitative grading assessment of protruding defects.

Benefits of technology

It enhances the ability to identify protruding defects and improves environmental adaptability, enables quantitative expression and grading of defect severity, improves the consistency and repeatability of test results, meets the stability and real-time requirements of automated production, supports the appearance inspection needs of various products, and provides full lifecycle traceability of product quality data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121998977A_ABST
    Figure CN121998977A_ABST
Patent Text Reader

Abstract

The invention discloses a visual detection and grading evaluation method for product bulge defects, which comprises the following steps of: acquiring a product image through a multi-view area-array camera, filtering interference through adaptive preprocessing based on a gray median and a median absolute deviation, and analyzing and extracting a bulge abnormal region through a connected region; the shape weight is calculated by combining the area compactness, the area and the like, the gray difference index and the shape weight are fused to generate an area score and weighted to obtain an overall defect severity score, finally, grading judgment is performed according to a threshold interval, and meanwhile, a result is synchronized to a control system to realize automatic sorting of a production line. The problems that an existing detection method is low in sensitivity, poor in environment adaptability and incapable of achieving refined grading are solved, the detection stability and the anti-interference capacity are improved, quantification and objectification of defect evaluation are achieved, the grading result meets the actual quality requirement, the system universality is high, and the appearance detection requirements of various precise products can be met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of digital image processing and intelligent defect recognition technology, and in particular to a method for detecting and classifying surface morphology anomalies based on statistical distribution modeling and regional feature weighted analysis. This method can be applied to the appearance consistency inspection of products such as display panel assemblies, glass covers, transparent structural parts, precision injection molded parts, and electronic assembly structural parts. Background Technology

[0002] In the manufacturing process of electronic products, structural components, and appearance parts, to meet assembly strength or sealing requirements, adhesive is often applied to the product edges, or structural assembly is completed using fasteners such as screws and clips. While these processes improve the overall reliability of the product, assembly stress or adhesive buildup can cause varying degrees of protrusions on the product surface near the edges. These protrusion defects become a significant factor affecting the product's appearance consistency and performance.

[0003] To address this type of appearance defect, existing technologies mostly employ machine vision inspection, which involves acquiring images of the product surface and analyzing the overall appearance or edge contours to identify anomalies. However, protrusion defects caused by edge glue injection or fasteners are characterized by their small size, concentrated distribution, and irregular shape. Furthermore, the defect location is strongly correlated with the product structure. Existing methods that uniformly analyze the entire image or complete edge contour are highly susceptible to interference from variations in product texture, uneven lighting, or natural edge undulations, making it difficult to guarantee the stability and accuracy of the detection.

[0004] Furthermore, existing inspection methods mostly rely solely on the presence or absence of defects as the sole criterion, lacking quantitative assessment methods for the degree of protrusion and failing to distinguish between defect types with varying degrees of impact on product function or appearance. This singular qualitative judgment method is ill-suited to the needs of quality grading control and process parameter optimization in actual production, easily leading to the over-rejection of qualified products or the influx of potentially defective products into downstream processes. Therefore, existing technologies still have significant room for improvement in the accurate detection and grading assessment of localized protrusion defects caused by edge glue application and fasteners. Summary of the Invention

[0005] To address the shortcomings of existing surface anomaly detection methods, such as insufficient sensitivity, poor environmental adaptability, reliance on human experience for judgment criteria, and difficulty in achieving refined grading, this invention aims to provide a visual detection and grading assessment method for product protrusion defects caused by edge glue injection and fasteners. By constructing a grayscale statistical distribution model and an adaptive threshold generation mechanism, the method improves the ability to identify minute protrusion anomalies and enhances environmental adaptability to changes in lighting and material differences. By fusing multi-dimensional parameters such as area, grayscale, and morphological features, the method achieves quantitative expression and grading judgment of the degree of protrusion defects, improving the consistency and repeatability of detection results. Furthermore, this invention features a clear computational structure, is easy to integrate into systems, and can meet the requirements for detection stability and real-time performance in automated production environments.

[0006] To achieve the above-mentioned objectives and solve the technical problem of inconsistent and unstable detection and evaluation of product surface protrusion defects caused by edge glue injection and fasteners, the core technology is as follows: by introducing an adaptive segmentation algorithm based on grayscale median and median absolute deviation (MAD) to achieve stable detection of bright and dark areas, and by combining a comprehensive scoring model of defect grayscale features and region shape weights to achieve quantitative and graded evaluation of protrusion defects.

[0007] This invention provides the following technical solution: a visual detection and grading evaluation method for product protrusion defects, comprising the following steps: a) using a multi-view area array camera combined with a motor-driven adjustable bracket, adjusting the camera angle and position according to the product structural characteristics, automatically locating and capturing images of areas on the product edges and surfaces prone to protrusion defects, and acquiring product image data; b) performing adaptive preprocessing on the images acquired in step a), first determining the area to be detected and cropping the image, then generating a saturation mask to exclude saturated highlight pixels, extracting low-frequency illumination components through fast box mean extraction, calculating the ratio residual image to weaken the influence of absolute brightness, and then constructing a bright / dark region segmentation model based on the grayscale median (m) and median absolute deviation (MAD), automatically determining the segmentation threshold to achieve bright and dark region segmentation, and filtering out low-frequency illumination components and saturated highlight interference; c) performing connected component analysis on the preprocessed images in step b), extracting potential protrusion abnormal regions, calculating and analyzing the grayscale characteristics, texture differences, and edge characteristics of each region. d) Establish a shape weight model for each defect region identified in step c), calculate the compactness, actual pixel area, and boundary perimeter of each region, determine the shape weight based on the region compactness, and increase the shape weight for slender and irregular abnormal regions; e) Calculate the grayscale difference index of each abnormal region, and use the grayscale difference index and the shape weight obtained in step d) as input to generate the scoring results of each region. The scores of all regions are weighted and summed and normalized to form the overall defect severity score of the product; f) Set multi-level threshold intervals according to product quality requirements, and classify the product according to the overall defect severity score obtained in step e), and the judgment results include "qualified", "minor defect" and "serious defect"; g) Output the detection results, scoring data and images with abnormal region annotations, and simultaneously synchronize the classification judgment results to the production line control system in real time to realize automatic product sorting, online alarm and process parameter linkage adjustment.

[0008] Furthermore, the method for determining the area to be detected in step b) is as follows: after accurately locating the product area in the original image, the area to be detected is initially determined by inward etching operation, and then the actual area to be detected is determined based on the typical positions of the protruding defects corresponding to the edge glue injection and fasteners. The image is cropped based on the area to be detected to improve the efficiency of subsequent algorithm processing.

[0009] Furthermore, the formula for generating the saturation mask in step b) is: Mask = {p | I(p) ≥ 0.8} Imax}, where I(p) is the original grayscale value of pixel p, and Imax is the maximum grayscale value of the image pixel; the low-frequency illumination component is obtained through fast box-type mean filtering with a filtering radius r=0.1 min(W,H), where W and H are the width and height of the cropped sub-image; the formula for calculating the ratio residual image is: R(x,y)=I(x,y) / (L(x,y)+ε), where I(x,y) is the original grayscale image, L(x,y) is the low-frequency illumination image, and ε is the minimum value to avoid division by zero.

[0010] Furthermore, the formulas for calculating the gray-level median (m) and median absolute deviation (MAD) mentioned in step b) are: m = median{R(p)|p P},MAD=median{|R(p)-m||p P}, R(p) is the ratio of pixel p to residual gray value, where P is the set of valid pixels; the formula for calculating the bright / dark region segmentation threshold is: , When k is set to 1, an initial mask for the bright area is generated. and the initial mask for the dark area R is the ratio residual image R(x,y), and the initial mask is subjected to morphological processing and area filtering to obtain the final bright / dark regions.

[0011] Furthermore, the morphological processing of the initial mask includes: using an opening operation with a radius of 3.5px to remove isolated noise points, and using a closing operation with a radius of 5.5px and hole filling to restore the continuity of the region; the area filtering is to retain regions with a connected region area greater than 150px.

[0012] Further, the formula for calculating the compactness of the region in step d) is: ci = 4πAi / Pi², where ci is the compactness of the i-th connected region, Ai is the actual pixel area of ​​the i-th connected region (excluding hole pixels), and Pi is the sum of the perimeters of all boundaries (outer boundary and inner hole boundary) of the i-th connected region; the formula for calculating the shape weight is: Fi = 1 + γ(1-ci), where γ is the maximum magnification, and its value is 0.3.

[0013] Furthermore, the formula for calculating the grayscale difference index in step e) is: Where ωi = Ai / AROI is the area percentage of the i-th connected region, AROI is the area of ​​the region to be detected, M is the number of bright regions, ω1 is the background area percentage of the bright region, ω2 is the background area percentage of the dark region, and μ i Let μ be the average gray level of the i-th connected region, and μ be the average gray level of the entire product region.

[0014] Furthermore, the calculation of the overall product defect severity score in step e) includes: first calculating the unnormalized score. Then, normalization is performed to obtain Where N is the total number of connected regions, Fi G represents the shape weight of the i-th connected region. i Let α be the grayscale difference index of the i-th connected region, α be the proportional magnification factor, MAD be the median absolute deviation of the image, and ε = 1e-6 to ensure numerical stability.

[0015] Furthermore, it includes a human visual consistency assessment step: organizing multiple experienced inspectors to conduct blind evaluations of product samples from the same batch, rating and ranking the severity of defects, performing correlation analysis between the overall defect severity score output by the algorithm and the human average score, and adaptively adjusting the grading threshold range in step f) based on the analysis results to ensure consistency between algorithmic judgment and human visual judgment. More specifically, organizing 5 or more inspectors with 3 or more years of experience in precision product appearance inspection to conduct blind evaluations of product samples from the same batch, rating and ranking the severity of defects, and performing correlation analysis between the overall defect severity score output by the algorithm and the human average score.

[0016] Furthermore, the output format of the detection results in step g) includes: an abnormal area result map with color overlay annotations, evaluation indicators and judgment conclusions including overall score, individual connected region score, shape weight, batch exportable CSV format data records and PDF format detection reports, wherein the CSV format data records include product number, timestamp, algorithm version, various indicators and judgment results.

[0017] The beneficial effects of this invention are:

[0018] By introducing an adaptive preprocessing algorithm based on the median and median absolute deviation of grayscale, effective suppression of external factors such as saturated highlights, uneven illumination, reflection, and shadows is achieved. The bright / dark region segmentation threshold is automatically determined by the image data distribution rather than a fixed threshold, so that the protrusion defects can maintain stable recognition results under different imaging conditions and different production environments, solving the problem that existing methods are easily affected by environmental interference.

[0019] A regional scoring and weighted evaluation mechanism integrating grayscale differences and morphological features was established, transforming the subjective defect judgment that originally relied on human experience into a calculable and comparable quantitative indicator (overall defect severity score). This achieved an objective expression of the degree of defect and visual impact, significantly improving the consistency and comparability of defect assessment and avoiding the subjectivity and randomness of human judgment.

[0020] The concept of regional shape weight is introduced into the scoring system. The weight is adjusted according to the compactness of the defect. The weight of high-impact defects such as slender and irregular ones is increased, while regular defects with small impact are scored normally. This makes the evaluation results highly consistent with the actual impact of defects on the product's appearance, functional areas and key parts. The rationality and credibility of the grading results are greatly improved, meeting the quality grading control needs in production.

[0021] By employing multi-view adaptive image acquisition, statistical feature-driven algorithm analysis, automated graded output, and production line PLC linkage, a complete closed-loop inspection system was established, encompassing image acquisition, processing and analysis, graded judgment, and production line handling. This system enables online monitoring and real-time feedback of product quality, significantly reducing manual intervention, improving automated production efficiency, and transforming the visual inspection process from passive defect diagnosis to proactive quality control.

[0022] The system adopts a modular design and adaptive algorithm framework, which can flexibly adjust the detection area, segmentation parameters, and grading thresholds according to the structural characteristics and defect distribution patterns of different products without major modifications to the algorithm core. It can adapt to the appearance inspection needs of various products such as display panels, glass covers, precision injection molded parts, and electronic assembly structural parts. It can also be extended to the detection of other surface defects such as dents, scratches, and color differences, making it widely applicable.

[0023] It supports batch export of CSV format data records and PDF format inspection reports. The records include product number, timestamp, algorithm version, various defect indicators and judgment results, realizing full life cycle traceability of product quality data. At the same time, the system can statistically analyze the defect distribution and severity under different batches and different process parameters, providing data support for the optimization of production process parameters and helping to continuously improve the production process. Attached Figure Description

[0024] Figure 1 This is a schematic diagram of the product image acquisition system mentioned in this invention;

[0025] Figure 2 This is a flowchart of the screen edge protrusion detection process mentioned in this invention;

[0026] Figure 3 This is a schematic diagram of the defect detection area mentioned in the present invention, showing the detection area near the camera hole of the mobile phone screen and the glue injection area of ​​the frame;

[0027] Figure 4 This is a flowchart of the image preprocessing process mentioned in this invention;

[0028] Figure 5 The images shown are comparisons of the effects before and after preprocessing mentioned in this invention. (a) is the original image before preprocessing, which has problems such as uneven lighting and strong local reflections. (b) is the image after preprocessing, which has a balanced brightness distribution and effectively reduces background interference.

[0029] Figure 6 The flowchart for the bright / dark region segmentation mentioned in this invention illustrates the steps of segmentation threshold determination based on grayscale median and MAD, morphological processing, and area filtering.

[0030] Figure 7The image shown here illustrates the effect of bright / dark region segmentation mentioned in this invention, demonstrating that the boundaries of the segmented bright / dark abnormal regions are clear and distinct from the background.

[0031] Figure 8 The product defect index score chart mentioned in this invention shows the index scores corresponding to products with different defect severity levels. The scores increase significantly with the increase of defect severity. Detailed Implementation

[0032] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0033] Reference Figures 1-8 As shown, a visual inspection and grading method for product protrusion defects includes the following steps:

[0034] a) A multi-view area array camera combined with a motor-driven adjustable bracket is used to adjust the camera angle and position according to the product's structural characteristics. This allows for automatic positioning and localized shooting of areas on the product's edges and surfaces prone to protruding defects, acquiring product image data. Imaging parameters can be flexibly adjusted according to the structural characteristics and typical defect distribution areas of different products, ensuring consistency and accuracy in imaging of products from different batches and with different postures. This avoids missed or misjudged defects due to deviations in imaging angle and position, providing high-quality, highly matched raw image data for subsequent image processing. At the same time, localized shooting reduces invalid image areas and improves the overall processing efficiency of the inspection process.

[0035] b) Adaptive preprocessing is performed on the image obtained in step a). First, the area to be detected is determined and the image is cropped. Then, a saturation mask is generated to exclude saturated highlight pixels. Low-frequency illumination components are extracted by fast box mean extraction. The ratio residual image is calculated to weaken the influence of absolute brightness. Then, a bright / dark region segmentation model is constructed based on the gray median (m) and median absolute deviation (MAD). The segmentation threshold is automatically determined to achieve bright and dark region segmentation. Low-frequency illumination components and saturated highlight interference are filtered out. Through multi-stage preprocessing operations, external interference factors such as uneven illumination, local strong reflection, and saturated highlights are filtered out layer by layer. The adaptive segmentation model based on gray statistical features replaces the fixed threshold, so that the bright and dark region segmentation results do not depend on manual setting. It has strong robustness to products with different lighting conditions and different material reflection characteristics. It can clearly distinguish abnormal areas from background areas, providing stable and reliable image input for subsequent defect identification and greatly improving the accuracy of defect detection.

[0036] c) Perform connected component analysis on the image preprocessed in step b) to extract potential protruding abnormal regions, calculate and analyze the grayscale features, texture differences and edge connectivity of each region, determine the authenticity and boundary range of the abnormal regions, and achieve accurate differentiation between real protruding defect regions and pseudo-abnormal regions formed by noise and texture fluctuations through multi-dimensional feature analysis, effectively eliminate invalid interference regions, and accurately define the boundaries of real abnormal regions to avoid feature calculation errors caused by ambiguous region division, provide accurate analysis objects for subsequent defect quantitative assessment, and reduce the probability of missed detection and misjudgment;

[0037] d) Establish a shape weight model for each defect region identified in step c), calculate the compactness, actual pixel area and boundary perimeter of each region, determine the shape weight based on the region compactness, increase the shape weight for slender and irregular abnormal regions, make up for the limitations of evaluating defects based solely on grayscale features, incorporate the actual impact of defect shape on product appearance and function into the evaluation system, amplify the weight of slender and irregular defects that have a greater impact on product quality, make the evaluation results more in line with the actual quality requirements of the product, and make the quantification of defect degree more reasonable and targeted;

[0038] e) Calculate the grayscale difference index of each abnormal area. Using the grayscale difference index and the shape weight obtained in step d) as input, generate the scoring results of each area. Weight the scores of all areas and normalize them to form the overall product defect severity score. This achieves multi-dimensional fusion and quantification of grayscale features and morphological features, transforming different types and forms of defects into calculable and comparable quantitative values. The normalization process eliminates the numerical differences between different batches and under different imaging conditions, ensuring the consistency and comparability of defect scores across batches and scenarios, and providing an objective and unified quantitative basis for subsequent classification judgment.

[0039] f) Set multi-level threshold ranges according to product quality requirements, and classify the product according to the overall defect severity score obtained in step e). The classification results include "qualified", "minor defect" and "serious defect", so as to realize the fine classification of product quality and match the quality classification control needs in production.

[0040] g) Outputs inspection results, scoring data, and images with anomaly area annotations. Simultaneously, it synchronizes the grading judgment results to the production line control system in real time, enabling automatic product sorting, online alarms, and linked adjustments to process parameters. The multi-format output of inspection results meets diverse needs such as quality traceability and manual review. Annotated images visualize the location and shape of defects, facilitating quick problem location by staff. Real-time linkage with the production line control system enables the direct conversion of inspection results into production actions, completing the closed-loop control of "inspection-judgment-handling." This transforms visual inspection from passive defect diagnosis to proactive quality control, improving the automation level and production efficiency of the production line.

[0041] In a preferred embodiment of the present invention, the method for determining the area to be detected in step b) is as follows: After accurately locating the product area in the original image, the area to be detected is initially determined through an inward etching operation. Then, the actual area to be detected is determined based on the typical locations of protruding defects corresponding to edge glue injection and fasteners. The image is then cropped based on the area to be detected to improve the processing efficiency of subsequent algorithms. Through precise positioning and targeted cropping, irrelevant background areas and non-defect-prone areas in the product image are removed, significantly reducing the amount of data processed by subsequent algorithms, improving the processing speed of image processing, and allowing the algorithm to focus on typical defect areas, avoiding interference from irrelevant areas, and improving the targeting and efficiency of defect detection.

[0042] In a preferred embodiment of the present invention, the formula for generating the saturation mask in step b) is: Mask = {p|I(p)≥0.8} Imax}, where I(p) is the gray value of pixel p, and Imax is the maximum gray value of the image pixel; the low-frequency illumination component is obtained through fast box-type mean filtering with a filtering radius r=0.1 min(W,H), where W and H are the width and height of the cropped sub-image; the formula for calculating the ratio residual image is: R(x,y)=I(x,y) / (L(x,y)+ε), where I(x,y) is the original grayscale image, L(x,y) is the low-frequency illumination image, and ε is a minimum value to avoid division by zero. The standardized formulas make the calculation process of saturation mask, low-frequency illumination component, and ratio residual image quantifiable and reproducible, avoiding the subjectivity of manual operation; the fast box-means method can efficiently extract the low-frequency illumination component in O(N) time, ensuring the real-time performance of the algorithm and adapting to the cycle time requirements of automated production; the ratio residual calculation weakens the influence of absolute brightness, improving the algorithm's adaptability to images with a large dynamic range, allowing abnormal regions under different brightness backgrounds to be effectively identified.

[0043] In a preferred embodiment of the present invention, the formulas for calculating the gray median (m) and median absolute deviation (MAD) in step b) are: m = median{R(p)|p P},MAD=median{|R(p)-m||p P}, where P is the set of pixels excluding the saturation mask; the formula for calculating the bright / dark region segmentation threshold is: , When k is 1, an initial mask is generated. , The initial mask is then morphologically processed and area filtered to obtain the final bright / dark regions. A segmentation threshold is calculated based on grayscale statistics after excluding saturated pixels, avoiding the influence of saturated highlights on threshold determination and making the threshold more closely match the actual grayscale distribution of the image. The standardized threshold calculation formula eliminates the need for manual intervention in the segmentation process, achieving adaptive threshold generation. The initial mask is further optimized through subsequent processing, providing more accurate bright / dark anomaly regions for subsequent defect identification and improving the reliability of the segmentation results.

[0044] In a preferred embodiment of the present invention, the morphological processing of the initial mask includes: using an opening operation with a radius of 3.5px to remove isolated noise points, and using a closing operation with a radius of 5.5px and hole filling to restore the continuity of the region; area filtering retains regions with a connected region area greater than 150px. The opening operation can effectively remove tiny isolated noise points in the image, avoiding noise points being misjudged as tiny defects; the closing operation and hole filling can repair the abnormal region breakage problem caused by image noise and texture gaps, restore the complete shape of the defective region, and ensure the accuracy of region feature calculation; area filtering further eliminates tiny invalid regions, focusing on raised defective regions with practical evaluation significance, reducing the invalid workload of subsequent feature calculation and scoring, and improving the algorithm processing efficiency.

[0045] In a preferred embodiment of the present invention, the formula for calculating the region compactness in step d) is: ci = 4πAi / Pi², where ci is the compactness of the i-th connected region, Ai is the actual pixel area of ​​the i-th connected region (excluding hole pixels), and Pi is the sum of the perimeters of all boundaries (outer boundary and inner hole boundary) of the i-th connected region; the formula for calculating the shape weight is: Fi = 1 + γ(1-ci), where γ is the maximum magnification, with a value of 0.3. The compactness formula can accurately quantify the degree of morphological regularity of the region, realizing the transformation from shape features to numerical values, and providing an objective basis for the calculation of shape weight; the shape weight formula, through a fixed maximum magnification, allows the weight adjustment to have a standardized scale, avoiding the arbitrariness of weight magnification, making the weight differences of different morphological defects more reasonable, and ensuring the consistency and comparability of defect evaluation results.

[0046] In a preferred embodiment of the present invention, in step e), the set of connected regions is set as follows: ,in The number of bright areas, If the total number of connected components is given, then the number of dark connected components is... The formula for calculating the within-group variance of each connected region relative to the entire product is as follows: Where, ω i =Ai / AROI represents the area percentage of the i-th connected region, AROI represents the area of ​​the region to be detected, M represents the number of bright regions, ω1 represents the background area percentage of the bright regions, ω2 represents the background area percentage of the dark regions, and μ i Let μ be the average gray level of the i-th connected region, and μ be the average gray level of the entire product area. Differentiated calculation logic is designed for abnormal regions of different types, such as bright and dark, so that the quantification of gray level difference is more in line with the image characteristics of different regions. The area ratio of the region is included in the calculation, so that the gray level difference index can simultaneously reflect the gray level contrast and area size of the defect, realizing multi-dimensional quantification of the gray level characteristics of the defect, and making the index more realistically reflect the actual severity of the defect.

[0047] In a preferred embodiment of the present invention, the calculation of the overall product defect severity score in step e) includes: first calculating the unnormalized score. Then, normalization is performed to obtain In this equation, N represents the total number of connected regions, Fi represents the shape weight of the i-th connected region, Gi represents the grayscale difference index of the i-th connected region, α represents the proportional magnification factor, MAD represents the median absolute deviation of the image, and ε = 1e-6 to ensure numerical stability. The unnormalized score integrates the grayscale and morphological features of all abnormal regions through weighted summation. Square root processing makes the score values ​​more closely match the human eye's perception of defect severity. Normalization processing based on the image noise scale (MAD) effectively eliminates image substrate differences between different batches and under different imaging conditions, ensuring the comparability of scores across batches. The proportional magnification factor can be flexibly adjusted according to actual production needs, making the score values ​​more suitable for the grading threshold setting. The setting of ε avoids division by zero errors, ensuring the stability of the algorithm.

[0048] In a preferred embodiment of the invention, a human visual consistency assessment step is also included: multiple experienced inspectors conduct blind evaluations of samples from the same batch of products, rate and rank the severity of defects, perform correlation analysis between the overall defect severity score output by the algorithm and the average human score, and adaptively adjust the grading threshold range in step f) based on the analysis results to ensure consistency between algorithmic judgment and human visual judgment. Calibrating the algorithm threshold based on human visual judgment effectively solves the problem of deviation between algorithmic evaluation and actual human inspection standards, improving the acceptability and interpretability of the test results. Through multiple iterative calibrations, the algorithm's judgment continuously aligns with actual industry inspection experience, ensuring a high degree of match between the test results and quality judgment standards in actual production, reducing the workload of manual review.

[0049] In a preferred embodiment of the present invention, the output format of the detection results in step g) includes: an abnormal area result map with color overlay annotations, evaluation indicators and judgment conclusions including overall score, individual connected region score, shape weight, batch-exportable CSV format data records, and PDF format detection reports. The CSV format data records include product number, timestamp, algorithm version, various indicators, and judgment results. The result map with color annotations provides a visual presentation of defects, allowing staff to quickly and intuitively view the location, quantity, and shape of defects; the multi-dimensional evaluation indicators provide detailed data support for quality analysis and process optimization; the CSV format data facilitates batch statistics, analysis, and storage, adapting to the big data management needs in the production process; the PDF format report facilitates quality traceability, cross-departmental communication, and archiving; information such as product number and timestamp enables a one-to-one correspondence between detection data and products, providing a complete basis for quality traceability throughout the product's entire lifecycle.

[0050] In this invention, the image acquisition module consists of a multi-view area array camera and a motor-driven adjustable bracket. Based on the shape, size, and typical defect distribution characteristics of the object being inspected (such as near the camera hole, the edge of the glue injection, and the assembly of the fastener), the camera angle and position are automatically adjusted by the motor drive to achieve automatic positioning and localized shooting of the product edge and surface areas prone to protruding defects. This ensures that the imaging of products from different batches and with different postures has consistency and accuracy, and obtains high-quality product image data.

[0051] In this invention, adaptive image preprocessing is the core of achieving stable detection. The purpose is to filter out interference such as saturated highlights, low-frequency illumination, and uneven illumination, so as to provide high-quality image input for subsequent defect identification. Specifically, it is divided into the following sub-steps: (1) Determination of the detection area and image cropping: The product area in the original image is accurately located. The detection area is initially determined by inward erosion operation. Then, the actual detection area is determined according to the typical position of the protrusion defects caused by edge glue injection and fasteners. The original image is cropped based on the detection area to remove irrelevant background areas and improve the processing efficiency of subsequent algorithms. (2) Saturation mask generation: Taking the cropped grayscale input image I(x,y) as the object, the pixel value range is [0,Imax]. In order to avoid the saturated highlights from causing deviations in statistics such as grayscale median and median absolute deviation, a saturation mask is generated: Mask={p|I(p)≥0.8 Imax}, pixels within the mask are ignored in subsequent processing. (3) Low-frequency illumination component extraction: The low-frequency illumination component L(x,y) of the image is extracted by the fast box averaging method, with a filter radius of r=0.1. min(W,H), where W and H are the width and height of the cropped sub-image. This method can be implemented efficiently in O(N) time, ensuring the real-time performance of the algorithm. (4) Ratio residual image calculation: In order to improve the adaptability to large dynamic range images and weaken the influence of absolute brightness, the ratio residual image is calculated: R(x,y)=I(x,y) / (L(x,y)+ε), where ε is the minimum value to avoid division by zero. This ratio range R serves as the basis for subsequent bright / dark region segmentation. (5) Bright / dark region segmentation: First, on the ratio residual map R(x,y), based on the pixel set P excluding the saturation mask, the gray median m and median absolute deviation MAD are calculated; then, the bright / dark region segmentation threshold is determined; finally, the initial mask is morphologically processed: an opening operation with a radius of 3.5px is used to remove isolated noise points, a closing operation with a radius of 5.5px and hole filling are used to restore the continuity of the region, and then filtering is performed according to the condition that the area of ​​the connected region is greater than 150px to obtain the final bright / dark region, which provides a stable input for subsequent defect index calculation.

[0052] Anomaly region extraction and feature analysis: Connectivity analysis is performed on the preprocessed image to extract all potential convex anomaly regions; for each potential region, its gray-level features (average gray level, gray-level variance), texture difference (texture similarity to the background), and edge connectivity (continuity of region edges) are calculated. The authenticity of the region is determined by comprehensively using the above features, eliminating false anomaly regions formed by noise and texture fluctuations, and accurately determining the boundary range of the real anomaly regions.

[0053] Form weight model construction: For each identified real defect area, a form weight model is established to quantify the actual impact of the defect on the product appearance through shape features. Specifically: (1) Calculation of region form parameters: Calculate the actual pixel area Ai (excluding hole pixels) of the i-th connected region and the sum of the perimeters Pi of all boundaries (outer boundary and inner hole boundary). (2) Compactness calculation: Calculate the region compactness based on the area and perimeter: ci=4πAi / Pi², the compactness ci range is (0,1]. The closer the region is to a circle, the closer ci is to 1, and the smaller the impact on the product appearance; the longer and more irregular the region, the further ci is from 1, and the greater the impact on the product appearance. (3) Shape weight calculation: Determine the shape weight based on the compactness: Fi=1+γ(1-ci), where γ is the maximum magnification, and the value is 0.3; when the region is a regular circle, Fi is close to 1 and there is no weight magnification; when the region is long and irregular, Fi is magnified to highlight the impact of this type of defect on the product.

[0054] Defect scoring and overall severity calculation: The gray-scale difference index and shape weight are combined to achieve a quantitative score of the degree of defect, specifically: (1) Gray-scale difference index calculation: Calculate the area ratio of the i-th connected region ωi=Ai / AROI (AROI is the area of ​​the region to be detected), and The area percentages of the background in the light and dark areas are respectively. For the first The average gray level of the connected regions The average gray level of the entire product area, the average gray level of the area μi, and the average gray level of the product as a whole μ; calculate the gray level difference index according to the area type (bright / dark), indicating that the more significant the gray level difference between the area and the background, the more obvious the raised defect. (2) Area score generation: take the gray level difference index Gi and the shape weight Fi as input, multiply the two to obtain the score of the i-th connected region, and realize the fusion of gray level features and shape features. (3) Overall defect severity calculation: sum the scores of all areas by weight to obtain the unnormalized overall score: Where N is the total number of connected regions; to facilitate threshold setting and cross-batch comparison, normalization is performed using the Image Noise Scale (MAD) as the normalization benchmark: , where α is the proportional amplification factor, ε=1e-6 to ensure numerical stability and avoid division by zero, and the final Gnorm is the overall defect severity score of the product.

[0055] Defect classification judgment: Based on the actual quality requirements and process standards of the product, multiple threshold ranges are set, and the product is automatically classified according to the overall defect severity score Gnorm: when the score is below the lower threshold, it is judged as qualified; when the score is between the upper and lower thresholds, it is judged as a minor defect; when the score is above the upper threshold, it is judged as a serious defect.

[0056] The system outputs multiple forms of test results and links with the production line control system in real time: (1) Image output: The actual product area is cropped from the original image and a result image with color overlay is generated. The detected bright / dark abnormal areas are displayed in different colors and the area number is marked; (2) Data output: The evaluation index of the product is output, including the overall defect severity score, the score of a single connected region, the shape weight of each region, etc., and the classification judgment conclusion is clearly defined; (3) Document output: It supports batch export of CSV format data records and PDF format test reports. The CSV record contains the product number, timestamp, algorithm version, various indicators and judgment results to achieve quality traceability; (4) Production line linkage: The classification judgment results are synchronized to the production line PLC control system in real time to realize the automatic sorting of products. The rejection signal is triggered for "severe defect" products, and the online alarm is triggered for continuous detection of abnormalities. It can also link with the process link to realize automatic parameter adjustment or shutdown inspection.

[0057] Human eye consistency assessment and parameter calibration: To ensure the consistency between the algorithm output and human visual judgment, this invention also includes a human eye consistency assessment step: multiple experienced inspectors conduct blind evaluations of product samples from the same batch, rating and ranking the severity of defects; the overall defect severity score output by the algorithm is correlated with the average human score, and the threshold range for grading is adaptively adjusted based on the analysis results. Through multiple iterations of calibration, the algorithm maintains a high degree of consistency with human visual judgment while meeting real-time performance and stability requirements.

[0058] In this invention, the multi-view adaptive image acquisition feature is used to obtain high-quality, consistent product images. The process involves adjusting the camera angle and position by driving the bracket with a motor, and capturing images of typical defect areas. This feature provides the foundation for all subsequent image processing steps, avoids detection errors caused by inconsistent imaging, and works in conjunction with image preprocessing features to reduce interference sources in the preprocessing stage.

[0059] The adaptive preprocessing feature based on grayscale statistics filters out interference such as uneven illumination, saturated highlights, and noise, achieving stable bright / dark region segmentation. The implementation process involves region cropping, saturation masking, low-frequency component extraction, and ratio residual calculation, followed by the generation of an adaptive segmentation threshold based on the grayscale median and MAD. This feature is a core prerequisite for defect identification and, in conjunction with the abnormal region extraction feature, transforms the complex original image into a bright / dark region that can be directly analyzed, significantly improving the accuracy of abnormal region extraction.

[0060] Connectivity analysis and anomaly identification features are used to accurately extract real protruding anomaly regions and eliminate false anomalies. The process involves performing connectivity analysis on the segmented bright / dark regions and combining grayscale, texture, and edge features to determine the authenticity of the regions. This feature takes over the preprocessing results and provides accurate analysis objects for the subsequent scoring model. It works in conjunction with the morphological weight model to construct features, performing morphological feature analysis only on real anomaly regions and avoiding invalid calculations.

[0061] The compactness-based morphological weighting model quantifies the actual impact of defect morphology on product appearance. The implementation process involves calculating compactness through area and perimeter, generating shape weights based on compactness, and amplifying the weights for irregular defects. This feature compensates for the shortcomings of traditional inspection that only focuses on grayscale differences. In conjunction with grayscale difference index features, it achieves multi-dimensional defect quantification of grayscale features and morphological features, making the scoring results more consistent with the actual quality requirements of the product.

[0062] The defect scoring feature that integrates multi-dimensional features generates an overall defect severity score for the product, thus quantifying the degree of defect. The process involves integrating grayscale difference indicators and shape weights to generate regional scores, weighted summing, and normalizing using MAD to obtain the overall score. This feature integrates the analysis results of all preceding features and works in conjunction with the grading judgment feature to provide quantifiable and comparable numerical evidence for grading, avoiding the risk of misjudgment based on a single threshold.

[0063] The multi-level threshold grading feature enables refined grading of product quality. The process involves setting threshold ranges based on quality requirements and determining the product grade based on the overall score. This feature takes the scoring results and works in conjunction with the output of test results and production line linkage features to transform the quantitative score into a production-executable judgment conclusion.

[0064] The multi-format output and production line linkage features enable the visualization, traceability, and automated control of test results. The process involves outputting labeled images, scoring data, and document reports, and synchronizing the results to the PLC control system. This feature applies the algorithm analysis results to actual production, working in conjunction with all preceding features to form a closed-loop production process of "detection-analysis-judgment-disposal".

[0065] The human eye consistency assessment feature is used to calibrate algorithm parameters and ensure consistency between algorithm judgment and human vision. The implementation process involves adjusting the grading threshold through correlation analysis between blind human evaluation and algorithm scores. This feature is a guarantee of algorithm robustness and works in conjunction with the grading judgment feature to make the algorithm results more in line with industry inspection standards, thereby improving the acceptability and interpretability of the test results.

[0066] This invention forms a dedicated detection system for protrusion defects caused by edge glue injection and fasteners, from "source control" of image acquisition, to "interference filtering" in preprocessing, to "precise positioning" of anomaly identification, and finally to "quantitative treatment" of scoring, grading, and linkage.

[0067] Example 1: Screen Protrusion Defect Detection System Based on Multi-View View. This example provides a screen protrusion defect detection system based on multi-view image acquisition and intelligent analysis to implement the detection and grading evaluation method of the present invention. The system includes an image acquisition module, an image processing and analysis module, a human-computer interaction and display output unit, and a PLC collaborative control unit, forming an integrated intelligent detection platform. The functions and implementations of each unit are as follows:

[0068] The image acquisition module consists of multiple area array industrial cameras, a light source assembly, and a motor-driven adjustable bracket. The cameras are mounted on the bracket via the motor drive assembly, and their angles and positions can be flexibly adjusted according to the screen's size, shape, and typical defect locations (such as near the camera hole or the glue injection area on the frame). Multiple cameras work together to capture multi-angle, different spectral information from the screen. The light source assembly uses a diffuse light source to avoid strong local reflections and ensure the uniformity and clarity of the image.

[0069] The image processing and analysis module, equipped with the detection algorithm of this invention, receives image data from the image acquisition module via a high-speed communication interface; it sequentially executes steps such as cropping the region to be detected, generating a saturation mask, extracting low-frequency illumination components, segmenting bright / dark regions, analyzing connected components, calculating morphological weights, scoring defects, and determining a grade, converting the detection results into a quantifiable data format. Specifically, refer to... Figure 1 As shown, the image acquisition module includes a 12-bit main detection camera 1, a high-frequency camera 2, a color camera 3, a short-side side-view camera 4, a long-side side-view camera 5, a motor 6, and a dust removal light source 7, all mounted on an adjustable bracket 8.

[0070] Human-machine interaction and display output unit: including industrial touch screen and data storage server, which can display test results, annotated abnormal area images and defect distribution in real time on an integrated human-machine interface; supports local storage and remote access of test data, and can batch export CSV format data records and PDF format test reports to achieve quality traceability.

[0071] The PLC collaborative control unit is responsible for triggering and synchronizing the camera, light source, and production line conveyor mechanism to ensure that the system operates in a coordinated manner within the production cycle. When the visual inspection result is determined to be "serious defect", a sorting signal is automatically issued to remove the defective product. When multiple "minor defect" or "serious defect" products are detected in succession, an online alarm is triggered, and the glue injection and assembly processes can be linked to realize automatic adjustment of process parameters or shutdown inspection, forming a closed-loop control of "detection-feedback-handling".

[0072] Example 2: Specific Detection Process for Screen Edge Protrusion Defects. This example uses the detection of protrusion defects caused by glue injection on the mobile phone screen bezel as an example to explain in detail the specific implementation process of the detection and grading evaluation method of the present invention. The process is as follows: Figure 2 As shown.

[0073] Reference Figure 3 As shown, the detection area is determined as follows: Raised defects caused by edge glue injection and fasteners mainly appear near the product's camera aperture. After accurately locating the product area in the original image, the area to be detected is initially determined through inward etching. Then, the actual detection area is determined based on the defect's position relative to the product. To improve algorithm efficiency, the image is cropped according to the detection area before refined detection is performed.

[0074] Reference Figure 4 As shown, image preprocessing: To overcome the interference of non-uniform illumination and local strong reflections on defect region extraction, this method first excludes saturated pixels and removes low-frequency illumination components from the cropped region of interest (ROI), thereby obtaining bright / dark regions that are insensitive to extreme values ​​and have strong robustness, providing stable input for subsequent index calculation and correlation analysis. Specifically:

[0075] Input and saturation mask. Input image in grayscale. For an object, the pixel value range is To avoid the influence of saturated highlights on statistical measures (such as median gray level and median absolute deviation), a saturation mask is generated first: Ignore when generating residual images in subsequent processes The pixels within.

[0076] Low-frequency illumination component. Low-frequency illumination image. The result was obtained through fast box-mean filtering, with a filter radius of r = 0.1. min(W,H), where W and H are the width and height of the cropped sub-image, can be efficiently implemented in O(N) time, improving the real-time performance of the algorithm.

[0077] Residual ratio image. To improve adaptability to images with a large dynamic range and mitigate the influence of absolute brightness, ratio residuals are used: The range of this ratio This serves as the basis for subsequent bright / dark region segmentation.

[0078] Reference Figure 5 The image shows a comparison between the original image and the image after preprocessing. (a) is the original image without preprocessing, exhibiting uneven lighting, strong local reflections, and uneven background grayscale distribution. (b) is the image result after the preprocessing steps of this invention. By performing grayscale normalization, noise suppression, and contrast enhancement on the original image, the overall brightness distribution of the image becomes more balanced, and background interference is effectively reduced. Comparing (a) and (b) demonstrates that the preprocessing method of this invention effectively improves image quality, enhances the distinction between abnormal areas and the background, and provides more stable and reliable input data for subsequent feature extraction and anomaly detection, thereby improving overall detection accuracy and stability.

[0079] Reference Figure 6 As shown, this invention analyzes the severity of product protrusions by analyzing the bright / dark features of the detection area. Therefore, a stable and reliable defect region extraction method is needed to provide stable input for subsequent index calculations and correlation analysis. This scheme uses a threshold derived from data distribution, is robust to a small number of extreme pixels, and has few parameters, making it easy to implement. First, in the obtained ratio residual map... Calculate the median of the grayscale ( ) and median absolute deviation ( ), denote the exclusion saturation mask If the set of pixels is P, then ; Then, determine the threshold for segmenting bright and dark regions. , (choose Generate initial mask , Finally, the initial mask is morphologically processed: first, isolated noise is removed by opening with a radius of 3.5px; to avoid narrow seams segmenting the same region, continuity is restored by closing with a radius of 5.5px and hole filling; then, filtering is performed based on the condition that the area of ​​the connected region is greater than 150px. The resulting bright / dark regions serve as reliable input for subsequent index calculations and correlation analysis.

[0080] Reference Figure 7The diagram illustrates the effect of the method of the present invention after segmenting an image into bright and dark regions. In the original image, due to differences in material reflection and local illumination variations, there is uneven gray-scale distribution, and the boundaries between bright and dark regions are not clear, making it difficult to accurately distinguish them directly using a fixed threshold. The present invention determines a dynamic segmentation threshold by statistically analyzing the gray-scale distribution of the target region, classifying regions with gray-scale values ​​higher than the threshold as bright regions and regions with gray-scale values ​​lower than the threshold as dark regions. Figure 7 As can be seen, after segmentation, the boundaries between bright and dark areas are clear, the grayscale distribution within the areas is uniform, and background interference is effectively suppressed. Compared with traditional fixed threshold segmentation methods, the method of this invention can more accurately distinguish between real abnormal areas and normal texture fluctuations, improving the accuracy and stability of region recognition and providing a reliable foundation for subsequent abnormal feature extraction and level evaluation.

[0081] Defect Score Calculation: To quantify the severity of defects, this invention proposes a method for calculating defect severity using within-group variance summation. This method quantifies each segmented connected region from two aspects: grayscale difference and shape, and summarizes the contribution of each region into a severity score for a single product. Specific steps and definitions are as follows.

[0082] Let the set of connected regions be ,in The number of bright areas, If the total number of connected components is given, then the number of dark connected components is... The within-group variance of each connected region relative to the entire product is calculated using the following formula: ,in, For the first Area percentage of connected regions The area to be detected is denoted as . and The area percentages of the background in the light and dark areas are respectively. For the first The average gray level of the connected regions This represents the average gray level of the entire product area.

[0083] The severity of defects in an image is reflected not only in grayscale levels but also in the shape of the segmented connected regions. Severe defects are typically elongated, fragmented, and have irregular edges, and should be magnified; while small, regularly shaped dots are considered less harmful. Therefore, the shape weight of each connected region is determined based on its shape, as shown in the following formula: ,in, For the first The compactness of a connected region is defined as follows: , This represents the actual pixel area of ​​the connected region (excluding pixels with holes). This is the sum of the perimeters of all boundaries (outer and inner boundaries) of the connected region. As the region approaches a circle... , When the region is long / irregular Much less than 1, It will be magnified. To achieve the maximum magnification, this invention selects... .

[0084] The severity of a defect in a single product is defined as the sum of the contributions from each region, i.e. To facilitate threshold setting and cross-batch comparison, for Perform normalization. Select the Image Noise Scale (MAD) as the normalization benchmark.

[0085] ,in, This is the proportional magnification factor. To ensure numerical stability and avoid division by zero, MAD represents the median absolute deviation of the product.

[0086] Reference Figure 8 As shown, the human visual consistency assessment aims to verify whether the algorithm output is consistent with the visual judgment of the inspector, which is a key step in ensuring the acceptability and interpretability of the test results. A rigorous and objective human visual consistency assessment is conducted to calibrate the algorithm's thresholds based on human benchmarks, identify deviations between the algorithm and human judgment, and guide improvements. This invention organizes multiple experienced inspectors to conduct blind evaluations of the same batch of samples, rating and ranking the severity of defects. Correlation analysis is performed between the algorithm score and the average human score to determine the thresholds and parameters that best match human visual perception. Through continuous iteration, the algorithm ensures accuracy in judgment while meeting real-time performance and stability requirements. Figure 8 The results show that, arranged from lowest to highest defect index, different product samples exhibit significant differences in defect index scores. Samples with higher scores typically show larger abnormal areas, significant grayscale contrast, or obvious morphological abnormalities; samples with lower scores mainly show slight texture fluctuations or background noise interference. By establishing a continuous scoring mechanism, this invention shifts from a qualitative judgment of "whether a defect exists" to a quantitative evaluation of "the degree of defect," enhancing the consistency and repeatability of detection results. It can also automatically classify results based on score ranges (e.g., acceptable, minor defect, severe defect). This scoring mechanism avoids the risk of misjudgment caused by single threshold judgments and improves the system's adaptability and stability in complex environments.

[0087] Output Results: After the detection is completed, the system will output the edge recognition and defect judgment results, including: (1) cropping the actual screen from the original image and generating a labeled result image, and displaying the detected bright / dark areas and their corresponding numbers in color overlay on the result image; (2) outputting the product's evaluation indicators (overall score, single connected region score, shape weight, etc.) and judgment conclusions; (3) batch exporting CSV records, including product number, timestamp, algorithm version, various indicators and results, and generating a PDF report;

[0088] (4) Send rejection / alarm signals in real time to control production sorting.

[0089] Finally, it should be noted that the above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for visual inspection and grading evaluation of product protrusion defects, characterized in that, Includes the following steps: a) Locate and capture images of the product's edges and surfaces where protrusions are likely to occur; b) Adaptive preprocessing is performed on the acquired image. First, the region to be detected is determined and the image is cropped. Then, a saturation mask is generated to exclude saturated highlight pixels. Low-frequency illumination components are extracted by fast box mean. The ratio residual image is calculated to weaken the influence of absolute brightness. Then, a bright / dark region segmentation model is constructed based on the gray median and median absolute deviation. The bright region segmentation threshold and dark region segmentation threshold are determined to achieve bright and dark region segmentation and filter out low-frequency illumination components and saturated highlight interference. c) Perform connected component analysis on the preprocessed image to extract potential protruding abnormal regions, calculate and analyze the gray-scale features, texture differences and edge connectivity of each region, and determine the authenticity and boundary range of the abnormal regions. d) Establish a shape weight model for each identified defect region, calculate the compactness, actual pixel area and boundary perimeter of each region, determine the shape weight based on the region compactness, and increase the shape weight for slender and irregular abnormal regions. e) Calculate the grayscale difference index of each abnormal region. Using the grayscale difference index and the obtained shape weight as input, generate the scoring results of each region. Weighted summation of all region scores and normalization processing are performed to form the overall product defect severity score. f) Set multi-level threshold ranges according to product quality requirements, and classify products based on the obtained overall defect severity score; g) Output the test results, scoring data, and images with abnormal areas marked. At the same time, synchronize the grading judgment results to the production line control system in real time to realize automatic product sorting, online alarm and linkage adjustment of process parameters.

2. The method according to claim 1, characterized in that, The method for determining the area to be detected in step b) is as follows: After accurately locating the product area in the original image, the area to be detected is initially determined by inward etching operation. Then, the actual area to be detected is determined based on the typical positions of the protruding defects corresponding to the edge glue injection and fasteners. The image is cropped based on the area to be detected to improve the efficiency of subsequent algorithm processing.

3. The method according to claim 1, characterized in that, The formula for generating the saturation mask in step b) is: Where I(p) is the original grayscale value of pixel p, I max This represents the maximum grayscale value of a pixel in the image. The low-frequency lighting component was obtained through a fast box-type mean filter with a filter radius of r=0.

1. min(W,H), where W and H are the width and height of the cropped sub-image; the formula for calculating the ratio residual image is: R(x,y)=I(x,y) / (L(x,y)+ε), where I(x,y) is the original grayscale image, L(x,y) is the low-frequency illumination image, and ε is the minimum value to avoid division by zero.

4. The method according to claim 1, characterized in that, In step b), the formulas for calculating the grayscale median and median absolute deviation are respectively: m = median{R(p)|p P},MAD=median{|R(p)-m||p P}, R(p) is the ratio residual gray value of pixel p, and P is the set of effective pixels; the calculation formulas for the bright region segmentation threshold and the dark region segmentation threshold are as follows: , When k is set to 1, an initial mask for the bright area is generated. and the initial mask for the dark area R is the ratio residual image R(x,y), and the initial mask is subjected to morphological processing and area filtering to obtain the final bright / dark regions.

5. The method according to claim 4, characterized in that, The morphological processing of the initial mask includes: using opening operations to remove isolated noise points, and using closing operations and hole filling to restore the continuity of the region.

6. The method according to claim 1, characterized in that, The formula for calculating the tightness of the area in step d) is: , where c i Let A be the compactness of the i-th connected region. i Let P be the actual pixel area of ​​the i-th connected region. i The sum of the perimeters of all boundaries of the i-th connected region; the formula for calculating the shape weight is: γ is the maximum amplification, with a value of 0.

3.

7. The method according to claim 6, characterized in that, The formula for calculating the grayscale difference index in step e) is: in, Let i be the area percentage of the i-th connected region. Let M be the area of ​​the region to be detected, M be the number of bright regions, ω1 be the proportion of the bright region to the background area, ω2 be the proportion of the dark region to the background area, and μ be the area of ​​the region to be detected. i Let μ be the average gray level of the i-th connected region, and μ be the average gray level of the entire product region.

8. The method according to claim 7, characterized in that, Step e) involves calculating the overall product defect severity score, which includes: first calculating the unnormalized score. Then, normalization is performed to obtain Where N is the total number of connected regions, F i G represents the shape weight of the i-th connected region. i Let be the grayscale difference index of the i-th connected region, α be the proportional magnification factor, MAD be the median absolute deviation of the image, and ε = 1e-6.

9. The method according to claim 1, characterized in that, It also includes a human visual consistency assessment step: organizing multiple experienced inspectors to conduct blind evaluations of product samples from the same batch, rating and ranking the severity of defects, performing correlation analysis between the overall defect severity score output by the algorithm and the human average score, and adaptively adjusting the grading threshold range based on the analysis results to ensure consistency between algorithm judgment and human visual judgment.

10. The method according to claim 1, characterized in that, The output of the detection results in step g) includes: an abnormal area result map with color overlay annotations, evaluation indicators and judgment conclusions including overall score, individual connected region score, shape weight, batch exported CSV format data records and PDF format detection report. The CSV format data records include product number, timestamp, algorithm version, various indicators and judgment results.

Citation Information

Patent Citations

  • Seamless steel tube defect detection method and device based on machine vision and storage medium

    CN119246811A

  • Ceramic product defect detection and analysis method and system

    CN119379680A

  • Circuit board welding fault identification method and system based on machine vision

    CN119648679A

  • Concave-convex point detection and defect evaluation system based on multistage detection and characteristic change

    CN120598931A

  • Foamed silicone rubber surface detection method based on image visual identification

    CN120894286A