A color printing color difference defect detection method based on machine vision

CN121904012BActive Publication Date: 2026-09-29SHANDONG LUJIAN PRINTING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610034318.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-12
Publication Date
2026-09-29
Estimated Expiration
2046-01-12

AI Technical Summary

Technical Problem

人工检测依赖检测人员的视觉判断,主观性强、效率低下,且易受疲劳、环境光照等因素影响,难以实现统一标准的批量检测;传统机器视觉检测方法多基 RGB色彩空间直接提取特征,缺乏针对性的多尺度处理机制,导致色彩特征提取不准确

Benefits of technology

[0033]与现有技术相比,本发明的优点和积极效果在于,其通过分区域自适应滤波、亮度补偿与饱和度增强的预处理提升图像质量,改进多尺度分解适配印刷品墨点纹理特性,精准保留各尺度色彩与纹理信息;基于Lab空间提取特征,结合纹理筛选与双维度距离聚类优化区域分割,再通过多特征融合与加权评分实现量化判定。既克服了人工检测主观低效、传统机器视觉特征提取不准、分割效果差的问题,又降低了漏检、误检率,能精准识别细微色差缺陷,适配复杂印刷品检测需求,兼顾检测精度与自动化效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121904012B_ABST
    Figure CN121904012B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of defect detection, and particularly relates to a color printing color difference defect detection method based on machine vision. The RGB image of the color printing is collected, and after pretreatment such as sub-region adaptive filtering and brightness compensation, three scale images are obtained through improved pyramid decomposition; each scale image is converted to Lab space, and color and brightness features are extracted; a similarity matrix is constructed based on the Euclidean distance of a and b channels to cluster coarse clusters, and double-dimensional distance function fine clustering is used for clusters with insufficient color uniformity; the segmentation quality is calculated by fusing the joint discrete degree and color difference gradient change rate features, and then the comprehensive score is obtained by weighting the region weight and multi-scale consistency, and if the comprehensive score is lower than the threshold, it is determined that there is a color difference defect. The present application overcomes the problems of subjective inefficiency of artificial detection and high false detection rate of traditional machine vision, accurately retains each scale feature, can identify subtle color difference, and balances detection accuracy and automation efficiency, and is suitable for complex printing detection requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of defect detection technology, and in particular relates to a method for detecting color difference defects in color printed materials based on machine vision. Background Technology

[0002] Color printed materials are widely used in packaging, advertising, and publication printing. Color difference defects (such as color cast, light color, and color spots) directly affect the visual effect of products and brand image. Therefore, color difference detection is a core link in the quality control of printed materials. With the printing industry developing towards higher speeds and greater precision, higher demands are placed on the accuracy, efficiency, and automation of color difference defect detection. Traditional detection methods are no longer sufficient to meet actual production needs. Existing color difference detection methods for color printed materials are mainly divided into two categories: manual inspection and machine vision inspection. Manual inspection relies on the visual judgment of inspectors, which is highly subjective, inefficient, and easily affected by factors such as fatigue and ambient lighting, making it difficult to achieve standardized batch inspection. Traditional machine vision inspection methods directly extract features from the multi-based RGB color space, lacking a targeted multi-scale processing mechanism, resulting in inaccurate color feature extraction. At the same time, traditional clustering and segmentation methods rely only on a single color distance index, without incorporating spatial location information. This leads to poor segmentation of areas with poor color uniformity, resulting in high rates of missed and false detections, and an inability to accurately identify subtle color difference defects, making it difficult to adapt to the quality inspection needs of complex printed materials. Summary of the Invention

[0003] To address the technical problems existing in the background art described above, this invention proposes a machine vision-based method for detecting color difference defects in color printed materials.

[0004] To achieve the above objectives, the technical solution adopted by the present invention includes the following steps:

[0005] S1. Acquire RGB images of color printed materials, perform image preprocessing and multi-scale decomposition sequentially to obtain images at three different scales; convert each scale RGB image to the Lab color space to obtain Lab space images at the corresponding scales, and extract the color distribution features of the a and b channels and the brightness distribution features of the L channel in the Lab space at each scale; the color distribution features include the mean, variance, kurtosis, and mutual information of the a and b channels; the brightness distribution features include the standard deviation of the gradient magnitude and the proportion of local brightness extrema of the L channel;

[0006] S2. For Lab space images at each scale, construct a similarity matrix based on the color Euclidean distance of the a-channel and b-channel, select the peak point set in the color distribution features as the initial cluster center, cluster the pixels to obtain coarse clusters, and calculate the color uniformity index of each coarse cluster.

[0007] S3. For coarse clusters with color uniformity index below the uniformity threshold, construct a two-dimensional distance function by combining the spatial distance of pixels and the Lab color distance, redetermine the cluster center and iterate the clustering to obtain fine clusters.

[0008] S4. Calculate the segmentation quality of the clusters at each scale. The comprehensive segmentation quality is a multi-scale feature fusion value, that is, the weighted sum of the joint discreteness feature and the color difference gradient change rate feature. The fusion weight of the two feature values ​​is determined by the entropy weight method. The clustering results of all scales are fused to obtain the corresponding comprehensive segmentation quality.

[0009] S5. Calculate the color difference quality comprehensive score of the color printed matter. The comprehensive score is obtained by weighting the regional weight score and the multi-scale consistency score. When the comprehensive score is lower than the quality score threshold, it is determined that there is a color difference defect.

[0010] Preferably, the specific implementation of the image preprocessing in step S1 is as follows:

[0011] S111. Perform noise suppression by calculating the mean and standard deviation of pixel grayscale values ​​for each channel of the acquired RGB image, and setting a three-level noise judgment threshold: , , ,in There are three judgment thresholds, The mean and standard deviation of grayscale values ​​are used to divide the pixels in each channel into low grayscale, medium grayscale, and high grayscale regions. For the low and high grayscale regions, a 3×3 window weighted median filter with pixel grayscale difference as the weight is used, and for the medium grayscale region, an adaptive Gaussian filter with variance dynamically adjusted based on the standard deviation of the window pixels is used.

[0012] S112. Divide the noise-suppressed RGB image into multiple non-overlapping sub-regions, calculate the preliminary mean brightness of each sub-region, and select the median of the mean brightness as the standard brightness benchmark. Calculate the brightness deviation value of each sub-region. A gradient compensation function is constructed based on the normalized distance d between the pixel and the region center. The compensated brightness is then mapped inversely to the RGB space;

[0013] S113. Calculate the color saturation of each pixel in the RGB image: Regarding saturation Pixels smaller than the set saturation threshold will have their saturation enhanced. ,in, The image is preprocessed by keeping the brightness constant and mapping it back to the RGB space to obtain the set saturation threshold.

[0014] Preferably, the specific implementation of multi-scale decomposition in step S1 to obtain images at three different scales is as follows:

[0015] S121, Using the preprocessed image as input as... Constructing an improved Gaussian pyramid As the basis for the Laplace pyramid decomposition, and considering the anisotropic characteristics of the ink dot texture direction in printed matter, the first... Layer Gaussian image , =0,1, construct a 5×5 adaptive weighted Gaussian kernel, kernel weight coefficients. ,in, The core center weight benchmark value, For the first The variance of the layer, by The texture direction entropy was calculated as follows: , This represents the texture direction entropy, with a value range of [0,1]. This is the texture direction weighting factor. These are pixel row and column coordinates; this adaptive Gaussian kernel is used. Perform filtering to obtain the filtered image. ;

[0016] S122. Filter the image. Extracting edge gradient maps Calculate the average gradient of each 2×2 pixel block. Set the gradient threshold for printed edges. ,right The pixel blocks are downsampled using gradient weighting, with weighting coefficients... The downsampling value is the weighted average of 2×2 pixels; for The pixel blocks are downsampled using mean downsampling, and the next layer of Gaussian image is obtained through non-uniform downsampling. ;

[0017] S123. Construct a color-compensated Laplace pyramid based on the improved Gaussian pyramid, and apply this to the... +1 layer Gaussian image A 2x upsampling operation is performed, and bilinear interpolation is used to obtain the initial upsampled image. ,calculate and The RGB channel pixel values ​​are normalized to the [0,1] interval, and the RGB space color difference of the corresponding pixel is calculated. ,in, This represents the pixel difference between corresponding channels of the two images after normalization.

[0018] S124. Constructing Compensation Factors ,in, The color difference threshold for printed materials in the RGB color space is used to apply the compensation factor. The RGB channels, each channel pixel value multiplied by Obtain compensated upsampled image ;

[0019] S125, Calculate the filtered image Compensated upsampling image residual image Then the three images at different scales are , , .

[0020] Preferably, before clustering the pixels to obtain coarse clusters in step S2, it is necessary to calculate the texture response value of each pixel in the Lab space image, filter out non-texture pixels using a texture response threshold, and perform subsequent clustering analysis only on non-texture pixels; the texture response value satisfies: ,in, Let i be the texture response value of the i-th pixel. These are the a-channel, b-channel, and L-channel values ​​of the i-th pixel, respectively. These are the corresponding channel values ​​of the j-th pixel within the eight neighborhoods of the i-th pixel.

[0021] Preferably, the specific implementation of constructing the similarity matrix in step S2 is as follows: for each pixel point Extract the a-channel and b-channel values ​​of the pixel in the Lab space image at the current scale. For any two pixels, calculate the Euclidean distance between their a-channel and b-channel values. Characterize the degree of color difference, and then convert the degree of difference into similarity. ,in Find the maximum Euclidean distance between all pixel pairs at the current scale, and then construct a similarity matrix using the pixel number as the row and column index.

[0022] Preferably, the color uniformity index in step S2 satisfies: ,in, Let q be the color uniformity index of the coarse cluster. These are the standard deviations of channels a and b of the coarse cluster, respectively. These are the mean values ​​of channel a and channel b of the coarse cluster, respectively. To avoid the minimum value where the denominator is zero.

[0023] Preferably, step S3, for coarse clusters with color uniformity indices below the uniformity threshold, constructs a two-dimensional distance function by combining the spatial distance of pixels and the Lab color distance, redetermines the cluster centers, and iterates the clustering process to obtain fine clusters. The specific implementation of this method is as follows:

[0024] S31. Extract the feature information of all pixels within the coarse clusters where the color uniformity index is below the uniformity threshold, including the Lab color value of each pixel. and spatial coordinates ;

[0025] S32. For any two pixels within the coarse cluster, construct a two-dimensional distance function that fuses Lab color distance and spatial location distance, wherein the two-dimensional distance function satisfies: ,in, Let be the two-dimensional distance between pixel i and pixel j. This is the distance weighting coefficient. This represents the diagonal length of the Lab space image at the current scale.

[0026] S33. Calculate the mean Lab color and mean spatial coordinate of all pixels in the coarse cluster, and select the three pixels with the smallest two-dimensional distance from the mean as the initial cluster centers of the fine cluster.

[0027] S34. During iterative clustering, first traverse all pixels within the coarse clusters to be refined, calculate the two-dimensional distance between each pixel and all initial cluster centers, and assign it to the refined cluster candidate cluster corresponding to the cluster center with the smallest distance; then, for each candidate cluster, update the cluster center by using the average Lab color and the average spatial coordinate of the pixels within the cluster; subsequently, if the maximum change in the two-dimensional distance between the cluster centers in two consecutive iterations is less than a set threshold, the iteration is terminated; after the iteration terminates, each of the current refined cluster candidate clusters is the refined cluster obtained by subdividing the coarse cluster.

[0028] Preferably, the calculation method for the joint discreteness feature and the color difference gradient change rate feature in step S4 is as follows: Joint discreteness feature ,in, Let m be the joint discreteness feature of the m-th cluster. This represents the number of color edge pixels within the cluster. This represents the total number of pixels within the cluster. The standard deviation of the spatial coordinates of pixels within this cluster. These represent the standard deviations of the L, a, and b channels of this cluster; the color difference gradient change rate characteristic satisfies: ,in, The color difference gradient change rate feature of the m-th cluster is... The color contrast of this cluster. Let be the Lab color gradient magnitude of the i-th pixel within this cluster. This represents the average color gradient magnitude of all pixels within the cluster.

[0029] Preferably, the comprehensive score in step S5, which is obtained by weighting the regional weight score and the multi-scale consistency score, is specifically implemented as follows:

[0030] S51. Calculate the regional weight score: ,in, Score the region by weight. Let m be the region weight of the m-th cluster. The overall segmentation quality of the m-th cluster is... , respectively, are the mean values ​​of the L channel, a channel and b channel of the m-th cluster, and M is the total number of clusters;

[0031] S52. Calculate the multi-scale consistency score: , where K is the decomposition scale number, The segmentation quality of the m-th cluster at the k-th scale;

[0032] S53. The regional weight score and the multi-scale consistency score are weighted and summed to obtain the comprehensive score.

[0033] Compared with existing technologies, the advantages and positive effects of this invention are as follows: it improves image quality through preprocessing with regional adaptive filtering, brightness compensation, and saturation enhancement; it improves multi-scale decomposition to adapt to the ink dot texture characteristics of printed materials, accurately preserving color and texture information at each scale; it extracts features based on Lab space, combines texture screening and two-dimensional distance clustering to optimize region segmentation, and then achieves quantitative judgment through multi-feature fusion and weighted scoring. This overcomes the problems of subjective inefficiency in manual inspection, inaccurate feature extraction in traditional machine vision, and poor segmentation results, while reducing the rates of missed and false detections. It can accurately identify subtle color difference defects, adapt to the needs of complex printed material inspection, and balance inspection accuracy with automation efficiency. Attached Figure Description

[0034] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0035] Figure 1 This is a flowchart illustrating a machine vision-based method for detecting color difference defects in printed materials. Detailed Implementation

[0036] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described below in conjunction with the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.

[0037] Numerous specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways than those described herein, and therefore the invention is not limited to the specific embodiments disclosed in the following specification.

[0038] In traditional methods of color difference detection in printed materials, manual inspection requires personnel to visually inspect each item, which is not only inefficient but also susceptible to factors such as ambient lighting, personnel fatigue, and inconsistent subjective judgment standards, resulting in low defect identification accuracy and failing to meet the high-efficiency quality inspection requirements of mass production. Therefore, this invention proposes a machine vision-based method for detecting color difference defects in color printed materials. The specific implementation steps are as follows: Figure 1 As shown.

[0039] First, RGB images of color printed materials were acquired. To address the shortcomings of traditional filtering methods in handling noise in different grayscale regions of printed images, which leads to noise residue or loss of image details, as well as issues such as brightness deviations caused by uneven lighting and unclear color features in low-saturation areas, affecting the accuracy of subsequent color feature extraction, image preprocessing and multi-scale decomposition were performed sequentially to obtain images at three different scales. Each scale's RGB image was then converted to the Lab color space to obtain the corresponding Lab space image. Specifically, each scale's RGB image is a three-channel pixel matrix, maintaining its independent resolution and spatial topology. Before conversion, the RGB three-channel pixel values ​​of each scale image were simultaneously normalized, standardizing the integer pixel values ​​of 0-255 to the floating-point range of 0-1, eliminating numerical magnitude deviations and ensuring conversion accuracy. Since RGB and Lab are different color representation systems, there is no direct linear conversion relationship between them. Therefore, the standard XYZ color space is used as the core transition bridge. The normalized RGB pixel values ​​of each scale are first substituted into the sRGB standard conversion formula to complete the mapping to the XYZ space, generating XYZ images of the same scale. Subsequently, using D65 as the standard white light reference point, the pixel values ​​of the XYZ images at each scale were normalized and calibrated. Then, the mapping was completed by substituting the values ​​into the internationally accepted Lab conversion formula, ultimately obtaining the Lab space image corresponding to each scale. The L channel represents brightness, the a channel represents red-green difference, and the b channel represents yellow-blue difference, perfectly meeting the requirements for extracting color difference features in printed materials. The color distribution features of the a and b channels and the brightness distribution features of the L channel in the Lab space at each scale were extracted. The color distribution features include the mean, variance, kurtosis, and mutual information of the a and b channels; the brightness distribution features include the standard deviation of the gradient magnitude and the proportion of local brightness extrema in the L channel.

[0040] The image preprocessing is implemented by noise suppression, calculating the mean and standard deviation of pixel grayscale values ​​for each channel of the acquired RGB image, and setting a three-level noise judgment threshold: , , ,in There are three judgment thresholds, The grayscale mean and standard deviation are used to divide the pixels of each channel into low grayscale, medium grayscale, and high grayscale regions. A 3×3 window weighted median filter, with pixel grayscale differences as weights, is applied to the low and high grayscale regions. An adaptive Gaussian filter, dynamically adjusting the variance based on the standard deviation of the window pixels, is applied to the medium grayscale region. The noise-suppressed RGB image is then divided into multiple non-overlapping sub-regions, and the preliminary mean brightness of each sub-region is calculated. The median of the mean brightness is selected as the standard brightness benchmark. Calculate the brightness deviation value of each sub-region. A gradient compensation function is constructed based on the normalized distance d between the pixel and the region center. The compensated brightness is then reverse-mapped back to the RGB space. The color saturation of each pixel in the RGB image is calculated: Regarding saturation Pixels smaller than the set saturation threshold will have their saturation enhanced. ,in, To obtain the preprocessed image, a pre-processed image is obtained by maintaining the brightness while keeping the saturation threshold constant and mapping it back to the RGB space. After image preprocessing, the image is decomposed into multiple scales. Considering that traditional multi-scale decomposition does not take into account the anisotropy of ink dot texture in printed materials, leading to color distortion, loss of texture information, and discontinuous feature transfer between scales during scale transformation, this invention employs an improved Gaussian pyramid and a color-compensated Laplacian pyramid multi-scale decomposition scheme to achieve accurate preservation and coherent transfer of color and texture information at each scale. Specifically, the preprocessed image is used as input... Constructing an improved Gaussian pyramid As the basis for the Laplace pyramid decomposition, and considering the anisotropic characteristics of the ink dot texture direction in printed matter, the first... Layer Gaussian image , =0,1, construct a 5×5 adaptive weighted Gaussian kernel, kernel weight coefficients. ,in, The core center weight benchmark value, For the first The variance of the layer, by The texture direction entropy was calculated as follows: , This represents the texture direction entropy, with a value range of [0,1]. This is the texture direction weighting factor. These are pixel row and column coordinates; this adaptive Gaussian kernel is used. Perform filtering to obtain the filtered image. For the filtered image Extracting edge gradient maps Calculate the average gradient of each 2×2 pixel block. Set the gradient threshold for printed edges. ,right The pixel blocks are downsampled using gradient weighting, with weighting coefficients... The downsampling value is the weighted average of 2×2 pixels; for The pixel blocks are downsampled using mean downsampling, and the next layer of Gaussian image is obtained through non-uniform downsampling. A color-compensated Laplace pyramid was constructed based on the improved Gaussian pyramid, and the color compensation type was applied to the first... +1 layer Gaussian image A 2x upsampling operation is performed, and bilinear interpolation is used to obtain the initial upsampled image. ,calculate and The RGB channel pixel values ​​are normalized to the [0,1] interval, and the RGB space color difference of the corresponding pixel is calculated. ,in, This represents the pixel difference between corresponding channels of the two images after normalization. A compensation factor is then constructed. ,in, The color difference threshold for printed materials in the RGB color space is used to apply the compensation factor. The RGB channels, each channel pixel value multiplied by Obtain compensated upsampled image Calculate the filtered image. Compensated upsampling image residual image Then the three images at different scales are , , The multi-scale decomposition of this invention adapts to the anisotropy of ink dot texture in printed materials, achieving accurate preservation of edge regions during downsampling and color deviation compensation during upsampling. This ensures that images at each scale retain their own color and texture features while achieving coherent feature transfer between scales. It provides comprehensive and accurate image data support for subsequent multi-scale feature extraction and cluster analysis, effectively solving the problems of color distortion, texture loss, and feature fragmentation between scales that exist in traditional multi-scale decomposition.

[0041] Then, for each scale of the Lab space image, a similarity matrix is ​​constructed based on the color Euclidean distance of the a-channel and b-channel. Peak points in the color distribution features are selected as initial cluster centers, and pixels are clustered to obtain coarse clusters. The color uniformity index of each coarse cluster is calculated. Before processing, the texture response value of each pixel in the Lab space image also needs to be calculated. Non-texture pixels are filtered out using a texture response threshold, and only non-texture pixels are subjected to subsequent cluster analysis. The texture response value satisfies: ,in, Let i be the texture response value of the i-th pixel. These are the a-channel, b-channel, and L-channel values ​​of the i-th pixel, respectively. These are the corresponding channel values ​​of the j-th pixel within the eight neighborhoods of the i-th pixel. This step accurately distinguishes between normal texture pixels and non-texture pixels in a color printed image, thereby eliminating the interference of texture on color difference defect detection and optimizing the effectiveness of cluster analysis. Clustering only non-texture pixels reduces unnecessary computation, improves detection efficiency, and allows the clustering results to more accurately reflect the true differences in color distribution, laying a reliable foundation for subsequent color difference defect determination.

[0042] The specific implementation of constructing the similarity matrix is ​​as follows: for each pixel point Extract the a-channel and b-channel values ​​of the pixel in the Lab space image at the current scale. For any two pixels, calculate the Euclidean distance between their a-channel and b-channel values. Characterize the degree of color difference, and then convert the degree of difference into similarity. ,in Find the maximum Euclidean distance between all pixel pairs at the current scale, and then construct a similarity matrix using the pixel number as the row and column index.

[0043] Then, the peak point set in the color distribution features is selected as the initial cluster centers, and the pixels are clustered to obtain coarse clusters. The color uniformity index of each coarse cluster is calculated. The color uniformity index satisfies the following conditions: ,in, Let q be the color uniformity index of the coarse cluster. These are the standard deviations of channels a and b of the coarse cluster, respectively. These are the mean values ​​of channel a and channel b of the coarse cluster, respectively. To avoid the minimum value where the denominator is zero.

[0044] For coarse clusters with color uniformity indices below the uniformity threshold, a two-dimensional distance function is constructed by combining the spatial distance of pixels with their Lab color distance. This function is used to redetermine cluster centers and iteratively cluster, resulting in finer clusters. Specifically, the color uniformity index of the coarse clusters is first assessed based on the uniformity threshold. Then, feature information of all pixels within the coarse clusters with color uniformity indices below the uniformity threshold is extracted, including the Lab color value of each pixel. and spatial coordinates For any two pixels within this coarse cluster, a two-dimensional distance function is constructed that fuses Lab color distance and spatial location distance. This two-dimensional distance function satisfies the following: ,in, Let be the two-dimensional distance between pixel i and pixel j. This is the distance weighting coefficient. Let be the diagonal length of the Lab spatial image at the current scale. Calculate the mean Lab color and mean spatial coordinate of all pixels within the coarse cluster. Using the mean as a benchmark, select the three pixels with the smallest two-dimensional distance to the benchmark as the initial cluster centers for the fine cluster.

[0045] During iterative clustering, all pixels within the coarse clusters to be finely clustered are traversed. For each pixel, the previously constructed two-dimensional distance function (which combines Lab color Euclidean distance and normalized spatial location distance) is called to calculate its distance value from all initial cluster centers. Based on the minimum distance matching rule, the pixel is assigned to the fine cluster candidate cluster corresponding to the distance.

[0046] Next, the cluster center update stage begins. For each initially formed fine cluster candidate cluster, the Lab color value and spatial coordinates of all pixels within the cluster are statistically analyzed. The mean values ​​of these two features are calculated separately and combined to form a Lab color-spatial coordinate joint cluster center, which replaces the original cluster center. The purpose of this step is to ensure that the cluster center closely matches the actual feature distribution of the current candidate cluster, avoiding the impact of initial center deviations on clustering accuracy. Subsequently, an iteration termination judgment is executed. The change in the two-dimensional distance between all cluster centers in two consecutive iterations (taking the maximum change of each center) is calculated and compared with a preset threshold. If the maximum value is less than the threshold, it indicates that the positions of all cluster centers have stabilized and the clustering results no longer fluctuate significantly, at which point the iteration terminates. If the condition is not met, the process returns to the pixel allocation stage, repeating the process based on the new cluster center. After the iteration terminates, the current fine cluster candidate clusters are the final fine clusters obtained from the subdivision of the coarse cluster. These clusters can be used for subsequent precise location and evaluation of color difference defects.

[0047] Next, considering that traditional segmentation quality assessment relies on only a single feature, leading to biased evaluation results that fail to fully reflect the effectiveness of cluster segmentation, the following steps calculate the segmentation quality of clusters at each scale. The comprehensive segmentation quality is a multi-scale feature fusion value, specifically a weighted sum of the joint dispersion feature and the color difference gradient change rate feature. The fusion weight of the two feature values ​​is determined using the entropy weight method. The corresponding comprehensive segmentation quality is obtained by fusing the clustering results from all scales. The joint dispersion feature is... ,in, Let m be the joint discreteness feature of the m-th cluster. This refers to the number of color edge pixels within the cluster. The color edge pixels are determined by calculating the color gradient magnitude of each pixel and identifying pixels with a color gradient magnitude greater than a gradient threshold as color edge pixels. This represents the total number of pixels within the cluster. The standard deviation of the spatial coordinates of pixels within this cluster. These represent the standard deviations of the L, a, and b channels of this cluster. The color difference gradient change rate characteristic satisfies: ,in, The color difference gradient change rate feature of the m-th cluster is... The color contrast of this cluster is the product of the a-channel range and the b-channel range. Let be the Lab color gradient magnitude of the i-th pixel within this cluster. This represents the average color gradient magnitude of all pixels within the cluster.

[0048] Within a single scale, the single-scale segmentation quality is calculated individually for each cluster. Taking a certain scale as an example, for the m-th cluster at that scale, its joint discreteness feature and color difference gradient rate of change feature are first calculated. Then, based on these two types of feature data of all clusters at the current scale, the global weights corresponding to these two features are calculated using the entropy weight method (the higher the feature discrimination, the greater the weight). The two types of feature values ​​of this cluster are then multiplied by their corresponding weights, and the sum is obtained to get the single-scale segmentation quality of the m-th cluster at that scale. All clusters at the same scale need to be calculated individually in this way, finally obtaining the single-scale segmentation quality corresponding to each cluster at that scale. After that, the single-scale segmentation quality of each cluster is obtained by weighting according to the weights. Finally, the single-scale segmentation quality of the same physical region at each scale is multiplied by the weight of the corresponding scale, and the weighted values ​​are summed and averaged to obtain the comprehensive segmentation quality of the physical region.

[0049] Finally, a comprehensive color difference quality score for the color printed matter is calculated. This comprehensive score is obtained by weighting a regional weight score and a multi-scale consistency score. When the comprehensive score is lower than the quality score threshold, a color difference defect is determined to exist. Specifically, the regional weight score is as follows: ,in, Score the region by weight. Let m be the region weight of the m-th cluster. The overall segmentation quality of the m-th cluster is... These represent the mean values ​​of the L, a, and b channels for the m-th cluster, respectively, where M is the total number of clusters. The multi-scale consistency score is as follows: , where K is the decomposition scale number, Let be the segmentation quality of the m-th cluster at the k-th scale. Finally, the region weight score and the multi-scale consistency score are weighted and summed to obtain the comprehensive score: ,in, Using weighting coefficients to balance regional priority and multi-scale stability, subjective quality is transformed into a quantitative comprehensive score. This not only unifies the testing standards but also takes into account the efficiency and accuracy of industrial batch testing, providing a reliable quantitative basis for the objective judgment of color difference defects.

[0050] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments for application in other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A method for detecting color difference defects in color printed materials based on machine vision, characterized in that, Includes the following steps: S1. Acquire RGB images of color printed materials, perform image preprocessing and multi-scale decomposition in sequence to obtain images at three different scales; convert each scale RGB image to Lab color space to obtain Lab space images at the corresponding scale, and extract the color distribution features of the a channel and b channel and the brightness distribution features of the L channel in Lab space at each scale. S2. For Lab space images at each scale, construct a similarity matrix based on the color Euclidean distance of the a-channel and b-channel, select the peak point set in the color distribution features as the initial cluster center, cluster the pixels to obtain coarse clusters, and calculate the color uniformity index of each coarse cluster. S3. For coarse clusters with color uniformity index below the uniformity threshold, construct a two-dimensional distance function by combining the spatial distance of pixels and the Lab color distance, redetermine the cluster center and iterate the clustering to obtain fine clusters. S4. Calculate the segmentation quality of clusters at each scale. The comprehensive segmentation quality is the multi-scale feature fusion value, which is the weighted sum of the joint discreteness feature and the color difference gradient change rate feature. The fusion weight of the two feature values ​​is determined by the entropy weight method. The clustering results of all scales are fused to obtain the corresponding comprehensive segmentation quality. S5. Calculate the color difference quality comprehensive score of the color printed matter. The comprehensive score is obtained by weighting the regional weight score and the multi-scale consistency score. When the comprehensive score is lower than the quality score threshold, it is determined that there is a color difference defect. In step S4, the segmentation quality of each cluster at each scale is calculated separately. Within a single scale, the single-scale segmentation quality of each cluster is calculated individually. For the m-th cluster at that scale, its joint discreteness feature and color difference gradient change rate feature are calculated separately. Then, based on the two types of features of all clusters at the current scale, the global weights corresponding to these two features are calculated using the entropy weight method. The two types of feature values ​​of the cluster are then multiplied by their corresponding weights, and the sum is obtained to get the single-scale segmentation quality of the m-th cluster at that scale. All clusters at the same scale need to be calculated separately in this way to finally obtain the single-scale segmentation quality corresponding to each cluster at that scale. The single-scale segmentation quality is obtained by weighting each cluster according to its weight. In step S4, the overall segmentation quality is obtained by multiplying the single-scale segmentation quality of the same physical region at each scale by the weight of the corresponding scale, and then summing and averaging the weighted values ​​to finally obtain the overall segmentation quality of the physical region. The specific implementation of the comprehensive score obtained by weighting the regional weight score and the multi-scale consistency score in step S5 is as follows: S51. Calculate the regional weight score: ,in, Score the region by weight. Let m be the region weight of the m-th cluster. The overall segmentation quality of the m-th cluster is... , respectively, are the mean values ​​of the L channel, a channel and b channel of the m-th cluster, and M is the total number of clusters; S52. Calculate the multi-scale consistency score: , where K is the decomposition scale number, The segmentation quality of the m-th cluster at the k-th scale; S53. The regional weight score and the multi-scale consistency score are weighted and summed to obtain the comprehensive score.

2. The method for detecting color difference defects in color printed materials based on machine vision according to claim 1, characterized in that, The specific implementation of the image preprocessing in step S1 is as follows: S111. Perform noise suppression by calculating the mean and standard deviation of pixel grayscale values ​​for each channel of the acquired RGB image, and setting a three-level noise judgment threshold: , , ,in There are three judgment thresholds, The mean and standard deviation of grayscale values ​​are used to divide the pixels in each channel into low grayscale, medium grayscale, and high grayscale regions. For the low and high grayscale regions, a 3×3 window weighted median filter with pixel grayscale difference as the weight is used, and for the medium grayscale region, an adaptive Gaussian filter with variance dynamically adjusted based on the standard deviation of the window pixels is used. S112. Divide the noise-suppressed RGB image into multiple non-overlapping sub-regions, calculate the preliminary mean brightness of each sub-region, and select the median of the mean brightness as the standard brightness benchmark. Calculate the brightness deviation value of each sub-region. ; A gradient compensation function is constructed based on the normalized distance d between the pixel and the region center. The compensated brightness is then mapped inversely to the RGB space; S113. Calculate the color saturation of each pixel in the RGB image: Regarding saturation Pixels smaller than the set saturation threshold will have their saturation enhanced. ,in, The image is preprocessed by keeping the brightness constant and mapping it back to the RGB space to obtain the set saturation threshold.

3. The method for detecting color difference defects in color printed materials based on machine vision according to claim 1, characterized in that, The specific implementation of multi-scale decomposition in step S1 to obtain images at three different scales is as follows: S121, Using the preprocessed image as input as... Constructing an improved Gaussian pyramid As the basis for the Laplace pyramid decomposition, and considering the anisotropic characteristics of the ink dot texture direction in printed matter, the first... Layer Gaussian image , =0,1, construct a 5×5 adaptive weighted Gaussian kernel, kernel weight coefficients. ,in, The core center weight benchmark value, For the first The variance of the layer, by The texture direction entropy was calculated as follows: , This represents the texture direction entropy, with a value range of [0,1]. This is the texture direction weighting factor. These are pixel row and column coordinates; this adaptive Gaussian kernel is used. Perform filtering to obtain the filtered image. ; S122. Filter the image. Extracting edge gradient maps Calculate the average gradient of each 2×2 pixel block. Set the gradient threshold for printed edges. ,right The pixel blocks are downsampled using gradient weighting, with weighting coefficients... The downsampling value is the weighted average of 2×2 pixels; for The pixel blocks are downsampled using mean downsampling, and the next layer of Gaussian image is obtained through non-uniform downsampling. ; S123. Construct a color-compensated Laplace pyramid based on the improved Gaussian pyramid, and apply this to the... +1 layer Gaussian image A 2x upsampling operation is performed, and bilinear interpolation is used to obtain the initial upsampled image. ,calculate and The RGB channel pixel values ​​are normalized to the [0,1] interval, and the RGB space color difference of the corresponding pixel is calculated. ,in, This represents the pixel difference between corresponding channels of the two images after normalization. S124. Constructing Compensation Factors ,in, The color difference threshold for printed materials in the RGB color space is used to apply the compensation factor. The RGB channels, each channel pixel value multiplied by Obtain compensated upsampled image ; S125, Calculate the filtered image Compensated upsampling image residual image Then the three images at different scales are , , .

4. The method for detecting color difference defects in color printed materials based on machine vision according to claim 1, characterized in that, Before clustering pixels to obtain coarse clusters in step S2, it is necessary to calculate the texture response value of each pixel in the Lab space image. Non-texture pixels are filtered out by a texture response threshold, and only non-texture pixels are subjected to subsequent clustering analysis. The texture response value satisfies the following: ,in, Let i be the texture response value of the i-th pixel. These are the a-channel, b-channel, and L-channel values ​​of the i-th pixel, respectively. These are the corresponding channel values ​​of the j-th pixel within the eight neighborhoods of the i-th pixel.

5. The method for detecting color difference defects in color printed materials based on machine vision according to claim 1, characterized in that, The specific implementation of constructing the similarity matrix in step S2 is as follows: for each pixel point Extract the a-channel and b-channel values ​​of the pixel in the Lab space image at the current scale. For any two pixels, calculate the Euclidean distance between their a-channel and b-channel values. Characterize the degree of color difference, and then convert the degree of difference into similarity. ,in Find the maximum Euclidean distance between all pixel pairs at the current scale, and then construct a similarity matrix using the pixel number as the row and column index.

6. The method for detecting color difference defects in color printed materials based on machine vision according to claim 1, characterized in that, The color uniformity index in step S2 satisfies: ,in, Let q be the color uniformity index of the coarse cluster. These are the standard deviations of channels a and b of the coarse cluster, respectively. These are the mean values ​​of channel a and channel b of the coarse cluster, respectively. To avoid the minimum value where the denominator is zero.

7. The method for detecting color difference defects in color printed materials based on machine vision according to claim 1, characterized in that, Step S3, for coarse clusters with color uniformity indices below the uniformity threshold, constructs a two-dimensional distance function by combining the spatial distance of pixels and the Lab color distance, redetermines the cluster centers, and iterates the clustering process to obtain fine clusters. The specific implementation of this process is as follows: S31. Extract the feature information of all pixels within the coarse clusters where the color uniformity index is below the uniformity threshold, including the Lab color value of each pixel. and spatial coordinates ; S32. For any two pixels within the coarse cluster, construct a two-dimensional distance function that fuses Lab color distance and spatial location distance, wherein the two-dimensional distance function satisfies: ,in, Let be the two-dimensional distance between pixel i and pixel j. This is the distance weighting coefficient. This represents the diagonal length of the Lab space image at the current scale. S33. Calculate the mean Lab color and mean spatial coordinate of all pixels in the coarse cluster, and select the three pixels with the smallest two-dimensional distance from the mean as the initial cluster centers of the fine cluster. S34. During iterative clustering, first traverse all pixels within the coarse clusters to be refined, calculate the two-dimensional distance between each pixel and all initial cluster centers, and assign it to the refined cluster candidate cluster corresponding to the cluster center with the smallest distance; then, for each candidate cluster, update the cluster center by using the average Lab color and the average spatial coordinate of the pixels within the cluster; subsequently, if the maximum change in the two-dimensional distance between the cluster centers in two consecutive iterations is less than a set threshold, the iteration is terminated; after the iteration terminates, each of the current refined cluster candidate clusters is the refined cluster obtained by subdividing the coarse cluster.

8. The method for detecting color difference defects in color printed materials based on machine vision according to claim 1, characterized in that, The calculation method for the joint discreteness feature and the color difference gradient change rate feature in step S4 is as follows: Joint discreteness feature ,in, Let m be the joint discreteness feature of the m-th cluster. This represents the number of color edge pixels within the cluster. This represents the total number of pixels within the cluster. The standard deviation of the spatial coordinates of pixels within this cluster. These represent the standard deviations of the L, a, and b channels of this cluster; the color difference gradient change rate characteristic satisfies: ,in, The color difference gradient change rate feature of the m-th cluster is... The color contrast of this cluster. Let be the Lab color gradient magnitude of the i-th pixel within this cluster. This represents the average color gradient magnitude of all pixels within the cluster.

Citation Information

Patent Citations

  • Detecting printing defects

    EP2761863A1

  • Vehicle detection method based on clustering algorithm

    WO2023108933A1