A white balance calibration method, apparatus, electronic device, and program product.
By employing a layered correction and closed-loop iterative approach, the error introduced by the fixed reference channel in existing white balance calibration is resolved, achieving higher precision white balance calibration that adapts to changes in sensors and light sources, thereby improving imaging quality.
Patent Information
- Application Number
- CN202611360859.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-03
- Publication Date
- 2026-11-17
AI Technical Summary
Existing white balance calibration methods rely on fixed color channels as white balance references, which cannot effectively compensate for errors introduced by differences in sensor batches, fluctuations in light source temperature, and changes in device photosensitivity, resulting in color cast problems in imaging.
By correcting channel-specific and internal errors in a layered manner, and using a closed-loop iterative method, the system first performs column-by-column alignment within each channel, then selects the brightest channel as a reference for secondary calibration, and iteratively generates feedback correction parameters under the same acquisition conditions. The system integrates multiple rounds of parameters to generate the target white balance mapping parameters.
It effectively improves the color cast problem of images after traditional open-loop white balance calibration, enhances the actual imaging accuracy of white balance calibration, adapts to changes in sensor batches and light source conditions, and avoids adaptation deviations caused by fixed reference channels.
Smart Images

Figure CN123123737A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of white balance calibration technology, and in particular to a white balance calibration method, apparatus, electronic device and program product. Background Technology
[0002] Currently, most existing white balance methods directly calculate the original RGB mean values of white paper, gray card, or standard white field, and then perform a one-time adjustment after calculating the channel gain ratio, which is an open-loop calibration mode. This method relies solely on the original image data before calibration for calculation, so even if the global mean is aligned, the calibrated white medium is still prone to color cast, and local color line defects are difficult to eliminate.
[0003] Existing solutions generally use a fixed color channel as the white balance reference or a preset fixed white point. Due to the influence of sensor batch differences, light source temperature fluctuations, light source aging, and changes in device photosensitivity, the preset reference channel may not be the brightest channel under the current operating conditions. Therefore, directly using a fixed reference for gain adjustment can easily lead to the problem of strong channels being improperly darkened. It can also cause the calibration results to be out of sync with the actual hardware output state. The calibration parameters obtained by relying solely on a single open-loop calculation cannot offset the actual errors introduced by hardware quantization, limiting, and analog link temperature drift. As a result, the final image will still have residual color cast issues. Summary of the Invention
[0004] This invention provides a white balance calibration method, apparatus, electronic device, and program product to correct channel-specific errors in a layered manner and alleviate the color cast problem of open-loop white balance imaging through closed-loop iteration.
[0005] In a first aspect, embodiments of the present invention provide a white balance calibration method, the method comprising: Dark field subtraction is performed based on dark field data and initial white field data from a uniform white calibration medium to obtain effective response data for each imaging unit in each color channel. Based on the effective response data, the channel response statistical target for each color channel is determined. The first-level alignment parameters within each channel are calculated using the response statistics target within each channel. The first-level alignment parameters are then applied to the initial white point data to obtain the channel statistics values of each channel after first-level alignment. The color channel with the largest response amplitude among the channel statistics values after first-level alignment is selected as the reference channel. A common white point target is constructed in conjunction with the safe output upper limit, and the second-level calibration parameters of each color channel are calculated based on the common white point target. The alignment parameters within the primary channel and the parameters after secondary calibration are written into the scanning device. Under the same acquisition conditions as the initial white field data acquisition conditions, the uniform white calibration medium is re-scanned to acquire feedback white field data. Feedback correction parameters are iteratively generated based on the feedback white field data. When a preset stop condition is met, the alignment parameters within the primary channel, the parameters after secondary calibration, and the feedback correction parameters obtained from multiple iterations are integrated to generate the target white balance mapping parameters.
[0006] In one possible implementation, the step of calculating the first-level channel alignment parameters using the response statistics target within each of the channels, and applying the first-level channel alignment parameters to the initial white field data to obtain the channel statistics values of each channel after first-level alignment includes: Based on the ratio of the statistical target of the intra-channel response of each color channel to the effective response of the corresponding imaging unit, the first-level intra-channel alignment parameters of each imaging unit are obtained after cropping the coefficient within the allowable range. The alignment parameters within the first-level channel are applied to the initial white field data to obtain pre-corrected white field intermediate data. After filtering out overly dark, saturated, and abnormal imaging unit positions from the pre-corrected white field intermediate data, the statistical values of each color channel after first-level alignment are obtained.
[0007] In one possible implementation, the color channel with the largest response amplitude among the first-level aligned channel statistics is selected as the reference channel. A common white point target is constructed in conjunction with the safe output upper limit. Based on the common white point target, the second-level calibrated parameters of each color channel are calculated, including: After first-level alignment of the red, green, and blue color channels, the color channel with the largest response amplitude is selected as the reference channel from the channel statistics. The smaller value between the upper limit of the safe output and the channel statistics after the first-level alignment of the reference channel is taken as the common white point target; Based on the ratio of the common white point target to the channel statistics after primary alignment of each color channel, the alignment coefficient between the secondary channels of each color channel is obtained after clipping the coefficient within the allowable range. The obtained alignment coefficients between the secondary channels are synchronously adapted to the direct gain path, segmented mapping path, and lookup table path, and node monotonicity checks, duplicate node merging, output limiting, and fixed-point rounding are performed to obtain the processed secondary calibration parameters.
[0008] In one possible implementation, the alignment parameters within the primary channel and the post-calibrated parameters are written into the scanning device; under the same acquisition conditions as the initial white field data acquisition conditions, the uniform white calibration medium is re-scanned to acquire feedback white field data, and feedback correction parameters are iteratively generated based on the feedback white field data; when a preset stopping condition is met, the alignment parameters within the primary channel, the post-calibrated parameters, and the feedback correction parameters obtained from multiple iterations are integrated to generate target white balance mapping parameters, including: Write the alignment parameters in the first-level channel and the parameters after the second-level calibration into the scanning device, and keep the light source, timing, simulation front end, and mechanical position conditions consistent with the initial white field data collected. Rescan the uniform white calibration medium and collect feedback white field data. The feedback white field data is mapped using the currently loaded calibration parameters. After filtering out overly dark, saturated, and abnormal imaging unit positions, the feedback channel statistics and feedback common target of each color channel are calculated. The residual white balance error is then calculated based on the feedback channel statistics and feedback common target. When the residual white balance error is greater than the preset residual error threshold, the feedback original correction coefficient of the current round is calculated, the feedback original correction coefficient is damped to obtain the feedback correction parameter of the current round, and the feedback correction parameter of the current round is synchronously applied to the calibration parameter loaded in the device, and then the process of re-scanning and collecting data is returned to start the next round of iteration. The iteration terminates when the preset stopping condition is met, and the alignment parameters in the first-level channel, the parameters after second-level calibration, and the feedback correction parameters obtained in each round are combined into the target white balance mapping parameters.
[0009] In one possible implementation, the preset stopping condition includes at least one of the following: the residual white balance error is less than or equal to the residual error threshold; the channel ratio integrated color difference meets the preset condition; the number of feedback iterations reaches the preset maximum number of feedback iterations; the number of effective imaging unit samples in any color channel is less than the preset threshold; and the feedback correction parameter continuously touches the upper and lower limits of the coefficient's allowable range.
[0010] In one possible implementation, the method further includes: Identify the image to be processed; The target white balance mapping parameters are called to transform the image to be processed, and amplitude limiting output processing is performed to obtain the target image after white balance correction.
[0011] In one possible implementation, the step of calling the target white balance mapping parameters to transform the image to be processed and performing amplitude limiting output processing to obtain a white balance corrected target image includes: Based on the target white balance mapping parameters and the endpoint-preserving secondary brightening function, the composite mapping parameters are determined; The image to be processed is mapped based on the composite mapping parameters, and the abnormal imaging unit neighborhood repair, output limiting, fixed-point scaling and quantization rounding are performed sequentially to obtain the target image.
[0012] Secondly, embodiments of the present invention provide a white balance calibration device, the device comprising: The analysis unit is used to perform dark field subtraction processing based on dark field data and initial white field data of uniform white calibration medium to obtain effective response data of each imaging unit in each color channel, and to determine the channel response statistical target corresponding to each color channel based on the effective response data. The alignment calculation unit is used to calculate the first-level channel alignment parameters using the response statistics target within each channel, apply the first-level channel alignment parameters to the initial white field data, and obtain the channel statistics values of each channel after first-level alignment; select the color channel with the largest response amplitude among the channel statistics values after first-level alignment as the reference channel, construct a common white point target in combination with the safe output upper limit, and calculate the second-level calibration parameters of each color channel based on the common white point target; The calibration unit is used to write the alignment parameters in the primary channel and the parameters after secondary calibration into the scanning device, and under the same acquisition conditions as the initial white field data acquisition conditions, to re-scan and acquire feedback white field data on the uniform white calibration medium, and to iteratively generate feedback correction parameters based on the feedback white field data; when a preset stop condition is met, the alignment parameters in the primary channel, the parameters after secondary calibration, and the feedback correction parameters obtained from multiple iterations are integrated to generate target white balance mapping parameters.
[0013] In one possible implementation, the alignment calculation unit is used for: Based on the ratio of the statistical target of the intra-channel response of each color channel to the effective response of the corresponding imaging unit, the first-level intra-channel alignment parameters of each imaging unit are obtained after cropping the coefficient within the allowable range. The alignment parameters within the first-level channel are applied to the initial white field data to obtain pre-corrected white field intermediate data. After filtering out overly dark, saturated, and abnormal imaging unit positions from the pre-corrected white field intermediate data, the statistical values of each color channel after first-level alignment are obtained.
[0014] In one possible implementation, the alignment calculation unit is used for: After first-level alignment of the red, green, and blue color channels, the color channel with the largest response amplitude is selected as the reference channel from the channel statistics. The smaller value between the upper limit of the safe output and the channel statistics after the first-level alignment of the reference channel is taken as the common white point target; Based on the ratio of the common white point target to the channel statistics after primary alignment of each color channel, the alignment coefficient between the secondary channels of each color channel is obtained after clipping the coefficient within the allowable range. The obtained alignment coefficients between the secondary channels are synchronously adapted to the direct gain path, segmented mapping path, and lookup table path, and node monotonicity checks, duplicate node merging, output limiting, and fixed-point rounding are performed to obtain the processed secondary calibration parameters.
[0015] In one possible implementation, the calibration unit is used for: Write the alignment parameters in the first-level channel and the parameters after the second-level calibration into the scanning device, and keep the light source, timing, simulation front end, and mechanical position conditions consistent with the initial white field data collected. Rescan the uniform white calibration medium and collect feedback white field data. The feedback white field data is mapped using the currently loaded calibration parameters. After filtering out overly dark, saturated, and abnormal imaging unit positions, the feedback channel statistics and feedback common target of each color channel are calculated. The residual white balance error is then calculated based on the feedback channel statistics and feedback common target. When the residual white balance error is greater than the preset residual error threshold, the feedback original correction coefficient of the current round is calculated, the feedback original correction coefficient is damped to obtain the feedback correction parameter of the current round, and the feedback correction parameter of the current round is synchronously applied to the calibration parameter loaded in the device, and then the process of re-scanning and collecting data is returned to start the next round of iteration. The iteration terminates when the preset stopping condition is met, and the alignment parameters in the first-level channel, the parameters after second-level calibration, and the feedback correction parameters obtained in each round are combined into the target white balance mapping parameters.
[0016] In one possible implementation, the preset stopping condition includes at least one of the following: the residual white balance error is less than or equal to the residual error threshold; the channel ratio integrated color difference meets the preset condition; the number of feedback iterations reaches the preset maximum number of feedback iterations; the number of effective imaging unit samples in any color channel is less than the preset threshold; and the feedback correction parameter continuously touches the upper and lower limits of the coefficient's allowable range.
[0017] In one possible implementation, the apparatus further includes a processing unit for: Identify the image to be processed; The target white balance mapping parameters are called to transform the image to be processed, and amplitude limiting output processing is performed to obtain the target image after white balance correction.
[0018] In one possible implementation, the processing unit is configured to: Based on the target white balance mapping parameters and the endpoint-preserving secondary brightening function, the composite mapping parameters are determined; The image to be processed is mapped based on the composite mapping parameters, and the abnormal imaging unit neighborhood repair, output limiting, fixed-point scaling and quantization rounding are performed sequentially to obtain the target image.
[0019] Thirdly, embodiments of the present invention provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps included in any of the methods in the first aspect.
[0020] Fourthly, embodiments of the present invention provide a computer-readable storage medium including program code, which, when executed on an electronic device, causes the electronic device to perform the steps included in any of the methods in the first aspect.
[0021] Fifthly, embodiments of the present invention provide a computer program product, the computer program product comprising: computer program code, which, when executed on an electronic device, causes the electronic device to perform the steps included in any of the methods in the first aspect.
[0022] The technical solutions provided by the embodiments of the present invention bring at least the following beneficial effects: In this embodiment of the invention, based on the effective response data of each imaging unit in each color channel, the response statistical target within each color channel is determined. Then, through the response statistical target within each color channel, the alignment parameters within the first-level channel and the parameters after secondary calibration are obtained. This allows for layered processing of column-by-column errors within channels and overall scale differences between channels, avoiding confusion between two different types of errors caused by a single global proportion. Specifically, when determining the parameters after secondary calibration, the currently brightest channel is selected as the reference channel to construct a common white point target. This adapts to changes in sensor batches and light source states, thus avoiding adaptation deviations caused by a fixed reference channel. Furthermore, after writing the alignment parameters within the first-level channel and the parameters after secondary calibration into the device, the feedback white point data is re-acquired using the initial white point data acquisition conditions, and feedback correction parameters are iteratively generated. Closed-loop iteration is performed using the actual hardware output to absorb actual hardware errors introduced by quantization, limiting, and analog links. Thus, after the iteration terminates, the target white balance mapping parameters obtained by integrating multiple types of parameters can effectively improve the problem of residual color cast in images after traditional open-loop white balance calibration, improving the actual imaging accuracy of white balance calibration.
[0023] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practice. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings.
[0024] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0025] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention, but do not constitute an undue limitation of the invention.
[0026] Figure 1 This is a schematic diagram of an uncorrected scanned image of white paper using existing technology. Figure 2 This is a schematic diagram of an uncorrected grayscale color chart scanned using existing technology. Figure 3 A comparison chart of RGB response curves before and after white balance calibration is provided for an embodiment of the present invention; Figure 4 A flowchart of a graded adaptive white balance system provided in an embodiment of the present invention; Figure 5 A schematic flowchart of a white balance calibration method provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of a first-level and second-level dual-channel alignment correction logic relationship provided in an embodiment of the present invention; Figure 7 A flowchart of a feedback iterative closed-loop calibration process provided in an embodiment of the present invention; Figure 8 This is a comparison chart of channel mean and residual convergence in white balance grading processing provided in an embodiment of the present invention; Figure 9 A logic block diagram of a white balance and endpoint preservation type secondary brightening composite mapping provided in an embodiment of the present invention; Figure 10 This is a schematic diagram comparing endpoint-preserving secondary highlighting mapping curves provided in an embodiment of the present invention; Figure 11 A comparison chart of the distribution of secondary brightening increment and the monotonicity of derivative provided in an embodiment of the present invention; Figure 12 A flowchart of the imaging operation phase of a scanning device is provided as an embodiment of the present invention; Figure 13 This invention provides a general block diagram of the entire process of hierarchical adaptive white balance calibration. Figure 14 A calibrated white paper scanning effect image provided in an embodiment of the present invention; Figure 15 This invention provides a calibrated grayscale color chart scanning effect image as an embodiment of the invention. Figure 16 This is a structural block diagram of a white balance calibration device provided in an embodiment of the present invention; Figure 17 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention. Without conflict, the embodiments and features in the embodiments of this invention can be arbitrarily combined with each other. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here. The term "comprising" and any variations thereof in the specification and claims of this invention are intended to cover non-exclusive protection. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.
[0028] In this embodiment of the invention, "and / or" describes the relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following associated objects have an "or" relationship.
[0029] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description. It should be noted that in the embodiments of the present invention, certain existing industry solutions such as software, components, and models may be mentioned. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solutions of the present invention, and do not imply that the inventors have used or necessarily used such solutions.
[0030] Contact image sensor (CIS) scanning devices integrate a light-emitting array, cylindrical lens, photosensitive array, and analog front end into the scanning head. The spectral power, sensor quantum efficiency, optical coupling efficiency, and analog link gain of the red (R), green (G), and blue (B) light-emitting channels are not entirely consistent, and the same white calibration medium often outputs different raw responses in the three color channels.
[0031] When the scanning head is composed of multiple sensor segments or multiple imaging units spliced together, due to the discrete characteristics of the light source, differences in lens coupling, fluctuations in the flatness of the glass plate, deviations in assembly position, and the discreteness of photosensitive unit manufacturing, inconsistent responses may occur column by column within the same color channel.
[0032] Therefore, the original white field will simultaneously exhibit channel-level overall color cast, as well as localized bright lines, dark lines, and color lines. Although basic non-uniformity calibration can map each imaging unit to the target output, processing such as segmented slope, output limiting, fixed-point rounding, and outlier removal will still result in residual biases in the red, green, and blue-white field averages after basic mapping. For example, ... Figure 1 As shown, this image was obtained by capturing a white sheet of paper without color correction. The image exhibits a noticeable bluish-green tint. Figure 2 As shown, the image obtained from the gray area of the color chart also shows a bluish-green tint.
[0033] It is evident that related technologies suffer from issues such as white field color cast, uneven response within the same color channel, and overall darker image after white balance in contact image sensor (CIS) scanning devices. The aforementioned color cast is not merely a proportional error in the red, green, and blue color channels, but encompasses two types of errors simultaneously: one is the spatial inconsistency in response between different imaging units within the same color channel due to differences in light source coupling, cylindrical lenses, photosensitive units, and analog linking; the other is the overall inconsistency in response scale between the red, green, and blue channels due to differences in emission spectrum, sensor quantum efficiency, and analog gain.
[0034] In view of this, embodiments of the present invention provide a white balance calibration method. This method is for linear or area array image sensors with multiple color channels (R, G, B). Through this method, the above-mentioned error can be processed in a hierarchical manner, that is, the color deviation is split into two levels: the first level is to align each channel column by column according to its own effective response mean; the second level selects the brightest channel as a common reference based on the output of the first level and aligns the other channels to it; after the parameters are applied, the white field is collected again, and feedback correction is performed based on the real output. Finally, the midtones are enhanced using an endpoint-preserving quadratic function.
[0035] For example, such as Figure 3 As shown, Figure 3 A comparison chart of RGB response curves before and after white balance calibration is shown. Figure 3 The left subplot shows the original channel normalized response curves before white balance. The overall scale difference between the R, G, and B curves is obvious, and the curves themselves fluctuate, which intuitively reflects the overall scale difference of the channels and the non-uniform response of each column within the channel. Figure 3 The right-hand sub-figure shows the channel response curves after hierarchical alignment and feedback convergence of this invention. The three RGB curves are highly overlapping, and the responses of each channel converge toward the same common white point. The residual error introduced by the hardware link is continuously compressed through feedback iteration. The correction effect of the two-level hierarchical correction and closed-loop feedback is intuitively verified from the curve dimension.
[0036] As can be seen, this invention provides a unified closed-loop white balance calibration method consisting of "response acquisition, alignment within the primary channel, selection of the brightest channel, alignment between secondary channels, re-acquisition feedback, adaptive correction, and composite secondary brightening". The composite secondary brightening is not a post-processing module independent of white balance; rather, it is incorporated into the same output mapping or lookup table after the feedback white balance converges, ensuring consistency between the color alignment result and the brightness enhancement result.
[0037] For example, such as Figure 4 The diagram shown is an exemplary flowchart of a graded adaptive white balance system according to the present invention. This diagram fully illustrates the entire logic chain from dark and white point acquisition to image brightening output. See also... Figure 4As shown, this invention breaks down color deviation into two levels of correction logic: the first level aligns each channel column by column according to its own effective response mean, eliminating the unevenness defect within each channel; the second level automatically selects the channel with the largest amplitude under the current working condition as a common reference based on the output of the first level, and aligns the other color channels to this reference channel, unifying the overall response scale of the three color channels; after completing the two-level parameter adaptation, the white field is collected again by hardware, and closed-loop feedback correction is carried out based on the actual simulated link output of the device, and finally, an endpoint-preserving secondary brightening function is introduced to optimize the midtone brightness of the image.
[0038] In this embodiment of the invention, for the purpose of better introducing the invention, the technical names involved in the invention are described below:
[0039] 1. A contact image sensor (CIS) is an image scanning device that integrates a light source, lens, and photoelectric sensor into one unit. It acquires image signals by directly contacting the original document being scanned.
[0040] 2. Dark Field Response: The output of the imaging unit when the illumination source is turned off or the incident light is blocked.
[0041] 3. White Response: The output of the imaging unit when the illumination source is turned on.
[0042] 4. Effective response: The non-negative value of the white field response minus the dark field response.
[0043] 5. LED light source: Divided into R, G, and B channels. The R channel is a controllable red LED light channel, the G channel is a controllable green LED light channel, and the B channel is a controllable blue LED light channel.
[0044] 6. Alignment within primary channels: Within each color channel, the response differences of different imaging units are corrected based on the effective mean or robust statistics of that channel.
[0045] 7. Alignment between secondary channels: After completing the alignment within a channel, select the brightest color channel as a common reference and align the other color channels to this reference channel.
[0046] 8. Data Acquisition Feedback Correction: After applying the primary and secondary parameters, re-acquire the white calibration medium, calculate the residual based on the actual data acquisition output, and correct the parameters again.
[0047] 9. Adaptive white balance: Update the feedback coefficients based on the channel responses obtained from each re-acquisition until the channel difference is below the threshold or the iteration limit is reached.
[0048] 10. Composite Output Mapping: Combines alignment within the primary channel, alignment between the secondary channels, acquisition feedback correction, and endpoint-preserving secondary highlighting into a continuous mapping or equivalent lookup table.
[0049] To further illustrate the white balance calibration method provided in the embodiments of the present invention, a detailed description is provided below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiments of the present invention provide method operation steps as shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on conventional or non-inventive methods. In steps where there is no logically necessary causal relationship, the execution order of these steps is not limited to the execution order provided in the embodiments of the present invention. In actual processing or when the device executes the method, it may be executed in the order shown in the embodiments or drawings, or in parallel (e.g., in an application environment with parallel processors or multi-threaded processing).
[0050] The following combination Figure 5 The flowchart shown illustrates the white balance calibration method in this embodiment of the invention. The method can be executed by a scanning device that combines image acquisition, data processing, and parameter storage functions. This scanning device can independently complete the entire process of acquiring dark / white field data, calculating calibration parameters, and writing the calibration parameters into its own storage unit. This scanning device is an electronic device. The specific implementation flow of this method is as follows: Step 501: Perform dark field subtraction processing based on the dark field data and the initial white field data of the uniform white calibration medium to obtain the effective response data of each imaging unit in each color channel, and determine the channel response statistical target corresponding to each color channel based on the effective response data.
[0051] In this embodiment of the invention, the initialization calibration task and acquisition conditions of the scanning device can be initialized first. This involves placing a uniform white calibration medium at the scanning position and fixing the resolution, scanning speed, line period, integration time, analog front-end gain, light source operating mode, and mechanical position. The feedback cycle is initialized to t=0, and the following settings are configured: minimum effective response threshold P_min; saturation judgment threshold L_sat; allowable ranges for first-level, second-level, and feedback coefficients; safe output upper limit L_safe; residual white balance error threshold τ; upper limit for feedback cycles T_max; and secondary brightening intensity α. Preferably, the above complex statistics and feedback loops are executed during factory calibration, maintenance calibration, or low-frequency self-calibration stages; during runtime, only the synthesized parameters are loaded.
[0052] In this embodiment of the invention, let: c∈{R,G,B}: color channel; i: horizontal imaging unit or pixel column index; h: calibration acquisition row index; H: number of acquisition rows under the same calibration state; D(c,i): dark field average response; W(c,i): initial white field average response; P(c,i): effective response after dark field subtraction; Ω(c): effective imaging unit set of channel c; μ(c): intra-channel response statistical target of channel c; g1(c,i): first-level intra-channel alignment coefficient; E1(c): channel statistics after first-level alignment. c∗: The brightest color channel after primary alignment; B: Common white point target for secondary channel alignment; K2(c): Alignment coefficient between secondary channels; Wfb(c,i): White response after re-acquisition following parameter application; Efb(c): Channel statistics after re-acquisition; Kfb(c): Correction coefficient for the current feedback round; Kd(c): Feedback coefficient after adding damping; L: Upper limit of output code value; Lsafe: Safe output upper limit to retain specular margin; τ: Residual white balance error threshold; α: Endpoint-preserving secondary brightening intensity. The clipping function is defined as: clip(x,a,b)=min(max(x,a),b).
[0053] In this embodiment of the invention, after initializing the calibration task and acquisition conditions, dark field data and initial white field data can be acquired.
[0054] Specifically, the light source is turned off or the incident light is blocked, and H rows of dark field data D(c,i) are continuously acquired. The dark field data can be determined based on the following formula: Formula 1.
[0055] Wherein, parameter c represents any color channel of R, G, B, parameter i represents a single horizontal imaging unit or pixel column index within the scanning head of the scanning device, and h represents the calibration acquisition row index.
[0056] Under specified light source conditions, a uniform white calibration medium is scanned to obtain initial white field data. The initial white field data can be determined based on the following formula: Formula 2.
[0057] Wherein, parameter c represents any color channel of R, G, B, parameter i represents a single horizontal imaging unit or pixel column index within the scanning head of the scanning device, and h represents the calibration acquisition row index.
[0058] In this embodiment of the invention, dark field data and initial white field data are obtained, and effective response data of each imaging unit in each color channel is obtained through dark field subtraction calculation. It can be determined based on the following formula three: Formula 3.
[0059] Wherein, parameter c represents any of the R, G, and B color channels, and parameter i represents the index of a single horizontal imaging unit or pixel column within the scanning head of the scanning device.
[0060] In some implementations, after obtaining the effective response data of each imaging unit in each color channel through dark field subtraction in Formula 3, multi-row averaging can be performed on the effective response data to obtain processed effective response data. During the scanning process, random noise such as readout noise and shot noise are introduced. This type of noise is an instantaneous disturbance and does not reflect the inherent response of the imaging system itself. Multi-row averaging can suppress this type of random noise and reduce the interference of instantaneous signal fluctuations on the output signal of the imaging unit. Therefore, the effective response data after multi-row averaging can remove random noise disturbances and mainly characterize the inherent optical and electrical response differences of the imaging system, providing reliable basic data for subsequently determining the statistical targets of the intra-channel response of each color channel and for white field correction.
[0061] In this embodiment of the invention, after obtaining the effective response data after noise reduction through multi-line averaging, in order to eliminate the interference of abnormal imaging units such as device defects, signal saturation, and excessively dark signals on the statistical results, the imaging units participating in the statistics in each color channel can be further screened.
[0062] In this embodiment of the invention, bad cells, excessively dark signals, signal saturation, and other abnormal locations can be eliminated, retaining only imaging units in normal condition for subsequent statistical calculations, thereby filtering effective imaging units for each channel. Specifically, as shown in Formula 4 below, effective sets are established for the red, green, and blue channels respectively: Formula 4.
[0063] in, This indicates bad columns, invalid parameter locations, or sets of consecutive abnormal regions. Dark, saturated, and abnormal locations are excluded from the channel statistics set to avoid a few extreme outliers skewing the overall channel statistical benchmark and ensure the reliability of subsequent channel statistical targets.
[0064] In this embodiment of the invention, after completing the screening of imaging units and constructing the effective set of each channel, it is also necessary to verify the reliability of the number of effective samples in each channel. When the number of effective samples in any color channel is less than a preset threshold, it indicates that the number of effective imaging units available in the current calibration scenario is insufficient and there is no reliable statistical calculation condition. At this time, the most recent effective parameters are retained and the calibration anomaly is recorded to avoid using unreliable data to force the solution of the white balance coefficient and to prevent the introduction of incorrect calibration parameters.
[0065] In this embodiment of the invention, after completing the imaging unit screening and sample quantity validity judgment, the effective imaging unit set obtained from each channel screening can be calculated using the following formula five: Formula 5.
[0066] in, The target values can be the arithmetic mean, median, truncated mean, or weighted statistic. It should be noted that the statistical targets for the red, green, and blue channels are not required to be equal at this stage; this step is only used to establish the spatial response consistency target within a single channel, focusing on correcting the response differences between imaging units within the channel, and will not intervene in or mix the inherent color ratio errors between channels in advance. Color equalization between channels will be handled in subsequent steps.
[0067] Step 502: Calculate the first-level channel alignment parameters using the response statistics target within each channel, apply the first-level channel alignment parameters to the initial white field data to obtain the channel statistics values of each channel after first-level alignment; select the color channel with the largest response amplitude among the channel statistics values after first-level alignment as the reference channel, construct a common white point target in combination with the safe output upper limit, and calculate the second-level calibration parameters of each color channel based on the common white point target.
[0068] In this embodiment of the invention, after solving the statistical target of the response within each color channel, a first-level alignment process of the imaging units within the channel can be performed to achieve response consistency compensation between different imaging units within the same color channel.
[0069] In this embodiment of the invention, based on the ratio of the statistical target of the in-channel response of each color channel to the effective response of the corresponding imaging unit, the first-level in-channel alignment parameters for each imaging unit are obtained after coefficient range clipping. The coefficient range clipping is used to constrain the gain parameters within a reasonable range, avoiding unreasonable compensation coefficients such as excessively large or small gains. The first-level in-channel alignment parameters are applied to the initial white field data to obtain pre-corrected white field intermediate data. This pre-corrected white field intermediate data is an intermediate result after preliminary in-channel compensation. Some overly dark, saturated, or abnormal points may still remain in the data. Therefore, it is necessary to filter out overly dark, saturated, and abnormal imaging unit positions from the pre-corrected white field intermediate data before performing statistical processing to obtain the first-level aligned channel statistics for each color channel.
[0070] In this embodiment of the invention, the response characteristics of different imaging units are determined by the underlying photosensitive device, and different parameter solution paths can be selected accordingly. Specifically, if the response of an imaging unit is approximately linear, a simple direct gain path can be used; if the photosensitive device corresponding to the imaging unit exhibits significant nonlinearity, a multi-node nonlinear calibration path is employed, achieving response alignment through node mapping.
[0071] In some implementations, for the direct gain path, the alignment parameter within the first-level channel per imaging unit is calculated using Formula 6 below. This formula corresponds to the ratio calculation of the statistical target to the effective response described above: Formula Six.
[0072] in, This is used to prevent abnormal gain caused by an excessively small denominator. A protection setting is configured to prevent abnormal divergence in gain values due to an excessively small denominator, ensuring the stability of alignment parameters within the first-level channel.
[0073] In some implementations, for multi-node nonlinear calibration paths, the original nodes of each imaging unit under the same color channel and response level can be mapped to the common target node of that channel. Regardless of whether direct gain, piecewise mapping, or lookup table implementation is used, the core objective of the first-level processing is to make the responses of different imaging units within the same channel approach the statistical target of that channel itself. This first-level alignment process is mainly used to solve spatial inconsistencies such as brightness fluctuations, scan stitching differences, and local color lines within the channel. It adopts the approach of independent compensation for each imaging unit, rather than using a global RGB ratio to uniformly replace the differentiated compensation of each imaging unit, thus better preserving local correction capabilities.
[0074] After obtaining the alignment parameters within the first-level channels of each imaging unit, these alignment parameters are applied to the initial white field data to obtain the pre-corrected white field intermediate data. This process is shown in Formula 7 below: Formula 7.
[0075] in, This is the intra-channel alignment mapping function. Depending on the implementation path, this mapping can be implemented using a first-level gain per imaging unit, a piecewise correction curve, or an equivalent lookup table. This is the initial white field data.
[0076] In this embodiment of the invention, after obtaining the intermediate pre-corrected white field data, there may still be overly dark positions, saturated positions, and abnormal imaging units in the intermediate pre-corrected white field data. Therefore, it is necessary to re-screen out the above-mentioned invalid positions and then perform statistics on the remaining valid samples to obtain the channel statistics value after first-level alignment for each color channel. For specific calculation, please refer to Formula 8: Formula 8.
[0077] In this embodiment of the invention, after the above-mentioned first-level alignment process, the spatial response fluctuations introduced by devices, optical paths, and scanning splicing within each color channel have been effectively weakened and suppressed. At this point, the differences between the statistical values of the first-level aligned channels corresponding to different color channels no longer primarily originate from local spatial deviations within the channels. and The difference mainly represents the overall response scale difference between color channels, and this scale difference between channels will serve as the input basis for subsequent cross-channel color equalization processing.
[0078] In this embodiment of the invention, after the first-level alignment process is completed, problems such as differences in optical paths, uneven photosensitive properties of devices, spatial brightness fluctuations caused by scanning stitching, and local color lines within each color channel have been effectively corrected. The response consistency of each imaging unit within a single channel reaches its optimal state. At this point, the remaining system error is no longer a local spatial deviation within a channel, but rather a color cast problem caused by the inconsistency in the overall inherent response scale between the red, green, and blue channels. Therefore, this invention further performs a second-level alignment calibration between channels. While fully preserving the spatial correction effect within the first-level channel, it unifies the overall response benchmark of each color channel, achieving adaptive white balance calibration for the entire scanning device.
[0079] In this embodiment of the invention, among the channel statistics after primary alignment of the red, green, and blue color channels, the color channel with the largest response amplitude is selected as the reference channel. To avoid the output signal after calibration exceeding the hardware safe output limit, the smaller value between the safe output limit and the channel statistics after primary alignment of the reference channel is taken as the common white point target. Based on the ratio of the common white point target to the channel statistics after primary alignment of each color channel, the alignment coefficients between the secondary channels of each color channel are obtained after clipping the coefficients within the allowable range. To enable all types of calibration paths to reuse this set of secondary alignment coefficients, the obtained secondary channel alignment coefficients can be synchronously adapted to the direct gain path, the segmented mapping path, and the lookup table path. After synchronous adaptation, node monotonicity checks, duplicate node merging, output limiting, and fixed-point rounding are further performed to obtain the processed secondary calibration parameters.
[0080] In this embodiment of the invention, to adaptively match differences in equipment, light source conditions, and device aging, a system reference channel is first dynamically selected. Specifically, based on the stable first-level aligned channel statistics of the red, green, and blue channels, the color channel with the largest response amplitude and the best signal-to-noise ratio is selected as the benchmark reference channel, avoiding the correction noise amplification problem caused by using a weak response channel as a reference. The specific method for selecting the brightest reference channel is shown in Formula Nine below: Formula Nine.
[0081] In this embodiment of the invention, after determining the reference channel, to balance calibration accuracy and hardware output safety, and to prevent the calibrated signal from overflowing the device's dynamic range and causing saturation distortion, this embodiment does not directly use the original statistical value of the reference channel as the white point target. Instead, it combines a preset safe output upper limit for constraint calibration, taking the smaller value between the safe output upper limit and the first-level aligned statistical value of the reference channel as the unified common white point target for the entire device. After the second-level coefficient is truncated, the output of each channel does not exceed the safe output upper limit, or an output upper limit constraint is added to the truncating conditions. This ensures full utilization of the device's effective dynamic range while preventing overcalibration anomalies. The specific configuration method for the common white point target is shown in Formula 10 below: Formula 10.
[0082] In this embodiment of the invention, after adopting this scheme, the secondary coefficient corresponding to the brightest channel obtained by screening is equal to or close to 1, and the remaining color channels move closer to this safe response level. That is, this scheme does not pre-fix a specific channel among red, green, and blue as the reference channel, and can adaptively adapt to scenarios where the brightest channel changes due to different batches of CIS devices, different light source color temperatures, and device aging, thereby improving the versatility of the calibration scheme.
[0083] In this embodiment of the invention, after determining a globally unified common white point target, the alignment coefficients between secondary channels specific to each color channel are calculated based on the ratio of the channel statistics after primary alignment to the common white point target. An extremum coefficient clipping mechanism is then used to eliminate unreasonable correction parameters such as excessive or negative gain, ensuring that the correction parameters remain within the engineering effective range. That is, only the overall response scale of each color channel is balanced and corrected, without altering the differential compensation relationship of each imaging unit within the channel after primary calibration, strictly preserving excellent spatial response consistency within a single channel. The specific calculation method for the secondary alignment coefficients of each color channel is shown in Formula 11 below. Formula 11.
[0084] Among them, the channel with the lower response usually satisfies The brightest channel usually satisfies In other words, weak channels with low response amplitude need to have their overall response improved, and their corresponding secondary alignment coefficient is usually greater than 1; the brightest channel, which serves as the benchmark, does not need to be significantly compensated, and its corresponding secondary alignment coefficient is usually equal to or infinitely close to 1, thus achieving global color balance based on the optimal channel.
[0085] In this embodiment of the invention, in order to ensure that the output effects of different calibration execution paths of the system are completely consistent and to avoid color deviation caused by multi-path parallelism, the alignment coefficients between the solved secondary channels can be synchronously adapted and updated to all calibration links of the system, including direct gain paths, segmented mapping paths, and lookup table paths, so as to realize the unified iteration of multi-path calibration logic.
[0086] In some implementations, for direct gain paths with simple structures and suitable for linear response scenarios, alignment coefficients between secondary channels are superimposed on the original correction parameters within the primary channel to complete global gain updates and achieve color balance adaptation in linear scenarios. The specific update method is shown in Formula Twelve below: Formula twelve.
[0087] In some implementations, for the piecewise mapping correction path of the adapter's nonlinear response, the proportional constraints between secondary channels are incorporated into the nonlinear mapping relationship by updating the target nodes corresponding to each response level. This preserves the nonlinear correction capability while completing the color alignment between channels. The specific nonlinear target update method is shown in Formula Thirteen below: Formula Thirteen.
[0088] In this embodiment of the invention, after completing the parameter synchronization update of all paths, to address issues such as curve distortion, node redundancy, numerical out-of-bounds errors, and floating-point precision mismatches that may occur after parameter iteration, further refined parameter verification and optimization are performed. This involves sequentially completing node monotonicity checks, merging duplicate nodes, output amplitude limiting, and hardware fixed-point rounding. Specifically, node monotonicity checks ensure smooth curve correction without reverse distortion; merging duplicate nodes reduces storage resources; output limiting ensures the signal remains within the hardware's effective range; and fixed-point rounding adapts to the embedded hardware's computational precision. Ultimately, this ensures that the direct gain path, segmented mapping path, and lookup table path have completely consistent color output effects, resulting in the final optimized parameters after secondary calibration.
[0089] For example, such as Figure 6 The diagram illustrates the overall correction logic of the first-level and second-level dual-channel alignment in this invention. The overall correction follows a layered correction approach of "local first, then global": First, first-level alignment ensures that the responses of all imaging units within each color channel converge to the channel's own statistical target, eliminating spatial non-uniformity; then, second-level alignment uses the brightest channel in the first-level steady-state output as the global white point reference, achieving overall color ratio balance across the three channels. This layered approach addresses both spatial non-uniformity and channel color cast issues, resulting in a clear correction logic, layered decoupling, and enhanced stability.
[0090] Step 503: Write the alignment parameters in the primary channel and the parameters after secondary calibration into the scanning device. Under the same acquisition conditions as the initial white field data acquisition, rescan the uniform white calibration medium to acquire feedback white field data. Iterate and generate feedback correction parameters based on the feedback white field data. When the preset stop condition is met, integrate the alignment parameters in the primary channel, the parameters after secondary calibration, and the feedback correction parameters obtained from multiple iterations to generate the target white balance mapping parameters.
[0091] In this embodiment of the invention, after completing the alignment calibration within the primary channel and the alignment calibration between the secondary channels, and obtaining the optimized secondary calibration parameters, a single round of forward calibration has completed the spatial consistency correction within the channels and the color ratio equalization between the channels. However, due to limitations such as equipment hardware quantization errors, minor optical path deviations, device nonlinear residuals, slight fluctuations in environmental conditions, and adaptation deviations between the algorithm model and the actual hardware link, relying solely on the alignment parameters within the primary channel and the parameters after secondary calibration will still result in a small amount of residual white balance error, making it impossible to achieve the ultimate white balance correction effect. To further eliminate static calibration residuals and adapt to the actual hardware output characteristics, this invention introduces a closed-loop feedback iterative calibration mechanism. By continuously correcting the calibration parameters through real hardware resampling data, it ultimately synthesizes target white balance mapping parameters with high accuracy and strong adaptability.
[0092] In this embodiment of the invention, the alignment parameters within the primary channel and the parameters after secondary calibration are written into the scanning device. Maintaining the same light source, timing, analog front-end, and mechanical position conditions as the initial white field data, the device rescans the uniform white calibration medium and acquires feedback white field data. The feedback white field data is mapped using the currently loaded calibration parameters. After filtering out overly dark, saturated, and abnormal imaging unit positions, the feedback channel statistics and common feedback target for each color channel are calculated. The residual white balance error is then calculated based on the feedback channel statistics and the common feedback target. When the residual white balance error exceeds a preset residual error threshold, the original feedback correction coefficient for the current round is calculated. The original feedback correction coefficient is damped to obtain the feedback correction parameters for this round, which are then synchronously applied to the calibration parameters already loaded in the device. The process then returns to the rescanning acquisition step to begin the next iteration. The iteration terminates when a preset stopping condition is met, and the alignment parameters within the primary channel, the parameters after secondary calibration, and the feedback correction parameters obtained from each round are combined into the target white balance mapping parameters.
[0093] In this embodiment of the invention, the first-level channel alignment parameters and the second-level calibration parameters that have been optimized before iteration are first written into the scanning device to complete the solidification and loading of the basic calibration parameters.
[0094] In this embodiment of the invention, to eliminate calibration deviations caused by differences in operating conditions and ensure that the feedback data and the initial calibration data have a completely consistent acquisition benchmark, the core operating conditions, such as the same light source parameters, scanning sequence, analog front-end configuration, and mechanical installation position as in the initial white field data acquisition stage, are strictly maintained. The standard uniform white calibration medium is scanned again to complete a new round of real data acquisition and obtain the feedback white field data. This acquisition process is not a repetitive memory calculation of historical raw data, but rather a complete physical link involving real light source imaging, sensor photoelectric conversion, analog signal processing, digital quantization, signal limiting, and hardware output. This accurately reflects the inherent deviation between the algorithm calculation model and the actual hardware output of the device, providing real and effective data support for closed-loop correction. The specific expression for the feedback white field data obtained by the rescanning acquisition is shown in Formula Fourteen: Formula Fourteen.
[0095] In this embodiment of the invention, after completing the actual acquisition of feedback white field data, in order to verify the actual correction effect of the currently fixed calibration parameters, the newly acquired feedback white field data needs to be substituted into the currently loaded primary and secondary composite calibration mapping relationship of the device to complete the signal mapping correction calculation and obtain preliminary feedback correction data, which intuitively reflects the actual output effect of the current parameters. The specific mapping calculation method is as follows: Formula 15: Formula 15.
[0096] In this embodiment of the invention, due to the influence of instantaneous noise during acquisition, random hardware fluctuations, and instantaneous anomalies of individual imaging units, the feedback correction data may still contain overly dark invalid points, signal saturation points, and abnormal imaging unit points. To ensure that the subsequent statistical results can accurately reflect the overall white balance residual of the system, rather than local instantaneous abnormal errors, it is necessary to screen out abnormal points in the mapped feedback data. After removing all invalid samples, the statistical values of the feedback channels corresponding to each color channel are calculated based on the remaining valid imaging unit samples to accurately characterize the current actual overall response level of each channel. The specific statistical calculation method is as follows: Formula Sixteen: Formula Sixteen.
[0097] In this embodiment of the invention, in order to unify the multi-channel calibration benchmark and continue the white dot alignment logic mentioned above, it is necessary to re-solve the global feedback common target corresponding to this iteration based on the effective feedback statistical results of each channel. This target serves as the unified benchmark for judging the white balance error in this iteration, ensuring that the iterative correction logic is consistent with the previous calibration logic and that the closed loops are connected. The specific calculation method for the feedback common target is as follows: Formula 17: Formula 17.
[0098] In this embodiment of the invention, after obtaining the statistical values of each feedback channel and the common target of global feedback, a residual white balance error index needs to be defined to quantify the residual deviation of the current calibration parameters and determine whether further iterative correction is needed. By comparing the deviation of the actual feedback statistical values of each color channel from the unified feedback target, the magnitude of the remaining white balance deviation of the current system is accurately characterized, providing a quantitative basis for subsequent feedback correction and iterative start / stop. The specific definition and calculation method of the residual white balance error are as follows: Formula 18: Formula 18.
[0099] In this embodiment of the invention, the quantification result of the residual white balance error can directly reflect the correction accuracy of the current calibration parameters. When the residual white balance error is greater than the preset residual error threshold, it indicates that the current calibration parameters still have a significant deviation and have not reached the convergence standard. A closed-loop feedback correction process needs to be initiated to further optimize the calibration parameters. First, based on the deviation relationship between the residual error of this round, the feedback statistics, and the common target, the unconstrained feedback original correction coefficient for the current round is calculated to provide a basic correction amount for parameter updates. The specific calculation method is as follows: Formula Nineteen:
[0100] When the residual white balance error is greater than the preset threshold, that is... hour, Formula 19.
[0101] In this embodiment of the invention, during actual hardware iteration, factors such as fixed-point quantization error, random noise in acquisition, and high-brightness signal amplitude limiting can easily lead to problems such as parameter oscillation, unstable convergence, and overcalibration in multiple iterations, affecting calibration accuracy and parameter stability. To avoid these defects, this invention does not directly use the original correction coefficients to update the parameters. Instead, it applies damping processing to the original feedback correction coefficients. By weakening the correction amplitude of a single iteration through damping constraints, the parameter update process is smoothed, effectively suppressing iterative oscillation, ensuring smooth convergence of the iteration process, and obtaining more stable feedback correction parameters for this round. The specific damping processing method is as follows: Formula 20: Formula 20.
[0102] Will Synchronization acts on direct gain, piecewise target, and lookup table, making Then, return to the previous steps of rescanning and acquiring feedback white field data to acquire it again. The feedback loop must be based on the actual output acquired again; it cannot simply use the same set of data to make repeated predictions.
[0103] To ensure synchronized and consistent correction effects across all calibration paths and avoid channel color difference and response inconsistencies caused by single-path correction, the feedback correction parameters obtained after damping processing must be synchronously applied to the direct gain path, segmented mapping target path, and lookup table path to complete a unified iterative update of all path parameters. After the parameter update is complete, the process returns to the previous step of rescanning and acquiring feedback white field data to initiate the next round of closed-loop iterative calibration, continuously compressing residual white balance errors. This closed-loop iteration strictly uses real hardware resampling data as the basis for correction, eliminating the problem of virtual correction through repeated calculations of single historical data, and ensuring that each round of iterative correction closely matches the actual output characteristics of the hardware.
[0104] In this embodiment of the invention, in order to achieve controllable iterative process, avoid invalid iteration, and adapt to various abnormal working conditions, the invention sets multi-dimensional and comprehensive preset iteration stop conditions, monitors the system status in real time during the iteration process, and terminates the feedback iteration process immediately when any one of the stop conditions is met, thus taking into account calibration accuracy, efficiency and equipment safety.
[0105] In one possible implementation, the preset stopping conditions include at least one of the following: residual white balance error is less than or equal to the residual error threshold; the channel ratio comprehensive color difference meets the preset conditions; the number of feedback iteration rounds reaches the preset maximum number of feedback rounds; the number of effective imaging unit samples in any color channel is less than the preset threshold; and the feedback correction parameters continuously touch the upper and lower limits of the allowable range of the coefficients. It can be seen that the preset stopping conditions cover five major scenarios: accuracy convergence, color difference compliance, round capping, sample anomaly, and parameter exceeding limits. For example, if the residual white balance error is less than or equal to the preset residual error threshold, the correction accuracy standard is met; if the channel ratio comprehensive color difference meets the preset qualification conditions, the color balance effect is satisfactory; if the number of feedback iteration rounds reaches the preset maximum number of feedback rounds, excessive iteration is avoided; if the number of effective imaging unit samples in any color channel is less than the preset threshold, the data is invalid and cannot support statistical correction; and if the feedback correction parameters continuously touch the upper and lower limits of the allowable range of the coefficients, there is a high probability of hardware problems such as equipment contamination, light source failure, or sensor anomalies, making further iteration meaningless.
[0106] Once the iterative process meets any stopping condition, the closed-loop feedback iteration terminates. At this point, the system has completed spatial consistency correction, inter-channel proportional equalization, and multi-round residual error iterative optimization. The first-level per-image-unit alignment parameters, the second-level calibrated parameters, and the feedback correction parameters obtained from multiple iterations are fused and synthesized to integrate multi-level correction capabilities, resulting in target white balance mapping parameters that combine spatial uniformity, channel color accuracy, and hardware adaptability. The final parameter synthesis method is shown in Formula 21 below: Formula 21.
[0107] It should be noted that this solution completes multiple rounds of closed-loop feedback iteration and parameter synthesis only during the equipment factory calibration or calibration update stage. During normal equipment operation, it is only necessary to load the final synthesized target white balance mapping parameters to perform correction, without the need to carry out real-time pixel-by-pixel feedback loop iteration. While ensuring correction accuracy, it significantly reduces the computing power overhead of the equipment, taking into account both imaging effect and operating efficiency.
[0108] For example, such as Figure 7 As shown, Figure 7 This is a flowchart of a feedback iterative closed-loop calibration process in an embodiment of the present invention.
[0109] exist Figure 7 The document fully demonstrates the closed-loop iterative logic after the secondary calibration parameters are written into the device. Specifically, the primary and secondary alignment parameters are first fixed to the scanning device gain, segmented target, and lookup table path; the initial calibration light source, timing, and mechanical conditions are strictly replicated, and white calibration medium is re-acquired to obtain feedback white field data; then, overly dark, saturated, and abnormal imaging unit points are removed, the feedback average of each channel is calculated, and the common white point of this round of feedback is solved in combination with the safety upper limit, and the residual white balance error is calculated; the system determines whether the residual error is less than the preset threshold. If the convergence condition is not met, the original feedback correction coefficient is calculated and obtained after damping processing. The damping correction coefficient is synchronously updated to all calibration paths and then jumps back to the resampling step to start a new round of iteration; if any stopping condition such as convergence, iteration upper limit, or sample failure is met, the loop is terminated, and the primary, secondary, and multi-round feedback coefficients are merged to synthesize the final white balance mapping parameters.
[0110] In this way, closed-loop correction is completed by re-sampling data based on the actual physical link of the scanning device. Unlike the traditional open-loop scheme that relies solely on initial data calculation, it can offset the inherent hardware residuals caused by analog front-end temperature drift, fixed-point quantization, and output limiting. Moreover, the damping processing mechanism suppresses the oscillation of iterative parameters, and the multi-dimensional stopping conditions take into account calibration accuracy, calibration efficiency, and equipment anomaly protection. The parameters after iterative convergence are more adaptable to light source aging and sensor batch differences.
[0111] like Figure 8 As shown, Figure 8 This is a comparison chart of the mean and residual convergence of the white balance graded processing channels in an embodiment of the present invention. Figure 8The results consist of two parts: a left-hand bar chart of channel mean values and a right-hand line chart of feedback residual convergence. The left-hand bar chart sequentially displays the changes in the normalized mean values of the R, G, and B channels under four stages: initial white point, alignment within the first-level channels, alignment between the second-level channels, and feedback convergence. Initially, the mean values of the three channels differ greatly. After the first-level correction, the uniformity of the response within a single channel is eliminated. The second-level correction unifies the overall scale of the three channels. After multiple rounds of feedback iteration, the RGB mean values become highly similar. The right-hand line chart shows that the residual white balance error Δwb continuously decreases with each feedback round. By the third iteration, the residual is far below the preset threshold, visually verifying the error convergence capability of the closed-loop iteration.
[0112] In this embodiment of the invention, after spatial alignment within the primary channel, proportional balancing between the secondary channels, and multiple rounds of closed-loop feedback iteration convergence, the target white balance mapping parameters with optimal accuracy are finally synthesized. These parameters have thoroughly corrected the spatial non-uniformity within the channels of the scanning device, the inherent color cast between channels, and the residual errors in the hardware link, thus possessing reliable white balance correction capabilities. To further optimize image quality and solve the problems of grayish black areas, insufficient midtone contrast, and high-saturation saturation caused by unconstrained brightening after traditional white balance correction, this invention introduces an endpoint-preserving secondary brightening algorithm based on accurate white balance correction, constructing a composite correction scheme that balances color accuracy and dynamic image texture.
[0113] In one possible implementation, after obtaining the target white balance mapping parameters, the image to be processed can be determined; the target white balance mapping parameters are called to transform the image to be processed, and amplitude limiting output processing is performed to obtain the target image after white balance correction.
[0114] As can be seen, after iteratively synthesizing the target white balance mapping parameters, these parameters can be directly applied to actual imaging scenarios. Specifically, the original image to be processed is acquired by the device, the pre-stored target white balance mapping parameters are called to perform color transformation correction on the image data, and with standard amplitude limiting output processing, basic white balance correction is quickly completed to obtain the target image after color correction, which meets the needs of conventional imaging correction.
[0115] To further improve image quality and optimize brightness levels, this invention preferably employs an enhanced composite correction scheme. In this embodiment, composite mapping parameters are determined based on the target white balance mapping parameters and the endpoint-preserving secondary brightening function; the image to be processed is then mapped based on these composite mapping parameters, and neighbor repair of abnormal imaging units, output limiting, fixed-point scaling, and quantization rounding are performed sequentially to obtain the target image.
[0116] In this embodiment of the invention, conventional linear overall gain brightening methods simultaneously increase image black noise and compress dynamic range, while unconstrained nonlinear brightening easily causes saturation distortion in highlight areas and disrupts the original color balance. To address these technical shortcomings, this invention, based on iterative convergence of white balance feedback and perfectly accurate color proportions, designs an endpoint-preserving secondary brightening function. This function specifically enhances the midtone levels of the image while fixing the black and white endpoints to ensure monotonic mapping, thus balancing brightening effect and imaging stability. In this embodiment, the endpoint-preserving secondary brightening function is defined for the composite white balance output result, specifically expressed as Formula 22: After the white balance feedback converges, the composite white balance output is... Define an endpoint-preserving quadratic function: Formula 22.
[0117] make In this case, the above formula can also be written in an equivalent form. The only difference between the two writing methods is the normalization method of the highlighting coefficient.
[0118] As can be seen, to adapt to different computational normalization scenarios and hardware fixed-point computation logic, the above function can be equivalently transformed. When the corresponding normalization constraints are met, the secondary highlighting function can be equivalently rewritten into a simplified form suitable for engineering implementation. The only difference between the two expressions is the normalization method of the highlighting coefficient; the core highlighting logic and endpoint constraint effects are completely identical.
[0119] In this embodiment of the invention, to intuitively demonstrate the brightening characteristics and clarify the algorithm enhancement principle, the brightening increment of the quadratic function is further derived to accurately characterize the brightness improvement magnitude corresponding to each gray level. The specific brightening increment calculation formula is as follows: Formula 23: Formula 23.
[0120] Based on the brightening increment formula, a complete secondary brightening mapping relationship can be further derived, fully integrating the basic white balance output and adaptive brightening increment, forming a standardized secondary enhancement mapping expression formula twenty-four: Formula 24.
[0121] Analysis of the incremental function reveals that this secondary brightening strategy achieves optimal tonal enhancement. The brightening increment peaks in the midtone region of the image, effectively enhancing the depth of the main subject and avoiding a grayish appearance caused by overall brightening. The specific peak characteristic constraint is shown in Formula 25 below: Formula 25.
[0122] To ensure proper grayscale sorting and prevent distortions such as grayscale inversion and image banding during brightening, this algorithm employs strict monotonicity constraints. Within the normal effective imaging range and without triggered signal cropping, the overall mapping function maintains a monotonically increasing characteristic. The specific constraint is shown in Formula 26: At that time, the area within which clipping was not triggered contains: Formula 26.
[0123] It is evident that the endpoint-preserving secondary brightening algorithm has core advantages: it strictly fixes the positions of black and white points in the image, preserves the details of the original image's light and dark boundaries, and does not destroy the original dynamic range; it only moderately brightens and enhances the midtones, which avoids the problem of linear gain raising black noise and solves the white field saturation distortion defect caused by unconstrained highlight brightening.
[0124] Meanwhile, to completely avoid secondary color shifts introduced by the brightening operation and ensure that the white balance correction results are not destroyed, this solution adopts a completely unified brightening coefficient, brightness threshold, fixed-point scaling rules and quantization rounding standard for the three RGB color channels to achieve synchronous and equal enhancement of the three channels.
[0125] For neutral pixels in an image, the three-channel input values are consistent. After a unified secondary brightening function operation, the output values remain equal. The specific derivation relationship is shown in Formula 27 below:
[0126] The RGB three channels use the same L, fixed-point scaling, and rounding rules. When the input is neutral pixels: Formula 27.
[0127] This ensures that neutral colors remain unbiased throughout the image enhancement process, and that secondary brightening operations do not disrupt the already calibrated channel color balance, achieving a "quality enhancement without color bias" correction effect.
[0128] like Figure 9 As shown, Figure 9 This is a logic block diagram of the white balance and endpoint preservation type secondary brightening composite mapping in an embodiment of the present invention.
[0129] exist Figure 9In this process, the input is a composite white balance map synthesized after first-level, second-level, and feedback iterations. The output of the map is substituted into an endpoint-preserving brightening function, which strictly constrains the black endpoint (F(0)=0) and the white endpoint (F(L)=L), producing a brightening increment only in the middle grayscale range. The RGB three channels reuse completely consistent brightening intensity α, output upper limit L, fixed-point scaling, and quantization rounding rules. When the neutral pixel satisfies (R=G=B=x), the output of the three channels remains equal after brightening, without introducing new color shift. Finally, the white balance correction and midtone brightening are fused to generate a unified composite map (T(c,i,x)). After monotonicity verification, output limiting, and endpoint detection, the output is an image with no color shift and optimized sense of layering.
[0130] By integrating color white balance correction and image enhancement processing into a single set of mapping parameters, the device does not need to perform two separate steps of correction and enhancement during operation, reducing the computing power overhead of embedded devices; the unified RGB enhancement rules ensure that neutral colors are not biased, and the endpoint constraints avoid the defects of conventional linear enhancement such as increasing black noise and highlight saturation distortion.
[0131] like Figure 10 As shown, Figure 10 This is a schematic diagram comparing the endpoint-preserving secondary brightening mapping curves in an embodiment of the present invention.
[0132] exist Figure 10 In the diagram, four types of curves are plotted with the normalized input x as the horizontal axis and the normalized output F(x) as the vertical axis for comparison: the dashed line y=x represents no brightening identity mapping, the red dotted line represents traditional linear gain brightening, and the blue, dark blue, and green solid lines represent endpoint-preserving secondary brightening curves with brightening intensity α=0.25 / 0.55 / 0.80, respectively. All secondary brightening curves have fixed endpoints (0,0) and (1,1), and the brightening increment is concentrated in the midtone range of the image without shifting the boundary of the highlight white point. When applied synchronously to the RGB channel, the neutral pixels can always maintain color balance.
[0133] like Figure 11 As shown, Figure 11 This is a comparison chart of the distribution of secondary brightening increment and the monotonicity analysis of derivative in an embodiment of the present invention. Figure 11 The image consists of two sub-images. The left sub-image shows the distribution curve of the brightening increment d(x), with the increment formula (d(x)=αx(1-x)) (the increment d(x) in the image). If x is normalized, the peak value is at x=1 / 2, and the peak value is α / 4. The right sub-image shows the first derivative curve of the brightening mapping. The derivative is greater than 0 throughout the entire process, and the minimum derivative is only at x=1, ensuring that the brightening mapping is monotonically increasing throughout the entire process and that there will be no grayscale inversion or image tortuosity distortion.
[0134] As can be seen, the characteristic of focusing the increment on the midtones solves the problems of grayish images and insufficient contrast after traditional white balance correction, while not amplifying noise in dark areas.
[0135] In this embodiment of the invention, to deeply integrate color correction and image enhancement and achieve dual processing in a single mapping, the invention fuses the multi-level calibration white balance mapping relationship described above with the endpoint-preserving secondary brightening function to generate a composite mapping parameter specifically for device operation. This integrates all correction and enhancement capabilities and simplifies the device's operational logic. The synthesized composite mapping fully encompasses spatial alignment within the primary channel, color ratio alignment between secondary channels, and multi-round real-world sampling feedback correction capabilities, while also overlaying midtone image enhancement functionality. The specific composite mapping synthesis formula is as follows: Formula 28: Formula 28.
[0136] in, It already includes alignment within the first-level channel, alignment between the second-level channels, and correction based on actual acquisition feedback. In this embodiment of the invention, during the actual imaging process of the device, based on the synthesized composite mapping parameters, the real-time acquired image to be processed undergoes full-process standardized processing, sequentially completing multi-dimensional fine correction and output optimization. The specific steps are as follows: First, based on the color channel attributes and imaging unit position of the current pixel, the corresponding composite mapping parameters or lookup table data are accurately read to achieve pixel-by-pixel differentiated and precise correction; second, for abnormal positions and bad column defects that may exist during the scanning process, neighborhood repair processing in the same channel is performed to fill in local abnormal pixel details and eliminate imaging defects; then, the endpoint-preserving secondary brightening function already incorporated into the algorithm is called to complete the midtone enhancement of the image; finally, unified output amplitude limiting, fixed-point precision scaling, and quantization rounding processing are performed to adapt to the hardware output range and computational precision requirements, ultimately outputting a high-quality target image that simultaneously completes color cast correction, spatial uniformity optimization, and midtone image quality enhancement.
[0137] like Figure 12 As shown, Figure 12 This is a flowchart illustrating the processing flow of the scanning device during the actual imaging operation phase in an embodiment of the present invention.
[0138] exist Figure 12 In the process, the real-time scan line and the original RGB color channel data are input. The first step is to call the composite white balance mapping synthesized in the calibration stage to complete the layered color correction. The second step is to detect the abnormal imaging units marked in the image and use neighboring pixels in the same channel to repair and eliminate local color line and bright-dark line defects. The third step is to substitute the endpoint-preserving secondary brightening function to optimize the midtone level. Finally, uniform output limiting, fixed-point scaling and quantization rounding are performed to output an RGB scan image with accurate white balance and complete details (in grayscale mode, a MONO grayscale image is output), completing the single-line image correction process.
[0139] As can be seen, the calibration stage only needs to complete the complex layer correction and feedback iteration in one go, and the daily scanning of the equipment only performs lightweight lookup table mapping operations, which greatly reduces the computing power consumption of real-time imaging; the abnormal bad column neighborhood repair and white balance and brightening are merged into a single pipeline, which eliminates local imaging defects without destroying the overall color balance, and takes into account both correction accuracy and imaging speed.
[0140] In the embodiments of the present invention, in order to better illustrate the solution provided by the present invention, such as Figure 13 As shown, Figure 13 This is a general flowchart of the graded adaptive white balance calibration process in this embodiment of the invention, providing a global logical overview of the entire calibration scheme. The process is divided into four main modules according to the execution order: the first module is calibration data acquisition and preprocessing (… Figure 13 Steps one through four are completed to perform dark field and white field acquisition, dark field subtraction, effective imaging unit selection, and single-channel statistical target solving; the second module is two-level layered alignment correction ( Figure 13 Steps five through nine are performed sequentially, including first-level intra-channel pixel-by-pixel alignment and second-level cross-channel adaptive white point alignment, simultaneously adapting to all hardware correction paths; the third module is closed-loop feedback iterative convergence ( Figure 13 Steps 10 to 13) involve re-sampling real white point data from the hardware to calculate the residuals, iterating the damping correction coefficient multiple times until convergence, and fusing multi-level parameters to generate a basic white balance mapping; the fourth module is image quality enhancement and device deployment ( Figure 13 (Steps 14-15) use a composite endpoint-preserving secondary brightening function to generate a unified lookup table that can be directly written to the device, and finally output the corrected image.
[0141] As can be seen, the calibration scheme provided by this invention can achieve the following effects:
[0142] (1) Layered decoupling of two types of color difference errors: splitting the two independent errors of spatial non-uniformity of imaging units in the channel and overall scale deviation between RGB channels, and adopting first-level and second-level step-by-step correction, which is different from the traditional single-level global gain, and can simultaneously eliminate local color line defects and overall color deviation of the image.
[0143] (2) Adaptive dynamic reference: The channel with the largest response amplitude after first-level correction is automatically selected as the white point reference. No R / G / B channel reference is fixed. It adapts to changes in sensor batch, light source color temperature, LED aging and other working conditions, and avoids weak channels being used as references to amplify and correct noise.
[0144] (3) Hardware closed-loop iteration to eliminate residuals: The real resampling data of the complete photoelectric, analog and quantization links of the scanning equipment is used as the feedback basis to offset the hardware temperature drift, fixed-point rounding and output limiting residuals that the open-loop algorithm cannot predict, and the white balance correction accuracy is significantly improved.
[0145] (4) Optimization of separation between calibration and operation phases: Complex iterative calculations are only performed during the factory / maintenance calibration phase, and the daily imaging of the equipment only loads the composite mapping lookup table after synthesis, taking into account both high-precision calibration and the low computing power operation requirements of embedded equipment.
[0146] (5) Brightening and white balance are blended without conflict: The endpoint-preserving secondary brightening function is adopted, and the RGB channels are enhanced synchronously and equally. Only the midtone level is improved, without changing the black and white endpoints or introducing new color shifts, thus solving the problems of graying, highlight saturation, and amplification of noise in dark areas after traditional correction.
[0147] (6) Multi-dimensional iterative protection mechanism: Set residual threshold, iteration round, effective sample number, coefficient boundary and other types of stopping conditions, and combine with damping correction to suppress parameter oscillation, avoid generating erroneous calibration parameters under abnormal working conditions such as hardware pollution and light source failure, and improve the robustness of the calibration process.
[0148] Furthermore, based on the principle analysis in the accompanying diagrams above, each schematic diagram visually verifies the core mechanism of this invention: hierarchical calibration, closed-loop iteration, and endpoint highlighting. For example, as mentioned above Figure 3 As shown, before correction, the R, G, and B channels not only have significant differences in overall response scale, but the individual channel curves also exhibit fluctuations. After the hierarchical calibration and closed-loop feedback convergence of this invention, the three RGB curves highly overlap with the same common output scale, clearly demonstrating the hierarchical correction effect of the three-level processing: first, intra-channel alignment; then, inter-channel alignment; and finally, feedback iterative correction.
[0149] For example, as mentioned above Figure 8 As shown, hierarchical processing has the function of eliminating color difference layer by layer: alignment within the first-level channel can significantly reduce the spatial response difference within a single channel; alignment between the second-level channels establishes a unified white point reference for the three channels; and the closed-loop feedback of hardware resampling can continuously compress the residual white balance error of the system. Combined with the aforementioned... Figure 10 , Figure 11 Analysis of these two sets of schematic diagrams shows that the brightening function used in this invention only generates brightness increments in the middle grayscale range of the image, while strictly satisfying the endpoint constraints; the brightening increments at both ends of the image are always 0, and when the brightening intensity satisfies (0≤α≤1), the mapping curve maintains a positive derivative throughout, and there will be no grayscale reversal or image fragmentation problems.
[0150] It should be noted that the aforementioned Figure 3 , Figure 8 , Figure 10 , Figure 11All of these are schematic diagrams based on the mathematical definition of the algorithm, and are only used to explain the calibration logic and provide quantifiable verification indicators. They are not intended as a basis for the actual performance of a specific sensor model. When calibrating actual equipment, they can be replaced with the real array data collected by the corresponding sensor. Adjustments to the values shown in the diagrams will not change the complete method flow and scope of protection of this invention.
[0151] like Figure 14 and Figure 15 The final result of the white paper sample obtained after this method, as well as the grayscale image color effect on the color chart, are clearly superior to the original, unprocessed image. Figure 1 and Figure 2 The images shown are more realistic, and the colors are more accurate.
[0152] Based on the same inventive concept, embodiments of the present invention provide a white balance calibration device capable of performing the functions corresponding to the aforementioned white balance calibration method. This white balance calibration device can be a hardware structure, a software module, or a hardware structure plus a software module. The white balance calibration device can be implemented using a chip system, which can consist of chips or include chips and other discrete components. Please refer to [link to previous text]. Figure 16 As shown, the white balance calibration device 1600 includes:
[0153] Analysis unit 1601 is used to perform dark field subtraction processing based on dark field data and initial white field data of uniform white calibration medium to obtain effective response data of each imaging unit in each color channel, and to determine the channel response statistical target corresponding to each color channel based on the effective response data.
[0154] Alignment calculation unit 1602 is used to calculate the first-level channel alignment parameters using the response statistical targets of each channel, apply the first-level channel alignment parameters to the initial white field data to obtain the channel statistics of each channel after first-level alignment; select the color channel with the largest response amplitude among the channel statistics of the first-level alignment as the reference channel, construct a common white point target in combination with the safe output upper limit, and calculate the second-level calibration parameters of each color channel based on the common white point target;
[0155] The calibration unit 1603 is used to write the alignment parameters in the primary channel and the parameters after secondary calibration into the scanning device, and under the same acquisition conditions as the initial white field data acquisition conditions, to re-scan and acquire feedback white field data on the uniform white calibration medium, and to iteratively generate feedback correction parameters based on the feedback white field data; when a preset stop condition is met, the alignment parameters in the primary channel, the parameters after secondary calibration, and the feedback correction parameters obtained from multiple iterations are integrated to generate target white balance mapping parameters.
[0156] In one possible implementation, the alignment calculation unit 1602 is used for: Based on the ratio of the statistical target of the intra-channel response of each color channel to the effective response of the corresponding imaging unit, the first-level intra-channel alignment parameters of each imaging unit are obtained after cropping the coefficient within the allowable range. The alignment parameters within the first-level channel are applied to the initial white field data to obtain pre-corrected white field intermediate data.
[0157] After filtering out overly dark, saturated, and abnormal imaging unit positions from the pre-corrected white field intermediate data, the statistical values of each color channel after first-level alignment are obtained.
[0158] In one possible implementation, the alignment calculation unit 1602 is used for: After first-level alignment of the red, green, and blue color channels, the color channel with the largest response amplitude is selected as the reference channel from the channel statistics. The smaller value between the upper limit of the safe output and the channel statistics after the first-level alignment of the reference channel is taken as the common white point target; Based on the ratio of the common white point target to the channel statistics after primary alignment of each color channel, the alignment coefficient between the secondary channels of each color channel is obtained after clipping the coefficient within the allowable range. The obtained alignment coefficients between the secondary channels are synchronously adapted to the direct gain path, segmented mapping path, and lookup table path, and node monotonicity checks, duplicate node merging, output limiting, and fixed-point rounding are performed to obtain the processed secondary calibration parameters.
[0159] In one possible implementation, the calibration unit 1603 is used for: Write the alignment parameters in the first-level channel and the parameters after the second-level calibration into the scanning device, and keep the light source, timing, simulation front end, and mechanical position conditions consistent with the initial white field data collected. Rescan the uniform white calibration medium and collect feedback white field data. The feedback white field data is mapped using the currently loaded calibration parameters. After filtering out overly dark, saturated, and abnormal imaging unit positions, the feedback channel statistics and feedback common target of each color channel are calculated. The residual white balance error is then calculated based on the feedback channel statistics and feedback common target. When the residual white balance error is greater than the preset residual error threshold, the feedback original correction coefficient of the current round is calculated, the feedback original correction coefficient is damped to obtain the feedback correction parameter of the current round, and the feedback correction parameter of the current round is synchronously applied to the calibration parameter loaded in the device, and then the process of re-scanning and collecting data is returned to start the next round of iteration. The iteration terminates when the preset stopping condition is met, and the alignment parameters in the first-level channel, the parameters after second-level calibration, and the feedback correction parameters obtained in each round are combined into the target white balance mapping parameters.
[0160] In one possible implementation, the preset stopping condition includes at least one of the following: the residual white balance error is less than or equal to the residual error threshold; the channel ratio integrated color difference meets the preset condition; the number of feedback iterations reaches the preset maximum number of feedback iterations; the number of effective imaging unit samples in any color channel is less than the preset threshold; and the feedback correction parameter continuously touches the upper and lower limits of the coefficient's allowable range.
[0161] In one possible implementation, the apparatus further includes a processing unit for: Identify the image to be processed; The target white balance mapping parameters are called to transform the image to be processed, and amplitude limiting output processing is performed to obtain the target image after white balance correction.
[0162] In one possible implementation, the processing unit is configured to: Based on the target white balance mapping parameters and the endpoint-preserving secondary brightening function, the composite mapping parameters are determined; The image to be processed is mapped based on the composite mapping parameters, and the abnormal imaging unit neighborhood repair, output limiting, fixed-point scaling and quantization rounding are performed sequentially to obtain the target image.
[0163] All relevant content of each step involved in the aforementioned embodiments of the white balance calibration method can be referenced to the functional description of the corresponding functional module of the white balance calibration device in the embodiments of the present invention, and will not be repeated here.
[0164] The module division in this embodiment of the invention is illustrative and represents only one logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional modules in the various embodiments of the invention can be integrated into a single controller, exist as separate physical entities, or be integrated into a single module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0165] Based on the same inventive concept, embodiments of the present invention provide an electronic device, please refer to... Figure 17 As shown, the electronic device includes at least one processor 1701 and a memory 1702 connected to the at least one processor. In this embodiment of the invention, the specific connection medium between the processor 1701 and the memory 1702 is not limited. Figure 17 Taking the connection between processor 1701 and memory 1702 via bus 1700 as an example, bus 1700 in... Figure 17 The connections between other components are shown in thick lines only and are not intended to be limiting. The Bus 1700 can be divided into address bus, data bus, control bus, etc., for ease of representation. Figure 17 The symbol is represented by only one thick line, but this does not indicate that there is only one bus or one type of bus. In addition, the electronic device includes a communication interface 1703 for receiving or transmitting data.
[0166] In this embodiment of the invention, the memory 1702 stores instructions that can be executed by at least one processor 1701. By executing the instructions stored in the memory 1702, at least one processor 1701 can perform the steps included in the aforementioned white balance calibration method.
[0167] The processor 1701 is the control center of the electronic device. It can connect to various parts of the electronic device through various interfaces and lines. By running or executing instructions stored in the memory 1702 and calling data stored in the memory 1702, it can monitor the various functions and data processing of the electronic device as a whole.
[0168] Optionally, processor 1701 may include one or more processing units. Processor 1701 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into processor 1701. In some embodiments, processor 1701 and memory 1702 may be implemented on the same chip; in some embodiments, they may be implemented separately on independent chips.
[0169] Processor 1701 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the various methods, steps, and logic block diagrams of the present invention embodiments. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods invented in conjunction with the present invention embodiments can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0170] Memory 1702, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 1702 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 1702 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In embodiments of the present invention, memory 1702 may also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0171] By designing and programming the processor 1701, the code corresponding to the white balance calibration method described in the foregoing embodiments can be embedded into the chip, so that the chip can execute the steps of the aforementioned white balance calibration method when running. How to design and program the processor 1701 is a well-known technique to those skilled in the art, and will not be described in detail here.
[0172] Based on the same inventive concept, embodiments of the present invention also provide a computer-readable storage medium including program code, which, when the program product is run on an electronic device, is used to cause the electronic device to perform the steps of the white balance calibration method described above.
[0173] In some possible implementations, various aspects of the white balance calibration method provided by the present invention can also be implemented as a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the steps in the white balance calibration method according to various exemplary embodiments of the present invention described above.
[0174] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0175] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0176] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0177] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0178] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A white balance calibration method, characterized by, The method includes: Dark field subtraction is performed based on dark field data and initial white field data from a uniform white calibration medium to obtain effective response data for each imaging unit in each color channel. Based on the effective response data, the channel response statistical target for each color channel is determined. The first-level alignment parameters within each channel are calculated using the response statistics target within each channel. The first-level alignment parameters are then applied to the initial white point data to obtain the channel statistics values of each channel after first-level alignment. The color channel with the largest response amplitude among the channel statistics values after first-level alignment is selected as the reference channel. A common white point target is constructed in conjunction with the safe output upper limit, and the second-level calibration parameters of each color channel are calculated based on the common white point target. The alignment parameters within the primary channel and the parameters after secondary calibration are written into the scanning device. Under the same acquisition conditions as the initial white field data acquisition conditions, the uniform white calibration medium is re-scanned to acquire feedback white field data. Feedback correction parameters are iteratively generated based on the feedback white field data. When a preset stop condition is met, the alignment parameters within the primary channel, the parameters after secondary calibration, and the feedback correction parameters obtained from multiple iterations are integrated to generate the target white balance mapping parameters.
2. The method according to claim 1, characterized in that, The first-level channel alignment parameters are calculated using the response statistics targets within each channel. These first-level channel alignment parameters are then applied to the initial white field data to obtain the channel statistics values for each channel after first-level alignment, including: Based on the ratio of the statistical target of the intra-channel response of each color channel to the effective response of the corresponding imaging unit, the first-level intra-channel alignment parameters of each imaging unit are obtained after cropping the coefficient within the allowable range. The alignment parameters within the first-level channel are applied to the initial white field data to obtain pre-corrected white field intermediate data. After filtering out overly dark, saturated, and abnormal imaging unit positions from the pre-corrected white field intermediate data, the statistical values of each color channel after first-level alignment are obtained.
3. The method according to claim 2, characterized in that, The color channel with the largest response amplitude among the first-level aligned channel statistics is selected as the reference channel. A common white point target is constructed based on the safe output upper limit. The second-level calibration parameters of each color channel are calculated based on the common white point target, including: After first-level alignment of the red, green, and blue color channels, the color channel with the largest response amplitude is selected as the reference channel from the channel statistics. The smaller value between the upper limit of the safe output and the channel statistics after the first-level alignment of the reference channel is taken as the common white point target; Based on the ratio of the common white point target to the channel statistics after primary alignment of each color channel, the alignment coefficient between the secondary channels of each color channel is obtained after clipping the coefficient within the allowable range. The obtained alignment coefficients between the secondary channels are synchronously adapted to the direct gain path, segmented mapping path, and lookup table path, and node monotonicity checks, duplicate node merging, output limiting, and fixed-point rounding are performed to obtain the processed secondary calibration parameters.
4. The method according to claim 3, characterized in that, The first-level channel alignment parameters and the second-level calibrated parameters are written into the scanning device; under the same acquisition conditions as the initial white field data acquisition conditions, the uniform white calibration medium is re-scanned and feedback white field data is acquired; feedback correction parameters are iteratively generated based on the feedback white field data. When the preset stopping condition is met, the alignment parameters within the first-level channel, the parameters after the second-level calibration, and the feedback correction parameters obtained from multiple iterations are integrated to generate target white balance mapping parameters, including: Write the alignment parameters in the first-level channel and the parameters after the second-level calibration into the scanning device, and keep the light source, timing, simulation front end, and mechanical position conditions consistent with the initial white field data collected. Rescan the uniform white calibration medium and collect feedback white field data. The feedback white field data is mapped using the currently loaded calibration parameters. After filtering out overly dark, saturated, and abnormal imaging unit positions, the feedback channel statistics and feedback common target of each color channel are calculated. The residual white balance error is then calculated based on the feedback channel statistics and feedback common target. When the residual white balance error is greater than the preset residual error threshold, the feedback original correction coefficient of the current round is calculated, the feedback original correction coefficient is damped to obtain the feedback correction parameter of the current round, and the feedback correction parameter of the current round is synchronously applied to the calibration parameter loaded in the device, and then the process of re-scanning and collecting data is returned to start the next round of iteration. The iteration terminates when the preset stopping condition is met, and the alignment parameters in the first-level channel, the parameters after second-level calibration, and the feedback correction parameters obtained in each round are combined into the target white balance mapping parameters.
5. The method according to claim 4, characterized in that, The preset stopping condition includes at least one of the following: the residual white balance error is less than or equal to the residual error threshold; the channel ratio comprehensive color difference meets the preset condition; the feedback iteration rounds reach the preset maximum number of feedback rounds; The number of valid imaging unit samples in any color channel is less than a preset threshold; The feedback correction parameters continuously touch the upper and lower limits of the coefficient's allowable range.
6. The method according to any one of claims 1-5, characterized in that, The method further includes: Identify the image to be processed; The target white balance mapping parameters are called to transform the image to be processed, and amplitude limiting output processing is performed to obtain the target image after white balance correction.
7. The method according to claim 6, characterized in that, The step of calling the target white balance mapping parameters to transform the image to be processed and performing amplitude limiting output processing to obtain a white balance corrected target image includes: Based on the target white balance mapping parameters and the endpoint-preserving secondary brightening function, the composite mapping parameters are determined; The image to be processed is mapped based on the composite mapping parameters, and the abnormal imaging unit neighborhood repair, output limiting, fixed-point scaling and quantization rounding are performed sequentially to obtain the target image.
8. A white balance calibration device, characterized in that, The device includes: The analysis unit is used to perform dark field subtraction processing based on dark field data and initial white field data of uniform white calibration medium to obtain effective response data of each imaging unit in each color channel, and to determine the channel response statistical target corresponding to each color channel based on the effective response data. The alignment calculation unit is used to calculate the first-level channel alignment parameters using the response statistics target within each channel, apply the first-level channel alignment parameters to the initial white field data, and obtain the channel statistics values of each channel after first-level alignment; select the color channel with the largest response amplitude among the channel statistics values after first-level alignment as the reference channel, construct a common white point target in combination with the safe output upper limit, and calculate the second-level calibration parameters of each color channel based on the common white point target; The calibration unit is used to write the alignment parameters in the primary channel and the parameters after secondary calibration into the scanning device, and under the same acquisition conditions as the initial white field data acquisition conditions, to re-scan and acquire feedback white field data on the uniform white calibration medium, and to iteratively generate feedback correction parameters based on the feedback white field data; when a preset stop condition is met, the alignment parameters in the primary channel, the parameters after secondary calibration, and the feedback correction parameters obtained from multiple iterations are integrated to generate target white balance mapping parameters.
9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps included in any one of claims 1-7.
10. A computer program product, the computer program product comprising: Computer program code that, when run on an electronic device, causes the electronic device to perform the steps included in any of the methods of claims 1-7.
