Color camera color correction method, system and device and medium
By combining transparent color cards with color measurement equipment, the problems of unevenness and occlusion of surface light sources in color correction of color cameras are solved, achieving highly accurate and efficient color correction that meets the color correction effect perceived by the human eye.
Patent Information
- Application Number
- CN202511156294.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-19
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2045-08-19
AI Technical Summary
Existing color correction methods for color cameras are affected by the non-uniformity of surface light sources and light source occlusion, resulting in insufficient color correction accuracy and an inability to accurately reflect the color perception of the human eye.
By combining transparent color cards with color measurement equipment, accurate color correction matrices are obtained through lens shading correction, white balance correction, and light source correction coefficient calculation. Transmissive color cards are used to solve light source obstruction problems, correct for surface light source non-uniformity, and fit measured color data to conform to human eye perception.
It significantly improves the accuracy of color correction, eliminates lens shading effects, ensures image brightness uniformity and color deviation correction, conforms to human visual perception, and reduces computational complexity and time cost.
Smart Images

Figure CN120676258A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of camera calibration, and in particular relates to a color calibration method, system, device and medium for a color camera. Background Art
[0002] The common principle of color imaging in color cameras is to use a Bayer filter to make each pixel of the image sensor sense one color of light, arrange adjacent pixels in an RGGB format, and then use an interpolation algorithm to make each pixel have RGB color information.
[0003] Due to limitations in the Bayer filter manufacturing process, the image sensor's spectral response curves for the three colors differ from those of the human eye, resulting in discrepancies between the captured image colors and the colors seen by the human eye. Furthermore, each image sensor has a different spectral response curve, necessitating a color correction algorithm to bring the captured image colors closer to what the human eye perceives. The most commonly used algorithm multiplies the camera's RGB data output by a 3×3 matrix (also known as a CCM matrix) to produce the corrected RGB data.
[0004] Traditional CCM matrix parameters are typically obtained by capturing a reflective color chart image and fitting it to the true color chart value, which is typically provided by the color chart manufacturer. A drawback of this method is that the true color chart value is affected by the surface light source. Different surface light sources have different spectra, resulting in different color coordinates reflected by the color chart. If a color measurement device is used to calibrate the color chart, the light from the surface light source hitting the color chart will be blocked because the color measurement device probe needs to receive light at close range, making it impossible to obtain accurate color information. Furthermore, since the color information measured by the color measurement device is affected by the non-uniformity of the surface light source, the measurement results will be biased, further affecting the accuracy of color calibration.
[0005] Therefore, in order to obtain accurate color correction results, the present invention provides a color correction method, system, device and medium for a color camera. Summary of the Invention
[0006] The purpose of the present invention is to overcome the above-mentioned problems existing in the prior art and provide a color correction method, system, device and medium for a color camera. For the technical problem of non-uniformity caused by surface light sources during color correction, a correction matrix is obtained through the actual measurement results of a transparent color card, and combined with the uniformity correction calculation process of the surface light source to improve the accuracy of color correction.
[0007] In order to achieve the above technical objectives and the above technical effects, the present invention is implemented through the following technical solutions: A color correction method for a color camera, based on image data collected by the color camera, uses target color data to fit and obtain color correction parameters, the correction method comprising: Fix the area light source and the color camera facing it to complete lens shading correction and white balance correction; Calculate the light source correction coefficient of each area of the surface light source to correct the non-uniformity of the surface light source; Fixing the transmissive color card so that it is located between the surface light source and the color camera and parallel to the surface light source; Calculating XYZ correction values for each color block on the transmissive color chart to convert them into LAB correction values; the XYZ correction values are calculated using the light source correction coefficients and XYZ original values, which are obtained by measuring the transmitted light of a surface light source through the transmissive color chart using a color measurement device; Fitting the measured color data and the LAB correction value to obtain a correction matrix as a color correction parameter; the measured color data is obtained by measuring the transmitted light of the area light source passing through the transmissive color card with a color camera; The light source correction coefficient is inversely proportional to the sum of the XYZ components of each light source area, and the XYZ components of each area are measured by a color measurement device; each light source area corresponds to each color block of the transmissive color card.
[0008] Furthermore, lens shading correction includes: Collect the surface light source image taken by the color camera and divide it into several areas; Calculate the total grayscale average value under each channel of the surface light source image and the grayscale average value corresponding to each area, and use the quotient of the total grayscale average value and the grayscale average value corresponding to each area as the lens correction coefficient of each area; The grayscale values of all pixels under each channel of the surface light source image are extracted, and the lens correction coefficients of the corresponding areas of each pixel are used to correct them to obtain the corrected image data.
[0009] Furthermore, white balance correction includes: Collect the area light source image captured by the color camera to obtain the maximum value of each RGB component; Calculate the quotient of the maximum value of all components in the surface light source image and the maximum value of each RGB component as the gain coefficient of each RGB component; Calculate the product of each RGB component data of the surface light source image and the corresponding gain coefficient to achieve white balance correction.
[0010] Furthermore, the color measurement device uses a colorimeter for measurement, and the distance between the colorimeter probe and each color block of the color card is kept consistent.
[0011] Furthermore, the specific calculation formula of the light source correction coefficient is as follows: α i =S light_XYZ_min / S light_XYZ (i); Among them, i is the serial number corresponding to different areas of the surface light source, α i is the light source correction coefficient corresponding to different areas of the surface light source, S light_XYZ_min It is the minimum value in the set formed by the sum of the XYZ components corresponding to all areas of the surface light source, S light_XYZ (i) is the sum of the XYZ components corresponding to different areas of the surface light source.
[0012] Furthermore, the specific calculation formula of the XYZ correction value is as follows: X target (i)=X card (i)×α i ; Y target (i)=Y card (i)×α i ; Z target (i)=Z card (i)×α i ; Among them, X target (i) is the X component correction value corresponding to each color block of the color card, X card (i) is the original value of the X component corresponding to each color block of the color card, Y target (i) is the Y component correction value corresponding to each color block of the color card, Y card (i) is the original value of the Y component corresponding to each color block of the color card, Z target (i) is the Z component correction value corresponding to each color block of the color card, Z card (i) is the original value of the Z component corresponding to each color block of the color card.
[0013] Furthermore, fitting the correction matrix based on the target color data includes: Collect the measured color data of each color block of the color card, that is, the measured RGB data, and calculate the simulated RGB data after the simulation matrix correction; Converting analog RGB data to LAB color space to obtain analog LAB data; When the sum of the squares of the Euclidean distances between the simulated LAB data and the target color data is minimized, the corresponding simulation matrix is used as the correction matrix.
[0014] The present invention also provides a color correction system for a color camera, comprising: Camera calibration module, used to complete lens shading correction and white balance correction of color cameras; A light source correction module is configured to calculate a light source correction coefficient for each area of the surface light source to correct for non-uniformity of the surface light source; wherein the light source correction coefficient is inversely proportional to the sum of the XYZ components of each area of the light source, and the XYZ components of each area are measured by a color measurement device; and each area of the light source corresponds one-to-one to each color block of the transmissive color card; a target analysis module for calculating XYZ correction values for each color block on the transmissive color chart to convert them into LAB correction values; the XYZ correction values are calculated using the light source correction coefficients and the XYZ original values, which are obtained by measuring the transmitted light of a surface light source through the transmissive color chart using a color measurement device; The correction analysis module is used to fit the measured color data and the LAB correction value to obtain a correction matrix as a color correction parameter; the measured color data is obtained by measuring the transmitted light of the area light source through the transmissive color card with a color camera.
[0015] The present invention also provides a color correction device for a color camera, comprising: Surface light source, used to provide lighting environment; A color camera is installed aligned with the surface light source so that the light-collecting surface of the color camera faces the surface light source; A transmissive color card is arranged between the surface light source and the color camera and is parallel to the surface light source; Color measurement equipment, used to measure the transmitted light of a surface light source passing through a color card; A processor is used to execute the above correction method.
[0016] The present invention also provides a computer-readable storage medium comprising a computer program, wherein the computer program implements the correction method when executed by a processor.
[0017] The beneficial effects of the present invention are: (1) The present invention performs color correction of a color camera based on a color card illuminated by an actual surface light source, thereby preventing the true value of the color card provided by the manufacturer from being affected by the actual surface light source. The transmissive color card solves the problem of surface light source occlusion during target color data measurement, and the light source correction coefficient solves the problem of surface light source uniformity. This significantly improves the accuracy of color correction as a whole, as follows: By shooting a surface light source to complete the lens shading correction and white balance correction of the color camera, effective correction of the color camera is achieved. Lens shading correction is performed in combination with the surface light source in the actual scene, eliminating the shadow effect caused by the lens characteristics in the surface light source image, making the brightness distribution of the image captured by the color camera more uniform; white balance correction ensures that there is no color cast in the image captured by the color camera, which is consistent with the color perception of the human eye.
[0018] By calculating the light source correction coefficients corresponding to different areas of the surface light source, so that the light source correction coefficient is inversely proportional to the sum of the XYZ components of each area of the light source, it can effectively deal with the problem of surface light source non-uniformity introduced again when the color measurement equipment measures the surface light source. It rationally utilizes the uneven distribution of different areas of the surface light source and forms a dynamic light source correction coefficient based on the sum of the XYZ components of different areas of the surface light source. Through the constraint of the inverse proportional relationship, it can form a light source correction coefficient that is opposite in size to the sum of the XYZ components of different areas, so that the different light source areas are unified after the final correction.
[0019] By placing a transmissive color card and using a color measuring device to measure the transmitted light of a surface light source passing through the color card, the XYZ original values corresponding to each color block of the color card are obtained, and then the LAB correction values corresponding to each color block of the color card are output in combination with the corresponding light source correction coefficient. The transmissive color card replaces the traditional reflective color card, fundamentally solving the problem of the color measuring device probe blocking the surface light source when collecting light at close range. At the same time, the XYZ original values measured by the color measuring device can be used to analyze the corrected target color data of each color block of the color card based on the light source correction coefficient. This not only avoids the accuracy problem caused by traditional manufacturers directly providing the true value of the color card in different surface light source environments, but also effectively solves the color distribution problem caused by the unevenness of the surface light source to the color measuring device through the correction of the XYZ original values.
[0020] By starting the color camera and collecting the transmitted light from the surface light source through the color card, the measured color data of each color block of the color card is obtained, and then a correction matrix is fitted based on the target color data. At this time, the measured color data and the target color data are both color data obtained based on the color card under the current surface light source. After removing the influence of the uniformity of the surface light source, the target color data has achieved an effect close to that perceived by the human eye. Therefore, the correction matrix fitted on this basis will inevitably make the corresponding corrected color data meet the requirements of the human eye.
[0021] (2) The present invention calculates the total grayscale average value under each channel of the surface light source image and the grayscale average value corresponding to each area, and uses the quotient of the total grayscale average value and the grayscale average value corresponding to each area as the lens correction coefficient of each area. This can efficiently complete the lens shading correction under the premise of limited resources and ensure the correction effect.
[0022] (3) The present invention calculates the quotient of the maximum value of all components in the surface light source image and the maximum value of each RGB component as the gain coefficient of each RGB component, which can reasonably utilize the surface light source for white balance correction so that the image color conforms to the visual perception of the human eye.
[0023] (4) In the calculation of the light source correction coefficient, the present invention uses the minimum value of the sum of the XYZ components corresponding to all areas of the surface light source as the reference, effectively avoiding the loss of details due to excessive brightness and, to a certain extent, restoring some detail information. At the same time, because the human eye is more sensitive to changes in brightness in dark areas, the minimum value is used as the reference, preserving the integrity of the dark area (i.e., the minimum brightness remains unchanged), which is more consistent with visual perception. At the same time, the relative contrast of the bright area after compression is still acceptable (because the original signal-to-noise ratio of the bright area is high). Moreover, by using the minimum value as the reference, only the global minimum needs to be found, effectively reducing time complexity and eliminating iteration or matrix operations. This greatly improves computational efficiency under limited computing resources.
[0024] (5) In the process of calculating the correction matrix, the present invention unifies the measured color data and the target color data into the same LAB color space for fitting. The LAB color space is designed to be an approximately uniform perceptual color space, which means that the numerical value of color differences is closer to the degree of difference perceived by human vision. Calibration in such a space can more directly optimize the color accuracy perceived by the human eye. Using the LAB color space for comparison clearly separates the luminance component (L) and the chrominance components (A, B), which allows the correction to more specifically address luminance or chrominance component issues. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings: Figure 1 is a flow chart of the correction method in the present invention; Figure 2 It is a structural block diagram of the correction system in the present invention; Figure 3 It is a structural schematic diagram of the correction device in the present invention.
[0026] In the figure: 1-area light source; 2-color camera; 3-transmissive color card; 4-linear platform. DETAILED DESCRIPTION
[0027] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0028] Color imaging with a color camera is typically based on image data captured by the camera, and color correction parameters are obtained by fitting the target color data. However, traditional target color data comes from the true color card values provided directly by the color card manufacturer. As the surface light source environment changes, the actual target color data of the color card will change accordingly. If the true color card values provided by the manufacturer are directly used as the actual target color data, the fitting result will deviate significantly from the actual value, thus affecting the accuracy of the final correction. If a color measuring device is used to measure the actual color of the color card at this time, the light from the surface light source shining on the color card will be blocked because the color measuring device probe needs to receive light at a close distance, making it impossible to obtain accurate color information. At the same time, because the color information measured by the color measuring device at this time is affected by the non-uniformity of the surface light source, the measurement result will be biased, further affecting the accuracy of color correction.
[0029] like Figure 1 As shown, in order to solve the above problem, this embodiment first provides a color camera color correction method, which specifically includes the following steps: Fix the area light source and the color camera facing it to complete lens shading correction and white balance correction.
[0030] The surface light source is white light, which can be a standard D65 surface light source or other surface light sources. By pointing a color camera at the illuminated surface light source, the corresponding surface light source image can be captured. At this time, lens shading correction performed in conjunction with the surface light source image is an image preprocessing technique used to eliminate the shadow effect caused by lens characteristics in the surface light source image. By homogenizing the surface light source image, the distribution of the surface light source image is made more uniform. White balance is to make the image color conform to the visual perception of the human eye. The human visual system has the ability to automatically white balance, which can compensate for the lighting in the environment so that objects are perceived as the same color. However, image sensors do not have this function. Therefore, the goal of white balance is to correct white objects under different surface light sources to the white color perceived by the human eye, so that there is no color cast in the image. The reason for choosing white is that the human eye is not as sensitive to the chromaticity information of other colors as white.
[0031] Calculate the light source correction coefficient for each area of the surface light source to correct the non-uniformity of the surface light source; wherein the light source correction coefficient is inversely proportional to the sum of the XYZ components of each area of the light source, and the XYZ components of each area are measured by a color measurement device.
[0032] As can be seen from the above, after the color camera completes lens shading correction when photographing a surface light source, although the unevenness of the camera and lens, as well as the unevenness caused by the surface light source distribution to the color camera, are corrected, when the surface light source is measured using a color measurement device, the unevenness of the surface light source will be reintroduced. Therefore, the color measurement device needs to separately measure the unevenness of the surface light source. Based on this, the impact of the uneven distribution of the surface light source can be removed during the subsequent true color value measurement, thereby obtaining a true value that matches the image data actually captured by the color camera. By making the light source correction coefficient inversely proportional to the sum of the XYZ components of each light source area, the distribution unevenness of different areas of the surface light source is rationally utilized. The dynamic light source correction coefficient is formed by combining the sum of the XYZ components of different areas of the surface light source. Through the constraint of the inverse relationship, a light source correction coefficient with the opposite magnitude of the sum of the XYZ components can be formed, so that the different light source areas are unified after the final correction.
[0033] Fixing the transmissive color card so that it is located between the surface light source and the color camera and parallel to the surface light source; each area of the light source corresponds to each color block of the transmissive color card one by one; Calculate the XYZ correction value of each color block on the transmissive color chart to convert it into a LAB correction value; the XYZ correction value is calculated using the light source correction coefficient and the XYZ original value, which is obtained by measuring the transmitted light of the area light source through the transmissive color chart using a color measurement device.
[0034] The use of a transmissive color card instead of a traditional reflective color card fundamentally solves the problem of the color measurement device probe blocking the surface light source when receiving light at close range. At the same time, the XYZ original values measured by the color measurement device can be used to analyze the LAB correction values of each color block on the color card after correction based on the light source correction coefficient, that is, the target color data. This not only avoids the accuracy issues caused by the traditional manufacturers directly providing the true value of the color card in different surface light source environments, but also effectively solves the color distribution problem caused by the unevenness of the surface light source to the color measurement device by correcting the XYZ original values.
[0035] The measured color data and the LAB correction value are fitted to obtain a correction matrix to serve as a color correction parameter; the measured color data is obtained by measuring the transmitted light of the area light source passing through the transmissive color card with a color camera.
[0036] At this point, the color card color directly captured by the color camera is the measured color data. Since the color measurement device has already obtained the target color data after calibration, in order to obtain the correction matrix, it is only necessary to make the color data obtained by combining the measured color data with the correction matrix closest to the target color data. The corresponding correction matrix can then be selected as the color correction parameter for the current scene. Since the measured color data and the target color data are both based on the color data obtained from the color card under the current area light source, the target color data has achieved an effect close to the human eye's perception after removing the influence of the area light source uniformity. Therefore, the correction matrix obtained by fitting on this basis will inevitably make the corresponding corrected color data meet the requirements of the human eye.
[0037] In summary, the present invention performs color correction of a color camera based on a color card under actual surface light source illumination, thereby avoiding the influence of the actual surface light source on the true value of the color card provided by the manufacturer. The transmissive color card solves the problem of surface light source occlusion during target color data measurement, and the light source correction coefficient solves the problem of surface light source distribution uniformity, thereby significantly improving the accuracy of color correction as a whole.
[0038] As can be seen from the above, the purpose of lens shading correction is to eliminate the shadow effect caused by lens characteristics in the surface light source image. In order to improve the correction efficiency and ensure the correction effect, the following steps are specifically included: The area light source image captured by the color camera is collected and divided into several regions. The collected area light source image is grid-segmented to form several cell regions, and the RGB data in each cell region is counted separately.
[0039] Calculate the total grayscale average value under each channel of the surface light source image and the grayscale average value corresponding to each area, and use the quotient of the total grayscale average value and the grayscale average value corresponding to each area as the lens correction coefficient of each area. Define the total grayscale average value under each RGB channel as R ave , G ave 、B ave , the grayscale average values corresponding to each area under each RGB channel are R ref (u,v),G ref (u,v),B ref (u, v), the lens correction coefficients of each area under each RGB channel are R gain (u,v),G gain (u,v),B gain (u,v), the calculation formula is as follows: R gain (u,v)=R ave / R ref (u,v) G gain (u,v)=Gave / G ref (u,v) B gain (u,v)=B ave / B ref (u,v) Among them, u and v are the horizontal and vertical coordinate numbers of each cell area respectively.
[0040] Extract all pixel grayscale values under each channel of the surface light source image, and use the lens correction coefficient of each pixel corresponding area to correct it to obtain the corrected image data. Define the pixel grayscale values under each RGB channel as R(x,y), G(x,y), and B(x,y), and the corresponding corrected pixel grayscale values are R gain (x,y),G gain (x,y),B gain (x, y), where x and y are the horizontal and vertical coordinate numbers of each pixel respectively. The calculation formula is as follows: R gain (x,y)=R(x,y)×R gain (u,v) G gain (x,y)=G(x,y)×G gain (u,v) B gain (x,y)=B(x,y)×B gain (u,v) As can be seen from the above, white balance is to make the color of the image consistent with the visual perception of the human eye. The goal is to correct white objects under different area light sources to the white perceived by the human eye. Therefore, in order to reasonably use the area light source for correction, white balance correction specifically includes the following steps: Collect the area light source image captured by the color camera to obtain the maximum value of each RGB component, which is defined as R max , G max 、B max .
[0041] Calculate the quotient of the maximum value of all components in the surface light source image and the maximum value of each RGB component as the gain coefficient of each RGB component, and define the maximum value of all components as I max , the gain coefficients of RGB components are R k , G k 、B k , the calculation formula is as follows: R k =I max / R max G k =I max / Gmax B k =I max / B max Calculate the product of the RGB component data of the surface light source image and the corresponding gain coefficient to achieve white balance correction. As can be seen from the above, the pixel grayscale values under each RGB channel are R(x,y), G(x,y), and B(x,y). The data after white balance correction are R white (x,y),G white (x,y),B white (x,y), the calculation formula is as follows: R white (x,y)=R(x,y)×R k G white (x,y)=G(x,y)×G k B white (x,y)=B(x,y)×B k To accurately capture color information that closely approximates human perception, color measurement equipment uses a colorimeter, and the distance between the colorimeter probe and each color block on the color chart is consistent. During measurement, the colorimeter probe is required to be as close to the color block as possible, but not touching it, and perpendicular to the plane of the color chart. The distance between the probe and the color chart should not vary significantly when measuring different color blocks. Compared to other measurement devices, a colorimeter offers a significant speed advantage. It can directly simulate the human eye's XYZ tristimulus response or directly calculate Lab values. Measurements are typically completed instantly (usually within a few tenths of a second to several seconds), and it is also portable, easy to operate, and relatively inexpensive.
[0042] In order to reasonably set the light source correction coefficient, a colorimeter can be used to measure the XYZ values of the surface light source area corresponding to each color block of the color card. The specific calculation formula of the light source correction coefficient is as follows: α i =S light_XYZ_min / S light_XYZ (i); Among them, i is the serial number corresponding to different areas of the surface light source, α i is the light source correction coefficient corresponding to different areas of the surface light source, S light_XYZ_min It is the minimum value in the set formed by the sum of the XYZ components corresponding to all areas of the surface light source, S light_XYZ (i) is the sum of the XYZ components corresponding to different areas of the surface light source.
[0043] Considering that the uneven distribution of surface light sources mainly causes the deviation of the L component, it is only necessary to correct the L component in combination with the light source correction coefficient. The specific calculation formula of the XYZ correction value is as follows: Xtarget (i)=X card (i)×α i ; Y target (i)=Y card (i)×α i ; Z target (i)=Z card (i)×α i ; Among them, X target (i) is the X component correction value corresponding to each color block of the color card, X card (i) is the original value of the X component corresponding to each color block of the color card, Y target (i) is the Y component correction value corresponding to each color block of the color card, Y card (i) is the original value of the Y component corresponding to each color block of the color card, Z target (i) is the Z component correction value corresponding to each color block of the color card, Z card (i) is the original value of the Z component corresponding to each color block of the color card. target (i) Y target (i) Z target (i) After converting to LAB color space, we get L arget (i) A target (i) B target (i), the specific conversion formula can be found in the following description.
[0044] When calculating the light source correction coefficient, the minimum value in the set formed by the sum of the X, Y, and Z components corresponding to all areas of the surface light source is used as the reference. This effectively avoids detail loss caused by excessive brightness and can, to a certain extent, restore some detail information. Furthermore, since the human eye is more sensitive to brightness changes in dark areas, using the minimum value as the reference preserves the integrity of dark areas (i.e., the minimum brightness remains unchanged), which is more consistent with visual perception. At the same time, the relative contrast of bright areas remains acceptable after compression (due to the high original signal-to-noise ratio in bright areas). Furthermore, choosing the minimum value as the reference only requires searching for the global minimum, effectively reducing time complexity and eliminating the need for iterations or matrix operations. This significantly improves computational efficiency with limited computing resources.
[0045] The specific process of calculating the XYZ correction value in combination with the light source correction coefficient is as follows: S1: Calculate the sum of the XYZ components corresponding to different areas of the surface light source Assume that the XYZ values corresponding to different areas of the surface light source are X light_i 、Y light_i 、Z light_i , the calculation formula is as follows:
[0046] Among them, k i is the intensity factor at region position i, Eref (λ) is the spectral power distribution of the reference light source, x(λ), y(λ), and z(λ) are the corresponding functions of the XYZ components in the CIE 1931 standard colorimetric observer color matching function, and X ref 、Y ref 、Z ref These are the X, Y, and Z values corresponding to the spectral power distribution of the reference light source.
[0047] Therefore, the sum of the XYZ components corresponding to the light source at the position i in the region is S light_XYZ (i) The calculation formula is:
[0048] Among them, S ref It is the sum of the XYZ components corresponding to the spectral power distribution of the reference light source. It is theoretically a constant and does not depend on the regional position.
[0049] S2:S light_XYZ_min Calculation of light source correction coefficients Due to: S light_XYZ (i)=k i ×S ref Therefore, S light_XYZ_min The location of the region corresponding to the minimum intensity factor: S light_XYZ_min (i)=k min ×S ref Among them, k min is the minimum value among all regional intensity factors.
[0050] Light source correction coefficient α at region position i i The calculation formula is:
[0051] S3:X card (i) Y ard (i) Z card Calculation of (i) Since X at different region positions i card (i) Y ard (i) Z card (i) Depending on the spectral power distribution of the light source and the color card transmittance t(λ), we can get:
[0052] Among them, X card_ref 、Y card_ref 、Z card_ref All are the X, Y, and Z values of the corresponding color card under the spectral power distribution of the reference light source.
[0053] S4:Xtarget (i) Y target (i) Z target Calculation of (i) From the above we can see that:
[0054] When the color card is uniform, t(λ) does not change with the position of the color block, so X card_ref 、Y card_ref 、Z card_ref are all constant and have nothing to do with the region position i, which means that the inhomogeneity of the light source has been completely removed.
[0055] To ensure that the final correction result is consistent with human eye perception, the correction matrix is obtained based on the target color data fitting, which specifically includes the following steps: Collect the measured color data of each color block of the color card, that is, the measured RGB data, and calculate the simulated RGB data after the simulation matrix correction; Converting analog RGB data to LAB color space to obtain analog LAB data; When the sum of the squares of the Euclidean distances between the simulated LAB data and the target color data is minimized, the corresponding simulation matrix is used as the correction matrix.
[0056] The fitting principle of the correction matrix is as follows: Let the RGB component data in the measured RGB data be R raw (i) G raw (i) B raw (i) Set the simulation matrix to a 3×3 matrix, and define the simulation RGB data after correction by the simulation matrix as R corr (i) G corr (i) B corr (i) Then convert to XYZ color space, and get the simulated XYZ data, each component data is X meas (i) Y meas (i) Z meas (i), the specific calculation formula is as follows:
[0057] Let X meas (i) Y meas (i) Z meas (i) After conversion to LAB color space, the component data are L meas (i) A meas (i) B meas (i), the specific calculation formula is as follows:
[0058] Among them, Xn 、Y n 、Z n They are 95.047, 100, and 108.833 respectively. n 、Y n 、Z n is the intermediate parameter involved in the operation, f(t) is the intermediate function involved in the operation, and t is the independent variable parameter involved in the f(t) operation.
[0059] From the above, we can see that the LAB correction values, i.e. the target color data, are L target (i) A target (i) B target (i), assume that the parameter W satisfies the following formula:
[0060] Where N is the total number of color blocks on the color card. The simulation matrix corresponding to the minimum W is used as the correction matrix. In this case, W is the sum of the squares of the Euclidean distances between the simulated LAB data and the target color data.
[0061] As can be seen above, both the measured and target color data were unified into the same LAB color space for fitting. The LAB color space is designed to approximate a uniform perceptual color space, meaning the numerical magnitude of color differences more closely matches the degree of difference perceived by human vision. Calibration in this space more directly optimizes the accuracy of color perception by the human eye. Using the LAB color space for comparison clearly separates the luminance component (L) and the chrominance components (A, B), allowing calibration to more specifically address luminance or chrominance issues.
[0062] like Figure 2 As shown, the second aspect of the present invention further provides a color camera color correction system, comprising: The camera correction module is used to complete the lens shading correction and white balance correction of the color camera.
[0063] The light source correction module is used to calculate the light source correction coefficient for each area of the surface light source to correct the non-uniformity of the surface light source; wherein the light source correction coefficient is inversely proportional to the sum of the XYZ components of each light source area, and the XYZ components of each area are measured by a color measurement device; each light source area corresponds one-to-one to each color block of the transmissive color card.
[0064] The target analysis module is used to calculate the XYZ correction value of each color block on the transmissive color chart to convert it into a LAB correction value; the XYZ correction value is calculated using the light source correction coefficient and the XYZ original value, which is obtained by measuring the transmitted light of the area light source through the transmissive color chart using a color measurement device.
[0065] The correction analysis module is used to fit the measured color data and the LAB correction value to obtain a correction matrix as a color correction parameter; the measured color data is obtained by measuring the transmitted light of the area light source through the transmissive color card with a color camera.
[0066] The specific operation of the correction system can be implemented with reference to the above correction method.
[0067] like Figure 3 As shown, the third aspect of the present invention further provides a color correction device for a color camera, comprising: The surface light source 1 is used to provide a lighting environment. The surface light source 1 is white light and can be a standard D65 surface light source or other surface light sources. The surface light source 1 is placed horizontally on the linear platform 4.
[0068] Color camera 2 is mounted facing area light source 1, with its light-collecting surface directly facing the area light source. If color camera 2 outputs Bayer format data, it should be converted to RGB data using an interpolation algorithm. If color camera 2 is a line scan camera, linear stage 4 should be controlled to move at a constant speed and the camera's line frequency adjusted to achieve an image with an aspect ratio of 1, thereby capturing a color card image. The same effect can also be achieved by controlling the movement of color camera 2 using other devices.
[0069] The transmissive color card 3 is set between the surface light source and the color camera, parallel to the surface light source 1, and within the field of view of the color camera; at this time, the transmissive color card 3 can be placed horizontally on the upper surface of the surface light source 1.
[0070] Color measurement equipment is used to measure the transmitted light from a surface light source through a color card. A colorimeter can be used as a color measurement device, but a spectrometer or other device can also be used. When measuring, the colorimeter probe is required to be as close to the color block as possible without touching it, and perpendicular to the color card plane. When measuring different color blocks, the distance between the probe and the color card should not be significantly different.
[0071] A processor is used to execute the above correction method.
[0072] A fourth aspect of the present invention further provides a computer-readable storage medium comprising a computer program, wherein the computer program implements the above-mentioned correction method when executed by a processor.
[0073] In practical applications, computer-readable storage media may take the form of any combination of one or more computer-readable media. Computer-readable media may be computer-readable signal media or computer-readable storage media. Computer-readable storage media may be, but are not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or components, or any combination thereof. More specific examples of computer-readable storage media may include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this embodiment, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device, or component.
[0074] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0075] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0076] Computer program code for performing the operations of the present application may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0077] Throughout this specification, references to terms such as "one embodiment," "example," and "specific example" indicate that the specific features, structures, materials, or characteristics described in conjunction with that embodiment or example are included in at least one embodiment or example of the present invention. In this specification, schematic representations of these terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0078] The basic principles, main features, and advantages of the present invention are shown and described above. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions are merely illustrative of the principles of the present invention. Various changes and modifications may be made to the present invention without departing from the spirit and scope of the present invention, and such changes and modifications fall within the scope of the invention as claimed.
Claims
1. A color correction method for a color camera, characterized in that: include: Fix the area light source and the color camera facing it to complete lens shading correction and white balance correction; Calculate the light source correction coefficient of each area of the surface light source to correct the non-uniformity of the surface light source; Fixing the transmissive color card so that it is located between the surface light source and the color camera and parallel to the surface light source; Calculating XYZ correction values for each color block on the transmissive color chart to convert them into LAB correction values; the XYZ correction values are calculated using the light source correction coefficients and XYZ original values, which are obtained by measuring the transmitted light of a surface light source through the transmissive color chart using a color measurement device; Fitting the measured color data and the LAB correction value to obtain a correction matrix as a color correction parameter; the measured color data is obtained by measuring the transmitted light of the area light source passing through the transmissive color card with a color camera; The light source correction coefficient is inversely proportional to the sum of the XYZ components of each light source area, and the XYZ components of each area are measured by a color measurement device; each light source area corresponds to each color block of the transmissive color card.
2. The color correction method for a color camera according to claim 1, characterized in that: Lens shading correction includes: Collect the surface light source image taken by the color camera and divide it into several areas; Calculate the total grayscale average value under each channel of the surface light source image and the grayscale average value corresponding to each area, and use the quotient of the total grayscale average value and the grayscale average value corresponding to each area as the lens correction coefficient of each area; The grayscale values of all pixels under each channel of the surface light source image are extracted, and the lens correction coefficients of the corresponding areas of each pixel are used to correct them to obtain the corrected image data.
3. The color correction method for a color camera according to claim 1, wherein: White balance correction includes: Collect the area light source image captured by the color camera to obtain the maximum value of each RGB component; Calculate the quotient of the maximum value of all components in the surface light source image and the maximum value of each RGB component as the gain coefficient of each RGB component; Calculate the product of each RGB component data of the surface light source image and the corresponding gain coefficient to achieve white balance correction.
4. The color correction method for a color camera according to claim 1, wherein: The color measurement device uses a colorimeter for measurement, and the distance between the colorimeter probe and each color block on the color card is consistent.
5. A color camera color correction method according to any one of claims 1 to 4, characterized in that: The specific calculation formula of the light source correction coefficient is as follows: α i =S light_XYZ_min / S light_XYZ (i); Among them, i is the serial number corresponding to different areas of the surface light source, α i is the light source correction coefficient corresponding to different areas of the surface light source, S light_XYZ_min It is the minimum value in the set formed by the sum of the XYZ components corresponding to all areas of the surface light source, S light_XYZ (i) is the sum of the XYZ components corresponding to different areas of the surface light source.
6. The color correction method for a color camera according to claim 5, characterized in that: The specific calculation formula of XYZ correction value is as follows: target (i)=X card (i)×α i ; Y target (i)=Y card (i)×α i ; Z target (i)=Z card (i)×α i ; Among them, X target (i) is the X component correction value corresponding to each color block of the color card, X card (i) is the original value of the X component corresponding to each color block of the color card, Y target (i) is the Y component correction value corresponding to each color block of the color card, Y card (i) is the original value of the Y component corresponding to each color block of the color card, Z target (i) is the Z component correction value corresponding to each color block of the color card, Z card (i) is the original value of the Z component corresponding to each color block of the color card.
7. The color correction method for a color camera according to claim 6, characterized in that: The correction matrix obtained by fitting the target color data includes: Collect the measured color data of each color block of the color card, that is, the measured RGB data, and calculate the simulated RGB data after the simulation matrix correction; Converting analog RGB data to LAB color space to obtain analog LAB data; When the sum of the squares of the Euclidean distances between the simulated LAB data and the target color data is minimized, the corresponding simulation matrix is used as the correction matrix.
8. A color camera color correction system, characterized in that: include: Camera calibration module, used to complete lens shading correction and white balance correction of color cameras; A light source correction module is configured to calculate a light source correction coefficient for each area of the surface light source to correct for non-uniformity of the surface light source; wherein the light source correction coefficient is inversely proportional to the sum of the XYZ components of each area of the light source, and the XYZ components of each area are measured by a color measurement device; and each area of the light source corresponds one-to-one to each color block of the transmissive color card; a target analysis module for calculating XYZ correction values for each color block on the transmissive color chart to convert them into LAB correction values; the XYZ correction values are calculated using the light source correction coefficients and the XYZ original values, which are obtained by measuring the transmitted light of a surface light source through the transmissive color chart using a color measurement device; The correction analysis module is used to fit the measured color data and the LAB correction value to obtain a correction matrix as a color correction parameter; the measured color data is obtained by measuring the transmitted light of the area light source through the transmissive color card with a color camera.
9. A color correction device for a color camera, characterized in that: include: Surface light source, used to provide lighting environment; A color camera is installed aligned with the surface light source so that the light-collecting surface of the color camera faces the surface light source; A transmissive color card is arranged between the surface light source and the color camera and is parallel to the surface light source; Color measurement equipment, used to measure the transmitted light of a surface light source passing through a color card; A processor, configured to execute the correction method according to any one of claims 1 to 7.
10. A computer-readable storage medium comprising a computer program, characterized in that When the computer program is executed by a processor, the correction method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Color digital camera white balance correction method based on color adaptation model
CN107197225A
Image color correction method and device
CN112839216A
Color reproduction correction method, color reproduction correction device and imaging apparatus
JP2015204481A
Color calibration method for imaging color measurement device
US20030169347A1
Image processing method, electronic device, computer program product, and storage medium
WO2024103746A1