Method for detecting defects in printed graphics based on machine vision
By preprocessing the RGB images of printed materials and analyzing the illumination level range, the color difference threshold is adaptively adjusted, which solves the detection error caused by illumination in the Lab color space template comparison method and achieves highly accurate detection of printing defects.
Patent Information
- Application Number
- CN202511292599.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-11
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2045-09-11
AI Technical Summary
When using the template comparison method of Lab color space for graphic printing defect detection, how to set a reasonable color difference threshold to improve the accuracy of defect detection, especially to avoid misjudgment and ignoring minor defects under different lighting conditions?
By acquiring RGB images of printed materials, marking blank area pixels and converting them to Lab color space, normalizing brightness processing is performed, dividing the illumination level range, obtaining the optimal color difference threshold based on the color fluctuation statistics of each range, comparing templates in Lab color space, and adaptively adjusting the color difference threshold to overcome the influence of illumination.
It improves the accuracy of graphic printing defect detection, effectively overcomes the problems of false detection and missed detection caused by uneven lighting, and ensures the accuracy and consistency of detection results.
Smart Images

Figure CN120765662B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method for detecting defects in printed images based on machine vision. Background Technology
[0002] Image and text defects are problems inherent in the printing industry, caused by a variety of factors such as insufficient printer ink, printhead clogging, changes in substrate characteristics, or inaccurate color management. Color deviation, a typical image and text defect, usually manifests as a perceptible difference between the hue, saturation, or brightness of the printed product and the standard design. Without strict control, this can lead to batch product scrapping, damage to brand image, and significant economic losses. However, by using automated machine vision inspection systems to identify and quantify color deviations on the surface of printed materials, problems can be detected promptly, and printing parameters can be adjusted to ensure color consistency and maintain the commercial value of the printed products.
[0003] Currently, the industry typically utilizes machine vision and image processing technologies to identify and locate color defects in printed materials. High-resolution scanners or industrial cameras acquire printed images under specific lighting conditions, and after preprocessing, template comparison techniques are used to detect printing defects. However, in actual inspection processes, uneven lighting can occur due to paper wrinkles and surface textures during image acquisition. Different textures result in different lighting conditions, and color differences between strong and weak light areas can lead to false detections of color defects, ultimately affecting the accuracy of color deviation (color difference) detection. The template comparison method in the Lab color space can overcome the influence of uneven local lighting to some extent, reduce false detections, and improve accuracy. However, the selection of the color difference threshold in the template comparison method of the Lab color space is difficult. Different color difference thresholds have different tolerances for detection results. If the color difference threshold is set too small, normal color fluctuations in dark areas will be misjudged as defects (false alarms). If the color difference threshold is set too large, real minor defects in bright areas will be ignored. Therefore, when using the template comparison method of the Lab color space for defect detection in graphic printing, how to set a reasonable color difference threshold to improve the accuracy of defect detection is an urgent problem to be solved. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a machine vision-based method for detecting defects in printed graphics, in order to solve the problem of how to set a reasonable color difference threshold and improve the accuracy of defect detection when using the template comparison method of Lab color space for defect detection in printed graphics.
[0005] This invention provides a machine vision-based method for detecting defects in printed images and text, which includes the following steps:
[0006] Obtain an RGB image of the printed material to be inspected, mark the pixels in the blank areas of the RGB image to obtain a marked image, and convert the marked image to Lab color space to obtain the target image;
[0007] The L-channel value of each pixel in the target image is normalized to obtain a normalized brightness value, based on a normal distribution. Based on the principle and the normalized brightness value of each pixel, the pixels in the target image are divided into a preset number of illumination level intervals.
[0008] For any light level range, based on the marked pixels in the light level range, obtain the corresponding color fluctuation statistics parameters to characterize the color fluctuation range without printing defects under the influence of light. Based on the color fluctuation statistics parameters, obtain the optimal color difference threshold corresponding to the light level range.
[0009] The optimal color difference threshold corresponding to each of the illumination level intervals is obtained. Based on the optimal color difference threshold corresponding to the illumination level interval to which each pixel in the target image belongs, a template comparison in the Lab color space is performed on the target image to obtain the result of the color difference defect of the printed matter to be detected.
[0010] Preferably, the normalization process for the L-channel value of each pixel in the target image to obtain a normalized brightness value includes:
[0011] Based on the L-channel value of each pixel in the target image, the mean and standard deviation of the L-channel value are obtained. For any pixel in the target image, the difference between the L-channel value of that pixel and the mean is obtained. The ratio between the difference and the standard deviation is used as the normalized brightness value of that pixel.
[0012] Preferably, the illumination level range includes: The illumination level increases sequentially, with higher illumination levels resulting in greater brightness.
[0013] Preferably, obtaining the corresponding color fluctuation statistical parameters based on the marked pixels existing in any of the illumination level intervals includes:
[0014] Detect whether there are marked pixels in any of the illumination level intervals. If marked pixels are detected in any of the illumination level intervals, calculate the mean value of the a channel, the standard deviation of the a channel value, the mean value of the b channel, the standard deviation of the b channel value, the mean value of the L channel, and the standard deviation of the L channel value for all marked pixels in any of the illumination level intervals.
[0015] For any marked pixel, calculate the color difference value of the marked pixel based on the difference between the a-channel value and the mean a-channel value, the difference between the b-channel value and the mean b-channel value, and the difference between the L-channel value and the mean L-channel value. Combine the L-channel value and the color difference value of the marked pixel into a feature vector. Based on the feature vector of each marked pixel, construct a color difference variation curve with the L-channel value on the horizontal axis and the color difference value on the vertical axis. Obtain the partial derivative of each data point on the color difference variation curve and obtain the mean of the partial derivatives, which is denoted as the average sensitivity coefficient of the effect of illumination on color difference.
[0016] The standard deviations of channel a, channel b, and channel L, along with the average sensitivity coefficient, constitute the statistical parameters of color fluctuation for any given illumination level range.
[0017] Preferably, after detecting whether a marked pixel exists in any of the illumination level intervals, the method further includes:
[0018] If no marked pixel is detected in any of the illumination level intervals, the historical color fluctuation statistics of any illumination level interval at the time of the last printing defect detection are obtained as the color fluctuation statistics of any illumination level interval.
[0019] Preferably, obtaining the optimal color difference threshold corresponding to any illumination level range based on the color fluctuation statistical parameters includes:
[0020] ;
[0021] in, This represents the optimal color difference threshold corresponding to any given light level range. This represents the preset confidence factor. This represents the standard deviation of the a-channel value in the color fluctuation statistics parameter. This represents the standard deviation of the b-channel value in the color fluctuation statistics parameter. This represents the standard deviation of the L channel value in the color fluctuation statistics parameter. This represents the preset weighting coefficient. This represents the average sensitivity coefficient in the color fluctuation statistics parameters.
[0022] Preferably, the step of performing template comparison in the Lab color space on the target image based on the optimal color difference threshold corresponding to the illumination level range to which each pixel in the target image belongs, and obtaining the image and text color difference defect result of the printed matter to be detected, includes:
[0023] A template image is obtained, and the template image and the target image are aligned pixel by pixel to obtain the color difference of each pixel in the target image. The color difference of each pixel is compared with the optimal color difference threshold corresponding to the illumination level range to which the pixel belongs to determine the defective pixel. Based on the defective pixel in the target image, the location of the color difference defect of the printed material to be inspected is determined.
[0024] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows:
[0025] This invention acquires an RGB image of the printed material to be inspected, marks the pixels belonging to blank areas in the RGB image to obtain a marked image, performs Lab color space transformation on the marked image to obtain the target image, and normalizes the L channel value of each pixel in the target image to obtain a normalized brightness value, based on a normal distribution. Based on the principle and the normalized brightness value of each pixel, the pixels in the target image are divided into a preset number of illumination level intervals. For any illumination level interval, according to the marked pixels present in the interval, the corresponding color fluctuation statistics are obtained to characterize the color fluctuation range without printing defects under illumination. Based on the color fluctuation statistics, the optimal color difference threshold corresponding to the illumination level interval is obtained. The optimal color difference threshold corresponding to each illumination level interval is obtained. Based on the optimal color difference threshold corresponding to the illumination level interval to which each pixel in the target image belongs, a template comparison in the Lab color space is performed on the target image to obtain the color difference defect result of the printed material to be inspected. Specifically, by converting the color space, the light intensity distribution (multiple illumination level intervals) in the RGB image is analyzed to determine the illumination intensity corresponding to each pixel in the image, which is used to measure the brightness of the pixel. Then, based on the marked pixels in the illumination level intervals, the normal fluctuation of illumination within each illumination level interval is analyzed to obtain color fluctuation statistical parameters, which are used to quantify the reasonable color difference fluctuation within the corresponding illumination level interval. Finally, using the color fluctuation statistical parameters, the optimal color difference threshold for each pixel is adaptively obtained, so that when performing color difference defect detection through template comparison, the influence of illumination can be overcome, and the accuracy of graphic printing defect detection based on color difference threshold can be improved. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in the embodiments of the present invention, 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.
[0027] Figure 1This is a flowchart of a machine vision-based method for detecting defects in printed graphics, provided in Embodiment 1 of the present invention. Detailed Implementation
[0028] Embodiments of this disclosure are described in detail below, with examples of these embodiments illustrated in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this disclosure, and should not be construed as limiting it.
[0029] It should be noted that the terms "first," "second," etc., used in this disclosure and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure.
[0030] To illustrate the technical solution of the present invention, specific embodiments are described below.
[0031] See Figure 1 This is a flowchart of a machine vision-based method for detecting defects in printed graphics, as provided in Embodiment 1 of the present invention. Figure 1 As shown, the method may include:
[0032] Step S101: Obtain the RGB image of the printed material to be inspected, mark the pixels in the blank areas of the RGB image to obtain the marked image, and convert the marked image to Lab space to obtain the target image.
[0033] Using appropriate image acquisition equipment (camera), an RGB image of the printed material to be inspected is captured perpendicularly above the paper. High image resolution and proper exposure are essential for accurate subsequent processing. Since actual RGB images are often affected by noise, distortion, and inconsistent color spaces, subsequent lighting modeling and defect identification will be severely hampered without systematic image preprocessing. Therefore, this embodiment of the invention employs a series of image preprocessing operations to ensure image accuracy and consistency.
[0034] Image preprocessing includes: image correction, which corrects the acquired RGB image to ensure direct alignment with the template during subsequent detection; this step can be achieved through image rotation, cropping, etc.; image segmentation, which segments the acquired RGB image into blank areas and marks the pixels belonging to the blank areas to obtain a marked image, which provides data input for subsequent steps; denoising, which denoises the marked image to reduce interference in subsequent processing steps; common denoising methods include median filtering and Gaussian filtering; and color space conversion, which uses a CIE standard D65 light source to convert the RGB color space of the marked image to the Lab color space to obtain the target image, providing data for subsequent operations.
[0035] It should be noted that image preprocessing is an existing technology and will not be discussed in detail here.
[0036] This yields high-quality, standardized Lab color space image data, which is the target image, providing reliable input for subsequent illumination analysis and color difference calculation.
[0037] Step S102: Normalize the L channel value of each pixel in the target image to obtain a normalized brightness value. Based on the normal distribution principle and the normalized brightness value of each pixel, divide the pixels in the target image into a preset number of illumination level intervals.
[0038] In color difference analysis methods, the color difference threshold is an important parameter for measuring color change, which directly affects the accuracy of color difference detection results. Different color difference thresholds will directly lead to large differences in the tolerance for judging whether there are defects in the printed images. Therefore, in this embodiment of the invention, the light intensity distribution is analyzed based on the Lab data features of each pixel in the target image to eliminate the influence of light, thereby adaptively obtaining the optimal color difference threshold for detecting defects in the printed matter to be inspected.
[0039] A single pixel's brightness value cannot adequately represent the brightness of its surrounding environment; it needs to be evaluated within the global brightness distribution of the entire image to characterize its relative brightness. The L-channel value directly corresponds to the brightness perceived by the human eye and is the most direct feature representing light intensity. Therefore, this embodiment of the invention normalizes the L-channel value of each pixel in the target image to obtain a normalized brightness value, thus eliminating the influence of the overall brightness of the image. Specifically, the method for normalizing the L-channel value of each pixel in the target image to obtain a normalized brightness value is as follows: based on the L-channel value of each pixel in the target image, the mean and standard deviation of the L-channel value are obtained. For any pixel in the target image, the difference between the L-channel value of that pixel and the mean is obtained. The ratio between the difference and the standard deviation is used as the normalized brightness value of that pixel.
[0040] In one embodiment, the technical formula for the normalized luminance value of any pixel is:
[0041]
[0042] in, This represents the normalized brightness value of any pixel. This represents the L-channel value of any pixel. This represents the mean value of the L channel of all pixels in the target image. It represents the standard deviation of the L-channel values of all pixels in the target image.
[0043] It should be noted that, This represents the global average brightness level of the target image. It represents the overall brightness fluctuation range of the target image. It is normalized using the mean and standard deviation, so that the normalized brightness value of a pixel no longer represents the absolute brightness, but rather the degree of deviation of the pixel from the global average brightness, thereby accurately quantifying the intensity of local illumination.
[0044] After obtaining the normalized brightness value of each pixel in the target image, according to the normal distribution... The principle involves dividing the normalized light intensity values into intervals. This division method ensures that the interval boundaries have clear statistical significance, allowing the vast majority of data points to be included in a meaningful brightness context, thereby transforming continuous light intensity into discrete, manageable "light levels". Therefore, based on the normal distribution principle and the normalized brightness value of each pixel, the pixels in the target image are divided into a preset number of light level intervals.
[0045] Based on the normal distribution Principle: The image brightness is such that most pixels are clustered around an average value, conforming to a normal distribution, with approximately 99.7% of the data points falling within the range of the mean ± 3 standard deviations. In this embodiment of the invention, the normalized brightness value is... The lighting is divided into 5 intensity levels, namely: The illumination levels increase sequentially, with higher illumination levels resulting in greater brightness. The proportion of data within each illumination level range varies. and Each of the data points accounts for approximately 6.7% (by merging the sparsest data at the very edge, sacrificing unnecessary detail (referring to the range of ±1.5 to ±3) in exchange for model robustness). and The data each accounted for approximately 24.2%. The data accounts for approximately 38.3% of the total data. This data is used to obtain the light intensity distribution, which is then divided into five levels in sequence: extremely dark, moderately dark, normal, moderately bright, and extremely bright. Based on the normalized brightness value of each pixel in the target image, each pixel is assigned to a corresponding illumination level range. For example, if a pixel has a normalized brightness value of 0.3, it is assigned to... Within the lighting level range, that is, the normal lighting area, pixels with a normalized brightness value of 1.6 are assigned to... Within the illumination level range, that is, the brighter area.
[0046] At this point, the uneven brightness that affects detection efficiency can be transformed into a range for measuring changes in illumination by means of light intensity distribution. In other words, the pixels in the target image are divided according to the intensity of illumination, and one illumination level range corresponds to one illumination intensity.
[0047] Step S103: For any illumination level range, based on the marked pixels in any illumination level range, obtain the corresponding color fluctuation statistical parameters to characterize the color fluctuation range without printing defects under the influence of illumination. Based on the color fluctuation statistical parameters, obtain the optimal color difference threshold corresponding to any illumination level range.
[0048] To accurately quantify the normal color fluctuation range under different local illumination intensities when there are no defects, that is, the allowable natural variation of the a-channel and b-channel values under defect-free conditions in a specific brightness environment, a Lab number fluctuation model associated with illumination partitions is constructed to obtain the color fluctuation statistical parameters corresponding to each illumination level interval. The color fluctuation statistical parameters are used to characterize the color fluctuation range without printing defects under the influence of illumination.
[0049] Different light intensities can cause the same color to be perceived differently. The blank areas of a printed material have no printed content, and their color changes are entirely due to the characteristics of the paper, wrinkles, and changes in light. This perfectly reflects the non-defect color fluctuations of the printed material being inspected. Therefore, the blank areas in the target image can truly reflect the color fluctuation range under the current lighting environment without the influence of printing defects. Then, based on the marked pixels in the target image (i.e., the marked pixels), the color fluctuation statistical parameters for each lighting level range are obtained as a reference benchmark for subsequent color difference comparison.
[0050] Taking any illumination level range as an example, firstly, it is detected whether there are marked pixels in any illumination level range. If marked pixels are detected in any illumination level range, it is determined that the pixels in any illumination level range involve pixels in the blank area. Then, the mean value of the a-channel of all marked pixels in any illumination level range is calculated. Standard deviation of channel a value mean of b channel values b channel value standard deviation Mean value of L channel and the standard deviation of L channel values It is used to characterize all color values that should appear in an area without graphic printing defects under the lighting environment corresponding to any lighting level range.
[0051] Furthermore, based on the L-channel value of each marked pixel, the sensitivity of color difference to illumination under conditions without printing defects is analyzed: for any marked pixel, the difference between the a-channel value and the mean a-channel value of that marked pixel is calculated. The difference between the b channel value and the mean of the b channel values And the difference between the L-channel value and the mean of the L-channel values. Calculate the color difference value of any of the marked pixels. A feature vector is formed by combining the L-channel value and color difference value of any marked pixel. Based on the feature vector of each marked pixel, a color difference variation curve is constructed with the L-channel value on the horizontal axis and the color difference value on the vertical axis. The partial derivative of each data point on the color difference variation curve is then obtained. The mean of the partial derivatives is obtained and denoted as the average sensitivity coefficient of the effect of illumination on color difference. Average sensitivity coefficient The value range is between [-1, 1], and the average sensitivity coefficient is... The larger the absolute value, the greater the impact of brightness fluctuation on color difference; therefore, the standard deviations of channel a, channel b, and channel L values, along with the average sensitivity coefficient, are used to construct the statistical parameters of color fluctuation corresponding to any given illumination level range. Partial derivatives are existing technology and will not be discussed further here.
[0052] It should be noted that if no marked pixels are detected in any of the illumination level intervals, it indicates that any illumination level interval involves areas with printed graphics in the target image. However, considering that the image environment is fixed each time a printed graphics defect is detected, that is, the interference in the collected images is the same, the color fluctuation statistical parameters corresponding to any of the illumination level intervals can be obtained based on historical detection data. These parameters are used to characterize all color changes that should appear in areas without printed graphics defects under the illumination environment corresponding to any of the illumination level intervals. Therefore, the historical color fluctuation statistical parameters corresponding to any of the illumination level intervals in the previous printed graphics defect detection are obtained as the color fluctuation statistical parameters corresponding to any of the illumination level intervals.
[0053] Similarly, the color fluctuation statistics parameters corresponding to each illumination level range are obtained as follows: , , , , .
[0054] After obtaining the color fluctuation statistics parameters corresponding to each illumination level interval, the optimal color difference threshold for color defect judgment under each specific illumination environment can be dynamically calculated based on these parameters. The optimal color difference threshold is not a fixed value but rather an adaptive value that changes with illumination conditions, quantifying the normal fluctuation range of defect-free colors under specific illumination. Therefore, for any illumination level interval, the optimal color difference threshold corresponding to that interval is obtained based on the color fluctuation statistics parameters. The specific calculation formula is as follows: ;
[0055] in, This represents the optimal color difference threshold corresponding to any given light level range. This represents the preset confidence factor. This represents the standard deviation of the a-channel value in the color fluctuation statistics parameter. This represents the standard deviation of the b-channel value in the color fluctuation statistics parameter. This represents the standard deviation of the L channel value in the color fluctuation statistics parameter. This represents the preset weighting coefficient. This represents the average sensitivity coefficient in the color fluctuation statistics parameters.
[0056] It should be noted that, and These represent the standard deviations of the variation of defect-free color in channels a and b within any given illumination level range. The sum of their squares constitutes the variance of the chromaticity variation. It is the core of the optimal color difference threshold, which directly reflects the natural fluctuation range of pure color information under the current lighting environment after excluding the influence of brightness. The greater the fluctuation, the larger the optimal threshold. It is the standard deviation of the L channel values within any given light level range, quantifying the natural fluctuation range under that lighting environment. It is the sensitivity coefficient (partial derivative) of color difference to brightness, which means that a small change in brightness L will cause color difference. How much change will occur? The term transforms brightness fluctuations into an equivalent variance contribution to the optimal color difference threshold through their sensitivity to color difference.
[0057] Preferably, in this embodiment of the invention, the following is set: This is used to finely adjust the contribution of brightness fluctuations to the optimal color difference threshold. When this happens, the formula becomes one that only considers chromaticity fluctuations, simplifying calculations and making it suitable for scenarios where high precision is not required or the impact on brightness is minimal, thus increasing... This value can more fully account for the impact of brightness variations, improving detection accuracy in areas of strong contrast. Confidence factor It is a key regulating parameter based on statistical principles. It is usually referenced to the normal distribution. In principle, the embodiments of the present invention are set This means that setting the optimal color difference threshold within the approximately 99% confidence interval of the normal fluctuation range can ensure tolerance for normal fluctuations and effectively capture outliers (defects) that are outside the range.
[0058] Thus, the optimal color difference threshold corresponding to each illumination level range can be obtained.
[0059] Step S104: Obtain the optimal color difference threshold corresponding to each illumination level range. Based on the optimal color difference threshold corresponding to the illumination level range to which each pixel in the target image belongs, perform template comparison in the Lab color space on the target image to obtain the result of the color difference defect of the printed material to be detected.
[0060] According to step S103 above, the optimal color difference threshold corresponding to each illumination level range can be obtained. The optimal color difference threshold of each pixel in the target image is set as the optimal color difference threshold corresponding to its respective illumination level range for subsequent template comparison in the Lab color space. Further, using the optimal color difference threshold corresponding to the illumination level range to which each pixel in the target image belongs, a template comparison in the Lab color space is performed on the target image to obtain the image and text color difference defect results of the printed matter to be detected: a template image is obtained, the template image and the target image are pixel-aligned, and the color difference of each pixel in the target image is obtained using the traditional color difference calculation formula based on the Lab values in the template image and the target image. The color difference of each pixel is compared with the optimal color difference threshold corresponding to the illumination level range to which the pixel belongs to determine the defective pixels. Based on the defective pixels in the target image, traditional morphological optimization is used to remove small areas, fill holes, and smooth edges on the defect mask to determine the image and text color difference defect location of the printed matter to be detected, and the image and text color difference defect location is segmented and displayed.
[0061] It should be noted that using template comparison in the Lab color space for image color difference defect detection is an existing technology and will not be elaborated on here.
[0062] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for detecting defects in printed graphics based on machine vision, characterized in that, The method comprises: Obtaining an RGB image of a printed matter to be detected, marking pixel points in the RGB image belonging to a blank area to obtain a marked image, performing Lab space conversion on the marked image to obtain a target image; The L channel value of each pixel point in the target image is normalized to obtain a normalized brightness value. According to the normal distribution principle and the normalized brightness value of each pixel point, the pixel points in the target image are divided into a preset number of illumination level intervals. The L channel value of each pixel point in the target image is normalized to obtain a normalized brightness value. According to the normal distribution principle and the normalized brightness value of each pixel point, the pixel points in the target image are divided into a preset number of illumination level intervals. For any illumination level interval, according to the marked pixel points existing in the any illumination level interval, corresponding color fluctuation statistical parameters are obtained, which are used to represent the color fluctuation range of the printed matter without printing defects under the influence of illumination, and according to the color fluctuation statistical parameters, the best color difference threshold corresponding to the any illumination level interval is obtained; Obtaining the best color difference threshold corresponding to each of the illumination level intervals, and performing template comparison on the target image in the Lab color space according to the best color difference threshold corresponding to the illumination level interval to which each pixel point in the target image belongs, to obtain the text and image color difference defect result of the printed matter to be detected; According to the marked pixel points existing in the any illumination level interval, the corresponding color fluctuation statistical parameters are obtained, which comprises: Detecting whether there are marked pixel points in the any illumination level interval, if the any illumination level interval is detected to have marked pixel points, calculating the average value of a channel value, the standard deviation of a channel value, the average value of b channel value, the standard deviation of b channel value, the average value of L channel value and the standard deviation of L channel value of all the marked pixel points in the any illumination level interval; For any marked pixel point, according to the difference value of the a channel value of the any marked pixel point and the average value of a channel value, the difference value of b channel value and the average value of b channel value, and the difference value of L channel value and the average value of L channel value, the color difference value of the any marked pixel point is calculated, and the L channel value and the color difference value of the any marked pixel point are combined to form a feature vector; according to the feature vector of each marked pixel point, an color difference change curve is constructed with the L channel value as the horizontal axis and the color difference value as the vertical axis, the partial derivative of each data point on the color difference change curve is obtained respectively, and the average value of the partial derivative is obtained, which is recorded as the average sensitivity coefficient of the influence of illumination on color difference; The standard deviation of a channel value, the standard deviation of b channel value, the standard deviation of L channel value and the average sensitivity coefficient are combined to form the color fluctuation statistical parameters corresponding to the any illumination level interval; If the any illumination level interval is detected to have no marked pixel points, the historical color fluctuation statistical parameters corresponding to the any illumination level interval in the last printing text defect detection are obtained as the color fluctuation statistical parameters corresponding to the any illumination level interval; The best color difference threshold corresponding to the any illumination level interval is obtained according to the color fluctuation statistical parameters, which comprises: ; wherein, represents the optimal color difference threshold value corresponding to any of the illumination level intervals, represents a preset confidence factor, represents the a channel value standard deviation in the color fluctuation statistical parameter, represents the b channel value standard deviation in the color fluctuation statistical parameter, represents the L channel value standard deviation in the color fluctuation statistical parameter, represents a preset weight coefficient, represents the average sensitivity coefficient in the color fluctuation statistical parameter. 2.The machine vision-based printed text defect detection method according to claim 1, characterized in that, The L channel value of each pixel point in the target image is normalized to obtain a normalized brightness value, which comprises: According to the L channel value of each pixel point in the target image, the average value and the standard deviation of the L channel value are obtained, for any pixel point in the target image, the difference value between the L channel value of the any pixel point and the average value is obtained, and the ratio between the difference value and the standard deviation is taken as the normalized brightness value of the any pixel point. 3.The machine vision-based printed text defect detection method according to claim 1, wherein, The light illumination level interval comprises: , the light illumination level is sequentially increased, the greater the light illumination level, the greater the brightness. 4.The machine vision-based printed text defect detection method according to claim 1, wherein, The target image is subjected to template comparison in the Lab color space according to the optimal color difference threshold corresponding to the light level interval to which each pixel point in the target image belongs, and a graphic-text color difference defect result of the to-be-detected printed matter is obtained, including: A template image is obtained, the template image and the target image are subjected to pixel point alignment, the color difference of each pixel point in the target image is obtained, the color difference of each pixel point is compared with the optimal color difference threshold corresponding to the light level interval to which the pixel point belongs, a defect pixel point is determined, and a graphic-text color difference defect position of the to-be-detected printed matter is determined according to the defect pixel point in the target image.
Citation Information
Patent Citations
Self-adaptive white balance processing method and device, medium and electronic equipment
CN112788322A
Textile color migration detection system and method
CN119130929A