Imaging unit calibration method, apparatus, electronic device, and program product
Patent Information
- Application Number
- CN202611362812.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-03
- Publication Date
- 2026-10-27
AI Technical Summary
[0003]现有校准技术校正效果不佳,根源在于三个层面的系统性失配:一是响应曲线失配,两点校正法以线性假设逼近实际弯曲的像素响应,偏离标定工作点后中低灰度区域残留明显纵向条纹;二是标定样本失配,预设固定灯值或百分比隐含线性假设,受光源批次差异、温度漂移及老化衰减影响,预设挡位偏离有效响应区间,样本聚集于饱和区或噪声区;三是应用场景失配,彩色模式各通道光谱响应灵敏度差异显著,灰度模式为多通道混合照明,现有方案以单一框架覆盖所有模式,局部坏点易放大为贯穿图像的纵向亮线或色线
在本发明实施例中,首先利用暗场数据、基准白场数据计算成像单元的有效响应,再配合彩色、灰度双模式光源驱动调节筛选安全响应区间,并通过闭环迭代获取目标光源参数,以此规避预设固定灯值由光源批次、温度、老化带来的标定样本失配问题,避免样本落入噪声或饱和区。以及,通过约束原始响应节点与通道公共目标节点严格单调,构建分段线性映射模型并做校正回退修复,摒弃传统两点校正的线性假设,适配实际弯曲的像素响应曲线,进而改善偏离标定工作点后中低灰度纵向条纹现象。在此基础上,进一步基于目标映射模型完成完整输入码值全覆盖处理,生成逐单元逐通道校准查找表,兼容彩色、灰度双工作模式,既能够抑制光谱灵敏度差异引发的色偏,又可防止局部坏点放大为贯穿图像的纵向亮线、色线,从而显著提升工业扫描图像均匀化校准精度与量产适用性。
Smart Images

Figure CN122994634A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of imaging calibration technology, and in particular to an imaging unit calibration method, apparatus, electronic device, and program product. Background Technology
[0002] In contact image sensors and industrial scanning imaging systems, due to manufacturing process deviations, differences in the uniformity of photosensitive materials, and mismatches in readout circuits, the photoelectric conversion characteristics of each pixel column in the imaging unit array have inherent inconsistencies. Under uniform illumination, the output image exhibits lateral non-uniform defects such as vertical bright and dark stripes and local color shifts. Uniformity calibration is a key process in mass production.
[0003] Existing calibration techniques are ineffective due to systemic mismatches at three levels: First, response curve mismatch. The two-point calibration method approximates the actual curved pixel response with a linear assumption, leaving obvious vertical stripes in the low and medium grayscale areas after deviating from the calibration working point. Second, calibration sample mismatch. The preset fixed lamp value or percentage implicitly assumes linearity, which is affected by batch differences in light sources, temperature drift, and aging attenuation. The preset level deviates from the effective response range, and the samples are concentrated in the saturation or noise areas. Third, application scenario mismatch. The spectral response sensitivity of each channel in color mode varies significantly, while grayscale mode is a multi-channel mixed illumination. Existing solutions cover all modes with a single frame, and local dead pixels are easily magnified into vertical bright lines or colored lines running through the image.
[0004] Therefore, how to improve the calibration effect has become an urgent technical problem to be solved. Summary of the Invention
[0005] This invention provides an imaging unit calibration method, apparatus, electronic device, and program product to improve the calibration accuracy of imaging inconsistencies to a certain extent.
[0006] In a first aspect, embodiments of the present invention provide an imaging unit calibration method, the method comprising: The effective response of each imaging unit is determined based on the dark field data of the imaging unit and the reference white field data. Based on the light source driving rules corresponding to the color and grayscale dual working modes, and combined with the effective response of each imaging unit, a safe response range is selected, and multiple sets of target response nodes are constructed within the safe response range. For each set of target response nodes, closed-loop iterative matching is performed according to the light source driving rules of the corresponding working mode to obtain the target light source parameters corresponding to each set of target response nodes. Based on the target light source parameters corresponding to each group of target response nodes, the original response nodes and channel common target nodes of each imaging unit are obtained, and the original response nodes and channel common target nodes are constrained to satisfy a strict monotonic relationship. Using the original response nodes and common target nodes that have been constrained, a piecewise linear mapping model is constructed, and the piecewise linear mapping model is corrected and rolled back to determine the target mapping model. The complete input code value inherent in the imaging sensor is processed according to the target mapping model to obtain a full-coverage calibration output result, and a calibration lookup table per imaging unit and per channel is generated based on the calibration output result.
[0007] In one possible implementation, the light source driving rules corresponding to the color and grayscale dual working modes include: In color working mode, a response ladder is independently constructed for each color channel. Based on the channel reference driving value and relative driving percentage, the channel candidate driving amount is calculated, and the current acquisition channel is set as the candidate driving amount. The other light-emitting channels except the current acquisition channel maintain the reference driving value calibrated by the light source at the factory. In grayscale mode, the overall lighting intensity is adjusted synchronously with a fixed drive ratio for multiple light-emitting channels, and the candidate drive quantity of multiple light-emitting channels is calculated synchronously based on the reference drive value and relative drive percentage of each channel. Based on the obtained candidate driving quantities, the light source driving configuration is performed, and the configured light source driving parameters are determined, so as to perform image acquisition based on the light source driving parameters.
[0008] In one possible implementation, by combining the effective responses of each imaging unit, a safe response range is screened, and multiple sets of target response nodes are constructed within the safe response range, including: Based on the effective responses of each imaging unit, effective imaging units are selected. Traverse all candidate driving values within the allowed driving range of the light source. For each candidate driving value, identify saturated imaging units in the original frame obtained by image acquisition based on the light source driving parameters, and statistically obtain the average response, maximum response, and number of saturated imaging units of the effective imaging units under the current candidate driving value. Based on the average response, maximum response, and number of saturated imaging units of the effective imaging units, candidate driving values that meet preset safety conditions are screened, and the largest safe driving value is selected from the candidate driving values that meet the preset safety conditions. The upper limit of the safe response range is determined by the average response corresponding to the largest safe driving value. When the minimum target response exceeds a preset ratio of the upper limit of the safety response range, a ratio limiting process is performed on the minimum target response to obtain the limited minimum target response, and multiple sets of target response nodes are generated between the limited minimum target response and the upper limit of the safety response range.
[0009] In one possible implementation, for each group of target response nodes, closed-loop iterative matching is performed according to the light source driving rules of the corresponding working mode to obtain the target light source parameters corresponding to each group of target response nodes, including: For each target response node under each mode channel, initialize the upper and lower bounds of the search relative to the light source drive, and limit the iterative search interval by the search upper and lower bounds; Select candidate driving percentages, configure the light source based on the light source driving parameters and perform image acquisition to obtain the original white field frame, extract the output values of each imaging unit from the original white field frame, and remove overly dark, saturated and invalid imaging units, and statistically obtain the full-frame average effective response under the candidate driving percentages; By comparing the full-amplitude average effective response with the target response node, the iterative search interval is adjusted. Within the iterative search interval, the candidate driving percentage with the smallest error and satisfying the saturation safety condition is selected to obtain the target light source parameters corresponding to the target response node. Each set of target light source parameters corresponds to a gear level.
[0010] In one possible implementation, based on the target light source parameters corresponding to each group of target response nodes, the original response nodes of each imaging unit and the common target nodes of the channels are obtained, including: For each gear, for each imaging unit in the gear, the output value corresponding to the imaging unit in the white field original frame of the gear is subtracted from the dark field average data and the value is taken as not less than zero to obtain the original response node of the imaging unit in the gear. For each gear position under each mode channel, a set of effective imaging units is constructed, excluding invalid imaging units. When the proportion of the number of imaging units in the set of effective imaging units is not less than a preset ratio, the channel common target node corresponding to the gear position under the mode channel is obtained based on the original response node of each imaging unit in the set of effective imaging units.
[0011] In one possible implementation, a piecewise linear mapping model is constructed using constrained original response nodes and common target nodes, including: Based on the original response nodes of each imaging unit and the common target nodes of the channels, the nodes are sorted in ascending order according to the response values to obtain the sorted node set. When it is determined that the sorted node set contains abnormal nodes, such as duplicate nodes, reversed responses, or node intervals smaller than the minimum allowed interval, node processing is performed; the node processing includes at least one of deleting invalid nodes, recalculating the interval slope, and limiting the node response amplitude. Obtain the processed valid nodes, and construct a piecewise linear mapping model based on the valid nodes.
[0012] In one possible implementation, the step of performing correction and backtracking repair on the piecewise linear mapping model to determine the target mapping model includes: Obtain the parameters of each segment interval of the piecewise linear mapping model, and perform constraint verification processing on each segment interval one by one; When any of the segmented interval parameters does not meet the preset constraints, correction and rollback repair processing is performed; wherein, the correction and rollback repair processing includes at least one of the following: using origin and lowest node interpolation correction for ultra-low response intervals, using the highest segmented interval slope extrapolation combined with amplitude limiting correction for ultra-high response intervals, using pre-configured rollback gain parameters to complete gain mapping rollback repair for imaging units with insufficient effective nodes, abnormal response or gain failure, using the mean or weighted interpolation of effective pixels in the neighborhood to repair isolated abnormal imaging units, and using the nearest effective position fitting repair for continuous abnormal regions; After completing the verification, correction, and rollback repair of all the segmented intervals, the abnormal color difference and bright / dark line defects in the imaging are eliminated, and the target mapping model is obtained.
[0013] In one possible implementation, the method further includes: The calibration lookup table is burned into the imaging system's hardware storage unit so that when the imaging system is working in real time, it can complete the real-time calibration output of the original code value by indexing the entries in the calibration lookup table.
[0014] Secondly, embodiments of the present invention provide an imaging unit calibration device, the device comprising: The determination unit is used to determine the effective response of each imaging unit based on the dark field data and the reference white field data of the imaging unit. The acquisition unit is used to filter the safe response range based on the light source driving rules corresponding to the color and grayscale dual working modes, combined with the effective response of each imaging unit, and construct multiple sets of target response nodes within the safe response range; for each set of target response nodes, closed-loop iterative matching is performed according to the light source driving rules of the corresponding working mode to obtain the target light source parameters corresponding to each set of target response nodes. The acquisition unit is used to acquire the original response node and the common target node of each imaging unit based on the target light source parameters corresponding to each group of target response nodes, and to constrain the original response node and the common target node of the channel to satisfy a strict monotonic relationship. A construction unit is used to construct a piecewise linear mapping model based on the original response nodes and common target nodes that have been constrained, and to perform correction and rollback repair processing on the piecewise linear mapping model to determine the target mapping model; The generation unit is used to process the inherent complete input code value of the imaging sensor according to the target mapping model to obtain a full-coverage calibration output result, and generate a calibration lookup table per imaging unit and per channel based on the calibration output result.
[0015] In one possible implementation, the obtaining unit is configured to: In color working mode, a response ladder is independently constructed for each color channel. Based on the channel reference driving value and relative driving percentage, the channel candidate driving amount is calculated, and the current acquisition channel is set as the candidate driving amount. The other light-emitting channels except the current acquisition channel maintain the reference driving value calibrated by the light source at the factory. In grayscale mode, the overall lighting intensity is adjusted synchronously with a fixed drive ratio for multiple light-emitting channels, and the candidate drive quantity of multiple light-emitting channels is calculated synchronously based on the reference drive value and relative drive percentage of each channel. Based on the obtained candidate driving quantities, the light source driving configuration is performed, and the configured light source driving parameters are determined, so as to perform image acquisition based on the light source driving parameters.
[0016] In one possible implementation, the obtaining unit is configured to: Based on the effective responses of each imaging unit, effective imaging units are selected. Traverse all candidate driving values within the allowed driving range of the light source. For each candidate driving value, identify saturated imaging units in the original frame obtained by image acquisition based on the light source driving parameters, and statistically obtain the average response, maximum response, and number of saturated imaging units of the effective imaging units under the current candidate driving value. Based on the average response, maximum response, and number of saturated imaging units of the effective imaging units, candidate driving values that meet preset safety conditions are screened, and the largest safe driving value is selected from the candidate driving values that meet the preset safety conditions. The upper limit of the safe response range is determined by the average response corresponding to the largest safe driving value. When the minimum target response exceeds a preset ratio of the upper limit of the safety response range, a ratio limiting process is performed on the minimum target response to obtain the limited minimum target response, and multiple sets of target response nodes are generated between the limited minimum target response and the upper limit of the safety response range.
[0017] In one possible implementation, the obtaining unit is configured to: For each target response node under each mode channel, initialize the upper and lower bounds of the search relative to the light source drive, and limit the iterative search interval by the search upper and lower bounds; Select candidate driving percentages, configure the light source based on the light source driving parameters and perform image acquisition to obtain the original white field frame, extract the output values of each imaging unit from the original white field frame, and remove overly dark, saturated and invalid imaging units, and statistically obtain the full-frame average effective response under the candidate driving percentages; By comparing the full-amplitude average effective response with the target response node, the iterative search interval is adjusted. Within the iterative search interval, the candidate driving percentage with the smallest error and satisfying the saturation safety condition is selected to obtain the target light source parameters corresponding to the target response node. Each set of target light source parameters corresponds to a gear level.
[0018] In one possible implementation, the acquiring unit is configured to: For each gear, for each imaging unit in the gear, the output value corresponding to the imaging unit in the white field original frame of the gear is subtracted from the dark field average data and the value is taken as not less than zero to obtain the original response node of the imaging unit in the gear. For each gear position under each mode channel, a set of effective imaging units is constructed, excluding invalid imaging units. When the proportion of the number of imaging units in the set of effective imaging units is not less than a preset ratio, the channel common target node corresponding to the gear position under the mode channel is obtained based on the original response node of each imaging unit in the set of effective imaging units.
[0019] In one possible implementation, the building unit is used for: Based on the original response nodes of each imaging unit and the common target nodes of the channels, the nodes are sorted in ascending order according to the response values to obtain the sorted node set. When it is determined that the sorted node set contains abnormal nodes, such as duplicate nodes, reversed responses, or node intervals smaller than the minimum allowed interval, node processing is performed; the node processing includes at least one of deleting invalid nodes, recalculating the interval slope, and limiting the node response amplitude. Obtain the processed valid nodes, and construct a piecewise linear mapping model based on the valid nodes.
[0020] In one possible implementation, the building unit is used for: Obtain the parameters of each segment interval of the piecewise linear mapping model, and perform constraint verification processing on each segment interval one by one; When any of the segmented interval parameters does not meet the preset constraints, correction and rollback repair processing is performed; wherein, the correction and rollback repair processing includes at least one of the following: using origin and lowest node interpolation correction for ultra-low response intervals, using the highest segmented interval slope extrapolation combined with amplitude limiting correction for ultra-high response intervals, using pre-configured rollback gain parameters to complete gain mapping rollback repair for imaging units with insufficient effective nodes, abnormal response or gain failure, using the mean or weighted interpolation of effective pixels in the neighborhood to repair isolated abnormal imaging units, and using the nearest effective position fitting repair for continuous abnormal regions; After completing the verification, correction, and rollback repair of all the segmented intervals, the abnormal color difference and bright / dark line defects in the imaging are eliminated, and the target mapping model is obtained.
[0021] In one possible implementation, the apparatus further includes a processing unit for: The calibration lookup table is burned into the imaging system's hardware storage unit so that when the imaging system is working in real time, it can complete the real-time calibration output of the original code value by indexing the entries in the calibration lookup table.
[0022] 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.
[0023] 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.
[0024] 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.
[0025] The technical solutions provided by the embodiments of the present invention bring at least the following beneficial effects: In this embodiment of the invention, the effective response of the imaging unit is first calculated using dark field data and reference white field data. Then, a safe response range is selected by adjusting the light source driven by color and grayscale dual-mode light sources. The target light source parameters are obtained through closed-loop iteration to avoid the calibration sample mismatch problem caused by light source batches, temperature, and aging due to preset fixed lamp values, thus preventing samples from falling into noise or saturation areas. Furthermore, by constraining the original response node and the common target node of the channel to be strictly monotonic, a piecewise linear mapping model is constructed and corrected and backed up. This abandons the linear assumption of traditional two-point correction and adapts to the actual curved pixel response curve, thereby improving the phenomenon of mid-to-low grayscale longitudinal stripes after deviating from the calibration working point. On this basis, the complete input code value full coverage processing is further completed based on the target mapping model to generate a unit-by-unit and channel-by-channel calibration lookup table that is compatible with color and grayscale dual working modes. This can suppress color shift caused by differences in spectral sensitivity and prevent local bad pixels from being magnified into longitudinal bright lines and color lines running through the image, thereby significantly improving the uniformity calibration accuracy and mass production applicability of industrial scanning images.
[0026] 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.
[0027] 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
[0028] 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.
[0029] Figure 1 A schematic diagram of an image captured by a contact image sensor on a white A4 sheet of paper; Figure 2 This is a schematic diagram of an image after two-point correction. Figure 3 This is a schematic diagram illustrating the process of scanning a white A4 sheet of paper at 300 DPI resolution during the calibration phase and statistically analyzing the response values of each of the R, G, and B channels. Figure 4 This is a schematic flowchart of an imaging unit calibration method provided in an embodiment of the present invention; Figure 5 This is a diagram of a standard white A4 sheet of paper. Figure 6 This is a schematic diagram illustrating the principle of a piecewise linear mapping algorithm provided in an embodiment of the present invention; Figure 7 This is a schematic diagram of the entire process of a calibration method provided in an embodiment of the present invention; Figure 8 A schematic diagram showing the comparison of RGB color mode 1200DPI per imaging unit response before and after calibration, provided as an embodiment of the present invention; Figure 9 This is a schematic diagram showing the comparison of the RGB color mode 600DPI per imaging unit response before and after calibration, as provided in an embodiment of the present invention. Figure 10 This is a schematic diagram showing the comparison of the response before and after 300 DPI per imaging unit in RGB color mode according to an embodiment of the present invention. Figure 11 This is a schematic diagram showing the comparison before and after calibration of the equivalent response of three lamps in the same proportional linkage in MONO grayscale mode at 1200DPI, provided as an embodiment of the present invention. Figure 12 This is a schematic diagram showing the comparison before and after calibration of the equivalent response of three lamps in the same proportional linkage in MONO grayscale mode at 600DPI, provided as an embodiment of the present invention. Figure 13 This is a schematic diagram showing the comparison before and after calibration of the equivalent response of three lamps in the same proportional linkage in MONO grayscale mode at 300DPI, provided as an embodiment of the present invention. Figure 14 A schematic diagram of a calibrated image provided in an embodiment of the present invention; Figure 15 This is a schematic diagram of an image acquired in grayscale mode with poor image quality, provided as an embodiment of the present invention. Figure 16 A schematic diagram of another calibrated image provided in an embodiment of the present invention; Figure 17 This is a structural block diagram of an imaging unit calibration device provided in an embodiment of the present invention; Figure 18 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. Without conflict, the embodiments and features in the embodiments of the present 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 the present 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.
[0031] 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.
[0032] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These embodiments should be considered merely exemplary. Therefore, those skilled in the art should 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, references may be made to existing industry solutions such as software, components, and models. 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.
[0033] Contact image sensors (CIS) are a new type of photoelectric imaging sensor that has been gradually developed and improved after charge-coupled devices (CCD) and complementary metal-oxide-semiconductor (CMOS) technologies. This device integrates a lenticular lens, a light-emitting diode array, a photosensitive element array, and a signal amplification circuit into one unit. During operation, the light emitted by the light source is reflected by the object being scanned, then projected and focused onto the photosensitive element array by the lenticular lens. The photosensitive element array converts the light signal into an electrical signal, which is amplified and output by the signal amplification circuit. After further processing, a complete image of the scanned object can be directly obtained.
[0034] Contact image sensors, with their advantages of small size, fast scanning speed, and low cost, are now widely used in the field of image scanning. Contact image sensors are composed of multiple segments. Factors such as uneven illumination, glass plate undulations, slight differences in the materials of the devices themselves, and differences in photosensitive characteristics can all cause significant differences in the output characteristics of different photosensitive units, resulting in inherent noise in the raw images directly output by contact image sensors. For example, ... Figure 1 As shown, Figure 1 The image was obtained directly from a white A4 sheet of paper by a contact image sensor without any processing. The output image shows a large number of fine black line noises, and the noise density is higher on the left side of the image than on the right side. This indicates that under the same external conditions, the imaging effect of each imaging unit of the contact image sensor is not consistent, the imaging process exhibits nonlinear characteristics, the overall quality of the original output image is poor, and there are also problems such as non-uniform brightness imbalance and pixel loss.
[0035] Therefore, in order to improve image quality, it is necessary to perform calibration processing on the image sensor to improve the image output effect.
[0036] To address the image calibration problem in scanning imaging, a two-point method is provided in related technologies to correct the non-uniformity of contact image sensors. This method is based on the assumption that the response of each photosensitive unit is linear. This assumption is basically valid in most of the response range of the photosensitive unit, and only when the input is extremely small or close to saturation will there be obvious nonlinearity. Ignoring the errors at both ends, the response of the detection unit can be considered to have linear characteristics.
[0037] It is evident that the traditional two-point calibration relies solely on the dark field and a single white field working point to complete the correction. The resulting gain parameters can only guarantee uniform output near a specific brightness level. When the scanning input changes from a bright area of white paper to a colored paper, gray, or dark area, the response slope of each column changes, and the original gain can no longer maintain the horizontal uniformity of the image, easily resulting in bright lines, dark lines, and local overexposure.
[0038] For example, such as Figure 2 As shown, Figure 2 The image shows the result after correction using the traditional two-point method. Due to the inconsistency between the calibration conditions and the actual acquisition conditions, although this method can eliminate some noise and fine line defects, the image still shows obvious fine lines and noise. The black line in the left box area is more prominent than that on the right.
[0039] Some existing solutions pre-set a number of fixed lamp values or fixed percentages. This method implies that the lamp value, luminous flux and sensor output are approximately linearly preset. However, differences in light source batches, temperature changes, light source aging and individual differences in sensor photosensitivity will change the actual response state, which can easily cause some calibration settings to fall into the high brightness area, noise area or directly enter the saturation area. In the end, the image still cannot achieve the ideal uniform effect.
[0040] Furthermore, related technologies offer correction methods such as multi-exposure fitting, residual iteration, polynomial fitting, and neural networks, which increase the amount of data collected, stored, and computationally expensive during the calibration phase. Placing complex fitting operations in the real-time execution phase for each row and each pixel will also reduce the real-time performance of the scan. Moreover, schemes based on neural networks to process nonlinear, high-order fitted images have high algorithm complexity, consume a large amount of system computing resources, have high processor performance requirements, are time-consuming to operate, and have poor real-time performance, making them difficult to deploy in embedded processors with limited computing resources. At the same time, the light source excitation logic corresponding to color scanning and grayscale scanning is different. Color mode needs to distinguish the spectral response differences between each color channel, while grayscale mode relies on multiple light emission channels to generate grayscale response. If existing technologies directly reuse the same single-lamp calibration process, the grayscale calibration curve will not match the actual multi-lamp lighting conditions. If completely independent calibration algorithms are designed for the two modes, it will bring problems such as difficult firmware maintenance, complex parameter formats, and increased operating resource consumption.
[0041] For example, such as Figure 3 As shown, Figure 3The results of scanning white A4 paper at 300 DPI resolution and analyzing the response values of the red, green, and blue channels show that the contact image sensor has different light sensitivity to different colors: it has high sensitivity to red light, with a response brightness of around 200; low sensitivity to green light, with a response brightness below 100; and moderate sensitivity to blue light, with a response brightness between 100 and 200.
[0042] Clearly, most calibration methods provided in related technologies ignore this photosensitive difference and fail to perform overall alignment only after each light channel is independently aligned. Furthermore, most existing calibration processes do not integrate saturation point removal, low response threshold judgment, node monotonicity repair, node insufficiency rollback, and abnormal column operation repair. Localized bad pixels are easily magnified into significant vertical bright or colored lines, lacking a complete closed-loop protection mechanism for saturation point removal, node monotonicity repair, node insufficiency rollback, and abnormal column operation repair.
[0043] In view of this, the present invention provides an imaging unit calibration method. This method first determines the effective response of each imaging unit based on its dark field data and reference white field data. Based on the light source driving rules corresponding to both color and grayscale dual operating modes, it filters safe response ranges and constructs multiple sets of target response nodes by combining the effective responses of each imaging unit. For each set of target response nodes, it performs closed-loop iterative matching according to the light source driving rules of the corresponding operating mode to obtain the target light source parameters corresponding to each set of target response nodes. Then, based on the target light source parameters, it obtains the original response nodes and common target nodes of each channel for each imaging unit, and constrains the original response nodes and common target nodes of the channels to satisfy a strict monotonic relationship. Based on the constrained nodes, it constructs a piecewise linear mapping model. After performing correction and backtracking repair processing on the piecewise linear mapping model, it obtains the target mapping model. Finally, it uses the target mapping model to perform full coverage processing on the complete input code values of the imaging sensor, outputs the calibration results, and generates calibration lookup tables for each imaging unit and each channel.
[0044] As can be seen, this invention no longer relies on a single calibration working point and a fixed lamp value calibration mode. It obtains the target light source parameters through a combination of safe response interval screening and closed-loop iterative matching, avoiding calibration sample mismatch issues caused by light source batches, temperature, and device aging, and preventing calibration samples from falling into noise or saturation regions. Based on strict monotonic constraints, node anomaly handling, and model correction rollback repair, it breaks away from the linear response assumption of traditional two-point calibration, adapting to the true nonlinear pixel response characteristics of CIS and improving longitudinal stripe defects in cross-brightness scenarios. This invention takes into account the light source excitation characteristics of both color and grayscale scanning modes, adapting to the differences in photosensitivity of different color channels, achieving channel alignment before overall calibration. Furthermore, it incorporates saturation point removal, node monotonic repair, node insufficiency rollback, and anomaly handling into the entire calibration process, forming a complete anomaly protection closed loop to prevent local bad pixels from being amplified into longitudinal bright lines or colored lines. The entire algorithm's calibration and operating overhead is controllable, requiring no complex fitting or neural network models, and can be adapted to resource-constrained embedded scanning equipment. Under mass production conditions, it effectively improves the brightness uniformity of CIS scanned images and enhances image output quality.
[0045] To further illustrate the imaging unit 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).
[0046] The following combination Figure 4 The flowchart shown illustrates the imaging unit calibration method in this embodiment of the invention. The method can be executed by an electronic device, and the specific implementation flow of the method is as follows: Step 401: Determine the effective response of each imaging unit based on the dark field data and the reference white field data of the imaging unit.
[0047] In this embodiment of the invention, given the inherent working principle and hardware characteristics of the CIS image scanning system, this invention mainly addresses the non-uniform brightness defects in grayscale and color modes, and proposes a novel calibration method to perform calibration processing on the original CIS acquired images, thereby obtaining scanned images with better accuracy in practical applications.
[0048] In this embodiment of the invention, the adjustable light source built into the device is directly used as a controllable excitation source. Multiple active scanning acquisitions are performed during the calibration phase. For each imaging unit, multiple sets of measured response nodes are used to approximate and fit the true response function of the imaging unit. The feasibility analysis of this solution is presented below from a theoretical perspective.
[0049] The raw output value of CIS is mainly determined by the effective incident light received by the pixel. The effective incident light can be approximately expressed as the product of the brightness of the light-emitting diode (LED), the reflectivity of the scanned medium, and the optical path response. The final raw output value of the pixel changes with the change of the effective incident light.
[0050] For any color channel c and any column x, the effective incident light received by that channel and column can be determined based on the following formula: Formula 1.
[0051] in, This represents the effective incident light quantity received in the c-th channel and x-th column. The brightness of the c-th LED; The reflectance of the scanned object to that color of light; The spatial non-uniformity coefficient caused by the optical path, CIS column response, lens, or structure.
[0052] As can be seen from Formula 1, LED brightness and paper reflectivity Both are multiplication factors. Therefore, whether reducing the brightness of the light source or scanning paper or colored areas with lower reflectivity, the effective incident light received by the CIS can be reduced.
[0053] Taking the green G channel as an example, when calibrating and scanning white paper, the effective incident light amount of the channel satisfies the following: White paper has a higher reflectivity to green light. The value is relatively large; when scanning green, blue, gray, or dark areas, the corresponding effective incident light amount is: Most colored areas have a lower reflectivity to light from a single channel than white paper, which satisfies the condition that... Therefore, we can obtain .
[0054] If the calibration process still uses white paper as the calibration medium, the brightness of the G channel LED will be proportionally... If the intensity is reduced, the effective incident light amount is then... When satisfied At that time, you can get .
[0055] Therefore, by reducing the LED brightness and using white paper for calibration, the raw output intensity corresponding to the low-response area of colored paper can be reproduced. Thus, the purpose of this invention in setting up multi-level LED light sources for calibration is not to replicate the color properties of the paper itself, but to simulate the sensor raw output corresponding to different response intensities of the same channel, thereby obtaining multiple sets of real response nodes to support subsequent response function fitting.
[0056] Before describing the specific implementation process of this invention, the symbols used in this document are defined uniformly: : Mode channel index. In color mode, it corresponds to the red, green, and blue channels; in grayscale mode, it represents the grayscale channel. : Horizontal imaging unit or column index, ; : Response gear index, ; : The number of rows collected for each calibration state; : The average dark field response at channel q and position i; : Average white field response at the j-th light source response level; P(q,i,j): Actual original response node after dark field subtraction; Target response nodes obtained from statistics of effective imaging units under the same gear; : The actual light source driving quantity corresponding to the j-th gear; The target response expected to be achieved in the j-th gear; The saturation value or upper limit of the output code value of the sensor; : The final output target of channel q.
[0057] The actual response node after dark field subtraction is defined as shown in Formula 2 below: Formula 2.
[0058] This calculation method separates dark current, simulated front-end zero-point offset, and fixed bias from the white field acquisition data, ensuring that all subsequent node construction and fitting calculations are based on the real response brought by the effective incident light, avoiding the interference of zero-point offset on the fitting results, and providing a reliable data foundation for subsequent safe response interval selection, target response node construction, and piecewise linear mapping model establishment.
[0059] In this embodiment of the invention, the calibration task initialization and data acquisition condition configuration are performed first.
[0060] In this embodiment of the invention, a uniform white calibration medium is selected as the calibration carrier during the calibration process. Specifically, standard white A4 paper is used as the calibration plate, and the physical appearance is as follows: Figure 5As shown, place it flat on the scanning imaging station to ensure the calibration optical path is uniform, unobstructed, and wrinkle-free, providing a unified hardware environment for accurate data acquisition. Based on this, complete the configuration of the full set of calibration parameters, which specifically include: basic acquisition parameters such as imaging width w, number of acquisition lines H per gear, and scanning resolution; the color or grayscale working mode to be calibrated; and the reference drive value corresponding to each emission channel. Relative drive adjustment range of the light source The preferred setting is Simultaneously, preset calibration constraint parameters such as the number of response nodes, response error tolerance N, and upper limit of the number of saturated imaging units provide a configuration basis for subsequent layered acquisition, iterative calculation, and threshold determination.
[0061] In this embodiment of the invention, after initialization configuration is completed, the effective response of all imaging units is accurately determined by collecting, processing and filtering dark field data and reference white field data, and abnormal invalid units are eliminated, providing clean and effective raw data for subsequent light source interval screening and node modeling.
[0062] In this embodiment of the invention, external light interference is isolated by turning off the device light source or completely blocking the incident light path, and preset H rows of dark field image data are continuously acquired. For each mode channel and each imaging unit position, the raw dark field data of multiple rows are averaged, smoothed, and rounded to obtain the average dark field response data D(q,i) of each imaging unit, effectively eliminating data deviations caused by random acquisition noise and dark current offset. Specifically, the average dark field response data D(q,i) of each imaging unit can be obtained based on the following formula: Formula 3.
[0063] In this embodiment of the invention, the light source is turned on and the reference drive is maintained in working state. H rows of reference white field data are continuously acquired under standard illumination conditions. Similarly, the average response data W(q,i) of the reference white field for each channel and each imaging unit is obtained by rounding down the average of multiple rows. The average response data W(q,i) of the reference white field for each imaging unit can be obtained based on the following formula: Formula 4.
[0064] Based on this, the inherent bias of the dark field is removed, and the reference effective response A(q,i) of each imaging unit is calculated. The reference effective response A(q,i) of each imaging unit can be obtained based on the following formula: Formula 5.
[0065] In this way, fixed interferences such as sensor dark current and simulated front-end zero-point offset are completely eliminated, and only the real photoelectric response corresponding to the incident light is retained.
[0066] In this embodiment of the invention, to avoid interference from failed pixels, saturated pixels, and pixels with hardware malfunctions on subsequent calibration accuracy, invalid imaging units can be screened and marked. Specifically, if the reference effective response of an imaging unit is lower than a preset minimum effective response threshold, the reference white field response reaches the upper limit of the sensor saturation code value, or the imaging unit is pre-marked with a hardware malfunction, it is determined and marked as an invalid position unit, and will no longer participate in the statistical and fitting modeling of the channel common target response nodes, thus ensuring the validity of the calibration data and the overall calibration accuracy from the source.
[0067] Step 402: Based on the light source driving rules corresponding to the color and grayscale dual working modes, and combined with the effective response of each imaging unit, a safe response range is selected, and multiple sets of target response nodes are constructed within the safe response range; for each set of target response nodes, closed-loop iterative matching is performed according to the light source driving rules of the corresponding working mode to obtain the target light source parameters corresponding to each set of target response nodes.
[0068] In this embodiment of the invention, after completing the acquisition of dark field and reference white field data and determining the effective imaging unit, the invention establishes a light source driving rule adapted to both working modes, taking into account the completely different light source excitation characteristics of CIS color scanning and grayscale scanning. This enables differentiated and precise controllable excitation and data acquisition of the light source under the two working conditions, solving the problems of single-scene adaptation and poor mode compatibility in traditional calibration methods. During the calibration process, the corresponding light source control logic is adaptively matched according to the currently selected working mode, completing independent channel-by-channel stepped acquisition in color mode and multi-channel proportional synchronous dimming acquisition in grayscale mode respectively.
[0069] In this embodiment of the invention, the light source driving rules corresponding to the color and grayscale dual working modes include: in the color working mode, independently constructing response ladders for each color channel, calculating candidate driving quantities for the channel based on the channel reference driving value and relative driving percentage, and setting the currently acquired channel as the candidate driving quantity, while maintaining the reference driving value of the light source as calibrated at the factory for the remaining light-emitting channels other than the currently acquired channel; in the grayscale working mode, maintaining a fixed driving ratio for multiple light-emitting channels to synchronously adjust the overall illumination intensity, and synchronously calculating candidate driving quantities for multiple light-emitting channels based on the reference driving value and relative driving percentage of each channel; and configuring the light source driving based on the obtained candidate driving quantities to determine the configured light source driving parameters for image acquisition based on the light source driving parameters.
[0070] In practical implementation, under color working mode, a response ladder is independently established for each color channel to achieve fine calibration of a single channel. Let the reference light source driving value for channel q be... If the relative driving percentage is p, then the candidate driving quantity of this channel can be determined based on the following formula: Formula Six.
[0071] When acquiring image data for channel q, only the currently acquired color emission channel is configured as the calculated candidate driving quantity. Except for the current acquisition channel, all other light-emitting channels maintain the reference driving value set by the factory of the light source, and perform the level search and data acquisition process for the red, green and blue color channels in turn to ensure that the single-channel response data is not affected by crosstalk.
[0072] In grayscale mode, the image brightness is formed by the superposition of multiple emission channels, making it impossible to simulate true grayscale illumination by adjusting a single color channel. Let the reference driving values for the red, green, and blue emission channels be respectively... Under the condition that the relative driving percentage is p, the candidate driving quantity of the multi-channel light emission can be calculated synchronously using the following formula.
[0073] Formula 7.
[0074] In grayscale mode, the multi-channel light emission always maintains the factory-fixed drive ratio, only synchronously scaling the overall illumination intensity, which conforms to the actual grayscale scanning mixed light imaging principle. Finally, the single-channel response is calculated through grayscale acquisition data, and the data is saved in grayscale mode channel format.
[0075] In this embodiment of the invention, through the aforementioned dual-mode differentiated light source driving configuration, the invention distinguishes between the acquisition logic of color channel independent dimming and grayscale multi-channel proportional dimming, thus overcoming the operational mismatch defect caused by the mixed use of a single set of dimming rules in traditional calibration algorithms. Simultaneously, after completing the initial differentiated light source acquisition, both working modes reuse the same data structure from the subsequent node operation steps. The mode channel, imaging unit, response level, original response node, and channel common target node serve as a unified data carrier for subsequent modeling and calibration, ensuring dual-mode scene adaptability while simplifying the algorithm architecture and firmware deployment costs.
[0076] In this embodiment of the invention, effective imaging units are selected based on the effective responses of each imaging unit; all candidate driving values within the allowable driving range of the light source are traversed; for each candidate driving value, saturated imaging units are identified from the original frames obtained by image acquisition based on the light source driving parameters, and the average response, maximum response, and number of saturated imaging units of the effective imaging units under the current candidate driving value are statistically obtained; based on the average response, maximum response, and number of saturated imaging units of the effective imaging units, candidate driving values that meet preset safety conditions are selected, and the largest safe driving value is selected among the candidate driving values that meet the preset safety conditions, and the upper limit of the safe response interval is determined by the average response corresponding to the largest safe driving value; when the lowest target response exceeds the preset proportion of the upper limit of the safe response interval, proportional limiting processing is performed on the lowest target response to obtain the limited lowest target response, and multiple sets of target response nodes are generated between the limited lowest target response and the upper limit of the safe response interval.
[0077] In this embodiment of the invention, after configuring the dual-mode light source driving rules and acquiring the light source parameters, the invention further filters out compliant and valid imaging units based on the previously screened effective response data of each imaging unit, eliminating abnormal units with hardware malfunctions, excessively dim responses, or saturation failures. This serves as the effective data basis for subsequent interval screening and node construction. On this basis, all candidate driving values within the allowed driving range of the light source are traversed. For each candidate driving value, image acquisition is performed based on the light source driving parameters in the corresponding working mode to obtain the original acquisition frame. By parsing the original frame data, the saturated imaging units under the current working condition are identified. Simultaneously, several key response parameters corresponding to the current candidate driving value are statistically obtained, specifically including the average response of the effective imaging units, the maximum response of the effective imaging units, and the number of saturated imaging units, providing a quantitative basis for determining safe driving conditions.
[0078] In this embodiment of the invention, candidate driving values are screened by pre-setting multiple security constraints. The specific constraints include the average response threshold of effective imaging units, the maximum response threshold of effective imaging units, and the threshold for the number of saturated imaging units. The corresponding determination formula is shown in Formula 8 below: Formula 8.
[0079] in, The average response of the effective imaging unit, The maximum response in the effective imaging unit, The number of imaging units required to achieve saturation is determined. Through multi-dimensional threshold constraints, substandard drive gears exhibiting large-area saturation or abnormal response distortion can be precisely screened out, ensuring the validity of the calibration data.
[0080] In this embodiment of the invention, among all candidate drive values that meet the safety constraints, the safety drive value with the largest value is selected as the optimal high-brightness drive level. The actual response is recorded as shown in Formula Nine below: Formula 9. Furthermore, the average response of the effective imaging unit corresponding to this setting is recorded as the upper limit of the safe response range. This ensures sufficient high-brightness output margin during the calibration process, completely avoiding the problem of local pixel saturation being mistakenly identified as a valid calibration node.
[0081] After determining the upper limit of the safe response range, the minimum target response is further solved and the amplitude limiting is optimized to avoid the impact of low-brightness noise and bad column interference on calibration accuracy. This invention sets the minimum target response to a value higher than the noise and bad column judgment region, and calculates the initial minimum effective response through a threshold multiple constraint as shown in Formula 10: Formula 10. This allows for the filtering of low-response invalid data at the source. Furthermore, to adapt to different light source conditions and avoid abnormal response ranges, when the lowest target response... Exceeding the upper limit of the safety response range When the preset ratio is reached, proportional limiting processing is performed on the minimum target response, and... Limited to Within this ratio, the lowest target response after the limit is obtained, solving the problem that the low gear cannot be searched when the highest response is too low.
[0082] In this embodiment of the invention, when the minimum target response exceeds a preset ratio of the upper limit of the safety response interval, a ratio limiting process is performed on the minimum target response to obtain the limited minimum target response, and multiple sets of target response nodes are generated between the limited minimum target response and the upper limit of the safety response interval.
[0083] In this embodiment of the invention, and N target response nodes are constructed. The node arrangement can be flexibly achieved using equal intervals, logarithmic intervals, quantile intervals, or curvature-adaptive non-uniform intervals. Optionally, to improve calibration accuracy in low-to-medium grayscale regions, a mixed-weight non-uniform arrangement is preferred, as shown in Formula 11 below. A suitable mixed-weight method for low-brightness compensation is: Formula 11.
[0084] Here, j=0 corresponds to the highest target response, and j=N-1 corresponds to the lowest target response. The linear term ensures that the target node covers the dynamic range, while the quadratic term causes intermediate targets to move moderately towards the low-response region, thereby enhancing the ability to describe the medium-to-low brightness region.
[0085] By adaptively generating multiple sets of target response nodes using corresponding weight formulas, the system not only fully covers the sensor's dynamic response range but also focuses on encrypting nodes in the low-brightness range, effectively improving the fitting accuracy of the sensor's nonlinear response range.
[0086] In this embodiment of the invention, for each target response node under each mode channel, the upper and lower bounds of the search relative to the light source drive are initialized, and the iterative search interval is defined by the upper and lower bounds of the search. Candidate drive percentages are selected, the light source is configured based on the light source drive parameters, and image acquisition is performed to obtain the original white field frame. The output values of each imaging unit are extracted from the original white field frame, and overly dark, saturated, and invalid imaging units are removed. The full-frame average effective response under the candidate drive percentage is statistically obtained. The full-frame average effective response is compared with the target response node, the iterative search interval is adjusted, and the candidate drive percentage with the smallest error and meeting the saturation safety condition is selected in the iterative search interval to obtain the target light source parameters corresponding to the target response node. Each set of target light source parameters corresponds to a level.
[0087] In this embodiment of the invention, for each target response node under each mode channel, the upper and lower bounds of the relative driving of the light source are initialized, and the iterative search interval is defined by the upper and lower bounds. Optionally, this scheme initializes the relative driving search interval of the light source to the maximum adjustable range, i.e., the minimum driving percentage. Maximum drive percentage .
[0088] In this embodiment of the invention, closed-loop iterative matching is continuously performed within a defined iterative search interval. Specifically, the percentage of candidates in the middle of the interval is first calculated. The actual light source driving quantity corresponding to the current candidate percentage is calculated and configured according to the aforementioned dual-mode light source driving rules. After completing the light source parameter configuration, preset H rows of white field data are collected. The collected raw white field frames are preprocessed to extract the output values of each imaging unit, and overly dark, saturated, and invalid imaging units are removed to avoid abnormal pixels interfering with calibration accuracy.
[0089] Based on this, the effective response and the full-frame average effective response under the current candidate drive percentage are calculated. Specifically, firstly, the dark field offset is subtracted using the following formula (Equation 12) to obtain the real-time response data of each effective imaging unit. Formula 12 is: Formula 12. The full-amplitude average effective response under the current candidate driver percentage is then calculated using Formula 13. Formula 13 is: .
[0090] The error between the current response and the preset target response is further calculated using the following formula fourteen: Formula 14. Finally, the iterative search interval is dynamically adjusted based on the response deviation (i.e., the error value obtained from the aforementioned calculation). Specifically, when the full-amplitude average effective response is greater than the target response node value, i.e. Lower the upper bound of the search; when the average effective response of the entire range is less than the value of the target response node, i.e. This increases the lower bound of the search, thereby continuously iterating and converging until the response error meets the preset error tolerance.
[0091] Throughout the entire iteration process, the percentage of optimal candidate drivers that minimizes the error within the interval and satisfies the saturation safety condition is continuously selected and recorded, using Formula Fifteen. The optimal light source driving parameters corresponding to the target response nodes are obtained through screening, and each set of target light source parameters generates an independent response level. In this way, using only the driving percentage as the control variable for iterative search, all response nodes used for calibration modeling ultimately adopt the actual response values collected by the device, rather than directly fitting the optical response through the driving percentage, thus completely avoiding the fitting deviation between the theoretical model and the actual hardware conditions.
[0092] Step 403: Based on the target light source parameters corresponding to each group of target response nodes, obtain the original response nodes and channel common target nodes of each imaging unit, and constrain the original response nodes and channel common target nodes to satisfy a strict monotonic relationship.
[0093] In this embodiment of the invention, for each gear position, for each imaging unit in the gear position, the output value corresponding to the imaging unit in the original white field frame of the gear position is subtracted from the average dark field data and the value is not less than zero to obtain the original response node of the imaging unit in the gear position; for each gear position in each mode channel, a set of effective imaging units excluding invalid imaging units is constructed. When the proportion of the number of imaging units in the effective imaging unit set is not less than a preset proportion, the channel common target node corresponding to the gear position in the mode channel is obtained based on the original response nodes of each imaging unit in the effective imaging unit set.
[0094] After completing the iterative search of all target response nodes, the set of light source driving parameters and the corresponding global response set for all gears under the current mode channel can be obtained, which are the light source driving sequences. Global average response sequence .
[0095] In some implementations, to ensure that the response ladder is orderly and the node distribution is reasonable, all calibrated gears are sorted in order according to the actual response values. Duplicate gears with response differences less than the minimum node interval are merged. If there is insufficient number of valid target nodes, the backup target response is called to iterate and search again to complete the gear data.
[0096] In this embodiment of the invention, based on the original white field acquisition data of each gear position, the original response node of each imaging unit is constructed pixel by pixel, and then processed by formula sixteen. The actual response values of each imaging unit at different power levels were calculated. Under the same power level, different imaging units will exhibit different original response values due to individual hardware differences and optical path differences. This invention fully preserves these individual pixel differences, providing real and complete step data support for subsequent column-by-column and unit-by-unit fine-grained non-uniformity compensation and mapping model construction.
[0097] In this embodiment of the invention, after solving and calculating the original response nodes of all imaging units under each gear, it is necessary to obtain the common target response nodes of each channel and each gear based on the effective pixel data statistics, so as to provide a standard alignment basis for subsequent unified calibration of the whole domain pixels.
[0098] To avoid interference from abnormal units such as extremely dark responses, saturated pixels, and hardware dead pixels on the overall calibration benchmark, this invention selects and constructs a pure set of effective imaging units for each mode channel and each light source response level, eliminating various abnormal and invalid pixel locations. The selection rules for the effective imaging unit set comprehensively consider response effectiveness and operational reliability, retaining only normal imaging units whose original response is not lower than the minimum effective response threshold, whose white field acquisition data has not reached the saturation upper limit, and which have not been marked as hardware faults. The corresponding effective imaging unit set is defined as follows: Formula 17. Wherein, To preset the minimum effective response threshold, To determine the upper limit of sensor saturation output, multiple conditions are used for joint screening to remove invalid pixels such as those that are saturated, too dark, or have hardware failures, thus ensuring the reliability of the statistical samples.
[0099] Based on this, the present invention can solve for the common target node corresponding to the channel position using various robust statistical methods such as mean, median, truncated mean, or weighted statistics, based on the effective imaging unit set, adapting to different accuracy and anti-interference requirements. Taking the arithmetic mean statistical method as an example, the calculation method of the common target node is shown in Formula 18 below: Formula 18.
[0100] In some implementations, to ensure the global representativeness of the statistical results for each gear level, this invention sets up an effective pixel ratio determination mechanism. If the pixel ratio |Ω(q,j)| of the effective imaging unit set for the current gear level is lower than a preset ratio of the total number of imaging units in the entire device, the data collected for that gear level is determined to be distorted and the statistical results invalid. The data of that set of nodes is discarded to avoid abnormal gear levels from participating in modeling and causing calibration curve distortion. By combining effective pixel screening with robust statistical methods, it is possible to effectively prevent local bad pixels, saturated pixels, and extremely dark failure columns from abnormally skewing the overall target response curve of the channel, and significantly improve the stability and realism of common target nodes.
[0101] Step 404: Construct a piecewise linear mapping model using the original response nodes and common target nodes with constraints completed, and perform correction and rollback repair on the piecewise linear mapping model to determine the target mapping model.
[0102] In this embodiment of the invention, based on the original response nodes of each imaging unit and the common target nodes of the channel, the nodes are sorted in ascending order according to the response values to obtain a sorted node set; when it is determined that there are abnormal nodes in the sorted node set, such as duplicate nodes, reversed responses, or node intervals less than the minimum allowable interval, node processing is performed; node processing includes at least one of deleting invalid nodes, recalculating the interval slope, and limiting the node response amplitude; the processed valid nodes are obtained, and a piecewise linear mapping model is constructed based on the valid nodes.
[0103] In this embodiment of the invention, after obtaining the original response nodes and common target nodes of the channel corresponding to each gear position, it is necessary to sort and repair the node sequence to ensure that the subsequent segmented mapping has monotonic and continuous physical meaning.
[0104] In this embodiment of the invention, the original nodes and common target nodes corresponding to each imaging position are sorted in ascending order according to their response values, and the sorted result should satisfy the formula shown in Formula Nineteen: Formula 19.
[0105] In this embodiment of the invention, after sorting, it is possible to detect whether there are any anomalies in the node sequence. If anomalies occur, such as duplicate adjacent original nodes, reversed target node size order (reverse response), or the interval between adjacent nodes is less than the minimum allowable interval set by the system, targeted node correction processing is carried out. Any one or more of the following processing methods can be selected: deleting duplicate and invalid abnormal nodes; merging adjacent nodes and recalculating the slope of the corresponding interval; constraining the amplitude of the target node to limit it within the response range of the previous node, restoring the strict monotonic relationship of the overall sequence.
[0106] In some implementations, if the number of effective nodes at the imaging location is still lower than the segmented calibration threshold after repair, the segmented mapping scheme for that location is abandoned, and the process is reverted to the two-point gain correction mode.
[0107] By using the monotonic constraint processing described above, we can ensure that the subsequent segmented mapping operation will not produce grayscale inversion, and prevent the output order from being reversed after calibration, thus avoiding image distortion caused by grayscale inversion from the algorithm level.
[0108] See Figure 6 As shown, Figure 6This is a schematic diagram illustrating the principle of the core piecewise linear mapping algorithm of this invention. Figure 6 The solid line represents the multi-node piecewise mapping curve of this invention, while the dashed line represents the traditional two-point single-gain baseline. The horizontal axis represents the measured original response of the imaging unit after dark field subtraction, and the vertical axis represents the unified common target output of the channels. The slopes of each segment are marked in the figure, with a larger slope in the low-response interval and a gentler slope in the high-response interval. The nodes are densified in the low-grayscale region. A direct comparison shows that there is a significant deviation between traditional linear fitting and the actual nonlinear response of the sensor. The multi-node piecewise model of this invention can accurately fit the full dynamic range response curve while ensuring that the mapping is strictly monotonic and without grayscale inversion.
[0109] In this embodiment of the invention, the parameters of each segment interval of the piecewise linear mapping model can be obtained, and constraint verification processing can be performed on each segment interval one by one. When any segment interval parameter does not meet the preset constraint conditions, correction and rollback repair processing is performed. The correction and rollback repair processing includes: using origin and lowest node interpolation correction for ultra-low response intervals, using the highest segment interval slope extrapolation combined with amplitude limiting correction for ultra-high response intervals, using pre-configured rollback gain parameters to complete gain mapping rollback repair for imaging units with insufficient effective nodes, abnormal response, or gain failure, using the mean or weighted interpolation of effective pixels in the neighborhood to repair isolated abnormal imaging units, and using the nearest effective position fitting repair for continuous abnormal regions. After the verification, correction, and rollback repair processing of all segment intervals are completed, the abnormal color difference and bright and dark line defects in the imaging are eliminated, and the target mapping model is obtained.
[0110] In this embodiment of the invention, after the nodes are sorted and anomaly repaired, the actual number of response nodes used can be adaptively determined by combining hardware resource constraints and error indicators. The total number of nodes N does not need to be fixed. This adaptive mechanism for determining the actual number of response nodes used first constructs an initial segmented mapping using a smaller number of nodes, and, as shown in Formula 20, calculates the interpolation error within each segmented interval: Formula 20. Among them, This is a reference output obtained at the supplementary test response location. This is the interpolated output calculated using the current j-th segment. Also, the 90th percentile statistical error is obtained by calculating the statistical error for all effective imaging units and multiple sets of test response points. Formula 21: Select the segment interval with the largest statistical error. Add a new target response node within this interval and recalculate the mapping relationship. Iterate this node-adding process until the maximum statistical error of all segmented intervals meets the requirement. Or the number of nodes reaches the maximum number of nodes that the hardware resources can support. By relying on this adaptive mechanism to determine the actual number of response nodes used, fewer nodes can be allocated to near-linear response intervals, while more nodes are automatically allocated to intervals with significant nonlinear characteristics. The final number of nodes is constrained by the processor's computing power, parameter storage capacity, calibration time, and preset accuracy requirements, thus achieving a balance between accuracy and resource consumption.
[0111] After completing node sorting, anomaly repair, and determining the adaptive number of nodes, a piecewise linear mapping model can be constructed.
[0112] Taking a specific imaging unit in any mode channel as an example, the effective original node after processing is denoted as... The corresponding common target node is denoted as When the input response z after dark field subtraction falls within the j-th segment interval, that is, it satisfies... At that time, perform piecewise linear mapping calculation: The slope of the corresponding segmented interval is expressed as: Since adjacent segments all output values at the common node position. This ensures continuous mapping output; at the same time and Both remain monotonic, with the original node sequence and the target node sequence maintaining a strictly monotonically increasing trend. The slope of each segment interval is positive, which can completely preserve the grayscale order of the input image.
[0113] In this embodiment of the invention, after the initial construction of the piecewise linear mapping model is completed, the invention further performs correction and backtracking repair processing on the mapping boundary interval, low-quality response pixels and abnormal imaging units to solve problems such as mapping distortion outside the node interval, inability to calibrate invalid pixels, and amplification and diffusion of local abnormal points, and finally forms a more robust target mapping model.
[0114] For boundary mapping scenarios of sensor global input code values, this invention sets up a dedicated boundary interpolation and extrapolation strategy to ensure the continuity and rationality of mapping in low-brightness dark areas and high-brightness saturation critical areas. When the calibration input response value is lower than the lowest response node of all effective nodes, the origin and the lowest effective node form an interpolation interval, and the mapping calculation of the low response interval is completed through linear interpolation, avoiding the problems of no mapping basis and gray-scale discontinuity in low gray-scale areas. When the input response value is higher than the highest response node of all effective nodes, the fixed slope of the highest segment interval is reused for linear extrapolation to achieve extended calibration in the high-brightness range.
[0115] To prevent negative value overflow or oversaturation issues in extrapolation calculations, upper and lower limits are enforced on the extrapolation output results, as shown in Formula 22 below: Formula 22 strictly constrains all mapped outputs within the effective output code value range [0, L] of the sensor, ensuring that the boundary outputs are legal and valid.
[0116] For abnormal points that cannot be addressed by segmented mapping, such as insufficient number of effective nodes in the imaging unit, low original response of dark and white fields, and abnormal pixel gain failure, this invention initiates a model rollback repair mechanism and replaces segmented mapping with a more stable two-point gain rollback scheme.
[0117] The two-point gain backoff scheme generates the backoff gain parameters for the corresponding positions based on formula twenty-three: Formula 23. Then, based on this fallback gain parameter, refer to Formula 24 to construct the fallback mapping output: Formula 24.
[0118] By standardizing gain backoff, calibration disorder is avoided due to invalid nodes and weak response pixels, thus ensuring the basic imaging uniformity of abnormal pixels.
[0119] To address isolated pixels and continuous aberration regions caused by hardware defects and process deviations, this invention introduces a neighborhood repair mechanism to suppress the spread of local bad pixels and distortion. The neighborhood repair mechanism works as follows: For a single isolated aberration point, if the calibration data of its left and right adjacent imaging units are both valid, the average calibration output or weighted interpolation result of the valid positions on both sides is used to replace the output value of the current aberration position, achieving smooth repair of single-point defects; for multi-pixel continuous aberration regions, the mapping parameters of the nearest valid imaging position are retrieved, and batch repair is completed by combining a neighborhood fitting algorithm or pre-stored compensation parameters, avoiding the formation of vertical bright lines, dark lines, and color shift defects that run through the image from local failure areas.
[0120] By comprehensively correcting and repairing the mapping boundaries, invalid pixels, and abnormal areas, the distortion of segmented mapping boundaries, pixel non-uniformity deviation, and local imaging defects are completely eliminated, and defects such as image color difference and vertical bright and dark lines are effectively avoided. Finally, a target mapping model with high accuracy, strong stability, and adaptability to complex mass production conditions is obtained.
[0121] Step 405: Process the inherent complete input code value of the imaging sensor according to the target mapping model to obtain the full-coverage calibration output result, and generate a calibration lookup table per imaging unit and per channel based on the calibration output result.
[0122] In this embodiment of the invention, after the construction, correction and back-down repair of the piecewise linear mapping model are completed and the final target mapping model is determined, the full-range input code value of the sensor can be fully calibrated based on the precise mapping relationship, so as to realize the unified calibration from single-point gear response correction to full-domain grayscale response.
[0123] For example, for an imaging system with an input bit depth of B, this invention can perform traversal pre-calculation on each mode channel, each imaging unit, and all input code values, and solve for the corresponding calibration output results through the established target mapping model to complete the full-range code value calibration mapping. The full-domain mapping calculation relationship can be expressed based on the following formula twenty-five: Formula 25.
[0124] in, The original input code value of the sensor. The mapping relationship is calculated for the target mapping model. This is the calibration output value for the corresponding channel, the corresponding imaging unit, and the corresponding raw code value.
[0125] Based on the channel characteristics of different working modes, this invention can independently generate calibration lookup tables for the corresponding channels. That is, in color mode, three independent channel lookup tables for red, green and blue can be generated separately, while in grayscale mode, only one grayscale lookup table adapted to the mixed light imaging characteristics is generated.
[0126] In this embodiment of the invention, the inherent complete input code value of the imaging sensor is fully covered according to the target mapping model, and the non-uniform response deviation of the original code value of the whole range is corrected one by one to obtain the calibration output result with no blind zone and full coverage. Based on the full-domain calibration output result, a fine calibration lookup table is generated for each imaging unit and each channel.
[0127] This method moves the complex model fitting and node correction calculations to the calibration stage. During the actual scanning operation of the device, rapid calibration can be completed directly by looking up a table. While ensuring high-precision calibration at the pixel and channel levels, it greatly reduces the computational overhead of the embedded device in real time, balancing imaging accuracy and scanning real-time performance.
[0128] In an embodiment of the present invention, see Figure 7 As shown, Figure 7 This is a flowchart illustrating the closed-loop execution process of a calibration algorithm according to the present invention, fully covering all core execution steps of the entire calibration scheme. The entire process begins with the calibration and acquisition of dark field and reference white field data. After completing the initial acquisition of basic data, it automatically distinguishes the light source driving logic between color mode and grayscale mode, ensuring proper underlying driver adaptation for the two parallel calibration branches. Subsequently, it completes the screening of safe response intervals and the construction of target nodes, achieving precise matching of light source levels through closed-loop iteration, and then calculating the original response nodes and common target nodes. Based on this, the system performs node anomaly repair and segmented mapping modeling, coupled with boundary correction and anomaly rollback repair mechanisms, and finally generates a cell-by-cell, channel-by-channel LUT lookup table through full code value traversal.
[0129] In this embodiment of the invention, the actual calibration performance of the method under different imaging modes and different resolutions will be presented intuitively through multiple sets of experimental effect diagrams.
[0130] See Figures 8 to 10 The image shows a comparison of RGB color mode before and after calibration at different resolutions.
[0131] Figure 8 This is a schematic diagram comparing the response of each imaging unit before and after calibration at 1200 DPI in RGB color mode. Figure 8 In the middle section, a comparison of the calibration effects of the R / G / B three channels under high resolution 1200 DPI is shown, divided into two main sections: Left column (before calibration): Each set of wave curves corresponds to a set of light source response steps. The R channel has the highest overall response amplitude, while the G channel has the lowest, with dramatic fluctuations along the horizontal pixel coordinate curve; the output difference between different imaging units within the same step is extremely large, and there are dual defects of mismatched response scales between channels and non-uniformity of each column within the same channel; Right column (after calibration): All steps converge to a straight horizontal line, and the horizontal pixel fluctuations are almost eliminated; the three color channels are matched with differentiated segmented slopes according to their own photosensitive characteristics (the G channel has a large slope to compensate for low response, and the R channel has a small slope to compress high amplitude), and each is mapped to a unified standard output range; different steps retain clear grayscale intervals, and there is no loss of grayscale levels.
[0132] Obviously, under high-resolution imaging arrays, the present invention can independently compensate for each pixel, adapt to high-density imaging unit arrays, and completely eliminate fine vertical color lines and bright and dark stripes under high scanning resolution.
[0133] Figure 9 This is a schematic diagram comparing the response of each imaging unit before and after calibration in RGB color mode at 600 DPI. Figure 9 Before calibration: The channel response hierarchy of R>G>B remains unchanged, and the horizontal pixel brightness fluctuates significantly. If a uniform global gain is used, the G channel will be darker and the color will be uneven. After calibration: Each step curve is completely flattened, and the adaptive slope of each channel completes the photosensitive difference compensation, and the uniformity of the output space is greatly improved.
[0134] based on Figure 9 As shown in the RGB channel comparison diagram of medium resolution 600DPI, the pixel array length is halved, and the original curve fluctuation period and discrete details are different from those of 1200DPI. However, the calibration rules are completely consistent. That is, the calibration scheme provided by this invention does not bind to a fixed imaging array width and can adapt to the number of pixels at medium resolution of 600DPI to complete node statistics and segmented mapping.
[0135] Figure 10 This is a schematic diagram comparing the response of each imaging unit in RGB color mode at 300 DPI before and after calibration. Figure 10Before calibration: the amplitude difference of the three color channels and the undulating defects in each column still exist, and the stripe defects are more visually concentrated at low resolution; after calibration: the step curve is straight and uniform, and the gray-scale layering from dark to light is completely preserved, without color breaks or local overexposure.
[0136] Depend on Figures 8 to 10 As can be seen, there are significant differences in the original response ranges of the R, G, and B channels in color mode. The original responses of the G and B channels are lower than those of the R channel, and there are fluctuations between different lateral imaging units. After the controlled light source response step calibration of this invention, each channel is mapped to its corresponding common target node according to its own measured original node, and the lateral output curves under the same response step converge significantly. For the G and B channels with lower original responses, the algorithm maps the effective response to the target output domain with a larger local segment slope; for the R channel with higher original responses, a smaller compensation slope is used, thereby achieving a uniform channel response range without changing the physical photosensitive characteristics of the channel.
[0137] In this embodiment of the invention, a specific calibration test was also conducted for the MONO grayscale mode. See also Figures 11 to 13 The image shows a comparison of the MONO grayscale mode before and after calibration at different resolutions. Figure 11 This is a schematic diagram comparing the equivalent response of three lights in the same proportional linkage in MONO grayscale mode at 1200DPI before and after calibration. Figure 12 This is a schematic diagram comparing the equivalent response of three lights in the same proportional linkage in MONO grayscale mode at 600DPI before and after calibration. Figure 13 This is a schematic diagram comparing the equivalent response of three lights in the same proportional linkage in MONO grayscale mode at 300DPI before and after calibration.
[0138] Depend on Figures 11 to 13 As can be seen, the MONO mode forms an equivalent grayscale response ladder through the proportional linkage of the three emission channels, and completes spatial non-uniformity compensation under a unified node model. The calibrated curve maintains small lateral fluctuations within each response ladder, while preserving the monotonic grayscale levels between different ladders.
[0139] Before calibration: Each set of curves on the left side of the figure corresponds to a controlled light source response step. Adjacent steps maintain grayscale order, but the same step exhibits significant fluctuations along the pixel coordinate direction, indicating that the optical coupling, photosensitivity, or analog gain of different imaging units are not entirely consistent. The overall heights of the curves for the three colors are also different: the R channel has the highest original response, the B channel is in the middle, and the G channel has the lowest.
[0140] This phenomenon involves two overlapping problems: different response scales between channels. If the same gain is applied directly to the original RGB values, the G channel will still be too dark, and the B channel compensation will be insufficient or excessive. There is also horizontal inconsistency within the same channel. Using only a single global channel gain cannot eliminate the brightness fluctuations between different pixel locations within the same color channel.
[0141] Therefore, the pre-calibration curve is not simply "overall low", but has both channel scale differences and column-by-column non-uniformity.
[0142] After calibration: Each set of horizontal curves on the right side of the figure corresponds to a common target node of the same set of response steps. It can be observed that: the curves within the same step are significantly flattened along the pixel coordinate direction, indicating that the lateral response differences of each imaging unit are compressed; the interval between different steps still maintains a low-to-high gradient, indicating that the algorithm does not compress all gray levels into the same value; R, G, and B are mapped to their respective target output domains, with the G channel using a larger local slope, the B channel using a medium slope, and the R channel using a smaller slope; the stability of the target curve comes from the pairing of the common target node and the original nodes column by column, rather than forcing the same fixed gain to be used for all columns.
[0143] In other words, the curve before calibration describes "what the sensor actually measured," while the curve after calibration describes "what each imaging unit should output while maintaining monotonic grayscale relationships." The algorithm completes the mapping from individual response coordinates to common output coordinates. The 300 DPI, 600 DPI, and 1200 DPI images have different horizontal pixel counts, and the spatial details and fluctuation periods of the curves also differ, but all three resolutions exhibit the same processing relationship: before calibration, there are column-by-column fluctuations, and after calibration, the same response step tends to be horizontal. This indicates that the parameter generation process can be adjusted according to the number of effective imaging units, rather than depending on a fixed image width.
[0144] Therefore, the calibration parameters of this invention are generated using the imaging unit position as an index, which can adapt to array widths corresponding to different resolutions; increasing or decreasing the number of imaging units does not change the basic process of node construction, target statistics, and segmented mapping. Figure 14 The image shown is the image after calibration using this method, and Figure 2 The comparison shows that the black line on the left side has almost disappeared, and the effect on both sides is uniform, resulting in good overall image quality. Figure 15 This is an image captured in grayscale mode with relatively poor image quality. Analysis reveals numerous fine lines indicating uneven brightness, resulting in an overall poor image quality. Figure 16 The image after this method is uniform overall and shows no abnormalities. Figure 15 The striped phenomenon.
[0145] Based on the same inventive concept, embodiments of the present invention provide an imaging unit calibration device that can perform the functions corresponding to the aforementioned imaging unit calibration method. This imaging unit calibration device can be a hardware structure, a software module, or a hardware structure plus a software module. The imaging unit calibration device can be implemented by a chip system, which can consist of chips or include chips and other discrete components. Please refer to [link to previous text]. Figure 17 As shown, the imaging unit calibration device 1700 includes: Determining unit 1701 is used to determine the effective response of each imaging unit based on the dark field data and reference white field data of the imaging unit; The acquisition unit 1702 is used to filter the safe response range based on the light source driving rules corresponding to the color and grayscale dual working modes, combined with the effective response of each imaging unit, and construct multiple sets of target response nodes within the safe response range; for each set of target response nodes, closed-loop iterative matching is performed according to the light source driving rules of the corresponding working mode to obtain the target light source parameters corresponding to each set of target response nodes. The acquisition unit 1703 is used to acquire the original response node and the common target node of each imaging unit based on the target light source parameters corresponding to each group of target response nodes, and to constrain the original response node and the common target node of the channel to satisfy a strict monotonic relationship. Construction unit 1704 is used to construct a piecewise linear mapping model based on the original response node and common target node with constraints, and to perform correction and back-down repair processing on the piecewise linear mapping model to determine the target mapping model; The generation unit 1705 is used to process the inherent complete input code value of the imaging sensor according to the target mapping model to obtain a full-coverage calibration output result, and generate a calibration lookup table per imaging unit and per channel based on the calibration output result.
[0146] In one possible implementation, the obtaining unit 1702 is used for: In color working mode, a response ladder is independently constructed for each color channel. Based on the channel reference driving value and relative driving percentage, the channel candidate driving amount is calculated, and the current acquisition channel is set as the candidate driving amount. The other light-emitting channels except the current acquisition channel maintain the reference driving value calibrated by the light source at the factory. In grayscale mode, the overall lighting intensity is adjusted synchronously with a fixed driving ratio for multiple light-emitting channels, and the candidate driving amount of multiple light-emitting channels is calculated synchronously based on the reference driving value and relative driving percentage of each channel. Based on the obtained candidate driving quantities, the light source driving configuration is performed, and the configured light source driving parameters are determined, so as to perform image acquisition based on the light source driving parameters.
[0147] In one possible implementation, the obtaining unit 1702 is used for: Based on the effective responses of each imaging unit, effective imaging units are selected. Traverse all candidate driving values within the allowed driving range of the light source. For each candidate driving value, identify saturated imaging units in the original frame obtained by image acquisition based on the light source driving parameters, and statistically obtain the average response, maximum response, and number of saturated imaging units of the effective imaging units under the current candidate driving value. Based on the average response, maximum response, and number of saturated imaging units of the effective imaging units, candidate driving values that meet preset safety conditions are screened, and the largest safe driving value is selected from the candidate driving values that meet the preset safety conditions. The upper limit of the safe response range is determined by the average response corresponding to the largest safe driving value. When the minimum target response exceeds a preset ratio of the upper limit of the safety response range, a ratio limiting process is performed on the minimum target response to obtain the limited minimum target response, and multiple sets of target response nodes are generated between the limited minimum target response and the upper limit of the safety response range.
[0148] In one possible implementation, the obtaining unit 1702 is used for: For each target response node under each mode channel, initialize the upper and lower bounds of the search relative to the light source drive, and limit the iterative search interval by the search upper and lower bounds; Select candidate driving percentages, configure the light source based on the light source driving parameters and perform image acquisition to obtain the original white field frame, extract the output values of each imaging unit from the original white field frame, and remove overly dark, saturated and invalid imaging units, and statistically obtain the full-frame average effective response under the candidate driving percentages; By comparing the full-amplitude average effective response with the target response node, the iterative search interval is adjusted. Within the iterative search interval, the candidate driving percentage with the smallest error and satisfying the saturation safety condition is selected to obtain the target light source parameters corresponding to the target response node. Each set of target light source parameters corresponds to a gear.
[0149] In one possible implementation, the acquisition unit 1703 is used for: For each gear level, for each imaging unit in the gear level, the output value corresponding to the imaging unit in the white field original frame of the gear level is subtracted from the dark field average data and the value is taken as not less than zero to obtain the original response node of the imaging unit in the gear level. For each gear position under each mode channel, a set of effective imaging units is constructed, excluding invalid imaging units. When the proportion of the number of imaging units in the set of effective imaging units is not less than a preset ratio, the channel common target node corresponding to the gear position under the mode channel is obtained based on the original response node of each imaging unit in the set of effective imaging units.
[0150] In one possible implementation, the building unit 1704 is used for: Based on the original response nodes of each imaging unit and the common target nodes of the channels, the nodes are sorted in ascending order according to the response values to obtain the sorted node set. When it is determined that the sorted node set contains abnormal nodes, such as duplicate nodes, reversed responses, or node intervals smaller than the minimum allowed interval, node processing is performed; the node processing includes at least one of deleting invalid nodes, recalculating the interval slope, and limiting the node response amplitude. Obtain the processed valid nodes, and construct a piecewise linear mapping model based on the valid nodes.
[0151] In one possible implementation, the building unit 1704 is used for: Obtain the parameters of each segment interval of the piecewise linear mapping model, and perform constraint verification processing on each segment interval one by one; When any of the segmented interval parameters does not meet the preset constraints, correction and rollback repair processing is performed; wherein, the correction and rollback repair processing includes at least one of the following: using origin and lowest node interpolation correction for ultra-low response intervals, using the highest segmented interval slope extrapolation combined with amplitude limiting correction for ultra-high response intervals, using pre-configured rollback gain parameters to complete gain mapping rollback repair for imaging units with insufficient effective nodes, abnormal response or gain failure, using the mean or weighted interpolation of effective pixels in the neighborhood to repair isolated abnormal imaging units, and using the nearest effective position fitting repair for continuous abnormal regions; After completing the verification, correction, and rollback repair of all the segmented intervals, the abnormal color difference and bright / dark line defects in the imaging are eliminated, and the target mapping model is obtained.
[0152] In one possible implementation, the apparatus further includes a processing unit for: The calibration lookup table is burned into the imaging system's hardware storage unit so that when the imaging system is working in real time, it can complete the real-time calibration output of the original code value by indexing the entries in the calibration lookup table.
[0153] All relevant content of each step involved in the aforementioned embodiments of the imaging unit calibration method can be referenced to the functional description of the corresponding functional module of the imaging unit calibration device in the embodiments of the present invention, and will not be repeated here.
[0154] 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.
[0155] Based on the same inventive concept, embodiments of the present invention provide an electronic device, please refer to... Figure 18 As shown, the electronic device includes at least one processor 1801 and a memory 1802 connected to the at least one processor. In this embodiment of the invention, the specific connection medium between the processor 1801 and the memory 1802 is not limited. Figure 18 Taking the connection between processor 1801 and memory 1802 via bus 1800 as an example, bus 1800... Figure 18 The connections between other components are shown in thick lines only and are not intended to be limiting. The 1800 bus can be divided into address bus, data bus, control bus, etc., for ease of representation. Figure 18 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 1803 for receiving or transmitting data.
[0156] In this embodiment of the invention, the memory 1802 stores instructions that can be executed by at least one processor 1801. By executing the instructions stored in the memory 1802, at least one processor 1801 can perform the steps included in the aforementioned imaging unit calibration method.
[0157] The processor 1801 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 1802 and calling data stored in the memory 1802, it can realize various functions of the electronic device and process data, thereby monitoring the electronic device as a whole.
[0158] Optionally, processor 1801 may include one or more processing units. Processor 1801 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 1801. In some embodiments, processor 1801 and memory 1802 may be implemented on the same chip; in some embodiments, they may be implemented separately on independent chips.
[0159] Processor 1801 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.
[0160] Memory 1802, 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 1802 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 1802 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures, and accessible by a computer, but is not limited thereto. In embodiments of the present invention, memory 1802 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0161] By designing and programming the processor 1801, the code corresponding to the imaging unit calibration method described in the foregoing embodiments can be embedded into the chip, so that the chip can execute the steps of the aforementioned imaging unit calibration method when running. How to design and program the processor 1801 is a well-known technique to those skilled in the art, and will not be described in detail here.
[0162] 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 imaging unit calibration method described above.
[0163] In some possible implementations, various aspects of the imaging unit 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 imaging unit calibration method according to various exemplary embodiments of the present invention described above.
[0164] 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-readable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0165] 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.
[0166] 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.
[0167] 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.
[0168] 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. An imaging unit calibration method, characterized in that, The method includes: The effective response of each imaging unit is determined based on the dark field data of the imaging unit and the reference white field data. Based on the light source driving rules corresponding to the color and grayscale dual working modes, and combined with the effective response of each imaging unit, a safe response range is selected, and multiple sets of target response nodes are constructed within the safe response range. For each set of target response nodes, closed-loop iterative matching is performed according to the light source driving rules of the corresponding working mode to obtain the target light source parameters corresponding to each set of target response nodes. Based on the target light source parameters corresponding to each group of target response nodes, the original response nodes and channel common target nodes of each imaging unit are obtained, and the original response nodes and channel common target nodes are constrained to satisfy a strict monotonic relationship. Using the original response nodes and common target nodes that have been constrained, a piecewise linear mapping model is constructed, and the piecewise linear mapping model is corrected and rolled back to determine the target mapping model. The complete input code value inherent in the imaging sensor is processed according to the target mapping model to obtain a full-coverage calibration output result, and a calibration lookup table per imaging unit and per channel is generated based on the calibration output result.
2. The method according to claim 1, characterized in that, The light source driving rules corresponding to the color and grayscale dual working modes include: In color working mode, a response ladder is independently constructed for each color channel. Based on the channel reference driving value and relative driving percentage, the channel candidate driving amount is calculated, and the current acquisition channel is set as the candidate driving amount. The other light-emitting channels except the current acquisition channel maintain the reference driving value calibrated by the light source at the factory. In grayscale mode, the overall lighting intensity is adjusted synchronously with a fixed drive ratio for multiple light-emitting channels, and the candidate drive quantity of multiple light-emitting channels is calculated synchronously based on the reference drive value and relative drive percentage of each channel. Based on the obtained candidate driving quantities, the light source driving configuration is performed, and the configured light source driving parameters are determined, so as to perform image acquisition based on the light source driving parameters.
3. The method according to claim 2, characterized in that, Based on the effective responses of each imaging unit, a safe response range is selected, and multiple sets of target response nodes are constructed within the safe response range, including: Based on the effective responses of each imaging unit, effective imaging units are selected. Traverse all candidate driving values within the allowed driving range of the light source. For each candidate driving value, identify saturated imaging units in the original frame obtained by image acquisition based on the light source driving parameters, and statistically obtain the average response, maximum response, and number of saturated imaging units of the effective imaging units under the current candidate driving value. Based on the average response, maximum response, and number of saturated imaging units of the effective imaging units, candidate driving values that meet preset safety conditions are screened, and the largest safe driving value is selected from the candidate driving values that meet the preset safety conditions. The upper limit of the safe response range is determined by the average response corresponding to the largest safe driving value. When the minimum target response exceeds a preset ratio of the upper limit of the safety response range, a ratio limiting process is performed on the minimum target response to obtain the limited minimum target response, and multiple sets of target response nodes are generated between the limited minimum target response and the upper limit of the safety response range.
4. The method according to claim 3, characterized in that, For each group of target response nodes, closed-loop iterative matching is performed according to the light source driving rules of the corresponding working mode to obtain the target light source parameters corresponding to each group of target response nodes, including: For each target response node under each mode channel, initialize the upper and lower bounds of the search relative to the light source drive, and limit the iterative search interval by the search upper and lower bounds; Select candidate driving percentages, configure the light source based on the light source driving parameters and perform image acquisition to obtain the original white field frame, extract the output values of each imaging unit from the original white field frame, and remove overly dark, saturated and invalid imaging units, and statistically obtain the full-frame average effective response under the candidate driving percentages; By comparing the full-amplitude average effective response with the target response node, the iterative search interval is adjusted. Within the iterative search interval, the candidate driving percentage with the smallest error and satisfying the saturation safety condition is selected to obtain the target light source parameters corresponding to the target response node. Each set of target light source parameters corresponds to a gear level.
5. The method according to claim 4, characterized in that, Based on the target light source parameters corresponding to each group of target response nodes, the original response nodes and channel common target nodes of each imaging unit are obtained, including: For each gear, for each imaging unit in the gear, the output value corresponding to the imaging unit in the white field original frame of the gear is subtracted from the dark field average data and the value is taken as not less than zero to obtain the original response node of the imaging unit in the gear. For each gear position under each mode channel, a set of effective imaging units is constructed, excluding invalid imaging units. When the proportion of the number of imaging units in the set of effective imaging units is not less than a preset ratio, the channel common target node corresponding to the gear position under the mode channel is obtained based on the original response node of each imaging unit in the set of effective imaging units.
6. The method according to claim 5, characterized in that, Using the constrained original response nodes and common target nodes, a piecewise linear mapping model is constructed, including: Based on the original response nodes of each imaging unit and the common target nodes of the channels, the nodes are sorted in ascending order according to the response values to obtain the sorted node set. When it is determined that the sorted node set contains abnormal nodes, such as duplicate nodes, reversed responses, or node intervals smaller than the minimum allowed interval, node processing is performed; the node processing includes at least one of deleting invalid nodes, recalculating the interval slope, and limiting the node response amplitude. Obtain the processed valid nodes, and construct a piecewise linear mapping model based on the valid nodes.
7. The method according to any one of claims 1-6, characterized in that, The step of correcting and backing down the piecewise linear mapping model to determine the target mapping model includes: Obtain the parameters of each segment interval of the piecewise linear mapping model, and perform constraint verification processing on each segment interval one by one; When any of the segmented interval parameters does not meet the preset constraints, correction and rollback repair processing is performed; wherein, the correction and rollback repair processing includes at least one of the following: using origin and lowest node interpolation correction for ultra-low response intervals, using the highest segmented interval slope extrapolation combined with amplitude limiting correction for ultra-high response intervals, using pre-configured rollback gain parameters to complete gain mapping rollback repair for imaging units with insufficient effective nodes, abnormal response or gain failure, using the mean or weighted interpolation of effective pixels in the neighborhood to repair isolated abnormal imaging units, and using the nearest effective position fitting repair for continuous abnormal regions; After completing the verification, correction, and rollback repair of all the segmented intervals, the abnormal color difference and bright / dark line defects in the imaging are eliminated, and the target mapping model is obtained.
8. An imaging unit calibration device, characterized in that, The device includes: The determination unit is used to determine the effective response of each imaging unit based on the dark field data and the reference white field data of the imaging unit. The acquisition unit is used to filter the safe response range based on the light source driving rules corresponding to the color and grayscale dual working modes, combined with the effective response of each imaging unit, and construct multiple sets of target response nodes within the safe response range; for each set of target response nodes, closed-loop iterative matching is performed according to the light source driving rules of the corresponding working mode to obtain the target light source parameters corresponding to each set of target response nodes. The acquisition unit is used to acquire the original response node and the common target node of each imaging unit based on the target light source parameters corresponding to each group of target response nodes, and to constrain the original response node and the common target node of the channel to satisfy a strict monotonic relationship. A construction unit is used to construct a piecewise linear mapping model based on the original response nodes and common target nodes that have been constrained, and to perform correction and rollback repair processing on the piecewise linear mapping model to determine the target mapping model; The generation unit is used to process the inherent complete input code value of the imaging sensor according to the target mapping model to obtain a full-coverage calibration output result, and generate a calibration lookup table per imaging unit and per channel based on the calibration output result.
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.