Defect region segmentation method and system based on powder coating image
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHAANXI FUHUA CHEMICAL CO LTD
- Filing Date
- 2026-07-03
- Publication Date
- 2026-08-04
AI Technical Summary
[0004]本发明提供基于粉末涂料图像的缺陷区域分割方法与系统,以解决现有的问题
[0015]本发明的技术方案的有益效果是:本发明实施例中提出了基于粉末涂料图像的缺陷区域分割方法与系统,通过分析粉末涂料图像中的反光分布特性,利用桔皮缺陷区域与无缺陷区域在反光分布模式上的差异,在局部窗口内统计反光模式的变动频次,并对不同背景光照强度所带来的偏差进行修正。同时,引入各点反光强度与背景光照的平均偏差作为辅助特征,以抑制可能的误识别,最终实现对粉末涂料图像中桔皮缺陷区域的准确分割。相较于现有方法,本发明将通常被视为噪声干扰的光照分布特征作为识别切入点,有效避免了桔皮缺陷在灰度图像中因纹理与梯度特征不明显而难以检测的问题。同时,通过引入额外的偏差特征进行综合分析,进一步提升了识别的准确性与鲁棒性。
Smart Images

Figure CN122510262A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image data processing technology, and specifically to a method and system for defect region segmentation based on powder coating images. Background Technology
[0002] Powder coating is an environmentally friendly and efficient surface treatment process widely used in home appliances, machinery, and other fields. The quality of the resulting coating directly affects the product's appearance, corrosion resistance, and service life. During the melting, leveling, and curing process of powder coating, factors such as workpiece surface roughness, excessively low curing temperature, or static electricity can easily cause orange peel defects on the coating surface. These defects not only damage the product's surface gloss and smoothness but may also lead to a decrease in protective performance due to uneven film thickness in certain areas.
[0003] Existing defect detection methods based on powder coating images mostly employ natural light or conventional diffuse illumination and rely on algorithms based on grayscale or gradient statistics. However, orange peel defects are mainly characterized by high-frequency, low-contrast texture fluctuations with smooth grayscale changes and a lack of obvious edge gradients. Therefore, they are easily misclassified as normal texture fluctuations in existing methods, leading to missed detections. Furthermore, existing methods typically treat highlight areas as high-frequency noise or abnormal interference points and remove them during the preprocessing stage. This processing precisely filters out the reflective distribution features that are crucial for identifying orange peel defects. Summary of the Invention
[0004] This invention provides a method and system for defect region segmentation based on powder coating images to solve existing problems.
[0005] The defect region segmentation method and system based on powder coating images of the present invention adopts the following technical solution: One embodiment of the present invention provides a defect region segmentation method based on powder coating images, the method comprising the following steps: The surface image of the workpiece after powder coating is acquired and preprocessed to obtain the relative reflective intensity value of each pixel in the powder coating area of the workpiece surface and the illumination component of each pixel. A local window corresponding to each pixel is established with each pixel as the center. The frequency of reflection mode change of each pixel is determined based on the sign change of the relative reflectance intensity value within the local window. Based on the illumination component of each pixel, the frequency of reflection mode variation is corrected to obtain the orange peel defect feature value of each pixel. The average absolute deviation of each pixel's region is determined based on the absolute value of the relative reflectance intensity within the local window corresponding to each pixel. Based on the orange peel defect feature values of all pixels and the mean absolute deviation of the region, a two-dimensional histogram is constructed, and the orange peel defect region in the surface image is segmented based on the two-dimensional histogram.
[0006] Furthermore, the specific steps involved in preprocessing the surface image to obtain the relative reflectance intensity value and illumination component of each pixel in the sprayed area of the workpiece surface are as follows: The surface image is converted to grayscale and background interference is removed to obtain the sprayed area on the workpiece surface; Gaussian blur is applied to the sprayed area on the workpiece surface to obtain the illumination component of each pixel in the sprayed area on the workpiece surface. The illumination component of each pixel is added to a non-zero constant to obtain a sum, and the gray value of each pixel is divided by this sum to obtain the reflection component of each pixel; Subtract 1 from the reflection component of each pixel to obtain the relative reflectance value of each pixel.
[0007] Furthermore, the specific steps for establishing a local window centered on each pixel and determining the frequency of reflection mode changes for each pixel based on the sign change of the relative reflectance intensity value within the local window are as follows: Construct a local window corresponding to each pixel, centered on any pixel in the sprayed area on the workpiece surface; Iterate through all pairs of adjacent pixels in the horizontal and vertical directions within the local window corresponding to each pixel, and filter out pairs of pixels with opposite relative reflectance values. Calculate the midpoint coordinates of each pair of pixels; The distance weight of each pixel pair is determined based on the midpoint coordinates of each pixel pair and the center point coordinates of the local window. The distance weights of all pixel pairs are summed to obtain the frequency of reflection mode changes for each pixel.
[0008] Furthermore, the specific steps for determining the distance weight of each pixel pair based on the midpoint coordinates of each pixel pair and the center point coordinates of the local window are as follows: Based on the midpoint coordinates of each pixel pair and the center point coordinates of the local window, obtain the squared Euclidean distance from the midpoint to the center point. Substituting the squared Euclidean distance from the midpoint to the center point into the Gaussian function yields the distance weight for each pixel pair.
[0009] Furthermore, the specific steps for correcting the frequency of reflection pattern changes based on the illumination component of each pixel to obtain the orange peel defect feature value for each pixel are as follows: Based on the illumination component of each pixel in the sprayed area on the workpiece surface, the illumination component-correction coefficient mapping table is consulted to determine the illumination intensity correction coefficient corresponding to each pixel; the illumination component-correction coefficient mapping table is obtained by calibrating the known orange peel defect area under different illumination components. Multiply the frequency of reflection pattern changes of each pixel by the illumination intensity correction coefficient corresponding to that pixel to obtain the orange peel defect feature value of each pixel.
[0010] Furthermore, the specific steps for determining the regional average absolute deviation of each pixel based on the absolute value of the relative reflectance intensity within the local window corresponding to each pixel are as follows: The mean absolute value of the relative reflectance intensity within the local window corresponding to each pixel is used to determine the average absolute deviation of the region for each pixel.
[0011] Furthermore, the specific steps for constructing a two-dimensional histogram based on the orange peel defect feature values of all pixels and the mean absolute deviation of the region, and segmenting the orange peel defect region in the surface image based on the two-dimensional histogram, are as follows: The orange peel defect feature value and the mean absolute deviation of the region for each pixel are used as the data pair for that pixel; A two-dimensional histogram is constructed based on the data pairs of all pixels in the sprayed area on the workpiece surface. Use a two-dimensional histogram to obtain the search region; Determine if there are local peaks within the search area: if so, use the largest local peak as the orange peel defect marker; Invert the two-dimensional histogram to obtain the inverted histogram; The watershed algorithm is used to segment the inverted and negated histogram to obtain the segmented regions; Map the points within the orange peel defect marking area back to the surface image of the workpiece after powder coating to obtain the initial defect area; Morphological processing was performed on the initial defect area to obtain the orange peel defect area.
[0012] Furthermore, the specific steps for obtaining the search region using a two-dimensional histogram are as follows: Gaussian smoothing is applied to the two-dimensional histogram to obtain the probability density surface; Use the point with the highest probability density in the probability density surface as the background marker; Based on historical orange peel defect image data, obtain the corresponding locations of historical orange peel defects; The search area is obtained by expanding the convex hull formed by the corresponding locations of historical orange peel defects outward by a preset ratio.
[0013] Furthermore, the method also includes: If there are no local peaks within the search area, it is determined that there are no orange peel defects in the surface image of the workpiece after powder coating.
[0014] One embodiment of the present invention provides a defect region segmentation system based on powder coating images, the system comprising the following modules: The acquisition module is used to acquire the surface image of the workpiece after powder spraying, and to preprocess the surface image to obtain the relative reflective intensity value of each pixel in the sprayed area of the workpiece surface and the illumination component of each pixel. The analysis module is used to create a local window for each pixel, and determine the frequency of reflection mode changes for each pixel based on the sign change of the relative reflectance intensity value within the local window. Based on the illumination component of each pixel, the frequency of reflection mode variation is corrected to obtain the orange peel defect feature value of each pixel. The average absolute deviation of each pixel's region is determined based on the absolute value of the relative reflectance intensity within the local window corresponding to each pixel. The segmentation module is used to construct a two-dimensional histogram based on the orange peel defect feature values of all pixels and the mean absolute deviation of the region, and to segment the orange peel defect region in the surface image based on the two-dimensional histogram.
[0015] The beneficial effects of the technical solution of this invention are as follows: This invention proposes a defect region segmentation method and system based on powder coating images. By analyzing the reflective distribution characteristics in the powder coating image, utilizing the difference in reflective distribution patterns between orange peel defect areas and non-defective areas, the frequency of reflective pattern changes is statistically analyzed within a local window, and deviations caused by different background illumination intensities are corrected. Simultaneously, the average deviation between the reflective intensity at each point and the background illumination is introduced as an auxiliary feature to suppress possible misidentification, ultimately achieving accurate segmentation of orange peel defect areas in powder coating images. Compared to existing methods, this invention uses illumination distribution features, which are often considered noise interference, as the identification entry point, effectively avoiding the problem that orange peel defects are difficult to detect in grayscale images due to unclear texture and gradient features. Furthermore, by introducing additional deviation features for comprehensive analysis, the accuracy and robustness of the identification are further improved. Attached Figure Description
[0016] To more clearly illustrate the technical solutions 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.
[0017] Figure 1 This is a flowchart illustrating the steps of the defect region segmentation method based on powder coating images of the present invention. Figure 2 This is a block diagram of the defect region segmentation system based on powder coating images according to the present invention. Detailed Implementation
[0018] 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 the defect region segmentation method and system based on powder coating images proposed by 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.
[0019] 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.
[0020] The following description, in conjunction with the accompanying drawings, details the specific scheme of the defect region segmentation method and system based on powder coating images provided by this invention.
[0021] It should be noted that this invention uses the reflective distribution characteristics in the powder-coated workpiece image and the differences between the normal area and the defect area as a basis to achieve the segmentation of the orange peel defect area.
[0022] After powder coating, workpieces are susceptible to orange peel defects due to process conditions or material properties. Therefore, it is necessary to analyze workpiece surface images to obtain the actual distribution of orange peel defects, in order to treat the defective areas or adjust the coating parameters.
[0023] Please see Figure 1 The diagram illustrates a flowchart of a defect region segmentation method based on powder coating images according to an embodiment of the present invention. The method includes the following steps: Step S001: Obtain a surface image of the workpiece after powder coating, and preprocess the surface image to obtain the relative reflective intensity value of each pixel in the powder coating area of the workpiece surface and the illumination component of each pixel.
[0024] It should be noted that this embodiment is based on the image of the workpiece after powder coating.
[0025] After the spraying process is completed, an artificial light source at a specific angle is first provided to the workpiece surface. Specifically, a ring light source is set around the workpiece and illuminates the workpiece surface at a low angle of about 10° to 30°. The setting of this low-angle ring light can produce obvious light and shadow contrast on the small undulation structure of the workpiece surface (such as the uneven texture formed by orange peel defects).
[0026] After the light source is set up, an image of the workpiece surface after powder coating is acquired using an industrial camera or other image acquisition equipment.
[0027] Step S001 further includes steps S0011-S0014: Step S0011: Perform grayscale processing on the surface image and remove background interference to obtain the spraying area on the workpiece surface.
[0028] It should be noted that after acquiring the surface image, it is converted into a grayscale image. Subsequently, background segmentation is performed on the grayscale image, that is, background interference is eliminated, and only the sprayed area on the workpiece surface is retained as the region of interest for subsequent processing. Background segmentation can be achieved by threshold segmentation, edge detection, or semantic segmentation methods based on deep learning. In this embodiment, a grayscale threshold-based segmentation method is preferred, which extracts the workpiece region by setting a grayscale threshold and generates a binary mask.
[0029] Step S0012: Apply Gaussian blur to the sprayed area on the workpiece surface to obtain the illumination component of each pixel in the sprayed area on the workpiece surface.
[0030] It should be noted that in the above steps, the surface image of the workpiece to be identified after powder coating was obtained under the condition of artificially providing low-angle ring light.
[0031] Orange peel defects that occur in powder coating appear as bright and dark ripples of varying sizes and uneven textures when exposed to light, resembling the surface of an orange peel, hence the name orange peel defect.
[0032] To fully highlight this defect, this embodiment employs low-angle ring light for artificial illumination during the image acquisition stage. This enhances the contrast between light and dark areas created by the minute undulations on the workpiece surface, ensuring that the texture fluctuations in the orange peel defect area are fully presented. Since the orange peel defect is not obvious in color or conventional texture features, but its reflective distribution has significant characteristics, the defect area can be segmented by analyzing the features of the reflective distribution in the image.
[0033] To extract the reflectance distribution, the illumination information must first be separated from the original image. According to Retinex theory, an image can be represented as the product of the illumination component and the reflection component. The illumination component reflects the intensity of ambient light illuminating the scene, typically changing gradually, corresponding to the low-frequency components of the image; the reflection component reflects the light reflection characteristics of the object's surface, containing rich edge and texture details, corresponding to the high-frequency components of the image.
[0034] Based on the above theory, in order to extract the reflective distribution of the surface undulation in the image, it is necessary to first estimate the illumination component (i.e. the low-frequency part) of the image, and then separate it from the original image. The remaining part is the reflective distribution of the coating surface.
[0035] Specifically, firstly, a Gaussian blur is applied to the sprayed area on the workpiece surface (the standard deviation of the Gaussian kernel is set to 50 pixels, and the window size is 101×101). Due to the large Gaussian kernel size, this operation effectively removes detailed textures, edge information, and localized reflections within the sprayed area, retaining only the slowly changing brightness gradient, thus obtaining the illumination component of each pixel, denoted as the overall illumination distribution background field. , Represents the coordinates of a pixel.
[0036] Gaussian blur is an image processing technique that smooths an image by replacing the value of each pixel with the weighted average of the values of its neighboring pixels. The weights are determined by a Gaussian distribution, with pixels closer to the center having a higher weight, thus causing the image to lose detail and become blurred. Gaussian blur is a well-known technique and will not be elaborated upon here.
[0037] Step S0013: Add the illumination component of each pixel to a non-zero constant to obtain a sum, and divide the gray value of each pixel by the sum to obtain the reflection component of each pixel.
[0038] Specifically, after obtaining the background field of the illumination distribution, for each pixel in the sprayed area on the workpiece surface, the original grayscale value before Gaussian blurring is... Divided by light component and nonzero constants The sum of these components yields the reflection component of that pixel. This reflection component is the reflected light distribution in the image. Here, we obtain the reflected light distribution with the background illumination field as a reference of 1. The closer this value is to 1, the closer the pixel is to the background illumination.
[0039] in, This is a preset non-zero minimum constant used to avoid division by zero and ensure numerical stability. Its specific value depends on the image grayscale range and is usually much smaller than the image grayscale mean. For example, when the image grayscale values are normalized to the [0, 1] interval... Desirable .
[0040] Step S0014: Subtract 1 from the reflection component of each pixel to obtain the relative reflectance value of each pixel.
[0041] Specifically, the reflection component is then centered by subtracting 1 from the reflection component of each pixel to obtain the relative reflectance value of that pixel. In the distribution of relative reflectivity, positions with values greater than 0 represent highlight areas where the pixel is brighter than the background light, while positions with values less than 0 represent shadow areas where the pixel is darker than the background light.
[0042] Step S002: Establish a local window corresponding to each pixel as the center, and determine the frequency of reflection mode change for each pixel based on the sign change of the relative reflective intensity value within the local window.
[0043] It should be noted that in the above steps, the reflective distribution of the image to be processed was obtained based on Retinex theory. Because the surface of the orange peel defect area has irregular bumps and depressions similar to orange peel, when illuminated, the raised parts form highlights, while the recessed parts form shadows. Therefore, its reflective distribution exhibits a non-uniform texture with alternating highlights and shadows. In contrast, the normal area has a smooth and even surface with uniform diffuse reflection characteristics, resulting in a relatively consistent reflective distribution or only a slow gradient without obvious alternation of light and dark. Based on this difference, the reflective characteristics of each region in the reflective distribution map are analyzed by dividing local windows, thereby achieving the segmentation of the orange peel defect area.
[0044] Step S002 further includes steps S0021-S0025: Step S0021: Using any pixel in the sprayed area on the workpiece surface as the center, construct a local window corresponding to each pixel.
[0045] Specifically, a local window of size 15×15 is created with each pixel as the center; for pixels located at the image boundary, the portion of the window that exceeds the boundary is filled by mirroring the internal pixels, with the image boundary as the axis of symmetry, thereby ensuring that boundary pixels can also obtain a complete local window without introducing non-real image information.
[0046] Step S0022: Traverse all pairs of adjacent pixels in the horizontal and vertical directions within the local window corresponding to each pixel, and filter out pairs of pixels with opposite relative reflectance values.
[0047] It should be noted that after obtaining the local window, the features within the window corresponding to each pixel are analyzed and used as the feature value of that pixel. Specifically, within each local window, the relative reflective intensity value obtained in the aforementioned steps is processed as follows: Since the reflective distribution of orange peel defects is significantly characterized by alternating highlights and shadows, and pixels with a relative reflective intensity value greater than 0 correspond to highlight areas, while pixels with a relative reflective intensity value less than 0 correspond to shadow areas, when the relative reflective intensity value between two adjacent pixels switches between positive and negative, it indicates that a switch between highlight and shadow has occurred at that location. Accordingly, all horizontally and vertically adjacent pixel pairs within the local window are traversed, and pixel pairs exhibiting the aforementioned sign switch are counted.
[0048] Step S0023: Calculate the midpoint coordinates of each pixel pair.
[0049] Specifically, for each selected pair of adjacent pixels with opposite relative reflectance values, the midpoint coordinates are calculated: for horizontally adjacent pixel pairs, the midpoint coordinates are the average row coordinates and the same column coordinates of the two pixels; for vertically adjacent pixel pairs, the midpoint coordinates are the same row coordinates and the average column coordinates of the two pixels. These midpoint coordinates characterize the position of the sign-switching event within the local window, serving as the basis for subsequent distance weight calculations.
[0050] Step S0024: Determine the distance weight of each pixel pair based on the midpoint coordinates of each pixel pair and the center point coordinates of the local window.
[0051] Specifically, it includes: Based on the midpoint coordinates of each pixel pair and the center point coordinates of the local window, obtain the squared Euclidean distance from the midpoint to the center point.
[0052] Substituting the squared Euclidean distance from the midpoint to the center point into the Gaussian function yields the distance weight for each pixel pair.
[0053] It should be noted that, considering the local window is square and the four corners are far from the center, the contribution of their pixels to local features should be relatively small. Therefore, when counting the following features within the local window, Gaussian weights are applied based on distance. ,in, This represents the coordinates of the midpoint of each pixel pair. This represents the coordinates of the center pixel of the local window. The scale parameter is taken as a fraction of the window border length. (At this point, the window edge weights are close to 0). This represents the distance weight for each pair of pixels. The square of the Euclidean distance from the midpoint to the center point.
[0054] Step S0025: Sum the distance weights of all pixel pairs to obtain the frequency of reflection mode changes for each pixel.
[0055] Specifically, This is recorded as the frequency of reflection pattern changes at each pixel.
[0056] Step S003: Based on the illumination component of each pixel, correct the frequency of reflection mode variation to obtain the orange peel defect feature value of each pixel.
[0057] Specifically, it includes: Based on the illumination component of each pixel in the sprayed area on the workpiece surface, the illumination component-correction coefficient mapping table is consulted to determine the illumination intensity correction coefficient corresponding to each pixel; the illumination component-correction coefficient mapping table is obtained by calibrating the known orange peel defect area under different illumination components.
[0058] Multiply the frequency of reflection pattern changes of each pixel by the illumination intensity correction coefficient corresponding to that pixel to obtain the orange peel defect feature value of each pixel.
[0059] It should be noted that even when using low-angle ring lighting during image acquisition, the actual light intensity may still fluctuate during the acquisition process. The frequency of reflection pattern changes, a crucial feature for identifying orange peel defects, is easily affected by light intensity: in areas with strong light, highlight clipping can obscure minute shadow details, leading to a lower measured frequency of reflection pattern changes and causing distortion. To ensure accurate identification, corrections must be made to account for the influence of light intensity.
[0060] For an orange peel defect, its true fluctuation degree (i.e., the characteristic value of the orange peel defect) can be represented by the product of the frequency of reflection pattern variation and the light intensity correction coefficient. Since the frequency of reflection pattern variation measured under different lighting conditions is different, the correction coefficient needs to be determined based on the actual light component. To this end, a mapping table of light component and correction coefficient is established in advance through calibration: Select the workpiece area with known orange peel defects, calculate the frequency of reflection pattern variation of the area under different light components, and assume that the true fluctuation degree of the defect is the standard value of 1, thereby obtaining the correction coefficient under the corresponding light component = 1 / frequency of reflection pattern variation, and record multiple sets of data to form a mapping table.
[0061] In actual testing, the illumination component of each pixel is obtained according to the aforementioned steps. The corresponding correction coefficient is obtained by querying the mapping table. Then change the frequency of the reflection mode of the pixel. and Multiplying them together yields the orange peel defect feature value for that pixel. This feature value reflects the degree of fluctuation in a local area; the larger the value, the higher the probability of orange peel defects at that location.
[0062] Step S004: Determine the average absolute deviation of each pixel's region based on the absolute value of the relative reflectance intensity within the local window corresponding to each pixel.
[0063] Specifically, it includes: The mean absolute value of the relative reflectance intensity within the local window corresponding to each pixel is used to determine the average absolute deviation of the region for each pixel.
[0064] It should be noted that since pinhole defects in powder coating, like particle defects, can cause changes in the reflective pattern, although the frequency is usually much weaker than that of orange peel defects, in a few dense cases, relying solely on the fluctuation of orange peel defects for identification may lead to misjudgment.
[0065] Pinhole defects appear as small, needle-like holes, while particle defects are small raised dots on the paint surface. Both types of defects are point-like and cause significant variations in reflective patterns. However, within the defect distribution area, most areas exhibit the same reflective properties as the background, with abrupt changes in reflective patterns only occurring at and near the defect point. In contrast, orange peel defects produce smooth reflective pattern changes, with the reflective pattern fluctuating throughout the entire defect area, and only a small portion matching the background. Therefore, to avoid misclassifying these two types of defects as orange peel defects in rare cases, a regional mean absolute deviation is introduced to further distinguish the initially located orange peel defect areas.
[0066] The regional mean absolute deviation (GMD) measures the average difference between the reflectance intensity of each pixel within a local window and the background illumination. For orange peel defects, the reflectance fluctuates throughout the defect area, resulting in a larger average difference from the background illumination. Pinhole and grain defects, however, only exhibit abrupt changes in reflectance patterns at and near the defect point, with most areas close to the background, leading to a significant dilution of the average distance and a value closer to 0. For each pixel, a local window is constructed centered on it. The mean absolute value of the relative reflectance intensity of all pixels within the window is defined as the regional mean absolute deviation (D) for that pixel. A larger D indicates a closer resemblance to an orange peel defect.
[0067] Step S005: Construct a two-dimensional histogram based on the orange peel defect feature values of all pixels and the mean absolute deviation of the region, and segment the orange peel defect region in the surface image based on the two-dimensional histogram.
[0068] Step S005 further includes steps S0051-S0058: Step S0051: Use the orange peel defect feature value and the average absolute deviation of the region for each pixel as the data pair for that pixel.
[0069] Specifically, each pixel has a The data pairs are used to describe the reflective distribution characteristics within a local area.
[0070] Step S0052: Construct a two-dimensional histogram based on the data pairs of all pixels in the sprayed area on the workpiece surface.
[0071] Specifically, count all pixels Construct a two-dimensional histogram from the data. .Will shaft and The axes are divided into discrete grid intervals according to preset intervals; all pixels in the spraying area on the workpiece surface are traversed, and based on each pixel... The data pairs are assigned to their corresponding grid intervals, and the number of pixels falling into each grid interval is counted to construct a two-dimensional histogram. .
[0072] Step S0053: Obtain the search area using a two-dimensional histogram.
[0073] Step S0053 further includes steps S00531-S00534: Step S00531: Perform Gaussian smoothing on the two-dimensional histogram to obtain the probability density surface.
[0074] It should be noted that convolving the two-dimensional Gaussian function with the histogram, and by setting an appropriate Gaussian kernel scaling parameter, weighted averages are applied to the statistical counts of each grid interval in the histogram. This eliminates statistical noise caused by data discretization and limited sample size, ultimately yielding a continuous and smooth probability density surface. This probability density surface typically exhibits a significant main peak, corresponding to a large area of normal background, characterized by low fluctuations. and low regional mean absolute deviation If the image to be detected contains orange peel defects, then in High value and A secondary peak will form in areas with higher values; if there are other types of defects such as scratches, a corresponding secondary peak may appear in other locations in the feature space.
[0075] Step S00532: Use the point with the highest probability density in the probability density surface as the background marker.
[0076] Step S00533: Obtain the corresponding location of historical orange peel defects based on historical orange peel defect image data.
[0077] It should be noted that: Several historical powder-coated workpiece images with known orange peel defects were collected. First, the actual orange peel defect areas were marked in the image space. Then, the fluctuation degree W and the mean absolute deviation D of each pixel within that area were calculated. All defect pixels were then... The coordinates are mapped to the feature space to obtain the set of distribution locations of historical orange peel defects in the feature space.
[0078] Step S00534: Expand the convex hull formed by the corresponding positions of historical orange peel defects outward by a preset ratio to obtain the search area.
[0079] It should be noted that the preset ratio is set according to the specific situation, and 10% is preferred here.
[0080] In the feature space, all historical orange peel defects are represented. The boundaries of the smallest convex polygon (i.e., convex hull) formed by the coordinate points are expanded outward by a preset proportion (e.g., 10%) to form a continuous region that contains the convex hull and has a slightly larger range. This region is determined as the search region for searching for orange peel defects in the current image feature space.
[0081] Step S0054: Determine whether there are local peaks within the search area: If so, use the largest local peak as the orange peel defect marker.
[0082] If there are no local peaks within the search area, it is determined that there are no orange peel defects in the surface image of the workpiece after powder coating.
[0083] It should be noted that: within the defined search region in the feature space, local peak detection is performed on the smoothed probability density surface. If at least one local peak exists within this region, it indicates that there is a pixel cluster in the current image that matches the historical orange peel defect feature distribution. In this case, the local peak with the largest amplitude is identified as the cluster. The location is identified as an orange peel defect marker for subsequent segmentation. If there are no local peaks in this area, it indicates that there is no obvious pixel aggregation in the search area within the feature space of the current image, thus determining that there are no orange peel defects in the surface image of the workpiece after powder coating.
[0084] Step S0055: Invert the two-dimensional histogram to obtain the inverted histogram.
[0085] It should be noted that: the constructed two-dimensional histogram To invert the histogram, take the opposite value of the statistical count in each grid interval. This operation converts the peak regions in the original histogram into valley regions.
[0086] Step S0056: Use the watershed algorithm to segment the inverted histogram to obtain the segmented regions.
[0087] It should be noted that the inverted histogram is calculated using the background markers and orange peel defect markers as seed points. Applying the watershed algorithm yields adaptive dividing lines between regions, where points within the orange peel defect marker region are statistical points corresponding to the orange peel defect region. This algorithm simulates the process of water injection starting from various sub-points, automatically constructing watersheds between different catchment basins as the water level rises, thus dividing the feature space into multiple independent regions. Each region corresponds to a set of similar... A set of pixels representing a feature.
[0088] Step S0057: Map the points within the orange peel defect marking area back to the surface image of the workpiece after powder coating to obtain the initial defect area.
[0089] It should be noted that: in the feature space, the area covered by the orange peel defect marker includes all... The coordinate points are extracted, and based on the position index recorded when constructing the two-dimensional histogram for each pixel, these feature points are mapped back to the original image space one by one; the set of all mapped pixels is the initial orange peel defect region.
[0090] Step S0058: Perform morphological processing on the initial defect area to obtain the orange peel defect area.
[0091] It should be noted that the initial orange peel defect region obtained after mapping back to image space undergoes morphological processing, specifically including first removing isolated noise and burrs through opening operations, then filling internal holes and connecting adjacent broken areas through closing operations, and finally obtaining a continuous and complete orange peel defect region.
[0092] Through the above process, the orange peel defect area was segmented based on the distribution characteristics of reflectivity in the powder coating image. After obtaining the orange peel defect area, the spraying effect was evaluated and graded according to the distribution of the area within the spraying range on the workpiece surface; corresponding treatment measures were taken for the defect area, including sanding and polishing for mild orange peel and deplasticizing and respraying for severe orange peel; if the treatment cost exceeded the value of the workpiece itself, it was scrapped or downgraded.
[0093] Please see Figure 2 The diagram illustrates a block diagram of a defect region segmentation system based on powder coating images according to an embodiment of the present invention. The system includes the following modules: The acquisition module 100 is used to acquire the surface image of the workpiece after powder spraying, and to preprocess the surface image to obtain the relative reflective intensity value of each pixel in the sprayed area of the workpiece surface and the illumination component of each pixel. The analysis module 200 is used to establish a local window corresponding to each pixel with each pixel as the center, and to determine the frequency of reflection mode change of each pixel based on the sign change of the relative reflection intensity value within the local window. Based on the illumination component of each pixel, the frequency of reflection mode variation is corrected to obtain the orange peel defect feature value of each pixel. The average absolute deviation of each pixel's region is determined based on the absolute value of the relative reflectance intensity within the local window corresponding to each pixel. The segmentation module 300 is used to construct a two-dimensional histogram based on the orange peel defect feature values of all pixels and the mean absolute deviation of the region, and to segment the orange peel defect region in the surface image based on the two-dimensional histogram.
[0094] In summary, in this embodiment of the invention, by analyzing the reflective distribution characteristics in powder coating images and utilizing the differences in reflective distribution patterns between orange peel defect areas and defect-free areas, the frequency of reflective pattern variations is statistically analyzed within a local window, and deviations caused by different background illumination intensities are corrected. Simultaneously, the average deviation between the reflective intensity at each point and the background illumination is introduced as an auxiliary feature to suppress possible misidentification, ultimately achieving accurate segmentation of orange peel defect areas in powder coating images. Compared to existing methods, this invention uses illumination distribution features, often considered noise interference, as the identification entry point, effectively avoiding the problem of orange peel defects being difficult to detect in grayscale images due to unclear texture and gradient features. Furthermore, by introducing additional deviation features for comprehensive analysis, the accuracy and robustness of the identification are further improved.
[0095] 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 defect region segmentation method based on powder coating images, characterized in that, The method includes the following steps: The surface image of the workpiece after powder coating is acquired and preprocessed to obtain the relative reflective intensity value of each pixel in the powder coating area of the workpiece surface and the illumination component of each pixel. A local window corresponding to each pixel is established with each pixel as the center. The frequency of reflection mode change of each pixel is determined based on the sign change of the relative reflectance intensity value within the local window. Based on the illumination component of each pixel, the frequency of reflection mode variation is corrected to obtain the orange peel defect feature value of each pixel. The average absolute deviation of each pixel's region is determined based on the absolute value of the relative reflectance intensity within the local window corresponding to each pixel. Based on the orange peel defect feature values of all pixels and the mean absolute deviation of the region, a two-dimensional histogram is constructed, and the orange peel defect region in the surface image is segmented based on the two-dimensional histogram.
2. The defect region segmentation method based on powder coating images according to claim 1, characterized in that, The specific steps involved in preprocessing the surface image to obtain the relative reflectance intensity value and illumination component of each pixel in the sprayed area of the workpiece surface are as follows: The surface image is converted to grayscale and background interference is removed to obtain the sprayed area on the workpiece surface; Gaussian blur is applied to the sprayed area on the workpiece surface to obtain the illumination component of each pixel in the sprayed area on the workpiece surface. The illumination component of each pixel is added to a non-zero constant to obtain a sum, and the gray value of each pixel is divided by this sum to obtain the reflection component of each pixel; Subtract 1 from the reflection component of each pixel to obtain the relative reflectance value of each pixel.
3. The defect region segmentation method based on powder coating images according to claim 1, characterized in that, The specific steps involved in establishing a local window centered on each pixel and determining the frequency of reflection mode changes for each pixel based on the sign changes of the relative reflectance intensity values within the local window are as follows: Construct a local window corresponding to each pixel, centered on any pixel in the sprayed area on the workpiece surface; Iterate through all pairs of adjacent pixels in the horizontal and vertical directions within the local window corresponding to each pixel, and filter out pairs of pixels with opposite relative reflectance values. Calculate the midpoint coordinates of each pair of pixels; The distance weight of each pixel pair is determined based on the midpoint coordinates of each pixel pair and the center point coordinates of the local window. The distance weights of all pixel pairs are summed to obtain the frequency of reflection mode changes for each pixel.
4. The defect region segmentation method based on powder coating images according to claim 3, characterized in that, The specific steps for determining the distance weight of each pixel pair based on the midpoint coordinates of each pixel pair and the center point coordinates of the local window are as follows: Based on the midpoint coordinates of each pixel pair and the center point coordinates of the local window, obtain the squared Euclidean distance from the midpoint to the center point. Substituting the squared Euclidean distance from the midpoint to the center point into the Gaussian function yields the distance weight for each pixel pair.
5. The defect region segmentation method based on powder coating images according to claim 1, characterized in that, The specific steps involved in correcting the frequency of reflection pattern changes based on the illumination component of each pixel to obtain the orange peel defect feature value for each pixel are as follows: Based on the illumination component of each pixel in the sprayed area on the workpiece surface, the illumination component-correction coefficient mapping table is consulted to determine the illumination intensity correction coefficient corresponding to each pixel; the illumination component-correction coefficient mapping table is obtained by calibrating the known orange peel defect area under different illumination components. Multiply the frequency of reflection pattern changes of each pixel by the illumination intensity correction coefficient corresponding to that pixel to obtain the orange peel defect feature value of each pixel.
6. The defect region segmentation method based on powder coating images according to claim 1, characterized in that, The specific steps for determining the average absolute deviation of each pixel's region based on the absolute value of the relative reflectance intensity within the local window corresponding to each pixel are as follows: The mean absolute value of the relative reflectance intensity within the local window corresponding to each pixel is used to determine the average absolute deviation of the region for each pixel.
7. The defect region segmentation method based on powder coating images according to claim 1, characterized in that, The specific steps involved in constructing a two-dimensional histogram based on the orange peel defect feature values of all pixels and the mean absolute deviation of the region, and then segmenting the orange peel defect region in the surface image based on the two-dimensional histogram, are as follows: The orange peel defect feature value and the mean absolute deviation of the region for each pixel are used as the data pair for that pixel; A two-dimensional histogram is constructed based on the data pairs of all pixels in the sprayed area on the workpiece surface. Use a two-dimensional histogram to obtain the search region; Determine if there are local peaks within the search area: if so, use the largest local peak as the orange peel defect marker; Invert the two-dimensional histogram to obtain the inverted histogram; The watershed algorithm is used to segment the inverted and negated histogram to obtain the segmented regions; Map the points within the orange peel defect marking area back to the surface image of the workpiece after powder coating to obtain the initial defect area; Morphological processing was performed on the initial defect area to obtain the orange peel defect area.
8. The defect region segmentation method based on powder coating images according to claim 7, characterized in that, The specific steps involved in obtaining the search region using a two-dimensional histogram are as follows: Gaussian smoothing is applied to the two-dimensional histogram to obtain the probability density surface; Use the point with the highest probability density in the probability density surface as the background marker; Based on historical orange peel defect image data, obtain the corresponding locations of historical orange peel defects; The search area is obtained by expanding the convex hull formed by the corresponding locations of historical orange peel defects outward by a preset ratio.
9. The defect region segmentation method based on powder coating images according to claim 7, characterized in that, The method further includes: If there are no local peaks within the search area, it is determined that there are no orange peel defects in the surface image of the workpiece after powder coating.
10. A defect region segmentation system based on powder coating images, characterized in that, The system includes the following modules: The acquisition module is used to acquire the surface image of the workpiece after powder coating, and to preprocess the surface image to obtain the relative reflective intensity value of each pixel in the sprayed area of the workpiece surface and the illumination component of each pixel. The analysis module is used to create a local window for each pixel, centered on the pixel, and determine the frequency of reflection mode changes for each pixel based on the sign change of the relative reflectance intensity value within the local window. Based on the illumination component of each pixel, the frequency of reflection mode variation is corrected to obtain the orange peel defect feature value of each pixel. The average absolute deviation of each pixel's region is determined based on the absolute value of the relative reflectance intensity within the local window corresponding to each pixel. The segmentation module is used to construct a two-dimensional histogram based on the orange peel defect feature values of all pixels and the mean absolute deviation of the region, and to segment the orange peel defect region in the surface image based on the two-dimensional histogram.