Parameter calibration method, computer equipment and storage medium
By acquiring multiple image sets under the same target color temperature, determining the combination of white balance and color correction parameters, and selecting the optimal parameter pair, the problems of reduced color correction accuracy and complex process caused by traditional separate calibration are solved, and the camera achieves accurate calibration and consistent color performance under the target color temperature.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHUHAI MOJIE TECH CO LTD
- Filing Date
- 2025-12-22
- Publication Date
- 2026-05-05
AI Technical Summary
The traditional separate calibration of white balance and color correction modules leads to reduced color correction accuracy and a complex and inefficient calibration process, making it difficult to effectively and uniformly calibrate images under different lighting conditions.
By acquiring multiple image sets at the same target color temperature, the combination of white balance correction parameters and color correction parameters for each image is determined to minimize color difference. The optimal parameter pair at the target color temperature is then selected for calibration.
It achieves optimal color correction under specific light intensity, improves the consistency and robustness of the camera's color performance at the target color temperature, and solves the problem of unstable color reproduction caused by changes in light intensity.
Smart Images

Figure CN121985227A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to parameter calibration methods, computer equipment, and storage media. Background Technology
[0002] Traditional camera white balance and color correction calibration are typically performed separately under different lighting intensities and color temperatures, often using independent white balance and color correction matrix calibration methods. Due to the diversity of lighting intensities and color temperatures, it is difficult to effectively unify the calibration of images under different lighting conditions, resulting in unsatisfactory color difference correction effects. Summary of the Invention
[0003] This application provides a parameter calibration method, computer equipment, and storage medium, aiming to solve the technical problem of reduced color correction accuracy and complex and inefficient calibration process caused by the separate calibration of traditional white balance and color correction modules.
[0004] Firstly, a parameter calibration method is provided, including: Acquire multiple image sets under the same target color temperature, wherein the multiple image sets are image sets corresponding to multiple light intensities, and each image set includes multiple images captured under the same light intensity; Determine the first parameter pair corresponding to each image in each image set to obtain multiple first sets; wherein, one first set corresponds to one image set, and each first set includes multiple first parameter pairs, the first parameter pair including white balance correction parameters and color correction parameters, the first parameter pair so that the color difference of the image after white balance correction processing and color correction processing is minimized; Determine the second parameter pair in each first set to obtain multiple second parameter pairs; wherein, a second parameter pair is obtained based on a first set, and the second parameter pair is the first parameter pair with the smallest color difference in the first set. Among the plurality of second parameter pairs, the target parameter pair corresponding to the target color temperature is selected, and the camera parameters under the target color temperature are calibrated based on the target parameter pair.
[0005] Secondly, a parameter calibration device is provided, comprising: The acquisition module is used to acquire multiple image sets under the same target color temperature. The multiple image sets are image sets corresponding to multiple light intensities, and each image set includes multiple images captured under the same light intensity. The determination module is used to determine the first parameter pair corresponding to each image in each image set, thereby obtaining multiple first sets; wherein, one first set corresponds to one image set, and each first set includes multiple first parameter pairs, the first parameter pairs including white balance correction parameters and color correction parameters, and the first parameter pairs minimize the color difference of the images after white balance correction processing and color correction processing; The determining module is further configured to determine a second parameter pair in each first set to obtain multiple second parameter pairs; wherein, a second parameter pair is obtained based on a first set, and the second parameter pair is the first parameter pair with the smallest color difference in the first set; The filtering module is used to filter out the target parameter pair corresponding to the target color temperature from the plurality of second parameter pairs, and calibrate the camera parameters under the target color temperature based on the target parameter pair.
[0006] Thirdly, a computer device is provided, including a memory and a processor, the memory being connected to the processor, the processor being configured to execute one or more computer programs stored in the memory, wherein when the processor executes the one or more computer programs, the computer device performs the parameter calibration method described in the first aspect.
[0007] Fourthly, a computer-readable storage medium is provided, which stores a computer program, the computer program including program instructions, which, when executed by a processor, cause the processor to perform the parameter calibration method of the first aspect.
[0008] This application achieves the following technical effects: By determining a first parameter pair that minimizes color difference for each image set under each illumination intensity, this application ensures optimal color correction performance under specific illumination intensities. This application does not simply calibrate under a single illumination intensity; instead, it finds the optimal parameters (second parameter pairs) for each of multiple illumination intensities and filters them, ensuring that the final selected target parameter pairs are validated across multiple scenarios, thus exhibiting stronger robustness and consistency at the target color temperature. The entire process revolves around the same target color temperature, and the resulting target parameter pairs are dedicated calibration parameters for that color temperature, effectively solving the problem of unstable color reproduction caused by changes in illumination intensity and improving the camera's overall color performance at that color temperature. Therefore, this application can effectively integrate correction information from different illumination intensities, achieving precise calibration of camera parameters at the target color temperature, improving the accuracy and consistency of color correction, and ultimately enhancing the color reproduction effect of the image. Attached Figure Description
[0009] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 A schematic flowchart of a parameter calibration method provided in an embodiment of this application; Figure 2 A schematic diagram of an outer layer optimization iteration process provided for an embodiment of this application; Figure 3 A schematic diagram of an inner-layer optimization iteration process provided for an embodiment of this application; Figure 4 This is a schematic diagram of the structure of a parameter calibration device provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0011] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.
[0012] It should be noted that, unless there is a conflict, the various features in the embodiments of this application can be combined with each other, all of which are within the protection scope of this application. Furthermore, although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than the module division in the device or the order in the flowchart. Moreover, the terms "first," "second," and "third" used in this application do not limit the data or execution order, but only distinguish identical or similar items with essentially the same function and effect.
[0013] The technical solution of this application is applicable to camera parameter calibration scenarios.
[0014] In traditional image signal processing (ISP), white balance (WB) and color correction matrix (CCM) are two crucial modules that are typically calibrated independently and sequentially. The white balance module is primarily responsible for correcting color deviations caused by different light source color temperatures. Its core function is to estimate the scene's color temperature, calculate the gain coefficient, and adjust the three channels to restore white objects in the image to white. The color correction matrix module is mainly used to correct the difference between the image sensor's color response and human vision or a standard color space (such as sRGB). This difference primarily stems from the physical characteristics of its color filter array, and precise color mapping is achieved through a 3x3 matrix multiplication operation.
[0015] The current industry standard practice is as follows: First, under a specific standard light source (such as D65, D50, TL84, etc.), the CCM matrix is individually calibrated using a 24-color chart or other standard color chart to obtain the optimal color reproduction effect under that light source. Then, under different color temperature light sources, the white balance gain coefficient is calibrated by shooting gray cards.
[0016] However, this separate calibration method has inherent technical drawbacks: First, error accumulation and interaction occur because the gain adjustment of the white balance module directly changes the input data of the subsequent CCM module. In practical applications, the CCM is calibrated under a single standard light source, but when the scene color temperature deviates from this standard light source, the RGB values after WB gain adjustment are no longer the input distribution expected by the CCM, causing the CCM to fail to operate at its optimal point, thus introducing color errors. Second, the calibration process is complex and inefficient, requiring multiple independent calibrations under various light source environments. The process is cumbersome and time-consuming, increasing the product development and manufacturing cycle and costs.
[0017] To address the aforementioned issues, this application determines a first parameter pair that minimizes color difference for each image set under different illumination intensities, ensuring optimal color correction performance at specific intensities. This application does not simply calibrate under a single illumination intensity; instead, it finds the optimal parameters (second parameter pairs) for each of multiple illumination intensities and filters them. The final selected target parameter pairs are validated across multiple scenarios, resulting in stronger robustness and consistency at the target color temperature. The entire process revolves around the same target color temperature, and the resulting target parameter pairs are dedicated calibration parameters for that color temperature. This effectively solves the problem of unstable color reproduction caused by variations in illumination intensity, improving the camera's overall color performance at that color temperature. Therefore, this application effectively integrates correction information from different illumination intensities, achieving precise calibration of camera parameters at the target color temperature, improving the accuracy and consistency of color correction, and ultimately enhancing the color reproduction of the image.
[0018] The technical solution of this application is described in detail below.
[0019] See Figure 1 , Figure 1 This is a flowchart illustrating a parameter calibration method provided in an embodiment of this application; as shown below. Figure 1 As shown, the method includes the following steps: S101, acquire multiple image sets under the same target color temperature, wherein the multiple image sets are image sets corresponding to multiple light intensities, and each image set includes multiple images captured under the same light intensity.
[0020] Color temperature is an indicator describing the color characteristics of the light emitted by a light source, measured in Kelvin (K). It reflects whether the hue of the light source leans towards a cool (blue) or warm (yellow) tone. Target color temperature refers to a specific color temperature value selected during calibration or testing, such as the common standard light source color temperatures like D65 (approximately 6500K, simulating midday sunlight) or D50 (approximately 5000K, simulating warmer-toned sunlight).
[0021] For example, to calibrate the camera's performance under standard daylight, the target color temperature would be set to D65 (approximately 6500K). To calibrate its performance under office fluorescent lighting, the target color temperature might be set to TL84 (approximately 4100K). The target color temperature remains constant throughout the entire S101 acquisition process.
[0022] Illumination intensity refers to the light energy received per unit area, which can be understood as brightness or darkness. At the same color temperature, illumination intensity can vary from very dark (such as dusk) to very bright (such as noon).
[0023] For example, with a D65 light source, you can simulate different light intensities such as 5 lux (dim indoors), 100 lux (office), 500 lux (bright indoors), and 2000 lux (overcast outdoors) by adjusting the power of the light source or changing the distance between the camera and the light source.
[0024] An image set refers to a collection of multiple images taken under a fixed light intensity.
[0025] Among them, multiple images refer to a series of photos taken under the same light intensity, rather than just one, which can eliminate random errors and improve the statistical reliability of the data.
[0026] In some embodiments, multiple image sets under the same target color temperature are obtained by the following steps: under the same target color temperature, multiple images at different light intensities are acquired according to fixed first calibration parameters and second calibration parameters to obtain multiple image sets under the same target color temperature. The multiple image sets are image sets corresponding to multiple light intensities, and each image set includes multiple images captured under the same light intensity.
[0027] The first calibration parameter can be a parameter of the BLC (Black Level Correction) module. The BLC module is primarily used to correct dark current noise and bias generated by the image sensor under no-light conditions, ensuring accurate reproduction of the black areas of the image. The BLC module parameters adjust the black level offset, aiming to eliminate DC bias in the image signal and ensure that subsequent processing (such as color correction and gamma transformation) is performed on a clean signal referenced to "zero," thus guaranteeing the accuracy of the processing results. The second calibration parameter can be a parameter of the LSC module. The LSC module is used to correct the reduction in image edge brightness (vignetting) caused by lens optical characteristics, ensuring uniform image brightness. The LSC module parameters are compensation parameters used to adjust lens illumination non-uniformity.
[0028] Therefore, in practice, BLC calibration is performed by taking multiple completely black RAW images in a darkroom environment with the lens cap on. The average pixel value of these images is calculated to determine the precise black level at the current operating temperature, and this value is set as a fixed parameter for the BLC module. LSC calibration is then performed by taking a pure white (or neutral gray) RAW image under a uniform standard light source (such as an integrating sphere or uniform light box). The brightness attenuation from the center to the edges of the image is analyzed, generating a 2D gain map (shading table) to compensate for this attenuation. The gain value of each pixel in this gain map is set as a parameter for the LSC module. Finally, the obtained BLC module parameters (first calibration parameters) and LSC module parameters are written into the ISP configuration, and it is declared that these fixed parameters will always be used in the subsequent color calibration process.
[0029] In one possible implementation, a target color temperature is selected as the light source color temperature of the shooting environment to ensure consistent light source color. Under the same target color temperature, the light source brightness is adjusted to form multiple different light intensity levels (such as 50 lux, 200 lux, 800 lux, etc.). Under each light intensity, multiple images (e.g., 10 images) are captured using fixed BLC module parameters and LSC module parameters to form an image set. The above acquisition process is repeated to obtain multiple image sets, with each image set corresponding to a light intensity.
[0030] Furthermore, with the BLC module parameters and LSC module parameters already fixed, multiple images under different light intensities are acquired to obtain multiple image sets under the same target color temperature: a target color temperature (such as D65) is selected as the light source color temperature of the shooting environment to ensure consistent light source color.
[0031] Loop sampling (taking three light intensities as an example): Acquire a low-light image set: Adjust the light source to a low intensity (e.g., 50 lux); capture a RAW image with the camera. The camera's internal ISP automatically and instantly applies the pre-defined BLC and LSC module parameters for processing, and then outputs the processed RAW data. Under the same lighting conditions, capture multiple images consecutively (e.g., 10 images) to obtain the first image set. Each of these 10 images undergoes the exact same BLC and LSC module processing.
[0032] Acquire a set of images under moderate lighting: Adjust the light source to moderate intensity (e.g., 500 lux); take 10 more consecutive shots. Use the exact same BLC and LSC module parameters for the camera to obtain a second set of images.
[0033] Acquire a set of images under high light: Adjust the light source to high intensity (e.g., 2000 lux); take 10 more consecutive shots while keeping the BLC module parameters and LSC module parameters unchanged to obtain a third set of images.
[0034] As can be seen, this embodiment ensures that the influence of light intensity changes on image color is fully considered under the same color temperature, providing high-quality and rich sample data for joint calibration.
[0035] S102, determine the first parameter pair corresponding to each image in each image set to obtain multiple first sets; wherein, one first set corresponds to one image set, each first set includes multiple first parameter pairs, the first parameter pair includes white balance correction parameters and color correction parameters, the first parameter pair makes the color difference of the image after white balance correction processing and color correction processing reach the minimum.
[0036] The first parameter pair refers to a set of parameters determined for each image, including white balance correction parameters and color correction parameters. This set of parameters works together on the image, performing white balance correction and color correction sequentially to minimize the color difference in the final image.
[0037] This can be understood as the first parameter pair being specific to a single image. For 10 images under the same illumination intensity, theoretically, 10 slightly different first parameter pairs will be obtained, because each image has slight differences due to factors such as random noise.
[0038] Wherein, the first set of multiple first sets refers to the first set corresponding to the multiple light intensities, meaning that one first set corresponds to one light intensity.
[0039] Therefore, a first set corresponds to a specific light intensity. For example, all images taken under "low light intensity (50 lux)" will have their respective calculated first parameter pairs aggregated to form the first set corresponding to low light intensity.
[0040] The white balance correction parameter refers to a set of variable parameters consisting of the gain values (gR, gG, gB) of the red, green, and blue channels. In the joint optimization framework of this scheme, it serves as the core variable of the outer layer optimization. All its components (including the green channel gain gG, which is usually fixed) can be adjusted to work in conjunction with the color correction matrix to minimize the total color difference of the final image.
[0041] Among them, the color correction parameter refers to the color correction matrix (CCM), which is usually a 3x3 matrix used to convert the linear color space data of the image into the target color space, thereby correcting color deviation.
[0042] Color difference is used to measure the difference between the color of the corrected image and the standard color. Common color difference formulas include CIE76 or CIEDE2000. The smaller the color difference, the more accurate the color reproduction.
[0043] For example, suppose three light intensities were captured, with five images taken at each intensity. For low light (50 lux): image 1 is processed to obtain parameter pair 1-1; image 2 is processed to obtain parameter pair 1-2, ..., image 5 is processed to obtain parameter pair 1-5. Therefore, the first set - low light = {parameter pair 1-1, parameter pair 1-2, ..., parameter pair 1-5} is obtained.
[0044] For medium lighting (500 lux), a set containing 5 parameter pairs will also be obtained.
[0045] For highlights (2000 lux), a set of 5 parameter pairs will also be obtained.
[0046] Ultimately, we obtained 3 first sets, totaling 15 first parameter pairs.
[0047] In some embodiments, the plurality of image sets includes a target image, which is one image in one of the image sets, and can be obtained through... Figure 2 The process steps shown determine the first parameter pair corresponding to the target image, including the following steps A1-A5: A1. Input the target image and the current white balance correction parameters into the first optimizer for optimization and solution, and obtain the optimal color correction parameters corresponding to the current white balance correction parameters.
[0048] The first optimizer is used to perform white balance correction processing on the target image according to the current white balance correction parameters to obtain the first corrected image corresponding to the target image, and to solve for the optimal color correction parameters based on the first corrected image; the optimal color correction parameters minimize the error between the first corrected image after color correction processing and the preset standard image corresponding to the target image.
[0049] Specifically, it can be done through Figure 3 The process steps shown are optimized to obtain the optimal color correction parameters corresponding to the current white balance correction parameters, including the following steps A11-A16: A11. Based on the current white balance correction parameters, perform white balance correction processing on the target image to obtain the first corrected image corresponding to the target image.
[0050] A12. Based on the current color correction parameters, perform color correction processing on the first corrected image to obtain the current corrected image corresponding to the target image.
[0051] A13. Determine the error between the current calibrated image and the preset standard image.
[0052] The specific implementation process of A13 is as described in B1-B2: B1. Calculate the difference between the color of each pixel in the current corrected image and the corresponding standard color in the preset standard image to obtain the squared difference of each pixel color; B2. Accumulate the squared differences of the colors of all pixels in the current corrected image to obtain the error between the current corrected image and the preset standard image.
[0053] A14. Determine whether the error between the current calibrated image and the preset standard image satisfies the second convergence rule.
[0054] The second convergence rule includes minimizing the error between the current corrected image and the preset standard image; optionally, the second convergence rule can also be that the number of inner layer iterations (i.e., the number of times A12~A15 is executed) reaches a first preset number.
[0055] The minimum error refers to the situation where, in multiple consecutive iterations, the change in error between the current calibrated image and the preset standard image is less than a preset threshold, at which point the current error is determined to be the minimum.
[0056] If the second convergence rule is not met, proceed to step A15; if the second convergence rule is met, proceed to step A16.
[0057] A15. Based on the error between the current calibrated image and the preset standard image, update the current color calibration parameters and execute step A12.
[0058] The specific implementation process of A15 is as described in B3: B3. Based on the error, determine the gradient corresponding to the error; based on the gradient, determine the first search direction; based on the first search direction, update the current color correction parameters.
[0059] In practice, firstly, the partial derivatives of the current error function (i.e., the total squared difference between the corrected image and the standard image) with respect to the current color correction parameters (e.g., the 9 elements in a 3x3 matrix) are calculated to obtain a gradient vector with the same dimension as the parameters. This gradient vector indicates the direction in which the error grows the fastest at the current position. Then, to reduce the error, the first search direction is set to the opposite direction of this gradient vector. Finally, along this first search direction, combined with a preset step size factor (or the optimal step size determined through line search), the current color correction parameters are updated by subtracting the product of the step size factor and the gradient vector from the current parameters. This yields a new set of color correction parameters that reduce the error, and this is used to proceed to the next iteration.
[0060] A16. Determine the current color correction parameters that satisfy the second convergence rule as the optimal color correction parameters corresponding to the current white balance correction parameters.
[0061] A detailed description of A11-A16 above: The A11-A16 process involves the inner optimizer solving for the optimal color correction parameters. The current white balance correction parameters refer to a set of RGB gain values [gR, gG, gB] proposed by the outer optimizer (such as the Nelder-Mead algorithm) in the current iteration. These white balance correction parameters are used to adjust the white balance. They are employed to eliminate color casts caused by different light source color temperatures, resulting in more natural image colors.
[0062] The target image refers to a single RAW image that is being processed and has already undergone BLC and LSC processing, which is the original image data that needs to be white-balanced and color-corrected.
[0063] The first corrected image refers to the image after adjustment using the current white balance correction parameters, which initially eliminates color temperature deviation.
[0064] The current color correction parameter is a variable that the inner optimizer is iteratively updating; it is a 3x3 CCM matrix. At the start of optimization, it may be an initial guess (such as the identity matrix), and it will be continuously adjusted as optimization progresses, gradually approaching the optimal solution.
[0065] The current corrected image refers to the corrected image obtained by applying the current color correction matrix based on the first corrected image.
[0066] The preset standard image refers to an ideal reference image, usually derived from a standard color chart or a professionally calibrated image, used as a calibration target. The preset standard image may contain the standard color values (Lab values or linear RGB values) of each color patch on the standard color chart in the target color space (such as sRGB).
[0067] Here, error refers to a measure of the difference between the current calibrated image and the preset standard image, expressed using the Frobenius norm of the sum of squared differences. The smaller this value, the better the calibration effect. The sole objective of the inner optimizer is to minimize this error value.
[0068] Here, the gradient is the partial derivative of the error function with respect to the color correction parameters, indicating the direction in which the error decreases the most.
[0069] The first search direction refers to the parameter update direction determined based on the gradient, which is used to optimize the color correction parameters.
[0070] The second convergence rule is the criterion for the inner optimizer to stop iterating, which usually includes the error reaching the minimum or the change being lower than the threshold.
[0071] The first optimizer (inner optimization) is an algorithm module responsible for optimizing color correction parameters to minimize errors under fixed white balance correction parameters.
[0072] The optimal color correction parameter refers to the color correction matrix that minimizes the error between the corrected image and the preset standard image. Specifically, it is the 3x3 matrix output by the inner optimizer after satisfying the second convergence rule. It is the CCM that minimizes the error under the current white balance correction parameters and represents the final result of this inner layer optimization.
[0073] In the specific implementation of A11, the current white balance correction parameters (such as the gains of the red, green, and blue channels) are used to adjust each color channel of the target image. That is, each pixel of the target image is multiplied by the gain coefficient of the corresponding channel. The purpose is to eliminate the color deviation caused by the color temperature of the light source, so that the image color is closer to natural, and finally the first corrected image is obtained, that is, the image after white balance correction.
[0074] For example, if the red channel gain is 1.2, the green channel gain is 1.0, and the blue channel gain is 0.9, then the red value of each pixel in the target image is multiplied by 1.2, the green value by 1.0, and the blue value by 0.9.
[0075] In the specific implementation of A12, the current color correction matrix is applied to the first corrected image, which is to multiply the three-channel color vector of each pixel by a 3×3 color correction matrix. This matrix is responsible for mapping the sensor color space to the standard color space, adjusting the color deviation, and obtaining the current corrected image.
[0076] In the specific implementation of A13, B1-B2 are included, which compare the pixel colors of 24 color block regions in the current calibrated image with the corresponding 24 standard Lab values in the preset standard image. The (red channel deviation)² + (green channel deviation)² + (blue channel deviation)² of each color block is calculated, and then the squared differences of the 24 color blocks are summed to obtain the error between the current calibrated image and the preset standard image.
[0077] Specifically, the average color values of the pixels in each of the 24 color patch regions are extracted from the currently calibrated image, resulting in 24 sets of RGB data. Simultaneously, the corresponding 24 standard Lab values from a preset standard image are obtained and converted to the RGB color space for comparison under the same benchmark. Next, for each color patch, the deviation between its calibrated RGB value and the standard RGB value in the red, green, and blue channels is calculated. These three deviations are then squared and summed to obtain the squared error for that single color patch. Finally, the squared errors calculated for all 24 color patches are summed, and this sum (i.e., the sum of the squares of the color deviations of all color patches) is the final error value.
[0078] The red channel deviation refers to the red component value of a pixel in the corrected image minus the red component value of the corresponding pixel in the preset standard image. Similarly, the green channel deviation is obtained by subtracting the green component value, and the blue channel deviation is obtained by subtracting the blue component value.
[0079] In the specific implementation of A15, the inner optimizer, i.e., the first optimizer (such as the SLSQP algorithm), analyzes the relationship between the error function Error and the nine elements of the CCM matrix (referring to all the numbers in a 3x3 color correction matrix). Specifically, it calculates the gradient matrix G of the error function with respect to the CCM matrix through analytical differentiation or numerical differencing. Each element of this gradient matrix indicates how increasing or decreasing the corresponding element in the CCM affects the total error. Then, the inverse direction of the gradient, -G, is determined as the search direction.
[0080] In the specific implementation of B3, a suitable step size is chosen to ensure that the error gradually decreases. Along the determined first search direction, the color correction matrix parameters are updated: Mccm new = Mccm current – α×G (α is the learning rate or step size, automatically adjusted by the optimization algorithm). A new CCM matrix is obtained, and the updated color correction matrix is used for the next round of color correction. Using the newly updated CCM matrix, we return to step A12 and continuously apply the new color correction parameters to the first corrected image, calculating the error and updating the parameters until the error reaches its minimum value or the change is below a preset threshold, or the maximum number of iterations is reached (i.e., A16).
[0081] In other words, the color is recalibrated using Mccm new, and a new total error Errornew is calculated. If the error decreases significantly, it proves that the update direction is correct. The new gradient is then calculated again, and the parameters are updated. The cycle of "calibration-error calculation-parameter update" continues until the error reaches its minimum value or the change is lower than the preset threshold, or the maximum number of iterations is reached.
[0082] Therefore, after each iteration, it is checked whether the error between the current corrected image and the preset standard image satisfies the second convergence rule. Assuming that after 45 iterations the error becomes 1.05, and the error in the next iteration becomes 1.049, the change is less than the preset threshold 1e-6. The loop stops. At this point, the final CCM matrix is determined as the optimal color correction parameter. This is then returned to the outer optimizer.
[0083] As can be seen, this embodiment employs layered optimization, first fixing the white balance correction parameters and then optimizing the color correction parameters in the inner layer to ensure that the corrected image colors closely approximate the standard target. Ultimately, this achieves accurate color reproduction of the image, improving visual quality and color consistency.
[0084] A2. Based on the optimal color correction parameters, determine the color loss value corresponding to the current white balance correction parameters.
[0085] The specific implementation process of A2 is as described in (a)-(f): (a) Based on the optimal color parameters, perform color correction on the first corrected image to obtain a second corrected image; (b) Divide the second corrected image into color blocks to obtain multiple color blocks; (c) Obtain the color value corresponding to each of the plurality of color patches; (d) Calculate the color difference between the color value corresponding to each color block and the corresponding preset standard color value to obtain the color difference of each color block; (e) Calculate the square of the color difference for each color patch to obtain the squared color difference for each color patch; (f) Sum the squared color differences of all color blocks to obtain the color loss value corresponding to the current white balance correction parameter.
[0086] A3. Determine whether the color loss value corresponding to the current white balance correction parameters meets the first convergence rule.
[0087] The first convergence rule includes minimizing the color loss value corresponding to the current white balance correction parameter; optionally, the first convergence rule may also be a second preset number of iterations (i.e., the number of times A1~A4 are executed) of the outer iterations of the first convergence rule.
[0088] If the first convergence rule is not met, proceed to step A4; if the first convergence rule is met, proceed to step A5.
[0089] A4. Update the current white balance correction parameters based on the color loss value corresponding to the current white balance correction parameters, and execute step A1.
[0090] A5. Determine the current white balance correction parameters and the optimal color correction parameters that satisfy the first convergence rule as the first parameter pair corresponding to the target image.
[0091] A detailed description of A2-A5 above: The process from A2 to A5 is the process by which the outer optimizer solves for the optimal white balance correction parameters, so that the final image after complete ISP processing (including Gamma correction) has the smallest difference between its color and the standard value.
[0092] The optimal color parameters are not a fixed matrix, but rather the optimal CCM matrix obtained by the inner optimizer for the white balance correction parameters g proposed by the outer optimizer. It is an intermediate product of the outer optimization and a key basis for evaluating the quality of the current white balance correction parameters.
[0093] The second corrected image refers to the image obtained by applying the optimal color correction parameters based on the first corrected image.
[0094] Color block segmentation is used to locate and crop rectangular areas of each individual color block on a standard color chart within an image. For example, from an image containing a 24-color chart, 24 smaller images can be segmented, each containing only one color block.
[0095] The color value refers to the average color of a color patch. Typically, the colors of all pixels within the color patch area are averaged to eliminate local noise and obtain a representative color value. This color value is usually represented in a perceptibly uniform color space (such as CIELAB) because the human eye perceives color differences in such a space more linearly.
[0096] Color difference ΔE is an indicator that quantifies the visual difference between two colors. Commonly used formulas include CIE76, CIE94, or the more precise CIEDE2000.
[0097] The color loss value refers to the sum of the squares of the color differences of all color blocks, which is used to measure the overall color correction error under the current white balance correction parameters.
[0098] Among them, the preset standard color value refers to the ideal standard color value corresponding to each color block, which is usually derived from a standard color chart or reference image.
[0099] The first convergence rule is the condition for the outer optimizer to stop iterating. This rule can be: the color loss value reaches its minimum, or the loss change: after several consecutive iterations, the decrease in the loss value is less than a very small threshold; the parameter change: the adjustment of the WB parameter itself is less than a threshold; and the maximum number of iterations: to prevent infinite loops, an upper limit for iterations is set (e.g., 100 times).
[0100] In the specific implementation of (a), the optimal color correction matrix obtained by inner layer optimization is used to perform matrix multiplication on the first corrected image to obtain the second corrected image.
[0101] In the specific implementation of (b), the second corrected image is divided into several color blocks, each representing a local region in the image. This can be achieved through grid partitioning (e.g., dividing the image into several fixed-size squares) or content-based segmentation algorithms (e.g., superpixel segmentation).
[0102] In the specific implementation of (c), the representative color value of each color block is calculated by calculating the average value of the colors of all pixels within the color block, or by using other statistical measures, such as median color or principal component color.
[0103] In the specific implementation of (d), the inherent and authoritative preset standard color values (i.e., standard Lab values) of the standard color chart are retrieved. Then, the actual color value of each color patch calculated in the previous step is compared pairwise with the corresponding standard color value, and a quantified color difference value is calculated for each color patch using a professional color difference formula (such as CIEDE2000). Thus, 24 independent color differences are obtained.
[0104] In the specific implementation of (e)-(f), the color difference of each color block is squared to obtain the squared color difference of each color block, and the squared color differences of all color blocks are summed to obtain the color loss value corresponding to the current white balance correction parameter.
[0105] Furthermore, the color loss value is used as feedback to adjust the white balance correction parameters to reduce overall color error. The adjusted white balance correction parameters and the target image are then input into the first optimizer (inner layer optimization) to optimize the color correction parameters. This process is repeated to form the outer layer optimization loop.
[0106] Therefore, initialize the white balance correction parameters; calculate the first corrected image; optimize the inner layer to obtain the optimal color correction parameters; calculate the color loss value; adjust the white balance correction parameters according to the loss value (e.g., using gradient descent or other optimization algorithms); determine whether the convergence rule is met (minimum loss value or the number of iterations reaches the threshold); if not converged, repeat the above steps.
[0107] Therefore, by iteratively updating the white balance correction parameters, the global optimal solution for overall color correction is sought.
[0108] Specifically, to determine whether the first convergence rule is met, in the outer optimization iteration, the current color loss value is calculated and compared with the historical loss value to determine whether it has reached its minimum or the change tends to zero, or to check whether the number of iterations has reached its upper limit. If any of these conditions are met, the optimization process is considered to have converged.
[0109] Specifically, the process of determining the current white balance correction parameters and the optimal color correction parameters as the first parameter pair involves combining the current white balance correction parameters and the corresponding optimal color correction parameters at the time of iteration termination as the final output first parameter pair. That is, the current white balance correction parameter value is recorded, and the optimal color correction matrix obtained from the corresponding inner layer optimization is recorded. These two are then encapsulated into a parameter pair, representing the best color correction scheme for the target image.
[0110] Therefore, when the outer layer optimization is complete and the first convergence rule is met, the iteration stops. At this point, the current white balance correction parameters and the corresponding optimal color correction parameters constitute the best color correction scheme for the target image, referred to as the first parameter pair. This parameter pair ensures the accuracy and naturalness of the image colors and can be used for the final output or further processing of the image.
[0111] Understandably, for each image in the image set, the first parameter pair corresponding to the image can be determined through the above steps A1-A5, thereby obtaining a first set; for each image set, the first set is determined in the same way, thereby obtaining multiple first sets.
[0112] As can be seen, in this embodiment, for each image, a set of white balance correction parameters (represented by green channel gain) and color correction parameters (color correction matrix) are determined to minimize the color difference of the image. Then, the parameter pairs of all images under the same illumination intensity are summarized to form the first set of illumination intensity. This set lays the foundation for the subsequent parameter calibration process.
[0113] S103, determine the second parameter pair in each first set to obtain multiple second parameter pairs; wherein, a second parameter pair is obtained based on a first set, and the second parameter pair is the first parameter pair with the smallest color difference in the first set.
[0114] In this case, a second parameter corresponds to a first set.
[0115] This can be understood as follows: since there are multiple light intensities (such as low, medium, and high), each light intensity corresponds to a first set, and each set will select a second parameter pair. Therefore, the final number of second parameter pairs will be the same as the number of light intensities.
[0116] The second parameter pair refers to the first parameter pair with the smallest color difference selected from each first set, which serves as the representative parameter pair for that set.
[0117] The process involves: a) visiting each first set sequentially; b) within each set, comparing the color differences of all first parameter pairs, and selecting the first parameter pair with the smallest color difference. Specifically, this can be achieved by calculating the color difference index for each first parameter pair in the set, finding the parameter pair with the smallest color difference, and defining that parameter pair as the second parameter pair for that set; c) repeating step b for all first sets to collect all second parameter pairs and form a second parameter pair set.
[0118] For example, suppose five images were taken in low light (50 lux), resulting in a set containing five pairs of first parameters. First set - Low light: P1 (from image 1), final color loss value L1 = 2.85 P2 (from image 2), final color loss value L2 = 2.91 P3 (from image 3), final color loss value _3 = 2.73 <-- Lowest! P4 (from image 4), final color loss value L4 = 2.88 P5 (from image 5), final color loss value L5 = 2.80 Selection process: The initial champion is P1, with a score of 2.85.
[0119] P2's score of 2.91 > 2.85, so the champion remains unchanged.
[0120] P3's score is 2.73 < 2.85, so P3 is now the champion with a score of 2.73.
[0121] P4's score of 2.88 > 2.73, so the champion remains unchanged.
[0122] P5's score of 2.80 > 2.73, so the champion remains unchanged.
[0123] After the iteration is complete, P3 wins. Therefore, P3 is determined to be the second parameter pair corresponding to the low-light environment.
[0124] Therefore, for multiple target images, multiple first sets are obtained. Each set contains multiple sets of white balance correction parameters and color correction parameters (first parameter pairs). By comparing color differences, the first parameter pair with the smallest color difference in each set is selected and called the second parameter pair. The resulting multiple sets of second parameter pairs represent the optimal combination of color correction parameters for different target images.
[0125] S104, among the plurality of second parameter pairs, select the target parameter pair corresponding to the target color temperature, and calibrate the camera parameters under the target color temperature based on the target parameter pair.
[0126] Green channel gain is a key parameter in white balance correction, representing the gain factor of the green channel in the image. The closer the green channel gain is to 1, the closer the brightness adjustment of that channel is to the original acquired value, resulting in more natural color reproduction.
[0127] Among them, the target parameter pair refers to the parameter pair selected from multiple second parameter pairs, whose green channel gain is closest to 1, indicating that the parameter pair performs the most stably and reliably under various lighting conditions.
[0128] Specifically, among multiple second parameter pairs, the difference between the green channel gain and 1 is calculated for each parameter pair, and the parameter pair with the smallest difference is selected. The target parameter pair is the parameter pair corresponding to the target color temperature. This means that when the color temperature is the target color temperature, the target parameter pair is used for white balance correction and color correction.
[0129] Furthermore, iterate through all pairs of second parameters and obtain their green channel gain. Calculate each Find the absolute value of the parameter pair that minimizes this value; this is called the target parameter pair.
[0130] For example, if there are three second parameter pairs with green channel gains of 0.95, 1.02, and 1.10, and the differences from 1 are calculated to be 0.05, 0.02, and 0.10, respectively, then the parameter pair with a green channel gain of 1.02 is selected as the target parameter pair.
[0131] As can be seen, by selecting the second parameter pair with the green channel gain closest to 1 in this embodiment, the target parameter pair that performs most stably and reliably under various lighting conditions can be selected. This target parameter pair is used as the final mass production parameter to calibrate the camera parameters under the target color temperature, ensuring the accuracy and consistency of image color reproduction and improving the user experience.
[0132] This application ensures optimal color correction at specific lighting intensities by determining a first parameter pair that minimizes color difference for each image set under each illumination intensity. Instead of simply calibrating under a single illumination intensity, this application finds the optimal parameters (second parameter pairs) for each of multiple illumination intensities and filters them. The final selected target parameter pairs are validated across multiple scenarios, resulting in stronger robustness and consistency at the target color temperature. The entire process revolves around the same target color temperature, and the resulting target parameter pairs are dedicated calibration parameters for that color temperature. This effectively solves the problem of unstable color reproduction caused by variations in illumination intensity, improving the camera's overall color performance at that color temperature. Therefore, this application effectively integrates correction information from different illumination intensities, achieving precise calibration of camera parameters at the target color temperature, improving the accuracy and consistency of color correction, and ultimately enhancing the color reproduction of the image.
[0133] The method of this application has been described above; the apparatus of this application will be described below.
[0134] See Figure 4 , Figure 4 This is a schematic diagram of the structure of a parameter calibration device provided in an embodiment of this application, as shown below. Figure 4 As shown, the parameter calibration device 40 includes: The acquisition module 401 is used to acquire multiple image sets under the same target color temperature. The multiple image sets are image sets corresponding to multiple light intensities, and each image set includes multiple images captured under the same light intensity. The determining module 402 is used to determine the first parameter pair corresponding to each image in each image set to obtain multiple first sets; wherein, one first set corresponds to one image set, and each first set includes multiple first parameter pairs, the first parameter pair including white balance correction parameters and color correction parameters, and the first parameter pair makes the color difference of the image after white balance correction processing and color correction processing reach the minimum. The determining module 402 is further configured to determine a second parameter pair in each first set to obtain multiple second parameter pairs; wherein, a second parameter pair is obtained based on a first set, and the second parameter pair is the first parameter pair with the smallest color difference in the first set; The filtering module 403 is used to filter out the target parameter pair corresponding to the target color temperature from the plurality of second parameter pairs, and calibrate the camera parameters under the target color temperature based on the target parameter pair.
[0135] This application ensures optimal color correction at specific lighting intensities by determining a first parameter pair that minimizes color difference for each image set under each illumination intensity. Instead of simply calibrating under a single illumination intensity, this application finds the optimal parameters (second parameter pairs) for each of multiple illumination intensities and filters them. The final selected target parameter pairs are validated across multiple scenarios, resulting in stronger robustness and consistency at the target color temperature. The entire process revolves around the same target color temperature, and the resulting target parameter pairs are dedicated calibration parameters for that color temperature. This effectively solves the problem of unstable color reproduction caused by variations in illumination intensity, improving the camera's overall color performance at that color temperature. Therefore, this application effectively integrates correction information from different illumination intensities, achieving precise calibration of camera parameters at the target color temperature, improving the accuracy and consistency of color correction, and ultimately enhancing the color reproduction of the image.
[0136] It should be noted that the parameter calibration device 40 described above can execute the parameter calibration method provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in the embodiments can be found in the parameter calibration method provided in the embodiments of this application.
[0137] See Figure 5 , Figure 5 This is a schematic diagram of the structure of a computer device 50 provided in an embodiment of this application. The computer device 50 includes a processor 501 and a memory 502. The memory 502 is connected to the processor 501, for example, via a bus.
[0138] Processor 501 is configured to support the computer device 50 in performing the corresponding functions in the methods described in the above method embodiments. Processor 501 may be a central processing unit (CPU), a network processor (NP), a hardware chip, or any combination thereof. The aforementioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The aforementioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0139] Memory 502 is used to store program code, etc. Memory 502 may include volatile memory (VM), such as random access memory (RAM); memory 502 may also include non-volatile memory (NVM), such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD); memory 502 may also include combinations of the above types of memory.
[0140] The memory 502 is used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the parameter calibration method or the corresponding program instructions / modules in the embodiments of this application. The processor executes the parameter calibration method or various functional applications and data processing of the parameter calibration method by running the non-volatile software programs, instructions, and modules stored in the memory, thereby realizing the parameter calibration method or the function of the parameter calibration method provided in the above method embodiments.
[0141] The memory 502 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function. The data storage area may store data created based on the use of the parameter calibration device, etc. In some embodiments, the memory may include memory remotely located relative to the processor, which can be connected to the parameter calibration device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0142] The one or more modules are stored in the memory. When executed by the one or more processors, they perform the parameter calibration method in any of the above method embodiments. For example, they perform the method steps described in the above method embodiments to realize the functions of the modules described in the above device embodiments.
[0143] This application also provides a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a computer, cause the computer to perform the parameter calibration method as described in the foregoing embodiments.
[0144] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing associated hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0145] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A parameter calibration method, characterized in that, include: Acquire multiple image sets under the same target color temperature, wherein the multiple image sets are image sets corresponding to multiple light intensities, and each image set includes multiple images captured under the same light intensity; Determine the first parameter pair corresponding to each image in each image set to obtain multiple first sets; wherein, one first set corresponds to one image set, and each first set includes multiple first parameter pairs, the first parameter pair including white balance correction parameters and color correction parameters, the first parameter pair so that the color difference of the image after white balance correction processing and color correction processing is minimized; Determine the second parameter pair in each first set to obtain multiple second parameter pairs; wherein, a second parameter pair is obtained based on a first set, and the second parameter pair is the first parameter pair with the smallest color difference in the first set. Among the plurality of second parameter pairs, the target parameter pair corresponding to the target color temperature is selected, and the camera parameters under the target color temperature are calibrated based on the target parameter pair.
2. The method according to claim 1, characterized in that, The plurality of image sets include a target image, wherein the target image is one of the images in one of the image sets; The determination of the first parameter pair corresponding to each image in each image set yields multiple first sets, including: The target image and the current white balance correction parameters are input into a first optimizer for optimization and solution to obtain the optimal color correction parameters corresponding to the current white balance correction parameters. The first optimizer is used to perform white balance correction processing on the target image according to the current white balance correction parameters to obtain a first corrected image corresponding to the target image, and to solve for the optimal color correction parameters based on the first corrected image. The optimal color correction parameters minimize the error between the first corrected image after color correction processing and the preset standard image corresponding to the target image. Based on the optimal color correction parameters, determine the color loss value corresponding to the current white balance correction parameters, and update the current white balance correction parameters based on the color loss value. Input the target image and the updated current white balance correction parameters into the first optimizer for optimization and solution to obtain the optimal color correction parameters corresponding to the current white balance correction parameters, until the first convergence rule is met. The first convergence rule includes minimizing the color loss value. The current white balance correction parameter and the optimal color correction parameter that satisfy the first convergence rule are determined as the first parameter pair corresponding to the target image.
3. The method according to claim 2, characterized in that, The step of inputting the target image and the current white balance correction parameters into the first optimizer for optimization and solving to obtain the optimal color correction parameters corresponding to the current white balance correction parameters includes: Based on the current white balance correction parameters, the target image is subjected to white balance correction processing to obtain the first corrected image corresponding to the target image; Based on the current color correction parameters, the first corrected image is subjected to color correction processing to obtain the current corrected image corresponding to the target image; Based on the error between the current corrected image and the preset standard image, the current color correction parameters are updated. Based on the updated current color correction parameters, the first corrected image is subjected to color correction processing to obtain the current corrected image corresponding to the target image, until the second convergence rule is met, the second convergence rule including the error reaching the minimum; The current color correction parameter that satisfies the second convergence rule is determined as the optimal color correction parameter corresponding to the current white balance correction parameter.
4. The method according to claim 3, characterized in that, The step of updating the current color correction parameters based on the error between the current corrected image and the preset standard image includes: Based on the error, determine the gradient corresponding to the error; Based on the gradient, determine the first search direction; Update the current color correction parameters according to the first search direction.
5. The method according to claim 3, characterized in that, Before updating the current color correction parameters based on the error between the current corrected image and the preset standard image, the method further includes: Calculate the difference between the color of each pixel in the current corrected image and the corresponding standard color in the preset standard image to obtain the squared difference of each pixel color; The error between the current corrected image and the preset standard image is obtained by summing the squared differences of the colors of all pixels in the current corrected image.
6. The method according to claim 2, characterized in that, The step of determining the color loss value corresponding to the current white balance correction parameter based on the optimal color parameters includes: Based on the optimal color parameters, the first corrected image is color corrected to obtain the second corrected image; Based on the second corrected image, determine the color loss value corresponding to the current white balance correction parameters.
7. The method according to claim 6, characterized in that, The step of determining the color loss value corresponding to the current white balance correction parameters based on the second corrected image includes: The second calibration image is divided into color blocks to obtain multiple color blocks; Obtain the color value corresponding to each of the multiple color blocks; Calculate the color difference between the color value corresponding to each color block and the corresponding preset standard color value to obtain the color difference of each color block; The squared color difference of each color block is calculated by squaring the color difference; The color loss value corresponding to the current white balance correction parameter is obtained by summing the squared color differences of all color blocks.
8. The method according to any one of claims 1-7, characterized in that, The acquisition of multiple image sets under the same target color temperature includes: Under the same target color temperature, multiple images at different light intensities are acquired based on fixed first and second calibration parameters to obtain multiple image sets under the same target color temperature.
9. A computer device, characterized in that, The device includes a memory and a processor, the memory being connected to the processor, the processor being configured to execute one or more computer programs stored in the memory, the processor causing the computer device to perform the method as described in claims 1-8 when executing the one or more computer programs.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method as described in claims 1-8.