A printed matter color correction method
Patent Information
- Application Number
- CN202511200640.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-26
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2045-08-26
AI Technical Summary
[0005]本申请的目的在于:针对现有颜色校正方法中无线性化处理导致的暗调和中亮调产品颜色还原准确性低,以及校正后图像中目标与背景区分度低的问题,提供一种高效、精确的颜色校正方法,提出用于精确线性化处理的gamma分段公式,利用算gamma分段公式对输入图像进行线性化,提高图像的颜色还原度,减小ΔE,使校正后暗调和中亮调产品颜色区分度大大提升,同时提出对应的色度增强方法,在保证颜色还原准确的前提下提升图像饱和度,进一步提升对印刷品色差和颜色类缺陷的检测能力
[0058] First, the technical solution in this application provides a piecewise gamma formula for precise linearization of input images. This piecewise gamma formula is used to linearize the image before adjusting its color. When the gray value of the pixel to be processed in the input image is less than the piecewise variable, the gamma polynomial fitting method is used to linearize the pixels of the input image. When the gray value of the pixel to be processed in the input image is greater than or equal to the piecewise variable, the gamma=1 method is directly used to linearize the pixels of the input image. The technical solution in this application separates the high-brightness region and the low-brightness region through the piecewise gamma formula and performs different types of linearization processing. This can maximize the brightness stretching of dark-toned products, improve their color differentiation, and avoid brightness compression of mid-brightness products, thereby improving the overall color reproduction accuracy of the image and reducing the ΔE value.
Smart Images

Figure CN121053227B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of color correction of printed matter, and more specifically, to a method for color correction of printed matter. Background Technology
[0002] With the improvement of production levels, the printing industry has increasingly higher requirements for color accuracy. Consequently, the requirements for the color fidelity and accuracy of images captured by vision components are also increasing. However, the colors of images captured by vision components differ under different light sources, which are determined by the spectral distribution of the light source and the RGB three-channel response characteristics of the camera. Color correction methods are usually used to adjust the color parameters of the camera to achieve accurate color reproduction on different devices, ensure color consistency, and thus accurately compare color differences and detect color defects.
[0003] Currently, traditional image color correction methods assume that the acquired images are linear and directly use a color correction matrix to adjust the image color. For example, a 3*3 numerical matrix is used to multiply the color value of each pixel in the image to obtain a high-precision color image after color correction.
[0004] Patent 1, "CN 108712639A, Image Color Correction Method, Device and System," optimizes traditional image color correction methods by using a 3×N dimensional numerical matrix for the color matrix and adding constraint terms to ensure that the coefficients of the color correction matrix satisfy the mid-gray block (a mid-gray block is a gray area where the values of the three RGB channels are equal or close, serving as a reference point without color bias in color correction; in the 3×N dimensional color matrix mentioned in the patent, the values of the mid-gray block are used as mathematical constraints to ensure that the correction result does not disrupt the balance of neutral gray). However, similar to traditional image color correction methods, the corrected product color value still differs somewhat from the standard color value, especially in terms of insufficient accuracy in color reproduction for dark-toned products. Patent 2, "CN115474028 A, A Fast Color Correction Device for Industrial Cameras," proposes a brightness correction algorithm for the acquired image, achieving a correction effect superior to patent "CN 108712639A," particularly improving the accuracy of color reproduction for dark-toned products, i.e., reducing ΔE. Figure 2 As shown in the patent 2-gamma curve, this method stretches the brightness of dark-toned products (such as products with a gray value n < 170), which improves the color differentiation. However, it compresses the brightness of medium-bright-toned products (such as products with a gray value n ≥ 170), which reduces the color differentiation and is not conducive to the detection of color defects. Summary of the Invention
[0005] The purpose of this application is to address the problems of low color reproduction accuracy in dark and mid-tone products and low distinction between targets and backgrounds in the corrected image caused by the lack of linearization in existing color correction methods. This application proposes an efficient and accurate color correction method, using a piecewise gamma formula for precise linearization. This formula linearizes the input image, improving color reproduction and reducing ΔE, thus significantly enhancing the color distinction between dark and mid-tone products after correction. Simultaneously, a corresponding chromaticity enhancement method is proposed to improve image saturation while ensuring accurate color reproduction, further improving the detection capability for color differences and color-related defects in printed materials.
[0006] The technical solution of this application is: a method for color correction of printed materials, the method comprising:
[0007] Step 1: Construct a piecewise gamma function using preset grayscale values as piecewise variables. Fit the unknown coefficients in the piecewise gamma function. Specifically, acquire a standard color card image in a preset shooting environment. Use the piecewise gamma function to linearize the measured grayscale values corresponding to the grayscale blocks in the standard color card image. Make the linearized measured grayscale values equal to the known standard grayscale values. Establish a fitting formula. Based on the fitting formula, use the least squares method to fit the unknown coefficients of the piecewise function.
[0008] Step 2: Use the gamma piecewise function to linearize the original RGB value array corresponding to the standard color chart image to obtain the linearized RGB value array;
[0009] Step 3: Based on the known standard RGB values corresponding to each color block in the standard color chart, obtain the corrected target RGB value array, and perform chromaticity adjustment on the target RGB value array to achieve chromaticity enhancement of the target image to be corrected. Specifically, transform the target RGB value array to the LCH color space, adjust the chromaticity C value, and then inversely transform the adjusted LCH value to the RGB color space to obtain the chromaticity-enhanced target RGB value array.
[0010] Step 4: Set the color correction matrix to be determined. Make the product of the linearized RGB value array corresponding to the standard color chart image and the color correction matrix equal to the target RGB value array after chromaticity enhancement, and calculate the color correction matrix.
[0011] Step 5: Acquire the target image in the same shooting environment, use the gamma piecewise function to linearize the original RGB values corresponding to the target image, and then multiply the linearized RGB value array with the color correction matrix A to obtain the corrected target image.
[0012] Furthermore, step 1 specifically includes the following steps:
[0013] Step 11, constructing a gamma piecewise function with n as a piecewise variable, expressed as:
[0014]
[0015] In the formula, a1, a2, a3, a4, a5 are coefficients to be fitted in the piecewise function, O gray is the measured gray value corresponding to the standard color card image, O' gray is the measured gray value after normalization processing, n is the piecewise variable, n∈(0,255);
[0016] Step 12, collecting a standard color card image with a camera in a preset shooting environment, and calculating the measured gray value O based on the RGB values corresponding to grayscale patches in the standard color card image gray , then performing normalization processing on the measured gray value O gray to obtain multiple sets of measured gray value data;
[0017] Step 13, calculating the standard gray value T based on the known standard RGB values corresponding to grayscale patches in the standard color card gray , performing normalization processing on the standard gray value T gray ;
[0018] Step 14, performing linearization processing on the normalized measured gray value O' gray by using the corresponding term satisfying the O gray <n condition in the piecewise function, making the linearized measured gray value O' gray equal to the standard gray value T' gray , establishing a fitting formula based on the equality relationship between the linearized measured gray value O' gray and the standard gray value T' gray , extracting data satisfying the O gray <n condition from multiple sets of measured gray value data, substituting the extracted data and the standard gray value T' gray together into the fitting formula, and performing fitting by the least square method to obtain coefficients of the piecewise function.
[0019] Further, the fitting formula in step 14 is expressed as:
[0020]
[0021] After transforming the fitting formula, we obtain:
[0022]
[0023] In the formula, m is the number of groups of data that satisfy the O gray <n condition extracted from multiple sets of measured gray value data, and i is the i-th group of the extracted data.
[0024] Furthermore, in step 2, the original RGB value array corresponding to the standard color chart image is represented as follows:
[0025]
[0026] In the formula, K is the total number of color patches in the standard color chart, [O Rk O Gk O Bk [ ] represents the original RGB value corresponding to the k-th color patch in the standard color chart image.
[0027] Furthermore, step 2 specifically includes:
[0028] The grayscale value O corresponding to each color patch is calculated based on the original RGB values of the standard color chart image. k,gray For grayscale value O k,gray Perform normalization processing, and then set the normalized grayscale value O. k,gray The values are substituted into the gamma piecewise function, and then the original RGB value array of the standard color chart image is linearized using the gamma piecewise function to obtain the linearized RGB value array. The calculation process of linearization is expressed as follows:
[0029]
[0030] In the formula, O Linearize_Rk R is the linearized value of the k-th color patch in the standard color chart image, O Linearize_Gk and O Linearize_Bk The calculation process and O Linearize_Rk The same applies, so I won't repeat it here; the final linearized RGB value array is represented as follows:
[0031]
[0032] In the formula, O Linearize This is a linearized array of RGB values corresponding to the standard color chart image.
[0033] Further, in step 3, the corrected target RGB value array is obtained based on the known standard RGB values corresponding to each color patch in the standard color chart, specifically including:
[0034] Using the standard RGB values corresponding to each color patch in the standard color chart as the target RGB values, set the corrected target RGB value array, represented as:
[0035]
[0036] Among them, [P Rk ,P Gk ,P Bk] represents the initial target RGB value corresponding to the k-th color block in the standard color chart.
[0037] Furthermore, step 3, specifically adjusting the chromaticity of the corrected target RGB value array, includes:
[0038] First, convert each group of RGB values in the target RGB value array to XYZ values. Then, convert the XYZ values to Lab values. Finally, convert the ab values in each Lab value group to chromaticity C and hue angle H to obtain the LCH value array. Multiply the chromaticity C in each LCH value group by a coefficient of 1.3, while keeping the L and H values unchanged, to obtain the adjusted LCH values, represented as:
[0039]
[0040] The adjusted LCH values of each group are inversely transformed to the Lab color space to obtain the adjusted Lab values, represented as follows:
[0041]
[0042] The adjusted Lab values of each group are inversely transformed to the XYZ color space to obtain the adjusted XYZ values, which are represented as follows:
[0043]
[0044] According to (Y′) 3 The size of Y′ is adjusted to determine the value of Y′. 3 When the value is greater than 0.008856, Y′=(Y′) 3 When (Y′) 3 When ≤0.008856, Y′=(Y′-16 / 116) / 7,787, make the same adjustments to X' and Z', and then use the standardized value X of the reference white point. n Y n Z n Normalization adjustments are made to X', Y', and Z', as follows:
[0045]
[0046] Each group X * Y * Z * The values are converted to the RGB color space to obtain the target RGB value array after chroma enhancement. The conversion process is represented as follows:
[0047]
[0048] The target RGB value array after chroma enhancement is represented as:
[0049]
[0050] Among them, [P' Rk ,P' Gk ,P' Bk [This refers to the enhanced chromaticity of the k-th color patch in the standard color chart.]
[0051] RGB values.
[0052] Furthermore, in step 4, the color correction matrix A is represented as:
[0053]
[0054] Let the linearized RGB value array O Linearize The product of the color correction matrix A and the color enhancement matrix A equals the target RGB value array P' after chroma enhancement, expressed as:
[0055]
[0056] Finally, the color correction matrix A is obtained.
[0057] The beneficial effects of this application are:
[0058] First, the technical solution in this application provides a piecewise gamma formula for precise linearization of input images. This piecewise gamma formula is used to linearize the image before adjusting its color. When the gray value of the pixel to be processed in the input image is less than the piecewise variable, the gamma polynomial fitting method is used to linearize the pixels of the input image. When the gray value of the pixel to be processed in the input image is greater than or equal to the piecewise variable, the gamma=1 method is directly used to linearize the pixels of the input image. The technical solution in this application separates the high-brightness region and the low-brightness region through the piecewise gamma formula and performs different types of linearization processing. This can maximize the brightness stretching of dark-toned products, improve their color differentiation, and avoid brightness compression of mid-brightness products, thereby improving the overall color reproduction accuracy of the image and reducing the ΔE value.
[0059] Traditional color correction methods typically assume the input image is linear without performing linearization. Existing color correction methods either directly use recommended color space values (such as gamma = 1.8 or 2.2) for linearization. These methods do not process the mid-to-high brightness and low brightness regions of the image separately. While stretching the brightness of low brightness regions, they also compress the brightness of mid-to-high brightness regions, which reduces the color discrimination of the image and is not conducive to the detection of color defects. In contrast, this invention uses a piecewise gamma formula to perform different linearization processes on different brightness regions, which can take into account the color reproduction accuracy of different brightness regions in the image, improve the overall color discrimination of the image, and thus effectively enhance the detection capability of color difference and color defects in printed materials.
[0060] Secondly, the technical solution in this application also provides a color enhancement method. This color enhancement method first converts the target RGB value to the LCH color space, adjusts the chromaticity C, and then inversely converts the adjusted LCH value back to the RGB color space. The technical solution in this application can improve the accuracy of image saturation through color enhancement while ensuring the accuracy of color reproduction, thereby further improving the detection capability of color difference and color-related defects in printed materials. In the inverse conversion process from LCH value to RGB value, the intermediate XYZ values are also standardized, so that each value in the color conversion process conforms to a unified standard. At the same time, by introducing brightness constraints, abrupt color changes in low-brightness areas are avoided, making the transition of low-brightness areas in the color conversion process smoother. The technical solution in this application can simultaneously achieve the effects of enhancing color accuracy, discrimination, and saturation, thereby improving the dynamic range of images acquired by the visual components.
[0061] Third, the color correction matrix obtained by the technical solution in this application can be directly burned into hardware acquisition cards or cameras and other devices. Compared with the calculation process of real-time color correction using software, the technical solution in this application can reduce memory consumption and computational load, and is more suitable for high-speed detection scenarios with high efficiency and low resource consumption.
[0062] Fourth, the color correction target data used in the technical solution of this application to calculate the color correction matrix is obtained by converting a device-independent color space Lab, which has strong versatility and adaptability. The Lab color space can describe colors more accurately and perform consistent color conversion between different devices, which can ensure the accuracy of transmission between different color device spaces. Attached Figure Description
[0063] The advantages of the above and / or additional aspects of this application will become apparent and readily understood in the description of the embodiments in conjunction with the following drawings, wherein:
[0064] Figure 1This is a schematic flowchart of a printing color correction method according to an embodiment of this application;
[0065] Figure 2 The image shows a comparison of the gamma curves corresponding to the traditional color correction method (Patent 1), the color correction method (Patent 2) in the background, and the color correction method of this application.
[0066] Figure 3 It is a comparison image of the color card image without color correction according to Example 1, the color card image after color correction using the methods of Patent 1 and Patent 2, the color card image after correction using the color correction method of this application, and the color card image after processing using the color correction and chromaticity enhancement method of this application.
[0067] Figure 4 It is a comparison image of a light purple mid-bright tone product without color correction based on Example 2, a light purple mid-bright tone product image after color correction using the methods of Patent 1 and Patent 2, a light purple mid-bright tone product image after color correction using the methods of this application, and a light purple mid-bright tone product image after processing using the color correction and chromaticity enhancement methods of this application.
[0068] Figure 5 It is a comparison image of a white highlight product image without color correction based on Example 3, a white highlight product image after color correction using the methods of Patent 1 and Patent 2, a white highlight product image after correction using the color correction method of this application, and a white highlight product image after processing using the color correction and chromaticity enhancement method of this application.
[0069] Figure 6 It is a comparison image of a dark blue product image without color correction based on Example 4, a dark blue product image after color correction using the methods of Patent 1 and Patent 2, a dark blue product image after color correction using the color correction method of this application, and a dark blue product image after processing using the color correction and chromaticity enhancement method of this application.
[0070] Figure 7 The image is a comparison of the following: a dark blue product image without color correction based on Example 5; a dark blue product image after color correction using the methods of Patent 1 and Patent 2; a dark blue product image after color correction using the color correction method of this application; and a dark blue product image after processing using the color correction and chromaticity enhancement method of this application. Detailed Implementation
[0071] To better understand the above-mentioned objectives, features, and advantages of this application, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of this application can be combined with each other.
[0072] In the following description, many specific details are set forth in order to provide a full understanding of this application. However, this application may also be implemented in other ways different from those described herein. Therefore, the scope of protection of this application is not limited to the specific embodiments disclosed below.
[0073] like Figure 1 As shown, this embodiment provides a method for color correction of printed materials, which specifically includes:
[0074] Step 1: Construct a piecewise gamma function using preset grayscale values as piecewise variables. Fit the unknown coefficients in the piecewise gamma function. Specifically, acquire a standard color chart image in a preset shooting environment. Use the piecewise gamma function to linearize the measured grayscale values corresponding to the grayscale blocks in the standard color chart image, making the linearized measured grayscale values equal to the known standard grayscale values. Establish a fitting formula. Based on the fitting formula, use the least squares method to fit the unknown coefficients of the piecewise function.
[0075] Step 11, construct the piecewise gamma function with n as the piecewise variable, expressed as:
[0076]
[0077] In the formula, a1, a2, a3, a4, and a5 are the coefficients to be fitted in the piecewise function, and O gray O' represents the measured grayscale value corresponding to the standard color chart image. gray The measured gray value is the normalized value, and n is the segmented variable, n∈(0,255).
[0078] Step 12: Use a camera to capture a standard color chart image in a preset shooting environment, and calculate the measured grayscale value O based on the RGB values corresponding to the grayscale color patches in the standard color chart image. gray Then, the measured grayscale value O gray Normalization was performed to obtain multiple sets of measured grayscale value data;
[0079] Specifically, the measured grayscale value O gray and the normalized measured gray value O' gray They are represented as follows:
[0080] O gray =0.299×O R +0.587×O G +0.114×O B
[0081]
[0082] In the formula, [O R O G OB are the RGB values corresponding to the grayscale color blocks in the standard color card image.
[0083] Step 13: calculating a standard grayscale value T based on the known standard RGB values corresponding to the grayscale color blocks in the standard color card gray , performing normalization processing on the standard grayscale value T gray ;
[0084] Specifically, the standard grayscale value T gray and the normalized standard grayscale value T' gray are respectively expressed as:
[0085] T gray = 0.299×T R + 0.587×T G + 0.114×T B
[0086]
[0087] in the formula, [T R , T G , T B are the standard RGB values corresponding to the grayscale color blocks in the known standard color card.
[0088] Step 14: performing linearization processing on the normalized measured grayscale value O' by using the corresponding term satisfying the condition O < n in the piecewise function, making the linearized measured grayscale value O' equal to the standard grayscale value T', establishing a fitting formula based on the equality relationship between the linearized measured grayscale value O' and the standard grayscale value T', extracting data satisfying the condition O < n from multiple sets of measured grayscale data, substituting the extracted data and the standard grayscale value T' into the fitting formula together, and performing fitting by using the least square method to obtain coefficients of the piecewise function; gray <n condition the corresponding item gray 进行线性化处理,令线性化后的实测灰度值O’ gray 等于标准灰度值T’ gray , based on linearized measured grayscale value O' gray and standard grayscale value T' gray the fitting formula is established based on the equality relationship between, extracting data satisfying the O < n condition from multiple sets of measured grayscale data, substituting the data together with the standard grayscale value T' gray <n condition the data, gray into the fitting formula, and fitting by the least square method to obtain the coefficients of the piecewise function;
[0089] the term corresponding to the condition O < n in the gamma piecewise function is gray <n condition the corresponding term is linearizing O' gray by using the term, and establishing a fitting formula for O' gray and T' gray :
[0090]
[0091] after deforming the fitting formula, the following is obtained:
[0092]
[0093] In the formula, m is the number of data groups extracted from multiple sets of measured gray value data that satisfy O gray <n condition, and i is the i-th extracted data group.
[0094] Based on the above fitting formula, fitting is performed by the least square method, which specifically includes:
[0095] Extracting m groups of data satisfying O gray <n condition from multiple sets of measured gray value data, and combining the m groups of data with T' gray and substituting them into the fitting formula together to obtain m equations, converting the m equations into the form of XN=y, wherein X is a matrix of m×5 with respect to O' gray_i , the form of each row is [1, x 4 , x 3 , x 2 , x], which corresponds to terms in the gamma piecewise function, N is a fitting coefficient matrix, N=[a1, a2, a3, a4, a5] T , the superscript T represents matrix transposition, y is an m×1 matrix with respect to , calculate X T X = X T ×X, X T y = X T ×y, then solve the normal equation X T XN = X T y to obtain N = (X T X) -1 X T y, finally obtain the coefficients a1, a2, a3, a4, a5 of the piecewise function, and substitute these coefficients into the constructed gamma piecewise function.
[0096] In this embodiment, m = 6 gray scale patches can be used, and the coefficients a1, a2, a3, a4, a5 of the piecewise function are obtained by the least square method; the specific process includes the following steps:
[0097] For example: the gray values of the input 6 gray patches are respectively [196, 124, 80, 45, 25, 11], and the standard gray values are [247, 198, 159, 120, 83, 39], thus 6 equations are obtained:
[0098]
[0099] Converting the above 6 equations into the form of XN=y, N=[a1,a2,a3,a4,a5] T , X and y are respectively:
[0100]
[0101] Solve for N = (X) T X) -1 X T The final coefficients of the piecewise function are: a1≈0.5000, a2≈-0.2000, a3≈0.3000, a4≈-0.4000, a5≈0.1000.
[0102] Step 2: Use the gamma piecewise function to linearize the original RGB value array corresponding to the acquired standard color card image to obtain the linearized RGB value array.
[0103] The original RGB value array corresponding to the standard color chart image is represented as:
[0104]
[0105] In the formula, K is the total number of color patches in the standard color chart, [O Rk O Gk O Bk [] represents the original RGB value corresponding to the k-th color patch in the standard color chart image;
[0106] The grayscale value O corresponding to each color patch is calculated based on the original RGB values of the standard color chart image. k,gray For grayscale value O k,gray Perform normalization processing, and then set the normalized grayscale value O. k,gray The values are substituted into the gamma piecewise function, and then the original RGB value array of the standard color chart image is linearized using the gamma piecewise function to obtain the linearized RGB value array. The calculation process of linearization is expressed as follows:
[0107]
[0108] In the formula, O Linearize_Rk R is the linearized value of the k-th color patch in the standard color chart image, O Linearize_Gk and O Linearize_Bk These are the linearized G and B values corresponding to the k-th color patch in the standard color chart image, respectively. Their calculation process is similar to that of O... Linearize_Rk The same applies, so I won't repeat it here; the final linearized RGB value array is represented as follows:
[0109]
[0110] In the formula, O Linearize This is a linearized array of RGB values corresponding to the standard color chart image.
[0111] Step 3: Obtain the corrected target RGB value array based on the known standard RGB values corresponding to each color block in the standard color chart. Perform chromaticity adjustment on the corrected target RGB value array to enhance the chromaticity of the target image to be corrected. Specifically, transform the target RGB value array to the LCH color space, adjust the chromaticity C value, and then inversely transform the adjusted LCH value to the RGB color space to obtain the chromaticity-enhanced target RGB value array.
[0112] Using the standard RGB values corresponding to each color patch in the standard color chart as the target RGB values, set the corrected target RGB value array, represented as:
[0113]
[0114] Among them, [P Rk ,P Gk ,P Bk [] represents the initial target RGB value corresponding to the k-th color patch in the standard color chart;
[0115] First, convert each group of RGB values in the target RGB value array to XYZ values. Then, convert the XYZ values to Lab values. Finally, convert the ab values in each Lab value group to chromaticity C and hue angle H to obtain the LCH value array. Multiply the chromaticity C in each LCH value group by a coefficient of 1.3, while keeping the L and H values unchanged, to obtain the adjusted LCH values, represented as:
[0116]
[0117] The adjusted LCH values of each group are inversely transformed to the Lab color space to obtain the adjusted Lab values, represented as follows:
[0118]
[0119] The adjusted Lab values of each group are inversely transformed to the XYZ color space to obtain the adjusted XYZ values, which are represented as follows:
[0120]
[0121] According to (Y′) 3 The size of Y′ is adjusted to determine the value of Y′. 3 When the value is greater than 0.008856, Y′=(Y′) 3 When (Y′) 3 When the value is ≤0.008856, Y′=(Y′-16 / 116) / 7,787. The same adjustments are made to X' and Z' to ensure consistent image color under different brightness conditions, avoiding abrupt color changes in low-brightness areas while maintaining color accuracy in high-brightness areas. After adjusting X', Y', and Z', the image is then processed according to the standardized value X of the reference white point.n Y n Z n (n stands for normalized) Normalize X', Y', and Z' so that each value is expressed under a unified standard. The normalized X', Y', and Z' are represented as:
[0122]
[0123] In the formula, X * Y * Z * These are the normalized X', Y', and Z' values;
[0124] Each group X * Y * Z * The values are converted to the RGB color space to obtain the target RGB value array after chroma enhancement. The conversion process is represented as follows:
[0125]
[0126] In the formula, R', G', and B' are the adjusted RGB values; the target RGB value array after chromatic enhancement is represented as:
[0127]
[0128] Among them, [P' Rk ,P' Gk ,P' Bk [This refers to the enhanced chromaticity of the k-th color patch in the standard color chart.]
[0129] RGB values.
[0130] Step 4: Set the color correction matrix to be determined. Make the product of the linearized RGB value array corresponding to the standard color chart image and the color correction matrix equal to the target RGB value array after chromaticity enhancement, and calculate the color correction matrix.
[0131] Let the color correction matrix A to be determined be:
[0132]
[0133] Let the linearized RGB value array O Linearize The product of the color correction matrix A and the color enhancement matrix A equals the target RGB value array P' after chroma enhancement, expressed as:
[0134]
[0135] Finally, the color correction matrix A is obtained according to the above formula.
[0136] Step 5: Acquire the target image in the same shooting environment, use the gamma piecewise function to linearize the original RGB values corresponding to the target image, and then multiply the linearized RGB value array with the color correction matrix A to obtain the corrected target image.
[0137] Specifically, the original RGB value array corresponding to the target image is denoted as E, and represented as:
[0138]
[0139] Where J is the total number of pixels in the target image, [E Rj E Gj E Bj [] represents the original RGB value corresponding to the j-th pixel in the target image;
[0140] The original RGB value array of the target image is linearized using the gamma piecewise function to obtain the linearized RGB value array of the target image. The linearization process is represented as follows:
[0141]
[0142] In the formula, E j,gray Let E′ be the measured gray value corresponding to the j-th pixel in the target image. j,gray E represents the normalized measured gray value corresponding to the j-th pixel in the target image. Linearize_Ri E is the linearized R value corresponding to the j-th pixel in the target image. Linearize_Gj and E Linearize_Bj Let G and B be the linearized values corresponding to the j-th pixel in the target image, respectively. Their calculation process is similar to that of O. Linearize_Rj The same applies, so I won't repeat it here; the linearized target image RGB value array is represented as follows:
[0143]
[0144] Multiplying the linearized target image RGB value array by the color correction matrix A yields the corrected target image RGB value array, represented as:
[0145]
[0146] In the formula, F is the RGB value array of the corrected target image. The corrected target image is obtained by visualizing the RGB value array F of the target image.
[0147] It should be noted that the above-mentioned color correction method for printed materials can be applied to the process of detecting defects in printed materials. The specific process of detecting defects in printed materials includes: preparing standard printed materials and printed materials to be inspected; using color correction matrix A to perform color correction processing on the standard printed materials and printed materials to be inspected respectively; setting a difference threshold for the corrected printed materials; comparing the corrected printed materials to be inspected with the corrected standard printed materials; for a single region of interest, if the difference between the average RGB values of the two images is greater than the difference threshold, the printed materials to be inspected are determined to be unqualified, and the host computer issues an alarm prompt; if the difference between the RGB values of the two images is greater than the threshold, the printed materials to be inspected are determined to be qualified.
[0148] In this embodiment, the region of interest can be delineated using existing methods, such as the Canny edge detection algorithm. The difference threshold is set according to the quality requirements of the current printed product, such as the maximum allowable deviation value of the current printed product. Different printed products have different quality standards. For example, for high-precision printed products (such as brand logos, packaging designs, etc.), the difference threshold is smaller.
[0149] like Figure 2 The images show the gamma curves corresponding to the traditional color correction method, the color correction method in Patent 2 in the background, and the color correction method in this application. The method in Patent 1 is similar to the traditional method, with a fixed slope of its gamma curve. The slope of the gamma curve corresponding to the method in Patent 2 changes with the input grayscale value. Neither of these two methods sets a piecewise variable and performs uniform linearization processing on the colors of high-brightness and low-brightness areas. The gamma curve corresponding to the method in this application sets a piecewise variable and performs different linearization processing on the colors of high-brightness and low-brightness areas.
[0150] It should be noted that, during the process of image color correction, the technicians of this application accidentally discovered that existing gamma functions do not handle image processing with sufficient detail. Although they can stretch the overall brightness of an image, they produce different stretching effects on different brightness areas. Taking the method in typical patent 2 as an example, the stretching effect is better when the image grayscale value is below 170, but above 170, it inhibits the brightness increase, producing an undesirable effect. The reason is that when ordinary gamma functions process images, they perform exponentiation based on the input grayscale value. Due to the non-linear characteristics of the gamma function, the function's graph is usually an "upward-curving" curve, meaning that the exponentiation changes more drastically in low-brightness areas, while the changes are more gradual in high-brightness areas. In this case, the grayscale value changes in low-brightness areas are stretched, while the grayscale value changes in high-brightness areas are suppressed. Specifically, when the gamma value is less than 1, the brightness of low grayscale value areas will be significantly increased, while the brightness of high grayscale value areas will not change much, resulting in the loss of detail in the bright parts of the image and producing an undesirable "over-compression" effect.
[0151] In this invention, while ensuring the color correction method Provided that the two indicators of Mean Camera Chroma are superior to those of Patent 2 (i.e., the indicators of this application), The Mean Camera Chroma (Patent 2) of this application yielded n=170 in experiments. This invention uses a grayscale value of 170 as a segmented variable to separate low-brightness and high-brightness regions, and introduces a piecewise function. Different gamma curves are applied for correction in different grayscale value ranges (0-170 and 170-255), which can more accurately control the changes in grayscale values. While ensuring the stretching of low-brightness regions, it avoids excessive compression or suppression of high-brightness regions, and better balances the effects of dark tone stretching and bright tone suppression of grayscale values. The piecewise gamma function effectively avoids the limitations of traditional gamma functions, improves the processing effect of images in different brightness regions, avoids the loss of image details, and makes the details of the corrected image clearer and more natural.
[0152] Example 1:
[0153] Prepare a diffused illumination source, an SG standard color chart, and a color acquisition device for the experiment. The diffused illumination source can be a tunnel light, surface light, or strip light source. The color acquisition device should be a 3-line RGB or 3CCD color camera.
[0154] The SG standard color card is uniformly illuminated by a diffused lighting source, and the SG standard color card image is acquired by a color acquisition device under a preset shooting environment. The acquired SG standard color card images are color corrected by the methods of Patent 1 and Patent 2 in the background art and the method in this application, respectively. The images without color correction, the images with color correction by the methods of Patent 1 and Patent 2, the images with color correction by the color correction method of this invention, and the images with color correction and color enhancement by the color enhancement method of this invention are evaluated using two indicators: color difference value and average camera chromaticity.
[0155] The color difference value is a quantitative indicator that measures the degree of difference between the colors of a standard color chart image captured by a camera and the colors of an ideal standard color chart. The smaller the color difference value, the better the color reproduction of the color correction method. In this example, the CIELAB 1976 color difference formula is selected, and the calculation is performed in the Lab color space. The Lab color space is closer to human vision, the perception is more uniform, and it is easier to observe with the naked eye. The CIELAB 1976 color difference formula is as follows:
[0156]
[0157] In the formula, The chromaticity values corresponding to the standard color chart image captured by the camera. The chromaticity value corresponds to the ideal standard color chart.
[0158] Mean Camera Chroma (or saturation) is the ratio of the average chromaticity of a standard color chart captured by the camera to the average chromaticity of an ideal standard color chart. It reflects the accuracy of color saturation reproduction. The closer this value is to 100%, the more accurate the color correction (i.e., the better the saturation accuracy of the color correction method). The calculation formula is as follows:
[0159]
[0160] In the formula, a i b i Let a be the chromaticity value corresponding to the i-th color patch in the standard color chart captured by the camera. i_ideal b i_ideal Let be the chromaticity value corresponding to the i-th color patch in the ideal standard color chart.
[0161] After completing the calibration, the result is obtained Figure 3 The comparison images shown below were analyzed. The average color difference and average camera chromaticity were calculated for each of the five images, resulting in the following table:
[0162] Table 1
[0163]
[0164] Figure 3 Image (a) is the image without color correction. Figure 3 Image (b) is the color-corrected image using the method of Patent 1. Figure 3 Image (c) is the color-corrected image using the method of Patent 2. Figure 3 Image (d) is the image after color correction using the color correction method of this application. Figure 3 Image (e) in the image has been processed using the color correction and chromaticity enhancement methods of this application. Figure 3 It can be seen that without color correction, the color blocks in the original image are blurry, and some color blocks are too dark to be distinguished by the naked eye. The image after color correction using Patent 1 shows a slight improvement in the clarity and saturation of the color blocks, but some color blocks are still too dark to be distinguished by the naked eye. The image after color correction using the method of Patent 2 shows clearer color blocks that can be distinguished by the naked eye, with a significant increase in brightness in the darker color blocks, making them clearly distinguishable by the naked eye, but the image saturation is reduced. The image processed using the color correction and chromaticity enhancement method of this application is the clearest, clearly distinguishable by the naked eye, with high overall brightness and saturation. Besides... Figure 3 Furthermore, as clearly shown in Table 1, the average color difference between the uncorrected color chart image and the ideal standard color chart is 29.45, and the average camera chromaticity is 60.32%, indicating poor color reproduction and low saturation accuracy. After correction using the method of Patent 1, the average color difference between the color chart image and the ideal standard color chart is 27.41, and the average camera chromaticity is 105.8%. Although the saturation is improved, the color reproduction is still relatively poor. After correction using the method of Patent 2, the average color difference between the color chart image and the ideal standard color chart is 11.76, and the average camera chromaticity is 83.2%. Compared to the uncorrected image, both indicators are significantly improved. The results show improvement. After using the color correction method of this invention, the average color difference between the color chart image and the ideal standard color chart is 10.64, and the average camera chromaticity is 96.28%. After using the chromaticity enhancement method of this invention, the average color difference between the color chart image and the ideal standard color chart is 6.84, and the average camera chromaticity is 104.4%. Compared with the previous four sets of images, both indicators have been significantly improved. The color reproduction is good and the saturation accuracy is high, resulting in a better overall reproduction effect. The color correction and chromaticity enhancement methods of this application are significantly better than those of Patent 1 and Patent 2, and can improve color reproduction while enhancing color saturation.
[0165] Example 2:
[0166] Prepare a diffused lighting source, a color acquisition device, and a defective pale purple mid-brightness product. The diffused lighting source can be a tunnel light, surface light, or strip light source, and the color acquisition device can be a 3-line RGB or 3CCD color camera.
[0167] A light purple mid-brightness product was uniformly illuminated using a diffused lighting source. A color acquisition device was used to capture the image of the light purple mid-brightness product. The product image was then color-corrected using the methods described in Patents 1 and 2 in the background art, as well as the method described in this application. Figure 4 The comparison chart shown is as follows. Figure 4 (a) is a pale purple image with bright tones that has not been color corrected. Figure 4 Image (b) is a light purple, mid-brightness product image after color correction using Patent 1. Figure 4 (c) is a light purple mid-tone image after color correction using the method of Patent 2. Figure 4 Image (d) in the image is a light purple mid-tone image after color correction using the color correction method of this application. Figure 4 Image (e) is a light purple mid-brightness product image processed using the color correction and chromaticity enhancement methods of this application;
[0168] from Figure 4 As can be seen, without color correction, a large area of white spot defects is clearly visible in the light purple background. After color correction using the method of Patent 1, the large area of white spot defects is clearly visible, but the image is dark. After color correction using the method of Patent 2, the contrast of the large area of white spot defects in the image is reduced, and the color distinction between the defects and the background in the image is low, which easily leads to detection errors. After color correction and color enhancement using the method of this application, the large area of white spot defects in the image can be clearly seen, and the overall color of the image is brighter. The color distinction between the defects and the background in the image is high, and the large area of white spot defects can be accurately detected.
[0169] Example 3:
[0170] Prepare a diffused lighting source, a color acquisition device, and a white high-brightness product with defects. The diffused lighting source can be a tunnel light, surface light, or strip light source. The color acquisition device should be a 3-line RGB or 3CCD color camera.
[0171] A white, high-brightness product is uniformly illuminated using a diffused lighting source. An image of the white, high-brightness product is captured using a color acquisition device. The image is then color-corrected using the methods described in Patents 1 and 2 in the background art, as well as the method described in this application. Figure 5 The comparison chart shown is as follows. Figure 5 (a) is a white highlight product image without color correction. Figure 5 (b) shows a white highlight product image after color correction using Patent 1. Figure 5 (c) A white, high-brightness product image after color correction using the method of Patent 2. Figure 5 Image (d) in the image is a white highlight product image after color correction using the method described in this application. Figure 5 Image (e) is a white highlight product image after color correction using the color correction and chromaticity enhancement methods of this application;
[0172] from Figure 5 As can be seen, without color correction, the blue-black defects in the image are clearly visible. After color correction using the method of Patent 1, the blue-black defects are more clearly visible, but the image is darker. After color correction using the method of Patent 2, the contrast of the blue-black defects in the image is reduced, and the color distinction between the blue-black defects and the background is low, which easily leads to detection errors. After color correction and color enhancement using the method of this application, the blue-black defects in the image are clearly visible, and the overall color of the image is brighter. The color distinction between the blue-black defects and the background is high, and the blue-black defects can be accurately detected.
[0173] Example 4:
[0174] Prepare a diffused lighting source, a color acquisition device, and a defective dark blue product. The diffused lighting source can be a tunnel light, surface light, or strip light source, and the color acquisition device can be a 3-line RGB or 3CCD color camera.
[0175] A dark blue product is uniformly illuminated using a diffused lighting source, and an image of the dark blue product is captured using a color acquisition device. The dark blue product image is then color-corrected using both the method described in Patent 2 in the background art and the method described in this application. Figure 6 The comparison chart shown is as follows. Figure 6 (a) is an uncorrected dark blue product image. Figure 6 Image (b) shows a dark blue product image after color correction using the method described in Patent 1. Figure 6 Image (c) shows a dark blue product image after color correction using the method described in Patent 2. Figure 6 Image (d) in the image is a dark blue product image after color correction using the method described in this application. Figure 6 Image (e) is a dark blue product image processed using the color correction and chromaticity enhancement methods of this application;
[0176] from Figure 6It can be seen that without color correction and when color correction is performed using the method of Patent 1, the blue ink spot defect in the image cannot be seen at all. After color correction using the method of Patent 2, the blue ink spot defect in the image can be seen, but the overall color of the image is dark, and the color distinction between the blue ink spot defect and the background is low, which easily leads to detection errors. After color correction using the method of this application, the blue ink spot defect in the image can be clearly seen, and the overall color of the image is bright. The color distinction between the blue ink spot defect and the background is high, and the blue ink spot defect can be accurately detected.
[0177] Example 5:
[0178] Prepare a diffused lighting source, a color acquisition device, and a defective dark blue product. The diffused lighting source can be a tunnel light, surface light, or strip light source, and the color acquisition device can be a 3-line RGB or 3CCD color camera.
[0179] A dark blue product is uniformly illuminated using a diffused lighting source, and an image of the dark blue product is captured using a color acquisition device. The dark blue product image is then color-corrected using both the method described in Patent 2 in the background art and the method described in this application. Figure 7 The comparison chart shown is as follows. Figure 7 (a) is an uncorrected dark blue product image. Figure 7 Image (b) shows a dark blue product image after color correction using the method described in Patent 1. Figure 7 Image (c) shows a dark blue product image after color correction using the method described in Patent 2. Figure 7 Image (d) in the image is a dark blue product image after color correction using the color correction method of this application. Figure 7 Image (e) is a dark blue product image processed using the color correction and chromaticity enhancement methods of this application;
[0180] from Figure 7 As can be seen, without color correction and with the method of Patent 1, the image is very dark and the white line defect in the image is completely invisible. After color correction with the method of Patent 2, the white line defect in the image can be seen, but the color distinction between the defect and the background in the image is low, making it easy to detect the defect incorrectly. After color correction with the method of this application, the white line defect in the image can be clearly seen, and the overall color of the image is brighter. The color distinction between the white line defect and the background in the image is high, and the white line defect can be accurately detected.
[0181] The experimental results from Examples 1 to 5 show that the color correction method in this application can effectively restore the color of the product image, improve the image saturation, and thus improve the detection capability of color difference and color-related defects in printed materials.
[0182] The steps in this application can be rearranged, combined, or deleted according to actual needs.
[0183] The units in the device of this application can be merged, divided, and deleted according to actual needs.
[0184] Although this application has been disclosed in detail with reference to the accompanying drawings, it should be understood that these descriptions are merely exemplary and not intended to limit the application of this application. The scope of protection of this application is defined by the appended claims and may include various variations, modifications, and equivalents of the invention without departing from the scope and spirit of this application.
Claims
1. A method for color correction of printed materials, characterized in that, The printed matter color correction method includes: Step 1: Construct a piecewise gamma function using preset grayscale values as piecewise variables. Fit the unknown coefficients in the piecewise gamma function. Specifically, acquire a standard color chart image in a preset shooting environment. Use the piecewise gamma function to linearize the measured grayscale values corresponding to the grayscale patches in the standard color chart image, making the linearized measured grayscale values equal to the known standard grayscale values. Establish a fitting formula. Based on the fitting formula, use the least squares method to fit the unknown coefficients of the piecewise function. The piecewise gamma function is expressed as: ; In the formula, a1, a2, a3, a4, and a5 are the coefficients to be fitted in the piecewise function, and O gray O' represents the measured grayscale value corresponding to the standard color chart image. gray The measured grayscale value after normalization, where n is the piecewise variable; Step 2: Use the gamma piecewise function to linearize the original RGB value array corresponding to the standard color chart image to obtain the linearized RGB value array; Step 3: Based on the known standard RGB values corresponding to each color block in the standard color chart, obtain the corrected target RGB value array. Perform chromaticity adjustment on the target RGB value array to enhance the chromaticity of the target image to be corrected. Specifically, transform the target RGB value array to the LCH color space, adjust the chromaticity C value, multiply the chromaticity C value in each LCH value by a coefficient of 1.3, keep the L and H values unchanged, and then inversely transform the adjusted LCH values to the RGB color space to obtain the chromaticity-enhanced target RGB value array. Step 4: Set the color correction matrix to be determined. Make the product of the linearized RGB value array corresponding to the standard color chart image and the color correction matrix equal to the target RGB value array after chromaticity enhancement, and calculate the color correction matrix. Step 5: Acquire the target image in the same shooting environment, use the gamma piecewise function to linearize the original RGB values corresponding to the target image, and then multiply the linearized RGB value array with the color correction matrix A to obtain the corrected target image.
2. The method for color correction of printed matter as described in claim 1, characterized in that, Step 1 specifically includes the following steps: Step 11: Construct a piecewise gamma function with n as the piecewise variable, where n ∈ (0, 255). Step 12: Use a camera to capture a standard color chart image in a preset shooting environment, and calculate the measured grayscale value O based on the RGB values corresponding to the grayscale color patches in the standard color chart image. gray Then, the measured grayscale value O gray Normalization was performed to obtain multiple sets of measured grayscale value data; Step 13: Calculate the standard grayscale value T based on the known standard RGB values corresponding to the grayscale color patches in the standard color chart. gray For standard grayscale value T gray Perform normalization processing; Step 14, using piecewise functions The corresponding term of the condition corresponds to the normalized measured gray value O' gray Perform linearization processing, and let the linearized measured gray value O' gray Equal to the standard grayscale value T' gray Based on the linearized measured gray value O' gray Compared with standard gray value T' gray A fitting formula is established based on the equation relationship between them, and the formula is extracted from multiple sets of measured grayscale data that satisfy the equation. The data under the given conditions is compared with the standard grayscale value T'. gray Substitute these values into the fitting formula and use the least squares method to fit the piecewise function to obtain its coefficients.
3. The method for color correction of printed materials as described in claim 2, characterized in that, The fitting formula in step 14 is expressed as follows: ; After transforming the fitting formula, we get: ; In the formula, m is the value extracted from multiple sets of measured grayscale data that satisfies the condition. The number of data sets for the condition, where i is the i-th data set extracted.
4. The method for color correction of printed matter as described in claim 2, characterized in that, In step 2, the original RGB value array corresponding to the standard color chart image is represented as follows: ; In the formula, K is the total number of color patches in the standard color chart, [O Rk O Gk O Bk [ ] represents the original RGB value corresponding to the k-th color patch in the standard color chart image.
5. The method for color correction of printed materials as described in claim 4, characterized in that, Step 2 specifically includes: The grayscale value O corresponding to each color patch is calculated based on the original RGB values of the standard color chart image. k,gray For grayscale value O k,gray Perform normalization processing, and then set the normalized grayscale value O. k,gray The values are substituted into the gamma piecewise function, and then the original RGB value array of the standard color chart image is linearized using the gamma piecewise function to obtain the linearized RGB value array. The calculation process of linearization is expressed as follows: ; In the formula, The linearized R value corresponding to the k-th color patch in the standard color chart image. and The calculation process and The same applies, so I won't repeat it here; the final linearized RGB value array is represented as follows: ; In the formula, This is a linearized array of RGB values corresponding to the standard color chart image.
6. The method for color correction of printed matter as described in claim 1, characterized in that, In step 3, the corrected target RGB value array is obtained based on the known standard RGB values corresponding to each color block in the standard color chart. Specifically, this includes: Using the standard RGB values corresponding to each color patch in the standard color chart as the target RGB values, set the corrected target RGB value array, represented as: ; Among them, [P] Rk , P Gk ,P Bk ] represents the initial target RGB value corresponding to the k-th color block in the standard color chart.
7. The method for color correction of printed matter as described in claim 6, characterized in that, Step 3, specifically adjusting the chromaticity of the corrected target RGB value array, includes: First, convert each group of RGB values in the target RGB value array to XYZ values. Then, convert the XYZ values to Lab values. Finally, convert the ab values in each Lab value group to chromaticity C and hue angle H to obtain the LCH value array. Multiply the chromaticity C in each LCH value group by a coefficient of 1.3, while keeping the L and H values unchanged, to obtain the adjusted LCH values, represented as: ; The adjusted LCH values of each group are inversely transformed to the Lab color space to obtain the adjusted Lab values, represented as follows: ; The adjusted Lab values of each group are inversely transformed to the XYZ color space to obtain the adjusted XYZ values, which are represented as follows: ; according to Size adjustment The value when When >0.008856, ,when At 0.008856, Make the same adjustments to X' and Z', and then use the normalized value X of the reference white point. n Y n Z n Normalization adjustments are made to X', Y', and Z', as follows: ; Each group , , The values are converted to the RGB color space to obtain the target RGB value array after chroma enhancement. The conversion process is represented as follows: ; The target RGB value array after chroma enhancement is represented as: ; Among them, [P' Rk , P' Gk ,P' Bk [ ] represents the enhanced RGB value of the k-th color patch in the standard color chart.
8. The method for color correction of printed matter as described in claim 7, characterized in that, In step 4, the color correction matrix A is represented as: ; Let the linearized RGB value array The product of the color correction matrix A and the color enhancement matrix A equals the target RGB value array P' after chroma enhancement, expressed as: ; Finally, the color correction matrix A is obtained.
Citation Information
Patent Citations
Image color correction method, apparatus and system
CN108712639A
Rapid color correction device and method for industrial camera
CN115474028A
Image color correction method and device
CN112839216A
Color processing apparatus and method thereof
JP2014204174A