Method for detecting defects on a spherical screen or an alucine screen based on visual analysis
By constructing a local window in the detection of aluminum curtain panels for dome screens, obtaining geometric distortion compensation factors and material illumination influence factors, and adaptively adjusting the dual thresholds of the Canny edge detection algorithm, the problems of low detection rate and poor robustness of traditional methods in the detection of aluminum curtain panels for dome screens are solved, and high-precision defect detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANDONG HUANWEI AMUSEMENT EQUIP CO LTD
- Filing Date
- 2026-04-07
- Publication Date
- 2026-06-02
AI Technical Summary
Traditional Canny edge detection algorithms cannot adapt to the nonlinear changes in the surface of dome aluminum panels caused by geometric curvature and material properties, resulting in low detection rate and poor robustness, and failing to meet the high precision requirements of industrial inspection.
By constructing a local window, the geometric distortion compensation factor and material illumination influence factor of the target pixel are obtained, and the dual thresholds of the Canny edge detection algorithm are adaptively adjusted to improve the accuracy of edge detection.
It enables precise detection of surface defects in dome aluminum curtain panels, improves the accuracy and adaptability of edge detection, and meets the high-precision requirements of industrial inspection.
Smart Images

Figure CN122134708A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of surface defect detection technology, and specifically to a method for detecting defects in dome aluminum curtain panels based on visual analysis. Background Technology
[0002] In modern manufacturing, dome-shaped aluminum curtain panels are widely used in construction, transportation, and industrial equipment, and their surface quality directly affects the performance and aesthetics of the products. In recent years, with continuous advancements in materials science and production processes, the production efficiency of dome-shaped aluminum curtain panels has significantly improved. However, correspondingly, the detection of surface defects (such as scratches, dents, and bubbles) has become increasingly complex. Traditional manual inspection methods, relying on human experience, are not only time-consuming and labor-intensive but also easily affected by subjective factors, leading to missed or misjudged defects. Therefore, designing an automated defect detection technology for dome-shaped aluminum curtain panels based on visual analysis is crucial.
[0003] The Canny edge detection algorithm first effectively removes noise interference from the image of the dome aluminum panel using Gaussian filtering to ensure the quality of subsequent processing. Then, it uses gradient calculation to accurately locate the edges, refines the edges through non-maximum suppression, and, combined with dual thresholding, can more clearly detect minor scratches, holes, and other defects on the surface of the dome aluminum panel. Therefore, this application uses the Canny edge detection algorithm for image segmentation of the target image. However, the traditional Canny edge detection algorithm uses globally fixed dual thresholds, which cannot adapt to the nonlinear changes on the dome surface caused by the geometric curvature and material characteristics of the dome aluminum panel: in the central region of the dome, the image distortion is small and the illumination is uniform, so the fixed threshold is still applicable; but in the edge region, geometric projection distortion leads to weakened edge features and distorted shapes, and the fixed threshold is prone to edge breakage or missed detection. At the same time, the high reflectivity of the dome aluminum panel creates a complex illumination distribution on the spherical surface, which easily produces false edges, and the material itself has texture, which further interferes with the acquisition of defect area edges. These defects together result in low detection rate and poor robustness of traditional methods in the dome aluminum panel scenario, which cannot meet the high precision requirements of industrial inspection. Summary of the Invention
[0004] To address the aforementioned technical problems, the present invention aims to provide a method for detecting defects in dome-shaped aluminum curtain panels based on visual analysis. The specific technical solution adopted is as follows:
[0005] One embodiment of the present invention provides a method for defect detection of dome-shaped aluminum curtain panels based on visual analysis, the method comprising:
[0006] Acquire a grayscale image of the surface of the dome aluminum curtain panel as the target image, and take any pixel as the target pixel; construct a window centered on the target pixel; adjust the set upper and lower thresholds according to the grayscale and gradient magnitude of the pixels within the window of the target pixel to obtain the basic upper and lower thresholds of the target pixel;
[0007] Within the window, obtain pixels similar to the target pixel and the smallest bounding rectangle that encloses the pixels similar to the target pixel; use the distance between the target pixel and the center point of the target image, the average gradient direction of the pixels within the window, the direction of the line connecting the target pixel and the center point of the target image, the ratio of the width to the length of the smallest bounding rectangle, the average gradient magnitude within the window, and the average gradient magnitude of the target image to obtain the geometric distortion compensation factor of the target pixel.
[0008] The highlight pixels within the window are obtained based on their grayscale values. The material illumination influence factor of the target pixel is obtained by using the highlight pixels within the window, the coefficient of variation of the gradient magnitude of the pixels within the window, and the correlation and entropy values of the grayscale co-occurrence matrix of the pixels within the window.
[0009] The basic upper and lower thresholds are adjusted using the geometric distortion compensation factor and material illumination influence factor of the target pixel to obtain adaptive upper and lower thresholds; edge detection is performed based on the adaptive upper and lower thresholds of each pixel in the target image to obtain an edge image; and defect detection is performed using the edge image.
[0010] Preferably, the basic upper limit threshold and basic lower limit threshold of the target pixel are obtained by adjusting the set upper and lower limit thresholds based on the gray level and gradient magnitude of the pixels within the window of the target pixel, including:
[0011] Half of the difference between the maximum and minimum grayscale values in the target image is obtained. The reciprocal of the absolute value of the difference between half of the difference and the grayscale value of the target pixel is taken to obtain the grayscale feature value. The standard deviation of the grayscale values of each pixel in the window of the target pixel, the grayscale feature value, and the mean of the gradient magnitude of the pixels in the window are added together and normalized to obtain the edge saliency of the target pixel. Based on the set upper and lower thresholds and the edge saliency of the target pixel, the basic lower threshold and the basic upper threshold of the target pixel are obtained.
[0012] Preferably, the basic upper limit threshold and basic lower limit threshold of the target pixel are obtained based on the set upper limit threshold, lower limit threshold, and edge saliency of the target pixel, including:
[0013] Set a base adjustment value; subtract the edge saliency of the target pixel from the preset value and multiply it by the base adjustment value to obtain the upper limit adjustment value; multiply the edge saliency of the target pixel by the base adjustment value to obtain the lower limit adjustment value; subtract the upper limit adjustment value from the set upper limit threshold to obtain the basic lower limit threshold of the target pixel; add the lower limit adjustment value to the set lower limit threshold to obtain the basic lower limit threshold of the target pixel.
[0014] Preferably, obtaining pixels similar to the target pixel within the window and the smallest bounding rectangle enclosing the pixels similar to the target pixel includes:
[0015] Multiply the grayscale value and gradient magnitude of a pixel to obtain its similarity metric. Select the n pixels within the window whose similarity metric is closest to that of the target pixel as similar pixels to the target pixel. Select the pixel located at the top left corner among the similar pixels to the target pixel and mark it as the initial point. Connect the similar pixels to the target pixel in a clockwise direction starting from the initial point to obtain the connected shape. Obtain the minimum bounding rectangle of the connected shape.
[0016] Preferably, the geometric distortion compensation factor of the target pixel is obtained using the distance between the target pixel and the center point of the target image, the average gradient direction of the pixels within the window, the direction of the line connecting the target pixel and the center point of the target image, the ratio of the width to the length of the minimum bounding rectangle, the average gradient magnitude within the window, and the average gradient magnitude of the target image, including:
[0017] The first feature of the window is obtained by multiplying the ratio of the number of pixels with non-zero gradient magnitudes within the window to the total number of pixels within the window by the mean of the gradient magnitudes of the pixels within the window; similarly, the first feature of the target image is obtained; the direction of the line connecting the target pixel to the center point of the target image is denoted as the radial direction; the geometric distortion compensation factor of the target pixel is obtained by multiplying and normalizing the distance between the target pixel and the center point of the target image, the absolute value of the difference between the average gradient direction of the pixels within the window and the radial direction, the ratio of the width to the length of the minimum bounding rectangle, and the absolute value of the difference between the first feature of the window and the first feature of the target image.
[0018] Preferably, obtaining the highlight pixels within the window based on grayscale values includes:
[0019] Set a grayscale threshold and record pixels within the window whose grayscale value is greater than or equal to the grayscale threshold as highlight pixels.
[0020] Preferably, the material illumination influence factor of the target pixel is obtained by utilizing the highlight pixels within the window, the coefficient of variation of the gradient magnitude of the pixels within the window, and the correlation and entropy values of the gray-level co-occurrence matrix of the pixels within the window, including:
[0021] The first reflective feature of the window is obtained by multiplying the ratio of the number of highlight pixels to the total number of pixels in the window by the coefficient of variation of the gradient magnitude of the pixels in the window. The second reflective feature of the window is obtained by taking the square root of the product of the inverse of the entropy value of the gray-level co-occurrence matrix of the pixels in the window and the correlation value. The material illumination influence factor of the target pixel is obtained by adding the normalized values of the first reflective feature and the second reflective feature and averaging them.
[0022] Preferably, the calculation model for the adaptive upper threshold and the adaptive lower threshold is as follows:
[0023] ,
[0024] ,
[0025] Where TTi and Tli are the adaptive upper and lower thresholds of the target pixel, respectively; TH0i and TL0i are the basic upper and lower thresholds of the target pixel, respectively; TL is the set lower threshold; Bi and Ki are the geometric distortion compensation factor and material lighting influence factor of the target pixel, respectively.
[0026] The embodiments of the present invention have at least the following beneficial effects: This application obtains a grayscale image of the surface of a dome aluminum curtain panel as the target image, and constructs a window centered on the target pixel; then, based on the grayscale and gradient magnitude of the pixels within the window of the target pixel, it adjusts the set upper and lower thresholds to obtain the basic upper and lower thresholds of the target pixel; and performs preliminary adaptive adjustments to the set upper and lower thresholds based on the local contrast, edge intensity, and brightness features of the target pixel, thereby enabling the dual thresholds of the Canny edge detection algorithm to initially adapt to the specificity of the dome aluminum curtain panel; further... The algorithm analyzes the pixels within the target pixel window and the pixels within the target image window, obtaining the geometric distortion compensation factor and the material illumination influence factor for the target pixel. These two factors are constructed from the perspectives of geometric distortion compensation and material reflection processing. Furthermore, the basic upper and lower thresholds are adjusted more precisely to obtain adaptive upper and lower thresholds. This makes the edge detection algorithm more suitable for the specific characteristics of the dome aluminum curtain panel when performing edge detection on the target image, thereby improving the accuracy of edge detection and making the defect detection of the dome aluminum curtain panel more accurate. Attached Figure Description
[0027] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a flowchart of a method for detecting defects in dome aluminum curtain panels based on visual analysis, provided as an embodiment of the present invention. Detailed Implementation
[0029] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a visual analysis-based defect detection method for dome aluminum curtain panels proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0030] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0031] The following description, in conjunction with the accompanying drawings, details a specific scheme for a visual analysis-based defect detection method for dome aluminum curtain panels provided by the present invention.
[0032] In this embodiment, the main application scenario of the present invention is as follows: This application mainly improves the dual threshold of the Canny edge detection algorithm based on the features of the surface image of the dome aluminum curtain panel, thereby improving the accuracy of edge detection, and then detecting defects on the surface of the dome aluminum curtain panel based on the image after the dome detection.
[0033] Please see Figure 1 The diagram illustrates a flowchart of a visual analysis-based defect detection method for dome aluminum curtain panels provided by an embodiment of the present invention. The method includes the following steps:
[0034] Step S1: Obtain a grayscale image of the surface of the dome aluminum curtain panel as the target image, and take any pixel as the target pixel; construct a window with the target pixel as the center; adjust the set upper and lower thresholds according to the grayscale and gradient magnitude of the pixels in the window of the target pixel to obtain the basic lower threshold and basic lower threshold of the target pixel.
[0035] In visual analysis-based defect detection of dome-shaped aluminum curtain panels, image acquisition is a crucial initial step. First, a high-resolution, high-sensitivity industrial camera must be selected to ensure clear capture of the surface details of the aluminum curtain panel. Second, the camera should be mounted in a suitable position to fully cover the aluminum curtain panel, and the focus and aperture adjusted to ensure a clear image with appropriate brightness. Then, a stable light source, such as an LED ring light, should be used to evenly illuminate the aluminum curtain panel, reducing shadow interference. Finally, an image of the surface of the aluminum curtain panel is captured, and the grayscale image of the acquired image is used as the target image. For ease of subsequent analysis, any pixel in the target image is used as an example for analysis, and this pixel is considered the target pixel.
[0036] In image processing of target images of dome aluminum curtain panels, accurate detection of surface defects is crucial, and edge detection is a vital component. Due to the complex characteristics of images on the surface of dome aluminum curtain panels, different regions exhibit diverse features due to factors such as material and lighting. Local features such as local contrast, edge intensity, and brightness affect edge detection performance, requiring a comprehensive consideration of these factors to determine a basic dual threshold, providing a fundamental basis for edge detection. Furthermore, the unique structure of dome aluminum curtain panels causes regular geometric distortions in the image, and material reflections and textures can interfere with defect edge acquisition. Therefore, to improve the accuracy and adaptability of edge detection and accurately detect surface defects of dome aluminum curtain panels, it is necessary to obtain geometric distortion compensation factors and material lighting influence factors based on the local features of the target pixels, and combine these with the basic dual threshold to obtain an adaptive dual threshold.
[0037] In the target image of the dome-shaped aluminum curtain panel, different regions exhibit diverse characteristics due to factors such as material and lighting. Local contrast reflects the degree of difference in pixel grayscale values within a region; areas with high contrast may have obvious edges or defects. Local gradient magnitude reflects the salience of edges within a region; areas with a large average gradient are more likely to be true edges. Brightness features are related to the brightness of a region; darker areas may have less obvious edge information due to material characteristics or insufficient lighting. Taking all these factors into account to determine the basic dual thresholds provides a fundamental basis for subsequent edge detection. This basic threshold setting based on local features fully considers the local characteristics of the image, making the initial edge detection more closely resemble the actual image situation and laying the foundation for subsequent fine-tuning. To analyze the local features of the target pixels, a window needs to be constructed centered on the target pixel. Preferably, in this application, the window size is n*n, where n is 9. A moderately sized window can better capture local features. Simultaneously, the grayscale and gradient magnitude of each pixel need to be acquired.
[0038] Therefore, the upper and lower thresholds of the target pixel are adjusted based on the grayscale and gradient magnitude of the pixels within the window of the target pixel to obtain the basic lower and lower thresholds of the target pixel.
[0039] Specifically, half of the difference between the maximum and minimum grayscale values in the target image is obtained. The reciprocal of the absolute value of the difference between half of the difference and the grayscale value of the target pixel is then used to obtain the grayscale feature value. The standard deviation of the grayscale values of each pixel within the window of the target pixel, the grayscale feature value, and the mean of the gradient magnitude of the pixels within the window are added together and normalized to obtain the edge saliency of the target pixel. Based on the set upper and lower thresholds and the edge saliency of the target pixel, the basic upper threshold and basic lower threshold of the target pixel are obtained.
[0040] Furthermore, based on the set upper and lower thresholds and the edge saliency of the target pixel, the basic upper and lower thresholds are obtained.
[0041] Specifically, a base adjustment value is set; the edge saliency of the target pixel is subtracted from the preset value and multiplied by the base adjustment value to obtain the upper limit adjustment value; the edge saliency of the target pixel is multiplied by the base adjustment value to obtain the lower limit adjustment value; the set upper limit threshold is subtracted from the upper limit adjustment value to obtain the basic lower limit threshold of the target pixel; the set lower limit threshold is added to the lower limit adjustment value to obtain the basic lower limit threshold of the target pixel.
[0042] The calculation models for the basic lower threshold and basic lower threshold of the target pixel are as follows:
[0043] ,
[0044] ,
[0045] Wherein, TH0i and Tl0i are the basic upper limit threshold and basic lower limit threshold of the i-th pixel, respectively, which are also the basic upper limit threshold and basic lower limit threshold of the target pixel; TH and TL are the set upper limit threshold and lower limit threshold, respectively, which are the set global basic upper limit threshold and lower limit threshold to achieve the set global basic upper limit threshold. Preferably, in this application, TH=150 and TL=1 / 3*TH=50 (the classic ratio of upper limit threshold to lower limit threshold is 2:1 to 3:1, and this application takes 3:1), taking a relatively loose basic threshold, and further adjusting it on the premise of ensuring rich edges;
[0046] θi represents the standard deviation of the gray levels of pixels within the window of that pixel, i.e., the local contrast. The higher the contrast, the stronger the edge salience of the region. Hmax and Hmin represent the maximum and minimum gray levels in the target image, respectively. The grayscale feature value is half the difference between the maximum and minimum grayscale values in the target image, i.e., the median value of the global grayscale range. Hi is the grayscale value of the i-th pixel. The closer the gray value of the i-th pixel is to the median gray value, the more uniform the local illumination, and the more obvious the edge information when edges exist. Dμi represents the average gradient magnitude of the pixels within the window. The larger the average gradient magnitude, the more significant the local edge. The edge saliency is obtained from these three terms. norm is the normalization function; additionally, in the calculation When obtaining the corresponding result, it is necessary to round it to the nearest integer.
[0047] TZ is the set basic adjustment value, which is 1 / 3TH=TL=50 (it can be set by yourself according to the factory quality inspection requirements of the current batch of dome aluminum curtain panels. The higher the requirements, the larger the adaptive range can be to further detect tiny edges and prevent tiny scratches from being missed). The upper limit adjustment value is set to 1. This value is used to adjust the set upper limit threshold to obtain the basic upper limit threshold TH0i for the i-th pixel. This indicates that the more significant the local edge features of the i-th pixel, the smaller the corresponding local high threshold (basic upper limit threshold). The lower limit adjustment value is used to adjust the set lower limit threshold to obtain the basic lower limit threshold Tl0i of the i-th pixel. This means that the more significant the local edge features are, the larger the corresponding local low threshold (basic lower limit threshold) is. That is, when the local edge features are obvious, the range of the double threshold should be appropriately narrowed to remove noise as much as possible and preserve the edge.
[0048] Similarly, by performing the same analysis, we can obtain the basic upper limit threshold and the basic lower limit threshold for each pixel.
[0049] Step S2: Obtain pixels similar to the target pixel within the window, as well as the smallest bounding rectangle enclosing the pixels similar to the target pixel; use the distance between the target pixel and the center point of the target image, the average gradient direction of the pixels within the window, the direction of the line connecting the target pixel and the center point of the target image, the ratio of the width to the length of the smallest bounding rectangle, the average gradient magnitude within the window, and the average gradient magnitude of the target image to obtain the geometric distortion compensation factor of the target pixel.
[0050] Due to the special structure of the dome screen aluminum panel, the image exhibits regular geometric distortion, with the distortion being minimal at the center and increasing towards the edges. Simultaneously, material reflection and texture further interfere with the acquisition of defect edges. Therefore, extracting features related to geometric distortion and material illumination from the target image, and constructing geometric distortion compensation factors and material illumination influence factors, can specifically correct edge detection deviations caused by these factors, making the threshold more consistent with reality.
[0051] The geometric distortion compensation factor aims to quantify the degree of image distortion caused by spherical projection. First, the surface of the spherical projection is curved, and the distortion is usually more significant the farther away from the image center. Second, the angle between the gradient direction of each pixel and the radial direction reflects the impact of distortion on the edges; the larger the angle, the greater the impact of distortion on the radial edges. At the same time, spherical distortion causes straight lines to become curves in the image; the greater the curvature, the greater the distortion in that region. Curvature estimation is approximated by the ratio of the width to the length of the minimum bounding rectangle of the curves of similar local pixels of the target pixel. Finally, since the texture of the distortion is compressed in regions far from the center, the edge density increases, meaning that the number of pixels with a large local window gradient mean and a non-zero gradient magnitude is higher than the global value. Combining these characteristics, the geometric distortion compensation factor can be obtained, comprehensively measuring the local distortion of the target pixel.
[0052] Therefore, first, obtain the pixels similar to the target pixel within the window, as well as the smallest bounding rectangle that encloses the pixels similar to the target pixel.
[0053] Specifically, the similarity metric of a pixel is obtained by multiplying its grayscale value and gradient magnitude. The n pixels within the window whose similarity metric values are closest to the target pixel are selected as the pixels similar to the target pixel. The pixel located at the top left corner among the pixels similar to the target pixel is selected as the initial point. Starting from the initial point, the pixels similar to the target pixel are connected in a clockwise direction to obtain the connected shape. The minimum bounding rectangle of the connected shape is then obtained.
[0054] Next, the geometric distortion compensation factor of the target pixel is obtained by using the distance between the target pixel and the center point of the target image, the average gradient direction of the pixels within the window, the direction of the line connecting the target pixel and the center point of the target image, the ratio of the width to the length of the minimum bounding rectangle, the mean of the gradient magnitude within the window, and the mean of the gradient magnitude of the target image.
[0055] Specifically, the first feature of the window is obtained by multiplying the ratio of the number of pixels with non-zero gradient magnitudes within the window to the total number of pixels within the window by the average gradient magnitude of the pixels within the window; similarly, the first feature of the target image is obtained; the direction of the line connecting the target pixel to the center point of the target image is denoted as the radial direction; the geometric distortion compensation factor of the target pixel is obtained by multiplying and normalizing the distance between the target pixel and the center point of the target image, the absolute value of the difference between the average gradient direction of the pixels within the window and the radial direction, the ratio of the width to the length of the minimum bounding rectangle, and the absolute value of the difference between the first feature of the window and the first feature of the target image.
[0056] The specific calculation model for the geometric distortion compensation factor of the target pixel is as follows:
[0057] ,
[0058] Where Bi is the geometric distortion compensation factor of the i-th pixel (target pixel); Si represents the distance between the i-th pixel and the center of the target image, that is, the number of pixels on the line connecting the two pixels. The farther the distance, the farther the current pixel is from the center of the image and the greater the possibility of distortion.
[0059] |Ji-Jxi| is the absolute value of the difference between the average gradient direction of the pixels within the window and the radial direction. Ji is the average gradient direction of the pixels within the window (by converting the gradient direction of each pixel within the window into points (cosθ, sinθ) on the unit circle, then calculating the mean of cosθ and sinθ of all points to obtain the average vector, and then calculating arctan2 (binary arctangent) of the average vector, the result is the average gradient direction of the pixels within the window). The radial direction |Jxi| refers to the angle between the direction vector from the image center to the target pixel and the horizontal coordinate axis (X-axis). The average gradient direction of the pixel refers to the angle between the average gradient direction of all pixels within the target window and the horizontal coordinate axis (X-axis). The difference between the two reflects the degree of deviation between the main direction of the texture in the target area and the radial direction of the area relative to the center of the circle. The greater the deviation, the greater the degree of local distortion.
[0060] The ratio of the width to the length of the minimum bounding rectangle represents the degree of curvature of the curve formed by its locally similar pixels, indicating a higher degree of local distortion. Dμi and Dμ represent the mean gradient magnitude of pixels within the window and the mean gradient magnitude of pixels in the target image, respectively. Ei and Zi represent the number of pixels with non-zero gradient magnitudes within the window and the total number of pixels within the window, respectively. E and Z represent the number of pixels with non-zero gradient magnitudes in the target image and the total number of pixels in the target image, respectively. The first characteristic of a window, The first feature of the target image is represented. This indicates the proportion of pixels with a large mean gradient and a non-zero gradient within the target window. In other words, the greater the difference between the local texture density of the target pixel and the global average texture density, the greater the degree of local distortion at that pixel. Similarly, the geometric distortion compensation factor for each pixel can be obtained.
[0061] Step S3: Obtain the highlight pixels within the window based on the grayscale values; use the highlight pixels within the window, the coefficient of variation of the gradient magnitude of the pixels within the window, and the correlation and entropy values of the grayscale co-occurrence matrix of the pixels within the window to obtain the material illumination influence factor of the target pixel.
[0062] The material illumination influence factor primarily assesses the impact of material and illumination on images by considering the reflectivity and texture characteristics of the dome aluminum curtain panel. Firstly, the dome aluminum curtain panel has a smooth, highly reflective surface. A higher proportion of local highlight pixels results in higher local reflection intensity, making it easier to detect reflective edges and increasing the false positive rate for defects. Secondly, highlight areas generally exhibit significant gradient changes compared to normal areas; the gradient is smaller at the center and larger at the edges, while the gradient in defect areas is more uniform. Therefore, a larger coefficient of variation in the local gradient amplitude suggests a more likely reflective area rather than a defective one. Furthermore, the rolling texture of the dome aluminum curtain panel exhibits certain regularity, while the texture in defective areas is complex and disordered. Lower local texture complexity and greater uniformity indicate a more likely local texture rather than a defective area. By combining these characteristics, the material illumination influence factor can be derived, accurately assessing the combined impact of material and illumination on images.
[0063] Therefore, highlight pixels within the window are obtained based on grayscale values. Specifically, a grayscale threshold is set, and pixels with a grayscale value greater than or equal to the threshold are recorded as highlight pixels. The grayscale threshold is obtained by sorting the global grayscale values in ascending order and taking the grayscale value at the 90th percentile (set according to the reflective characteristics of the current dome screen aluminum panel material; the stronger the reflectivity, the larger the threshold should be to prevent normal areas from being identified as reflective points).
[0064] Furthermore, the material illumination influence factor of the target pixel is obtained by utilizing the specular pixels within the window, the coefficient of variation of the gradient magnitude of the pixels within the window, and the correlation and entropy values of the gray-level co-occurrence matrix of the pixels within the window.
[0065] Specifically, the first reflective feature of the window is obtained by multiplying the ratio of the number of highlight pixels to the total number of pixels in the window by the coefficient of variation of the gradient magnitude of the pixels in the window; the second reflective feature of the window is obtained by taking the square root of the product of the inverse of the entropy value of the gray-level co-occurrence matrix of the pixels in the window and the correlation value; the first reflective feature and the second reflective feature of the window are added together and normalized to obtain the material illumination influence factor of the target pixel.
[0066] The specific calculation model for the material illumination influence factor of the target pixel is as follows:
[0067] ,
[0068] Where Ki is the material lighting influence factor of the i-th pixel; Gi is the number of highlight pixels within the window of the i-th pixel; and Zi is the number of pixels within the window of the i-th pixel. The larger the proportion of highlight pixels within the window, the stronger the local reflection interference. CVi is the coefficient of variation of the gradient magnitude of each pixel within the window. The larger the coefficient of variation, the more it matches the characteristic of large gradient changes in reflective areas. The first reflective feature of the window; Eti and Cri represent the entropy and correlation values of the gray-level co-occurrence matrix of the window pixels, respectively. i represents the second reflective feature of the window, indicating that the smaller the entropy value within the window and the greater the correlation, the more it matches the characteristics of low complexity and high uniformity of the material's own texture region; norm represents the normalization function. Similarly, the material lighting influence factor of each target pixel can be obtained.
[0069] Step S4: Adjust the basic upper threshold and basic lower threshold using the geometric distortion compensation factor and material illumination influence factor of the target pixel to obtain the adaptive upper threshold and adaptive lower threshold; perform edge detection based on the adaptive upper threshold and adaptive lower threshold of each pixel in the target image to obtain the edge image; use the edge image for defect detection.
[0070] The geometric distortion compensation factor and material illumination influence factor of the target pixel were obtained above. Although the basic upper and lower thresholds consider local contrast, edge intensity, and brightness features, they do not fully account for the influence of geometric distortion and material illumination. The geometric distortion compensation factor and material illumination influence factor correct the deviation of edge detection from different perspectives. Combining the two with the basic dual thresholds, the adaptive dual thresholds corresponding to the target pixel can be obtained, thereby improving the accuracy and adaptability of edge detection and more accurately detecting defects on the surface of the dome aluminum curtain panel.
[0071] Therefore, by using the geometric distortion compensation factor and material lighting influence factor of the target pixel, the basic upper limit threshold and basic lower limit threshold are adjusted to obtain the adaptive upper limit threshold and adaptive lower limit threshold.
[0072] The specific calculation models for the adaptive upper and lower thresholds are as follows:
[0073] ,
[0074] ,
[0075] Where TTi and Tli are the adaptive upper and lower thresholds of the target pixel, respectively; TH0i and TL0i are the basic upper and lower thresholds of the target pixel, respectively; TL is the set lower threshold; Bi and Ki are the geometric distortion compensation factor and material lighting influence factor of the target pixel, respectively.
[0076] This refers to the adjustment range of each factor when adjusting the basic upper and lower thresholds based on the two factors mentioned above. This means that when the local geometric distortion of the target pixel is large, the basic upper limit threshold should be increased and the sensitivity should be reduced to prevent the edge of the distorted area from breaking. At the same time, when its material and reflectivity are large, the basic upper limit threshold should be reduced and the sensitivity should be increased to prevent the material texture and reflective area from being identified as the edge. This means that when the local geometric distortion corresponding to the target pixel is large, the lower threshold should be lowered to reduce sensitivity and prevent edge breakage of the distorted area. Conversely, when the material texture and reflectivity are large, the lower threshold should be increased to improve sensitivity and prevent the material texture and reflective areas from being identified as edges. Here, the i-th pixel is taken as the target pixel. From this, the adaptive upper and lower thresholds for each pixel in the target image can be obtained.
[0077] Finally, after obtaining the adaptive upper and lower thresholds for each pixel in the target image, edge detection is performed based on these thresholds to obtain the edge image. Specifically, the adaptive upper and lower thresholds for each pixel are combined with the Canny edge detection algorithm to perform edge detection on the target image to obtain the edge image. Defect detection of the dome-shaped aluminum curtain panel can be further automated by combining machine learning techniques.
[0078] First, the binary image (edge image) generated by edge detection is preprocessed: broken edges are repaired by morphological operations (such as dilation and closing operations) to enhance the continuity of the defect area; then, candidate defect areas are extracted by connected component analysis; then, the geometric features (such as area, perimeter, aspect ratio) and texture features (such as edge density, gray-level variance) of the candidate defect areas are calculated to construct a sample dataset containing location and feature information. Each sample in the sample dataset contains the geometric and texture features of a candidate defect area.
[0079] Then, multiple manually labeled defect images are collected (labeling the defect types of each defect region in the defect images). The geometric and texture features of a defect region are combined to form a sample of that defect region, with the sample labeled as the defect type of the manually labeled defect region. This process constructs a sample dataset containing location and feature information for use by traditional machine learning models (such as defect recognition models based on support vector machines). (The process involves first collecting multiple manually labeled defect images, extracting the geometric features (e.g., area, perimeter, aspect ratio) and texture features (e.g., edge density, grayscale variance) of various defects in these images, and then constructing a sample dataset containing location and feature information.) The dataset is then divided into training and testing sets. The feature data from the training set is input into the support vector machine model for training, allowing the model to learn the feature patterns of different defect categories. After training, the model performance is evaluated using the testing set, and the parameters are adjusted and optimized based on the results to ultimately obtain a model that can accurately identify panel defects. This process of training and classification yields a defect recognition model. The samples corresponding to each candidate region of the target image are then input into the model, and the model directly outputs the precise location and category of the defect (such as scratches, dents, holes, etc.) through analysis. Post-processing can be used to optimize the results, ultimately achieving efficient and accurate location and defect classification.
[0080] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this specification. Additionally, the processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0081] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
[0082] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for defect detection of dome-shaped aluminum curtain panels based on visual analysis, characterized in that, The method includes: Acquire a grayscale image of the surface of the dome aluminum curtain panel as the target image, and take any pixel as the target pixel; construct a window centered on the target pixel; adjust the set upper and lower thresholds according to the grayscale and gradient magnitude of the pixels within the window of the target pixel to obtain the basic upper and lower thresholds of the target pixel; Within the window, obtain pixels similar to the target pixel and the smallest bounding rectangle that encloses the pixels similar to the target pixel; use the distance between the target pixel and the center point of the target image, the average gradient direction of the pixels within the window, the direction of the line connecting the target pixel and the center point of the target image, the ratio of the width to the length of the smallest bounding rectangle, the average gradient magnitude within the window, and the average gradient magnitude of the target image to obtain the geometric distortion compensation factor of the target pixel. The highlight pixels within the window are obtained based on their grayscale values. The material illumination influence factor of the target pixel is obtained by using the highlight pixels within the window, the coefficient of variation of the gradient magnitude of the pixels within the window, and the correlation and entropy values of the grayscale co-occurrence matrix of the pixels within the window. The basic upper and lower thresholds are adjusted using the geometric distortion compensation factor and material illumination influence factor of the target pixel to obtain adaptive upper and lower thresholds; edge detection is performed based on the adaptive upper and lower thresholds of each pixel in the target image to obtain an edge image; and defect detection is performed using the edge image.
2. The method for defect detection of dome aluminum curtain panels based on visual analysis according to claim 1, characterized in that, The step of adjusting the set upper and lower thresholds based on the grayscale and gradient magnitude of pixels within the window of the target pixel to obtain the basic upper and lower thresholds of the target pixel includes: Half of the difference between the maximum and minimum grayscale values in the target image is obtained. The reciprocal of the absolute value of the difference between half of the difference and the grayscale value of the target pixel is taken to obtain the grayscale feature value. The standard deviation of the grayscale values of each pixel in the window of the target pixel, the grayscale feature value, and the mean of the gradient magnitude of the pixels in the window are added together and normalized to obtain the edge saliency of the target pixel. Based on the set upper and lower thresholds and the edge saliency of the target pixel, the basic lower threshold and the basic upper threshold of the target pixel are obtained.
3. The method for defect detection of dome aluminum curtain panels based on visual analysis according to claim 2, characterized in that, The process of obtaining the basic upper and lower thresholds of the target pixel based on the set upper and lower thresholds and the edge saliency of the target pixel includes: Set a base adjustment value; subtract the edge saliency of the target pixel from the preset value and multiply it by the base adjustment value to obtain the upper limit adjustment value; multiply the edge saliency of the target pixel by the base adjustment value to obtain the lower limit adjustment value; subtract the upper limit adjustment value from the set upper limit threshold to obtain the basic lower limit threshold of the target pixel; add the lower limit adjustment value to the set lower limit threshold to obtain the basic lower limit threshold of the target pixel.
4. The method for defect detection of dome aluminum curtain panels based on visual analysis according to claim 1, characterized in that, The step of obtaining pixels similar to the target pixel within the window and the smallest bounding rectangle enclosing the pixels similar to the target pixel includes: Multiply the grayscale value and gradient magnitude of a pixel to obtain its similarity metric. Select the n pixels within the window whose similarity metric is closest to that of the target pixel as similar pixels to the target pixel. Select the pixel located at the top left corner among the similar pixels to the target pixel and mark it as the initial point. Connect the similar pixels to the target pixel in a clockwise direction starting from the initial point to obtain the connected shape. Obtain the minimum bounding rectangle of the connected shape.
5. The method for defect detection of dome aluminum curtain panels based on visual analysis according to claim 1, characterized in that, The geometric distortion compensation factor for the target pixel is obtained by utilizing the distance between the target pixel and the center point of the target image, the average gradient direction of the pixels within the window, the direction of the line connecting the target pixel and the center point of the target image, the ratio of the width to the length of the minimum bounding rectangle, the mean gradient magnitude within the window, and the mean gradient magnitude of the target image. The first feature of the window is obtained by multiplying the ratio of the number of pixels with non-zero gradient magnitudes within the window to the total number of pixels within the window by the mean of the gradient magnitudes of the pixels within the window; similarly, the first feature of the target image is obtained; the direction of the line connecting the target pixel to the center point of the target image is denoted as the radial direction; the geometric distortion compensation factor of the target pixel is obtained by multiplying and normalizing the distance between the target pixel and the center point of the target image, the absolute value of the difference between the average gradient direction of the pixels within the window and the radial direction, the ratio of the width to the length of the minimum bounding rectangle, and the absolute value of the difference between the first feature of the window and the first feature of the target image.
6. The method for defect detection of dome aluminum curtain panels based on visual analysis according to claim 1, characterized in that, The step of obtaining the highlight pixels within the window based on grayscale values includes: Set a grayscale threshold and record pixels within the window whose grayscale value is greater than or equal to the grayscale threshold as highlight pixels.
7. The method for defect detection of dome-shaped aluminum curtain panels based on visual analysis according to claim 1, characterized in that, The method of obtaining the material illumination influence factor of the target pixel by utilizing the highlight pixels within the window, the coefficient of variation of the gradient magnitude of the pixels within the window, and the correlation and entropy values of the gray-level co-occurrence matrix of the pixels within the window includes: The first reflective feature of the window is obtained by multiplying the ratio of the number of highlight pixels to the total number of pixels in the window by the coefficient of variation of the gradient magnitude of the pixels in the window. The second reflective feature of the window is obtained by taking the square root of the product of the inverse of the entropy value of the gray-level co-occurrence matrix of the pixels in the window and the correlation value. The material illumination influence factor of the target pixel is obtained by adding the normalized values of the first reflective feature and the second reflective feature and averaging them.
8. The method for defect detection of dome aluminum curtain panels based on visual analysis according to claim 1, characterized in that, The specific calculation model for the adaptive upper threshold and adaptive lower threshold is as follows: , , Where TTi and Tli are the adaptive upper and lower thresholds of the target pixel, respectively; TH0i and TL0i are the basic upper and lower thresholds of the target pixel, respectively; TL is the set lower threshold; Bi and Ki are the geometric distortion compensation factor and material lighting influence factor of the target pixel, respectively.