Image color correction methods, apparatus, devices and storage media
By determining the color correction matrix under preset element constraints, and constructing the correction matrix using a genetic optimization algorithm and different lighting environments, the problem of inaccurate color correction of camera images is solved, and high-accuracy color correction is achieved.
Patent Information
- Application Number
- CN202010687674.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-16
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2040-07-16
AI Technical Summary
In existing technologies, the color correction matrix of images captured by cameras cannot converge accurately, resulting in inaccurate color correction and an inability to reproduce true colors.
By obtaining the color element values of the image to be corrected and the standard image, the color correction matrix is determined under the constraints of preset elements. The optimal solution is obtained by using a genetic optimization algorithm. The color correction matrix is constructed under different lighting environments and color temperatures, and adjustments are made considering the gain effect.
It improves the accuracy of image color correction, ensuring that image colors are consistent with real colors and adapting to different lighting and gain conditions.
Smart Images

Figure CN113947533B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image color correction method, apparatus, device and storage medium. Background Technology
[0002] With the continuous development of camera technology, the quality requirements for images captured by cameras are also increasing. Because the colors in images captured by cameras differ somewhat from the colors actually seen by the human eye, color correction is necessary in practical applications to reproduce the true colors of the captured target.
[0003] In existing technologies, the most widely used color correction method is to compare the image captured by the camera with a standard image to obtain a color correction matrix with the smallest error, and then achieve the purpose of image restoration by correcting the color correction matrix.
[0004] However, there is a problem in the process of obtaining the color correction matrix that the direction of correction convergence cannot be limited, which leads to inaccurate color correction and a certain gap between the correction result and the true color of the target. Summary of the Invention
[0005] This invention provides an image color correction method, apparatus, device, and storage medium to improve the accuracy of image color correction.
[0006] In a first aspect, embodiments of the present invention provide an image color correction method, comprising:
[0007] Obtain the color element values to be corrected of the standard image acquired by the image acquisition device to be corrected, and obtain the standard color element values of the standard image;
[0008] Under the constraints of preset elements, a color correction matrix is determined based on the color element values to be corrected and the standard color element values;
[0009] The color correction matrix is used to perform color correction on the image acquired by the image acquisition device to be corrected.
[0010] Secondly, embodiments of the present invention also provide an image color correction device, comprising:
[0011] The color element acquisition module is used to acquire the color element values to be corrected of the standard image acquired by the image acquisition device to be corrected, and to acquire the standard color element values of the standard image.
[0012] The correction matrix determination module is used to determine a color correction matrix based on the color element value to be corrected and the standard color element value under the constraints of preset elements.
[0013] The image color correction module is used to perform color correction on the image acquired by the image acquisition device to be corrected based on the color correction matrix.
[0014] Thirdly, embodiments of the present invention also provide an apparatus, comprising:
[0015] One or more processors;
[0016] Storage device for storing one or more programs.
[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the image color correction method as described in any embodiment of the present invention.
[0018] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the image color correction method as described in any embodiment of the present invention.
[0019] This invention, based on the color element values to be corrected of the standard image acquired by the image acquisition device and the standard color element values of the standard image, determines a color correction matrix under the constraints of preset elements. This achieves precise control over the convergence direction of the color correction matrix through the constraints of preset elements, thereby improving the accuracy of color correction. Attached Figure Description
[0020] Figure 1A This is a flowchart of the image color correction method in Embodiment 1 of the present invention;
[0021] Figure 1B This is a schematic diagram of the LAB model in Embodiment 1 of the present invention;
[0022] Figure 1C This is a flowchart of finding the optimal solution of the objective function in Embodiment 1 of the present invention;
[0023] Figure 2 This is a flowchart of the image color correction method in Embodiment 2 of the present invention;
[0024] Figure 3 This is a flowchart of the image color correction method in Embodiment 3 of the present invention;
[0025] Figure 4 This is a schematic diagram of the image color correction device in Embodiment 4 of the present invention;
[0026] Figure 5 This is a schematic diagram of the device in Embodiment 5 of the present invention. Detailed Implementation
[0027] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.
[0028] Example 1
[0029] Figure 1A This is a flowchart of the image color correction method in Embodiment 1 of the present invention. This embodiment is applicable to situations where the colors of images captured by a camera under different lighting conditions are corrected to their true colors. This method can be executed by an image color correction device, which can be implemented in software and / or hardware and can be configured in a device, such as a backend server or other device with communication and computing capabilities. Figure 1A As shown, the method specifically includes:
[0030] Step 101: Obtain the color element values to be corrected of the standard image acquired by the image acquisition device, and obtain the standard color element values of the standard image.
[0031] The images captured by the image acquisition device to be calibrated are affected by the lighting environment and imaging principle, resulting in a certain discrepancy between the images and the true colors. That is, the colors in the image differ from the colors directly perceived by the human eye. Therefore, the colors of the images captured by the image acquisition device need to be calibrated to match the colors directly perceived by the human eye. For example, the image acquisition device to be calibrated includes devices such as cameras that capture images or videos. Standard images provide a reference for accurately reproducing the colors of images on any medium under any lighting conditions; for example, standard images include 24-color charts.
[0032] The color element values to be calibrated refer to the information in the image acquired by the image acquisition device that represents the image's colors. For example, color elements may include the three primary colors in the RGB color space, or the luminance element and two color channels in the LAB color space. Standard color element values are determined based on the inherent colors of the standard image, and these standard color element values are known and predetermined.
[0033] Specifically, the image acquisition device acquires the standard image to obtain the image to be corrected from the standard image, and determines the color element values of the image to be corrected. For example, it determines the RGB average value of each color block in the 24-color card image to be corrected; and determines the standard color element values of the standard image. For example, it reads the standard 24-color card and manually selects the RGB average value of each color block in the 24 color blocks.
[0034] The color elements of an image can be represented using different color space models. Commonly used color space models include RGB, HSV, YUV, and LAB color spaces. When correcting image colors, the elements in the RGB color space are highly correlated, and color deviations cannot be measured mathematically. In contrast, the LAB color space separates luminance and chrominance, and the distance between coordinate points can represent the differences between colors. Therefore, the color correction matrix can be obtained in the LAB color space and directly used to measure the difference between the image captured by the camera and the target image.
[0035] Since color elements in the RGB color space can be directly obtained, after obtaining the color element values to be corrected in the RGB color space of the standard image, the RGB color space is converted to the LAB color space. The coordinate calculation is converted into vector calculation through the LAB color space. The correlation between elements is reduced by using coordinate representation, thereby improving the judgment of differences between image colors.
[0036] For example, a standard image of a 24-color chart acquired by the image acquisition device to be calibrated is obtained. The RGB values of each pixel in the standard image to be calibrated are read, and the RGB values to be calibrated are converted into luminance vectors, hue vectors, and saturation vectors using the following formulas. First, the RGB values to be calibrated are converted into the three elements of the LAB color space using the following formulas: Where L* represents the brightness value in the LAB color space, and a* and b* correspond to two color channel values. a* represents a color ranging from dark green (low brightness value) to gray (medium brightness value) and then to bright pink (high brightness value); b* represents a color ranging from bright blue (low brightness value) to gray (medium brightness value) and then to yellow (high brightness value). X, Y, and Z are the tristimulus values of color in the image, corresponding to the RGB values respectively. n =0.9505, Y n =1.00, Z n =1.0890.
[0037] After determining the L*, a*, and b* of each pixel in the image acquisition device to be calibrated, according to... Figure 1B As shown in the LAB model diagram, the vector representations of the hue and saturation values of each pixel can be determined using a* and b*, for example, by the following formulas: Hue representation: H* = b* / a*, Saturation representation: C* = (a* / b*) / b*. 2 +b* 2 ) 1 / 2 .
[0038] In an optional embodiment, since the electron beam emitted by the picture tube in the camera and the brightness of the resulting image do not change linearly with the input voltage of the picture tube, the electron flow changes exponentially with respect to the input voltage, and the exponent of the input voltage is greater than the exponent of the electron beam. That is, the signal in dark areas of the image captured by the camera is darker than the actual situation, while the signal in bright areas is brighter than the actual situation. Therefore, gamma compensation is required to reproduce the image captured by the camera. For example, a standard image acquired by the image acquisition device to be corrected is obtained, and the color element values to be corrected are determined after gamma compensation is performed on the image.
[0039] Step 102: Under the constraints of preset elements, determine the color correction matrix based on the color element values to be corrected and the standard color element values.
[0040] The preset elements represent the convergence direction for setting the correction requirements of the image acquired by the image acquisition device. For example, when the image needs the highest accuracy in the hue element after correction, the preset element is set to hue; or when the image needs the highest accuracy in the saturation element after correction, the preset element is set to saturation. The color correction matrix represents the difference between the colors of the image acquired by the image acquisition device and the true colors, and the difference can be adjusted according to this matrix.
[0041] Specifically, after determining the preset elements, when determining the difference between the color element value to be corrected and the standard color element value, the weight of the difference of the preset elements is increased, so that the color correction matrix is determined under the constraint of the preset elements, thereby realizing the control of the convergence direction of the color correction matrix.
[0042] For example, since the human eye is more sensitive to differences in hue than to differences in saturation, preset elements are set as hue elements, so that hue can be controlled when determining the color correction matrix, thereby increasing the accuracy of the obtained color correction matrix.
[0043] In an optional embodiment, step 102 includes:
[0044] Determine the control parameters of the preset elements, and construct an objective function based on the control parameters; wherein, the objective function is used to determine the difference between the color element value to be corrected and the standard color element value;
[0045] Based on the color element values to be corrected and the standard color element values, the color correction matrix when the objective function is the optimal solution is determined as the target color correction matrix.
[0046] The control parameters represent the degree of influence of preset elements on the color correction result, and can be determined according to the actual situation; for example, they can be determined based on empirical values. The objective function represents the magnitude of the color difference between the image to be corrected and the standard image. For example, it can characterize the overall difference between the values of each element.
[0047] Adjusting the hue is used as a constraint term in the objective function. For example, this constraint term can be represented by PM(ρ,θ), where ρ represents the saturation difference between the saturation of any pixel and the standard saturation determined according to the standard color element values, and θ represents the hue difference between the hue of any pixel and the standard hue determined according to the standard color element values. Building upon the above example, the hue and saturation element values in the constraint term are represented using the a* and b* element values in the LAB color space. Where λ represents the control parameter used to control the degree of influence of hue on the correction result, and W(i) represents the weight of the i-th pixel, which can be determined according to the weight of the color block to which the pixel belongs. The weight of the color block can be determined according to the degree of color bias in the correction result. For example, if the correction accuracy requirement for red in the correction result is higher than that for green, then the weight of the red color block is set to be higher than that of green. The convergence direction of the color correction matrix can also be controlled by setting the weight.
[0048] The objective function can be determined using the following formula:
[0049]
[0050] Where L represents the difference between the brightness of any pixel and the standard brightness determined according to the standard color element value, and the color correction matrix when the objective function is the optimal solution is the target color correction matrix; n represents the total number of pixels, and for a 24-color chart, n is 24.
[0051] For example, the target color correction matrix is determined by finding the optimal solution to the objective function using an iterative method. In this embodiment of the invention, a heritage optimization algorithm is used for iterative solution, but the invention is not limited to this algorithm. Figure 1CThe flowchart shown illustrates the process of finding the optimal solution for the objective function. Specifically, it includes: using decimal encoding, randomly initializing N populations (called the initial population), setting the maximum number of iterations and the minimum allowable error; calculating the fitness function, determining the fitness value based on the objective function, and then judging whether the fitness meets the iteration stopping condition. If it does, the iteration stops; otherwise, genetic operations are performed; selection operations, selecting some superior individuals from the parent population based on the objective function value to pass on to the next generation. This invention uses a roulette wheel selection method; crossover operations, randomly pairing individuals in the population, exchanging parts of their encoding bits according to probability Pc, and obtaining new individuals through hybridization. The new individuals combine the characteristics of their parents; and mutation operations, randomly selecting an individual in the population and performing mutation operations according to probability Pm, randomly mutating the encoding bits of the selected individual to obtain new individuals.
[0052] Step 103: Perform color correction on the image acquired by the image acquisition device to be corrected based on the color correction matrix.
[0053] Based on the color feature values to be corrected, a color correction matrix is used to perform color correction on the image acquired by the image acquisition device. For example, based on the above example, the obtained color correction matrix is applied to the LAB color space. The LAB color space is converted to the RGB color space to obtain a color correction matrix applied to the RGB color space. This color correction matrix is then multiplied by the RGB pixel value matrix of the standard image acquired by the image acquisition device to obtain the corrected image pixel value matrix. For example, the following formula is used for image color correction: Here, matrix C represents a 3x3 color correction matrix. Indicates the color element value to be corrected. This matrix represents the color element values after color correction, and the color-corrected image can be obtained through this matrix.
[0054] This invention, based on the color element values to be corrected of the standard image acquired by the image acquisition device and the standard color element values of the standard image, determines a color correction matrix under the constraints of preset elements. This achieves precise control over the convergence direction of the color correction matrix through the constraints of preset elements, thereby improving the accuracy of color correction.
[0055] Example 2
[0056] Figure 2 This is a flowchart of the image color correction method in Embodiment 2 of the present invention. Embodiment 2 is a further optimization based on Embodiment 1. Figure 2 As shown, the method includes:
[0057] Step 201: Under at least four color temperature environments, acquire at least four sets of color element values to be corrected for the standard image acquired by the image acquisition device to be corrected, and acquire at least four sets of standard color element values for the standard image.
[0058] Color temperature is a unit of measurement for the color components in light. Theoretically, blackbody temperature refers to the color of a blackbody after being heated from absolute zero (-273°C). When heated, a blackbody gradually changes from black to red, then yellow, then white, and finally emits blue light. The spectral composition of the light emitted by a blackbody at a certain temperature is called the color temperature at that temperature. Color temperature is an important concept describing the spectral characteristics of a light source. It uses the temperature of a perfect radiator to represent the spectral composition of the light source and is measured in Kelvin (K). Color temperature can be used to represent different lighting environments when an image acquisition device is capturing images; for example, different color temperatures can indicate the difference between taking a picture under incandescent light and taking a picture under colored light.
[0059] Specifically, under light source environments corresponding to at least four color temperatures, standard images are acquired using an image acquisition device to be calibrated, and at least four sets of color element values to be calibrated corresponding to at least four images are obtained. For example, in an incandescent lamp environment, the image acquisition device is used to acquire the standard image, obtaining the color element values to be calibrated at a color temperature of 2700K. Similarly, in a daylight fluorescent lamp environment, the image acquisition device is used to acquire the standard image, obtaining the color element values to be calibrated at a color temperature of 6000K. Another example is a tungsten filament lamp with a color temperature of approximately 3200K. The number of color temperature environments is not limited. In this embodiment of the invention, acquiring as many color temperature environments as possible to obtain the color element values to be calibrated is beneficial to improving the accuracy of the color calibration matrix determination.
[0060] Step 202: Under the constraints of preset elements, determine the color correction matrix at at least four color temperatures based on at least four sets of color element values to be corrected and at least four sets of standard color element values.
[0061] After determining the preset elements, based on at least four sets of color element values to be corrected corresponding to at least four color temperatures, the differences between these values and the standard color element values at the corresponding color temperatures are calculated to determine the color correction matrices for the at least four color temperatures. For example, color correction matrices are determined for a color temperature of 2700K, 3200K, and 6000K, with each color correction matrix associated with a specific color temperature.
[0062] Step 203: Fit interpolation curves based on the color correction matrices at at least four color temperatures, and determine the target color correction matrix at the target color temperature by fitting the interpolation curves.
[0063] Since the values of the color elements to be corrected at all color temperatures cannot be exhausted, the color correction matrix at all color temperatures cannot be obtained. For the color correction matrix not at the above four color temperatures, nonlinear interpolation is used to determine it.
[0064] Obtaining the target color correction matrix at the target color temperature through nonlinear interpolation involves finding a specific function whose value at at least four color temperatures is equal to the original function f(x) based on the color correction matrices of the unknown function f(x). This specific function approximates the original function f(x) at these four color temperatures. This approximation can then be used to calculate the approximate values of the original function f(x) at other color temperatures, serving as the target color correction matrix. In other words, the color correction matrix at other color temperatures is obtained through nonlinear interpolation using the color correction matrices at at least four color temperatures. Finally, a curve is fitted using all the color correction matrices to obtain a continuous curve from a finite number of discrete points.
[0065] For example, based on the color correction matrix at 2700K, 3200K, 4500K, and 6000K, color correction matrices at several other color temperatures are obtained through nonlinear interpolation. Then, the functional relationship between the color correction matrix values and the color temperature is obtained by fitting these color correction matrices. Based on the functional relationship, the fitting interpolation curve is determined, and then the target color correction matrix at the target color temperature of 5000K is obtained.
[0066] In an optional embodiment, step 203 includes:
[0067] Based on the values of each matrix element in the color correction matrix at at least four color temperatures, the response model of each matrix element to the color temperature is determined by nonlinear interpolation.
[0068] The target matrix element values at the target color temperature are determined based on the response model of each matrix element and color temperature, and the target color correction matrix is constructed based on the target matrix element values.
[0069] Because the response of the RGB three-channel components at different color temperatures is non-linear, the brightness, hue, and saturation values converted from the RGB three-channel component values are also non-linear, causing non-linear correlations between the matrix elements in the target color correction matrix. Therefore, if the color correction matrix is treated as a whole and non-linear interpolated, the matrix elements will be inaccurately determined.
[0070] The response model of each matrix element to color temperature is determined by nonlinear interpolation based on the values of each matrix element in the color correction matrix. Then, the target matrix element values at the target color temperature are determined based on the response model. For example, nonlinear fitting models of the nine matrix elements in a 3x3 color correction matrix with color temperature are determined separately using nonlinear interpolation. The target matrix element values at the target color temperature are then determined based on the nonlinear fitting models of each matrix element, which helps improve the accuracy of the target color correction matrix.
[0071] In an optional embodiment, the response model of each matrix element to color temperature is determined according to the following formula:
[0072]
[0073] Among them, M t The color temperature T is determined by nonlinear interpolation. t The color correction matrix T is shown below. t It is the calibrated color temperature, M down It is the calibrated color temperature T t The associated left-neighbor base color temperature color correction matrix, ΔM is the calibrated color temperature T t The color correction matrix is the difference between the color correction matrix of the left neighbor base color temperature and the color correction matrix of the right neighbor base color temperature. ΔT is the color temperature difference between the right neighbor base color temperature and the left neighbor base color temperature, and S is the response model including the model coefficients.
[0074] The response model of each matrix element to color temperature can be represented by a fitted curve, for example, This function represents the response model of different matrix elements and color temperature. When training the above formula using a nonlinear interpolation method, x i To calibrate color temperature T t The matrix elements below, input x i The matrix coefficients A are obtained. i B i C i and D i , where i represents the index of the matrix element.
[0075] The calibrated color temperature refers to the color temperature corresponding to the color correction matrix fitted by nonlinear interpolation based on the base color temperature. The base color temperature is the color temperature corresponding to the color correction matrix determined in step 202. The left neighbor base color temperature associated with the calibrated color temperature refers to the base color temperature that is smaller than the calibrated color temperature and adjacent to it. The right neighbor base color temperature associated with the calibrated color temperature refers to the base color temperature that is larger than the calibrated color temperature and adjacent to it. For example, based on the above example, the base color temperatures are 2700K, 3200K, and 6000K. The calibrated color temperature can be set according to the training process. When the calibrated color temperature T...t When it is 3000K, then M t To determine the color correction matrix with a color temperature of 3000K using nonlinear interpolation, M down Let ΔM be the color correction matrix corresponding to a base color temperature of 2700K, ΔM be the absolute value matrix of the differences between corresponding elements of the color correction matrix corresponding to a base color temperature of 2700K and the color correction matrix corresponding to a base color temperature of 3200K, ΔT be the difference between the base color temperatures of 3200K and 2700K, and S be the response model of the i-th matrix element. i The input is M t The i-th element in the model is used to train the model by setting the color temperature, resulting in S. i Model coefficients A i B i C i and D i During training, the least squares sum of errors is used as the evaluation metric to determine the model coefficients. The fitting curve for the i-th matrix element is then determined based on the model coefficients. Finally, the i-th target matrix element corresponding to the target color correction matrix at the target color temperature is determined based on the fitting curve.
[0076] Step 204: Perform color correction on the image acquired by the image acquisition device to be corrected based on the target color correction matrix.
[0077] This invention, based on the nonlinear response of color elements in images acquired at different color temperatures, constructs a response model of each matrix element in the color correction matrix at different color temperatures and the color temperature, so as to obtain the relationship between each matrix element and the color temperature, and then determines each target matrix element according to the target color temperature, thereby improving the accuracy of the target color correction matrix determination.
[0078] Example 3
[0079] Figure 3 This is a flowchart of the image color correction method in Embodiment 3 of the present invention. Embodiment 3 is a further optimization based on the above embodiments. Figure 3 As shown, the method includes:
[0080] Step 301: Obtain the color element values to be corrected of the standard image acquired by the image acquisition device, and obtain the standard color element values of the standard image.
[0081] Step 302: Under the constraints of preset elements, determine the color correction matrix based on the color element values to be corrected and the standard color element values.
[0082] Step 303: Obtain the target gain of the image acquisition device to be calibrated, and the target image information acquired by the image acquisition device to be calibrated under the target gain.
[0083] The gain of the image acquisition device to be calibrated is used to increase the brightness of the acquired image, which will have a certain impact on the color correction matrix. For example, when using the same color correction matrix to correct the color of an image under different gains, the greater the gain, the more color noise is introduced by the color correction matrix, resulting in inaccurate color of the corrected image.
[0084] Among them, the target gain refers to the gain value adopted by the image acquisition device when acquiring the image to be corrected, which can be obtained by the image acquisition device. The target image information refers to the image color information of the image to be corrected acquired by the image acquisition device, which can be determined by the three channel values in the RGB color space.
[0085] Specifically, the gain of the image acquisition device when acquiring the image to be corrected is used as the target gain, and the pixel values of the RGB three channels in the image to be corrected are determined.
[0086] Step 304: Determine the correction adjustment matrix associated with the target gain based on the target gain and target image information.
[0087] The correction adjustment matrix is used to eliminate the color noise caused by the target gain, based on the analysis of the pixel value ratio of the target image information.
[0088] Specifically, based on the pixel values of each pixel in the three channels of the target image information, the proportion of pixel values in the three channels is determined, thereby determining the impact of gain, and the impact of gain is eliminated by adjusting the correction matrix.
[0089] In an optional embodiment, the correction adjustment matrix associated with the target gain is determined by the following formula:
[0090]
[0091] Where P is the correction adjustment matrix, N R N G and N B These represent the number of channels in the target image information whose values are greater than the channel threshold, N is the total number of channels, and iso is the target gain. max β is the gain threshold of the image acquisition device to be calibrated, and β is the gain influence factor.
[0092] Specifically, the channel thresholds can be set according to the actual situation. The channel thresholds for the three RGB channels can be set to the same or different values; there is no limitation here. R This represents the number of pixels in the target image whose R-channel value is greater than the channel threshold of the R-channel. Similarly, N... G The sum is NB The number of pixels in the target image whose G and B channel values are greater than the corresponding channel thresholds. This is determined by N. R N G and N B The proportion of pixel values in the three channels can be determined. ISO represents the gain when acquiring the target image, and ISO... max The value of β is determined based on the equipment specifications of the image acquisition device to be calibrated, and can be set according to the actual calibration situation, or determined based on empirical values. For example, a 3x3 calibration adjustment matrix can be obtained using the above matrix.
[0093] Step 305: Determine the adjusted color correction matrix based on the color correction matrix and the correction adjustment matrix.
[0094] The color noise in the color correction matrix is adjusted by correcting the adjustment matrix, thereby improving the color correction accuracy of the adjusted color correction matrix.
[0095] For example, the adjusted color correction matrix is determined according to M2 = M1·P, where M2 is the adjusted color correction matrix, P is the correction adjustment matrix, and M1 can be the color correction matrix determined in step 302 based on the color element value to be corrected and the standard color element value, or it can be the target color correction matrix at the target color temperature determined by the response model of each matrix element and the color temperature in embodiment two. That is, after determining the target color correction matrix based on the color temperature, further adjustments are made based on the target gain to improve the accuracy of color correction.
[0096] Considering the impact of gain on image quality, image information under different gains is analyzed, and the color correction matrix is adjusted according to the gain and the proportion of channel oversaturation to preserve color under high gain while reducing color noise.
[0097] Step 306: Perform color correction on the image acquired by the image acquisition device to be corrected based on the adjusted color correction matrix.
[0098] The embodiments of the present invention adaptively adjust the color adjustment matrix based on the target gain, thereby realizing that the color correction is adjusted as the gain changes, reducing the impact of color noise on image color, and improving the adaptability and accuracy of image color correction.
[0099] Example 4
[0100] Figure 4 This is a schematic diagram of the image color correction device in Embodiment 4 of the present invention. This embodiment is applicable to situations where the colors of images captured by a camera under different lighting conditions are corrected to their true colors. Figure 4 As shown, the device includes:
[0101] The color element acquisition module 410 is used to acquire the color element values to be corrected of the standard image acquired by the image acquisition device to be corrected, and to acquire the standard color element values of the standard image.
[0102] The correction matrix determination module 420 is used to determine a color correction matrix based on the color element value to be corrected and the standard color element value under the constraints of preset elements.
[0103] The image color correction module 430 is used to perform color correction on the image acquired by the image acquisition device to be corrected based on the color correction matrix.
[0104] This invention, based on the color element values to be corrected of the standard image acquired by the image acquisition device and the standard color element values of the standard image, determines a color correction matrix under the constraints of preset elements. This achieves precise control over the convergence direction of the color correction matrix through the constraints of preset elements, thereby improving the accuracy of color correction.
[0105] Optionally, the correction matrix determination module 420 is specifically used for:
[0106] Determine the control parameters of the preset elements, and construct an objective function based on the control parameters; wherein, the objective function is used to determine the difference between the color element value to be corrected and the standard color element value;
[0107] Based on the color element values to be corrected and the standard color element values, the color correction matrix when the objective function is the optimal solution is determined as the target color correction matrix.
[0108] Optional, the color element acquisition module 410 is specifically used for:
[0109] Under at least four color temperature environments, acquire at least four sets of color element values to be corrected for the standard image acquired by the image acquisition device to be corrected, and acquire at least four sets of standard color element values for the standard image.
[0110] Accordingly, the correction matrix determination module 420 is specifically used for:
[0111] Under the constraints of preset elements, based on the at least four sets of color element values to be corrected and the at least four sets of standard color element values, a color correction matrix is determined at at least four color temperatures.
[0112] The method further includes a target color correction matrix determination module, used for:
[0113] The target color correction matrix at the target color temperature is determined by fitting interpolation curves to the color correction matrices at the at least four color temperatures and then using the fitted interpolation curves.
[0114] Optional, the target color correction matrix determination module is specifically used for:
[0115] Based on the values of each matrix element in the color correction matrix at the at least four color temperatures, the response model of each matrix element to the color temperature is determined by nonlinear interpolation.
[0116] The target matrix element values at the target color temperature are determined based on the response model of each matrix element and color temperature, and the target color correction matrix is constructed based on the target matrix element values.
[0117] Optionally, the response model of each matrix element to color temperature can be determined according to the following formula:
[0118]
[0119] Among them, M t The color temperature T is determined by nonlinear interpolation. t The color correction matrix T is shown below. t It is the calibrated color temperature, M down It is the calibrated color temperature T t The associated left-neighbor base color temperature color correction matrix, ΔM is the calibrated color temperature T t The color correction matrix is the difference between the color correction matrix of the left neighbor base color temperature and the color correction matrix of the right neighbor base color temperature. ΔT is the color temperature difference between the right neighbor base color temperature and the left neighbor base color temperature, and S is the response model including the model coefficients.
[0120] Optionally, the device further includes a gain adjustment module, specifically used for:
[0121] Obtain the target gain of the image acquisition device to be corrected, and the target image information acquired by the image acquisition device to be corrected at the target gain;
[0122] Determine the correction adjustment matrix associated with the target gain based on the target gain and the target image information;
[0123] Based on the color correction matrix and the correction adjustment matrix, the adjusted color correction matrix is determined.
[0124] Optionally, the correction adjustment matrix associated with the target gain can be determined using the following formula:
[0125]
[0126] Where P is the correction adjustment matrix, N R N G and N B Let N be the number of channels in the target image information whose values are greater than the channel threshold, and let iso be the target gain.max β is the gain threshold of the image acquisition device to be corrected, and β is the gain influence factor.
[0127] The image color correction device provided in the embodiments of the present invention can execute the image color correction method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the image color correction method.
[0128] Example 5
[0129] Figure 5 This is a schematic diagram of the structure of a device provided in Embodiment 5 of the present invention. Figure 5 A block diagram of an exemplary device 12 suitable for implementing embodiments of the present invention is shown. Figure 5 The device 12 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0130] like Figure 5 As shown, device 12 is represented as a general-purpose computing device. The components of device 12 may include, but are not limited to: one or more processors or processing units 16, system storage device 28, and bus 18 connecting different system components (including system storage device 28 and processing unit 16).
[0131] Bus 18 represents one or more of several bus architectures, including a memory device bus or memory device controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0132] Device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by device 12, including volatile and non-volatile media, removable and non-removable media.
[0133] System storage device 28 may include computer system readable media in the form of volatile storage devices, such as random access memory (RAM) 30 and / or cache storage device 32. Device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (…). Figure 5 Not shown; usually referred to as a "hard drive"). Although Figure 5Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. Storage device 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0134] A program / utility 40 having a set (at least one) of program modules 42 may be stored in, for example, storage device 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of the present invention.
[0135] Device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with device 12, and / or with any device that enables device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 22. Furthermore, device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. Figure 5 As shown, network adapter 20 communicates with other modules of device 12 via bus 18. It should be understood that, although... Figure 5 As not shown, other hardware and / or software modules can be used in conjunction with device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0136] Processing unit 16 executes various functional applications and data processing by running programs stored in system storage device 28, such as implementing the image color correction method provided in the embodiments of the present invention, including:
[0137] Obtain the color element values to be corrected of the standard image acquired by the image acquisition device to be corrected, and obtain the standard color element values of the standard image;
[0138] Under the constraints of preset elements, a color correction matrix is determined based on the color element values to be corrected and the standard color element values;
[0139] The color correction matrix is used to perform color correction on the image acquired by the image acquisition device to be corrected.
[0140] Example 6
[0141] Embodiment 6 of the present invention also provides a computer-readable storage medium having a computer program stored thereon. When executed by a processor, the program implements the image color correction method provided in the embodiments of the present invention, including:
[0142] Obtain the color element values to be corrected of the standard image acquired by the image acquisition device to be corrected, and obtain the standard color element values of the standard image;
[0143] Under the constraints of preset elements, a color correction matrix is determined based on the color element values to be corrected and the standard color element values;
[0144] The color correction matrix is used to perform color correction on the image acquired by the image acquisition device to be corrected.
[0145] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) 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, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0146] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying 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. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0147] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0148] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can 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 it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0149] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. An image color correction method, characterized in that, include: Obtain the color element values to be corrected of the standard image acquired by the image acquisition device to be corrected, and obtain the standard color element values of the standard image; Under the constraints of preset elements, a color correction matrix is determined based on the color element value to be corrected and the standard color element value. When determining the difference between the color element value to be corrected and the standard color element value, the weight of the difference of the preset elements is increased. The preset elements are used to represent the convergence direction of the correction requirements of the image acquired by the image acquisition device to be corrected. The preset elements include hue elements or saturation elements. The color correction matrix is obtained in the LAB color space. The color correction matrix is used to perform color correction on the image acquired by the image acquisition device to be corrected. Before performing color correction on the image acquired by the image acquisition device based on the color correction matrix, the method further includes: Obtain the target gain of the image acquisition device to be corrected, and the target image information acquired by the image acquisition device to be corrected at the target gain; A correction adjustment matrix associated with the target gain is determined based on the target gain and the pixel value ratio of the target image information; the correction adjustment matrix is used to eliminate the color noise effect caused by the target gain. Based on the color correction matrix and the correction adjustment matrix, the adjusted color correction matrix is determined.
2. The method according to claim 1, characterized in that, Under the constraints of preset elements, a color correction matrix is determined based on the color element values to be corrected and the standard color element values, including: Determine the control parameters of the preset elements, and construct an objective function based on the control parameters; wherein, the objective function is used to determine the difference between the color element value to be corrected and the standard color element value; Based on the color element values to be corrected and the standard color element values, the color correction matrix when the objective function is the optimal solution is determined as the target color correction matrix.
3. The method according to claim 1, characterized in that, Obtaining the color element values to be corrected of the standard image acquired by the image acquisition device to be corrected, and obtaining the standard color element values of the standard image, includes: Under at least four color temperature environments, acquire at least four sets of color element values to be corrected for the standard image acquired by the image acquisition device to be corrected, and acquire at least four sets of standard color element values for the standard image. Accordingly, under the constraints of preset elements, a color correction matrix is determined based on the color element values to be corrected and the standard color element values, including: Under the constraints of preset elements, based on the at least four sets of color element values to be corrected and the at least four sets of standard color element values, a color correction matrix is determined at at least four color temperatures. The method further includes: The target color correction matrix at the target color temperature is determined by fitting interpolation curves to the color correction matrices at the at least four color temperatures and then using the fitted interpolation curves.
4. The method according to claim 3, characterized in that, Based on the color correction matrices at the at least four color temperatures, a target color correction matrix at the target color temperature is determined by nonlinear interpolation, including: Based on the values of each matrix element in the color correction matrix at the at least four color temperatures, the response model of each matrix element to the color temperature is determined by nonlinear interpolation. The target matrix element values at the target color temperature are determined based on the response model of each matrix element and color temperature, and the target color correction matrix is constructed based on the target matrix element values.
5. The method according to claim 4, characterized in that, The response model of each matrix element to color temperature is determined according to the following formula: Among them, M t The color temperature T is determined by nonlinear interpolation. t The color correction matrix T is shown below. t It is the calibrated color temperature, M down It is the calibrated color temperature T t The associated left-neighbor base color temperature color correction matrix, ΔM is the calibrated color temperature T t The color correction matrix is the difference between the color correction matrix of the left neighbor base color temperature and the color correction matrix of the right neighbor base color temperature. ΔT is the color temperature difference between the right neighbor base color temperature and the left neighbor base color temperature, and S is the response model including the model coefficients.
6. The method according to claim 1, characterized in that, The correction adjustment matrix associated with the target gain is determined using the following formula: Where P is the correction adjustment matrix, N R N G and N B Let N be the number of channels in the target image information whose values are greater than the channel threshold, and let iso be the target gain. max β is the gain threshold of the image acquisition device to be corrected, and β is the gain influence factor.
7. An image color correction device, characterized in that, include: The color element acquisition module is used to acquire the color element values to be corrected of the standard image acquired by the image acquisition device to be corrected, and to acquire the standard color element values of the standard image. The correction matrix determination module is used to determine a color correction matrix based on the color element value to be corrected and the standard color element value under the constraints of preset elements; when determining the difference between the color element value to be corrected and the standard color element value, the weight of the difference of the preset elements is increased; the preset elements are used to represent the convergence direction of the correction requirements of the image acquired by the image acquisition device to be corrected, and the preset elements include hue elements or saturation elements; the color correction matrix is obtained in the LAB color space. An image color correction module is used to perform color correction on the image acquired by the image acquisition device to be corrected based on the color correction matrix. The device further includes a gain adjustment module, specifically used for: Obtain the target gain of the image acquisition device to be corrected, and the target image information acquired by the image acquisition device to be corrected at the target gain; A correction adjustment matrix associated with the target gain is determined based on the target gain and the pixel value ratio of the target image information; the correction adjustment matrix is used to eliminate the color noise effect caused by the target gain. Based on the color correction matrix and the correction adjustment matrix, the adjusted color correction matrix is determined.
8. A device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the image color correction method as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the image color correction method as described in any one of claims 1-6.
Citation Information
Patent Citations
Image color correction method based on simulated annealing optimization algorithm
CN104217409A
Pixel-based color restoration device and method
CN108377373A
Image color correction method, apparatus and system
CN108712639A