Correction method and device of scanning device and electronic equipment
By performing comprehensive corrections when the scanning device is first started and writing correction parameters to the file system, the problem of low efficiency and low accuracy at each startup of the scanning device is solved, and efficient and accurate scanning correction is achieved.
Patent Information
- Application Number
- CN202510860346.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-08-19
AI Technical Summary
The existing scanning devices require corrections every time they are started, and the correction efficiency is low and the accuracy is not high, so they cannot accurately correct the specific usage environment and equipment status.
The scanning device is fully corrected when the first startup is started, recording the exposure time correction of the image sensor and the offset correction and gain correction parameters of the simulated front-end, generating configuration information and writing to the file system, and using these configuration information directly for correction at the next startup.
It significantly reduces correction time, improves correction efficiency and accuracy, and ensures consistency in scanning quality.
Smart Images

Figure CN120512499A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a calibration method and device for a scanning device, and electronic equipment. Background Art
[0002] During the printing and scanning process, scan calibration is crucial to ensuring print quality or scan quality. Traditional scanning devices or printing devices need to be calibrated each time they are started. Taking the printer as an example, each time it is started, the operator needs to manually calibrate it based on the print preview effect. The calibration efficiency is low and the calibration results are affected by human factors, resulting in large fluctuations in accuracy. Alternatively, a set of calibration values is preset at the factory and the calibration values are fixed in the device. Each time it is started, calibration is performed based on the fixed calibration values. This calibration method cannot accurately calibrate the specific usage environment and device status, resulting in poor calibration results. Summary of the Invention
[0003] The embodiments of the present invention provide a calibration method, device, and electronic device for a scanning device, which can solve the problem that the existing scanning device needs to be calibrated each time it is started, resulting in low calibration efficiency and low accuracy.
[0004] In one aspect, an embodiment of the present invention discloses a calibration method for a scanning device, wherein the scanning device includes an image sensor and an analog front end. The method includes:
[0005] Querying the configuration information of the scanning device from the file system;
[0006] If the configuration information is not found, recording the first characteristic parameter corresponding to the exposure time correction of the image sensor and the second characteristic parameter corresponding to the offset correction and the gain correction of the analog front end, respectively, to obtain the second configuration information;
[0007] The second configuration information is written into the file system so as to be called after the scanning device is restarted.
[0008] On the other hand, an embodiment of the present invention discloses a calibration device for a scanning device, the calibration device comprising a processor, an image sensor, and an analog front end; the processor is configured to:
[0009] Querying the configuration information of the scanning device from the file system;
[0010] If the configuration information is not found, recording the first characteristic parameter corresponding to the exposure time correction of the image sensor and the second characteristic parameter corresponding to the offset correction and the gain correction of the analog front end, respectively, to obtain the second configuration information;
[0011] The second configuration information is written into the file system so as to be called after the scanning device is restarted.
[0012] On the other hand, an embodiment of the present invention further discloses an electronic device, which includes a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to execute the aforementioned correction method of the scanning device by one or more processors.
[0013] An embodiment of the present invention further discloses a readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the aforementioned calibration method for a scanning device.
[0014] The embodiments of the present invention include the following advantages:
[0015] An embodiment of the present invention provides a calibration method for a scanning device. The method performs a comprehensive calibration when the scanning device is first started, and writes the corrected configuration information into a file system. The configuration information stored in the file system can be directly used the next time the scanning device is started, without the need for a full calibration again. This significantly reduces calibration time and improves calibration efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0017] Figure 1 is a flowchart of a calibration method for a scanning device according to an embodiment of the present invention;
[0018] Figure 2 It is a structural block diagram of an embodiment of a correction device for a scanning device of the present invention;
[0019] Figure 3 This is a structural block diagram of an electronic device provided by an example of the present invention. DETAILED DESCRIPTION
[0020] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort shall fall within the scope of protection of the present invention.
[0021] Method Example
[0022] Reference Figure 1 , shows a flowchart of an embodiment of a calibration method for a scanning device of the present invention, the method may specifically include the following steps:
[0023] Step 101: Query the configuration information of the scanning device from the file system;
[0024] Step 102: If the configuration information is not found, first characteristic parameters corresponding to exposure time calibration of the image sensor and second characteristic parameters corresponding to offset calibration and gain calibration of the analog front end are recorded to obtain second configuration information.
[0025] Step 103: Write the second configuration information into the file system so that the scanning device can call it after restarting.
[0026] The scanning device calibration method provided in an embodiment of the present invention can perform scanning calibration on the scanning device. The scanning device is a device or electronic device with a scanning function. Exemplarily, the scanning device may include at least one of the following: a scanner, a printer, a multi-function printer (MFP) with integrated printing, copying, and scanning functions, a mobile device (such as a smartphone, a tablet computer, etc., which uses a camera in conjunction with an application to implement document scanning, text recognition, and other functions), a smart wearable device (such as smart glasses, AR devices, etc.), a 3D scanner, etc.
[0027] The scanning device in the embodiment of the present invention is equipped with an image sensor and an analog front end (AFE). Among them, the image sensor may include a contact image sensor (CIS), a complementary metal-oxide-semiconductor (CMOS), a charge-coupled device (CCD), and other sensors that form images by converting optical signals into electrical signals. Taking a contact image sensor as an example, a contact image sensor is a sensor used for image scanning and acquisition, mainly composed of a light source, an optical system, an image sensor, and a signal processing circuit. The CIS is used to scan and capture image information. The light source illuminates the scanned object, transmits the reflected light to the image sensor through the optical system, realizes image acquisition, and converts the optical signal into an electrical signal, which is then processed by the signal processing circuit to generate digital image data. The AFE (Analog Front End) is an electronic circuit that processes analog signals, typically including an amplifier, a filter, a gain control, an offset control, and an analog-to-digital converter (ADC). The analog front end is used to process the analog signals from the image sensor, ensure signal quality and stability, and convert the analog signals into digital signals through signal amplification, signal filtering, gain and offset adjustment, and analog-to-digital conversion for subsequent digital processing.
[0028] Embodiments of the present invention utilize a contact image sensor and an analog front end to calibrate a scanning device, including correcting the contact sensor's exposure duration and the analog front end's offset and gain. By performing a comprehensive calibration upon initial startup of the scanning device and writing the corrected configuration information to the file system, the device can directly use the configuration information stored in the file system upon subsequent startup, eliminating the need for a full calibration. This significantly reduces calibration time and improves efficiency.
[0029] Specifically, after the scanning device is started, the configuration information of the scanning device is first queried from the file system. If the configuration information exists in the file system, the various correction parameters in the configuration information can be dynamically adjusted according to the actual environment and device status of the scanning device (such as changes in light brightness, changes in sensor sensitivity). For example, the correction white bar is scanned, and the configuration information is adjusted according to the obtained scanned pixel value to obtain the first configuration information. Among them, the correction white bar is a white board used to calibrate the corresponding position of the scanning bar in the scanning device hardware, and the scanned pixel values are all obtained under the correction white bar. Exemplarily, the scanning bar in the CIS can be controlled by a stepper motor to move to the position of the correction white bar, and the correction white bar is scanned at this position.
[0030] It should be noted that changes in the brightness of the scanning device's light source directly affect the intensity of the reflected light from the surface of the calibration white strip. When the ambient light or light source brightness increases, the amount of light reflected by the calibration white strip, supported by the whiteboard, increases. When reflected to the image sensor, the image sensor receives more photons, which can be converted into a higher electrical signal (pixel value), resulting in an increase in the scanned pixel value. Conversely, when the brightness decreases, the pixel value decreases. For example, assuming the light source brightness is constant, the reference pixel value of the calibration white strip is 255, which is pure white in 8-bit grayscale. If the light brightness decreases by 20%, the amount of light reflected from the calibration white strip decreases, and the pixel value captured by the image sensor may drop to 200. By comparing the difference between the actual value and the reference value, the magnitude of the change in light brightness can be determined.
[0031] Furthermore, the light source driving parameters or sensor gain can be dynamically adjusted according to the change amplitude, so that the scanned pixel values of the corrected white bars return to the reference range, thereby compensating for the influence of the light brightness change on the scanning effect.
[0032] In addition, the sensitivity of image sensors (such as CMOS / CCD) will change with usage time, temperature or aging. When the sensitivity decreases, the electrical signal generated under the same light intensity is weakened, resulting in a low pixel value; when the sensitivity increases, the pixel value is high. Suppose that a newly manufactured image sensor obtains a pixel value of 255 when scanning the calibration white bar under standard light intensity. After one year of use, the sensitivity decreases by 10% due to device aging. The pixel value obtained by scanning the calibration white bar under the same light intensity may become 230. The degree of attenuation of the sensor sensitivity can be determined by detecting the long-term offset of the pixel value. Furthermore, the processor of the scanning device can compensate for the sensitivity change by adjusting the gain or offset of the image sensor. For example, when it is estimated that the sensitivity of the image sensor decreases by 10%, the processor will increase the gain by 10% to restore the scanned pixel value of the calibration white bar to the reference value, thereby ensuring the accuracy of subsequent scans.
[0033] It's understandable that changes in light brightness and sensor sensitivity can coexist, such as sudden changes in ambient light and sensor aging. Changes in the scanned pixel values during the white bar correction are the result of both. Large fluctuations in pixel values over a short period of time are primarily attributed to changes in light brightness, such as interference from external light sources. Slow, long-term drift in pixel values is likely due to decreased sensitivity caused by image sensor aging, such as degradation of semiconductor material performance.
[0034] After each scan of the calibration white bar, the current calibration parameters, such as the light source brightness coefficient and sensor gain value, can be updated, forming an execution process of "scan white bar → analyze pixel value → update parameters → apply new parameters". For example:
[0035] Initial configuration: light source brightness 50%, image sensor gain 1.0, reference pixel value 255 for white bar calibration.
[0036] When the ambient light dims, the scanned pixel value obtained by scanning the calibration white bar is 200. The processor adjusts the light source brightness to 60% and the gain to 1.2, restoring the scanned pixel value to 255, and generating the first configuration information. Subsequent scans are based on this first configuration information to ensure consistent scan quality even when the scanning device's environment changes.
[0037] The configuration information of the scanning device includes parameters such as the exposure time of the image sensor, the gain value and offset value of the AFE. Each scanning device usually sets the value ranges of various parameters in the system file when it leaves the factory. When adjusting the configuration information, at least one of the exposure time of the CIS, the gain value and the offset value of the AFE can be adjusted according to the value ranges of various parameters until the preset requirements are met. The preset requirements include a reference value or reference range for the exposure time of the image sensor in the scanning device, a reference value or reference range for the gain value of the AFE, and a reference value or reference range for the offset value of the AFE. These reference values can usually be determined when the scanning device leaves the factory and can be stored in the system file or storage module of the scanning device. When adjusting at least one item of the configuration information of the scanning device, the corresponding reference value can be read from the system file or storage module, and the configuration information can be adjusted based on the reference value.
[0038] If the scanning device configuration information is not present in the file system, it is determined that this is the first boot and a comprehensive calibration of the scanning device is required. Specifically, the contact image sensor exposure duration is calibrated, and the analog front end offset and gain are calibrated to obtain second configuration information. This second configuration information is then written to the file system, allowing for scanning calibration based on the configuration information in the file system during the next boot.
[0039] For example, when calibrating the exposure time of the CIS, the AFE can be initially set up first. For example, the gain value of the AFE is set to 1 and the offset value is set to 0 to prevent the AFE from affecting the actual value output by the CIS. That is, the AFE is currently only an AD (analog-to-digital) module and does not modify the analog value. Then, the red, green, and blue lights are turned on separately for separate exposure. When the scanned pixel value is at a fixed value (for example, 130) and the error is minimized, the exposure time of each of the red, green, and blue lights is recorded.
[0040] It should be noted that AFE initialization can be achieved through hardware-level signal chain control. Specifically, register configuration sets the initial gain value to 1 and the initial offset value to 0, allowing the AFE to perform only AD conversion and not participate in signal amplification or offset adjustment. For example, I2C instructions can be used to write control words 0x01 (gain register) and 0x00 (offset register) to the AFE chip. For the CIS, hardware-based GPIO pins can independently control the red / green / blue LED lights on and off, for example, a high level turns on the red light and a low level turns off the other lights. The exposure duration can be controlled by the CIS internal timer or an external clock signal, and the exposure time parameters are set through registers. For example, writing 0x64 to the CIS control register indicates a 100ms exposure. The CIS is configured uniformly through GPIO pins and register settings.
[0041] After each exposure, the software can read the pixel values output by the CIS via an SPI or parallel interface, sampling N times continuously (e.g., N = 10) to reduce the impact of random noise. Furthermore, the CIS can be evaluated for error. For example, the average value Avg and standard deviation σ of the pixel values obtained from N samples are calculated. The goal is to minimize |Avg - 130| and σ, thereby making the first configuration information more accurate. For example, if the sampled values are [128, 132, 130, 129, 131], then Avg = 130 and σ ≈ 1.41, meeting the error requirements.
[0042] If Avg < 130, it means that the sampled pixel value is too low and the exposure is insufficient. You can increase the exposure time to compensate: T_new = T_old + ΔT, such as ΔT = 5ms.
[0043] If Avg>130, it means that the sampled pixel value is too high and overexposed. You can reduce the exposure time to make adjustments: T_new=T_old-ΔT.
[0044] The adjustment step size ΔT may be decreased with the number of iterations, such as ΔT = 5 ms for the first time and ΔT = 1 ms for subsequent times, to improve accuracy.
[0045] When M consecutive iterations (e.g., M = 3) satisfy: |Avg-130| ≤ ε, ε is the error threshold, such as ε = 2; standard deviation σ ≤ σ_threshold, such as standard deviation threshold σ_threshold = 1, the sampled pixel value is considered stable, and the exposure time corresponding to the current sampling is recorded.
[0046] It is understood that the fixed value does not require a single scan to be exactly equal to a value, such as 130. Instead, it is determined by the statistical characteristics of multiple sampling (such as mean + standard deviation). For example, the pixel value obtained in a single scan is allowed to be between 125 and 135, but the average pixel value obtained from 10 consecutive samples must be close to 130, and the fluctuation range must gradually decrease, so as to obtain the fixed value of the scanned pixel value corresponding to the minimum error.
[0047] In addition, the spectral response and brightness of red, green, and blue LEDs are different, so the exposure time to achieve the same pixel value (130) may be different. For example, a red light may require 70ms, a green light may only require 50ms due to its fast spectral response, and a blue light may require 80ms due to its weaker light intensity. After calibration, the optimal exposure time of the three colors of light must be recorded separately to form a calibration parameter table, such as [R: 70ms, G: 50ms, B: 80ms], which is used for exposure control during subsequent color scanning.
[0048] Through the above-mentioned hardware control, software sampling and iteration mechanism, correction of exposure duration can achieve precise locking of pixel values, thereby ensuring color consistency and brightness stability of the scanned image.
[0049] When performing offset calibration on the AFE, perform initial settings. For example, keep the AFE gain at 1 and turn off all lights in the CIS. Then, adjust the offset until the scanned pixel value is at a fixed value (e.g., 20) with minimal error. Record the current offset value.
[0050] As an example, the hardware implementation steps of adjusting the offset value may include:
[0051] 1. Initial state setting: Set the AFE gain value to 1 through the hardware register, that is, the amplifier does not amplify the signal, and the gain coefficient G = 1. Cut off the power supply of all CIS light sources, such as controlling the GPIO pin to output a low level and turn off the drive circuit.
[0052] 2. Offset voltage adjustment: The internal offset circuit of the AFE receives a digital control signal, such as an 8-bit binary value, and converts it into an analog bias voltage, such as 0-2.5V, which is superimposed on the sensor output signal.
[0053] In hardware, the mapping relationship between offset value and bias voltage is usually linear. For example, the offset register value range of 0-255 corresponds to the bias voltage of 0-2.5V, and the step size of 2.5V / 256 ≈ 9.76mV.
[0054] 3. Pixel value acquisition: The ADC samples the analog signal output by the AFE and converts it into a digital pixel value. For example, a 10-bit ADC corresponds to 0-1023.
[0055] In addition, hardware filtering circuits, such as RC low-pass filters, can be used to reduce noise interference and ensure the stability of the analog signal value corresponding to the sampling.
[0056] The control logic at the software level can specifically include:
[0057] 1. Communication protocol implementation: Use the I2C / SPI driver library to send instructions, for example:
[0058] I2C_Write(AFE_ADDR,OFFSET_REG,offset_value), used to set the offset register value;
[0059] I2C_Read(AFE_ADDR,ADC_DATA_REG) is used to read the ADC sampling value.
[0060] 2. Closed-loop regulation algorithm:
[0061] Initialization: Set the initial gain value G=1, the initial offset value offset=0, and turn off the three primary color lights of the image sensor.
[0062] Iterative adjustments:
[0063] The offset value Δoffset is taken according to the step size, such as 5, and the increment / decrement offset value is sent to the AFE register.
[0064] After each adjustment, wait for the ADC sampling to stabilize, such as sampling 10 times and taking the average value, and calculate the current pixel value average V_avg.
[0065] Calculate the error E = |V_avg - fixed value 20| and record the offset value corresponding to the minimum error.
[0066] When the error E is less than a threshold (such as 0.5) or the number of iterations reaches an upper limit (such as 100), the iteration is stopped and the current offset value is recorded.
[0067] When performing AFE gain calibration, first adjust the AFE offset setting based on the offset value obtained from offset calibration, and set the CIS based on the average exposure time of the three primary RGB lights. Under these conditions, adjust the AFE's initial gain value to ensure that the scanned pixel value reaches the expected value (for example, 200) and the error is within the allowable range. Record the current gain value.
[0068] As an example, the hardware implementation steps of AFE gain correction may include:
[0069] 1. Initialize the hardware connection: Write the offset value after offset correction to the AFE through the I2C / SPI interface. For example, the offset value recorded previously is 20.
[0070] Based on the average exposure time of the RGB lights, such as 50ms for red light, 60ms for green light, and 55ms for blue light, with an average of 55ms, the exposure time is set through the CIS driver circuit.
[0071] 2. Gain Adjustment: Set the initial value of the AFE gain register to 1, for example, register address 0x02. The default value of 0001b corresponds to a gain of 1. When the CIS starts scanning, the hardware automatically amplifies the analog signal and feeds it into the A / D converter, outputting a digital pixel value. A hardware feedback loop (e.g., a comparator) monitors the deviation between the output pixel value and the expected value (e.g., 200) in real time. If the deviation exceeds a threshold (e.g., ±5), a gain register adjustment is triggered.
[0072] The control logic at the software level can specifically include:
[0073] The driver layer encapsulates the I2C / SPI communication interface and provides APIs for reading and writing AFE registers and setting CIS exposure duration. The algorithm layer implements the closed-loop gain adjustment algorithm, including pixel value acquisition, error calculation, and iterative gain adjustment. The application layer configures parameters such as expected pixel values and error thresholds, and records the final gain value.
[0074] For example, it is assumed that the offset value after offset correction is 20 and has been written into the AFE register.
[0075] The average exposure time of the RGB lights is calculated as follows: red light exposure time: 50ms, green light exposure time: 60ms, blue light exposure time: 55ms, and average exposure time: (50+60+55) / 3=55ms.
[0076] Correction target: The scanned pixel value is stabilized at 200, with an error of ≤3.
[0077] Hardware parameters: AFE gain register address: 0x02, each bit corresponds to a 0.5x gain, for example, 0010b = 2x, 0100b = 4x. CIS drive PWM frequency: 100kHz. A 55ms exposure corresponds to PWM pulse count = 55ms × 100kHz = 5500 pulses.
[0078] The calibration process is analyzed step by step as follows:
[0079] 1. Initial setup.
[0080] The software writes an initial offset value of 20 to the AFE register via I2C, such as address 0x01, value 0x14.
[0081] The software sets the PWM pulse number of the CIS to 5500 to achieve a 55ms exposure.
[0082] The initial AFE gain value is set to 1, such as writing 0x01 to register 0x02.
[0083] 2. First scan.
[0084] After scanning, the pixel values are read. Assume the average pixel value is 150. Due to insufficient gain, it is lower than the target value of 200. Error = 200 - 150 = 50 > 3, which is greater than the error. Therefore, a gain adjustment is triggered: current_gain = 1 + 0.2 = 1.2. Since each bit corresponds to a 0.5x gain, the corresponding register value is adjusted to: 0x02 × 1.2 / 0.5 = 0x04.8, which is rounded to 0x05, or 2.5x.
[0085] 3. Second scan.
[0086] The gain adjustment is set to 1.2 times. The average pixel value obtained by scanning is 180. The error = 200-180 = 20>3, so the gain is further increased to 1.5 times.
[0087] The average pixel value obtained from scanning is 225, and the error = 225-200 = 25>3. At this time, the gain is too large, so continue to adjust the gain to 1.4 times;
[0088] When the gain is iteratively adjusted to 1.6, the average pixel value obtained from the scan is 198, and the error is 200-198 = 2≤3, so the gain condition is met. The gain value of 1.6 is recorded at this time, and the corresponding gain value in the AFE register is 1.6 / 0.5 = 3.2, which is rounded to 3.
[0089] Finally, the calibrated AFE gain, offset value, and CIS RGB light exposure time parameters are written to the file system.
[0090] When the scanning device is restarted, these correction parameters can be read from the file system and applied, and then the above steps can be repeated to perform fine-tuning correction within the parameter value range, thereby improving the correction speed.
[0091] In an optional embodiment of the present invention, the recording of the first characteristic parameter corresponding to exposure time correction of the image sensor and the second characteristic parameter corresponding to offset correction and gain correction of the analog front end to obtain the second configuration information includes:
[0092] Step S11, setting an initial gain value and an initial offset value for the analog front end;
[0093] Step S12: Turn on the three primary color lights of the contact image sensor for separate exposure until the first scan pixel values corresponding to the three primary color lights meet the first preset condition, and record the second exposure time of each of the three primary color lights;
[0094] Step S13, turning off the three primary color lamps of the contact image sensor, and adjusting the initial offset value until the scanned pixel value of the scanning device meets a second preset condition, thereby obtaining a second offset value;
[0095] Step S14: adjusting the initial gain value based on the second exposure time and the second offset value until the scanned pixel value of the scanning device meets a third preset condition, thereby obtaining a second gain value;
[0096] Step S15: Generate the second configuration information according to the second exposure duration, the second offset value, and the second gain value.
[0097] In an embodiment of the present invention, an initial gain value and an initial offset value can be set for the AFE first, and then the exposure duration of the CIS can be corrected under the conditions corresponding to the initial gain value and the initial offset value. Specifically, the three primary color lights (RGB lights, i.e., red, green, and blue lights) of the CIS are turned on separately for separate exposure. For example, the red light is turned on, the green and blue lights are turned off, and then the exposure duration is adjusted. Each time an adjustment is made, the calibration white bar is scanned once to determine whether the first scanned pixel value obtained meets the first preset condition. If it meets the first preset condition, the exposure duration at this time is recorded as the second exposure duration of the red light. The other two lights are processed in the same manner, and finally the second exposure duration of each of the three primary color lights is obtained. Among them, the first preset condition can include the target pixel value, the error range and the standard deviation threshold, the minimum number of sampling times, etc. The first preset condition can be stored in text, or in a linked list, register, etc., and the embodiment of the present invention does not specifically limit this. The specific exposure duration correction process can refer to the above embodiment.
[0098] Next, the three primary color lamps of the CIS are turned off, and the AFE is calibrated for offset. Specifically, the offset value can be adjusted within the offset value range using a binary method, with each adjustment performed by scanning the calibration white bar until the second scanned pixel value meets the second preset condition, thereby obtaining the second offset value.
[0099] As an example, assume the second preset condition is: the offset value range is 0-255 with an allowable error range of ±1, and assume the AFE offset register is 8 bits with a value range of 0x00-0xFF. The preset target pixel value is 20, that is, the pixel value must fall between 19 and 21.
[0100] Assume that the initial AFE offset value is 0, and when the three primary color lamps in the CIS are turned off, the initial pixel value obtained by scanning the correction white bar is 5.
[0101] When using the binary method to adjust the offset value, first initialize the upper and lower limits: low = 0, high = 255. Then, iteratively calculate the intermediate value and adjust it until the obtained pixel value meets the second preset condition. The offset value that meets the second preset condition is recorded as the second offset value. A specific correction example is as follows:
[0102] Table 1
[0103] Number of iterations Adjustment range Middle offset value Scan pixel values Satisfy the second prerequisite Next steps 1 low=0,high=255 128 120 No (value is too high) Set high = 128 to reduce the upper bound 2 low=0,high=128 64 60 No (value is too high) Set high = 64 3 low=0,high=64 32 30 No (value is too high) Set high = 32 4 low=0,high=32 16 18 No (low value) Set low = 16 to expand the lower bound 5 low=16,high=32 24 22 No (exceeds upper limit 21) Set high = 24 6 low=16,high=24 20 20 Yes (exceeds upper limit 21) Record the offset value 20 and end the iteration
[0104] It should be noted that when the binary method is used to adjust the offset value, the range is reduced by half each time, and the adjustment range is determined by the current range. For example, the first adjustment range is 128, and the second adjustment range is 64, which is gradually refined.
[0105] The second preset condition is an iteration termination condition, which may include at least one of the following:
[0106] The scanned pixel value falls within the target range (e.g., 19 to 21) and the results are stable for two consecutive scans;
[0107] ● Force termination when the number of iterations reaches an upper limit (such as 10) to avoid infinite loops;
[0108] ●The adjustment step size of the offset value is less than 1. For example, in an 8-bit register precision, the minimum step size is 1.
[0109] By iteratively adjusting the AFE offset value using a binary search method, the optimal offset parameters are efficiently found to stabilize the scanned pixel values within the target range. This process achieves high-precision correction by narrowing the search range, making it suitable for scenarios that require dynamic adaptation to hardware drift, such as changes in image sensor sensitivity due to aging and ambient light fluctuations.
[0110] Then, under conditions corresponding to the second exposure duration and the second offset value, the AFE is subjected to gain correction. For example, within the gain value range of the AFE, the gain value is adjusted using a binary method, and the calibration bar is scanned each time the gain value is adjusted until the third scanned pixel value satisfies the third preset condition, thereby obtaining the second offset value.
[0111] As an example, assume the second exposure duration is: red light: 50ms, green light: 60ms, blue light: 55ms. The second offset value that meets the second preset condition is: 20, the gain value range is: 1.0 to 8.0 (assuming the AFE supports 16-level gain with a step size of 0.5, i.e. 1.0, 1.5, 2.0, ..., 8.0). The third preset condition includes: target pixel value: 200 (the expected scan value for the corrected white bar); error tolerance: ±5, that is, the third pixel value obtained after gain correction must be between 195 and 205. The gain correction process using the binary method is as follows:
[0112] Table 2
[0113]
[0114]
[0115] It should be noted that the first preset condition, the second preset condition and the third preset condition in the embodiment of the present invention can be set according to actual needs, and the first preset condition, the second preset condition and the third preset condition can be the same or different.
[0116] In an embodiment of the present invention, the initial gain value of the AFE can be set to 1, and the initial offset value can be set to 0, that is, the AFE is currently only an AD (analog-digital) module, and the analog quantity is not modified, thereby avoiding the AFE from affecting the actual value output by the CIS, and improving the accuracy of the correction result of the exposure time of the CIS. Similarly, when the embodiment of the present invention corrects the offset value of the AFE, by turning off the three primary color lights of the CIS, the influence of the CIS on the offset correction of the AFE is avoided, thereby improving the accuracy of the offset correction. The embodiment of the present invention performs gain correction on the AFE based on the second exposure time after the CIS is corrected and the second offset value after the AFE is corrected, and can comprehensively consider the synergistic influence of the CIS and the AFE on the scanning results, further improving the effectiveness and accuracy of the gain correction of the AFE.
[0117] Optionally, the step of turning on the three primary color lights of the image sensor to perform separate exposures until the first scan pixel values corresponding to the three primary color lights meet a first preset condition includes:
[0118] Step S21: adjusting the exposure time for each primary color lamp and obtaining a first scanned pixel value respectively; the first scanned pixel value represents the scanned pixel value when the analog front end does not modify the analog quantity;
[0119] Step S22, calculating first pixel values according to the first scanned pixel value, the initial gain value, and the initial offset value;
[0120] Step S23: performing error analysis based on the first pixel values to determine the second exposure time corresponding to each of the primary color lights.
[0121] It should be noted that there is a corresponding relationship between the offset value and the gain value of the AFE. The offset value affects the baseline of the scanning signal, and the gain value affects the amplification of the scanning signal. The calculation process of the pixel value can refer to the following formula:
[0122] P=a×GAIN+OFFSET (1)
[0123] Where P is the pixel value after AFE amplification. a is the analog signal pixel value scanned by the CIS, i.e., the scanned pixel value. GAIN is the AFE gain value, and OFFSET is the AFE offset value.
[0124] In an embodiment of the present invention, the initial gain value of the AFE can be set to 1, and the initial offset value can be set to 0, that is, the AFE is currently only an AD (analog-digital) module, and the analog quantity is not modified, so as to avoid the AFE affecting the actual value of the CIS output.
[0125] In this embodiment of the present invention, the red, green, and blue lights can be turned on separately for independent exposure. For each primary color light, after each adjustment of the exposure duration, the white bar is scanned and calibrated to obtain the first scanned pixel value a, and the first pixel value is calculated according to the above formula (1). If the difference between the first pixel value and the first reference pixel value is within the first error range, the current exposure duration is used to determine the second exposure duration of the corresponding primary color light.
[0126] For example, using a 300 dpi (dots per inch) scanner as an example, a row has 2592 pixels, each with a value ranging from 0 to 255 (8-bit data). During image correction, the CIS scanning bar is first moved to the calibration white bar position using a stepper motor. The file system is then checked for configuration information. If so, this information is used as the default value for the correction.
[0127] When performing CIS exposure time correction, the initial gain value GAIN of the AFE is set to 1 (the gain value range is 0-63) and the initial offset value OFFSET is set to 0 (the offset value range is 0-255) according to formula (1) to prevent the AFE device from affecting the actual value obtained by the CIS scan. That is, the AFE is currently only an AD (analog-digital) module, and the pixel value after amplification is only the pixel value of the scanned analog signal, and the analog value is not modified.
[0128] Turn on the red, green and blue lights separately for separate exposure. In an embodiment of the present invention, the exposure time can be adjusted within the exposure time range by using a binary method, with each adjustment step being 10. Each time an adjustment is made, the first scanned pixel value of the scan correction white bar is obtained, and the pixel value of each pixel point is calculated according to the above formula (1), and the pixel values of the 2592 pixel points are averaged to obtain the first pixel value in the embodiment of the present invention. The first pixel value is compared with the first reference pixel value (such as 85). When the error is within the first error range (such as plus or minus 10), the second exposure time of each of the three primary color lights is recorded. The specific exposure time adjustment process can refer to the aforementioned embodiment, and the embodiment of the present invention will not be further described here.
[0129] As an example, assume the exposure duration range is 20ms to 200ms, with an adjustment step of 10ms. The first reference pixel value is 85, and the first error range is ±10, meaning the pixel value must be between 75 and 95. The number of pixels is 2592, and the first pixel value is obtained by averaging the pixel values of each pixel in a single row of scan data. The light source type is RGB independent exposure.
[0130] Taking red light exposure correction as an example, the initial exposure time range is 20ms to 200ms, with a step of 10ms. The iterative adjustment process of the exposure time using the binary method is as follows:
[0131] Table 3
[0132] Number of iterations Exposure duration (ms) First pixel value Error from reference value Whether the conditions are met Next steps 1 110 105 +20 no Reduce exposure time 2 100 95 +10 yes Recording exposure time 100ms
[0133] The error between the first pixel value and the reference value = the first pixel value - the first reference pixel value. For example, when the first pixel value is 95 and the reference value is 85, the error is 95 - 85 = +10, which is within the first error range.
[0134] The exposure duration in each iteration can be stored as a temporary variable. The corrected exposure duration, that is, the second exposure duration corresponding to the primary color light, can be persistently stored. For example, the second exposure duration is written to the CIS register to ensure that subsequent scans directly use the corrected value.
[0135] Through this parametric correction mechanism, the optimal exposure time of the RGB primary color lights in different environments can be quickly found to ensure the brightness consistency and color accuracy of the scanned image.
[0136] Optionally, adjusting the initial offset value until the scanned pixel value of the scanning device meets a second preset condition includes:
[0137] Step S31: While the analog front end maintains the initial gain value unchanged, the initial offset value is adjusted to obtain a current offset value;
[0138] Step S32: acquiring a second scanned pixel value based on the current offset value; the second scanned pixel value represents a scanned pixel value when the primary color lamp is turned off;
[0139] Step S33, calculating a second pixel value according to the second scanned pixel value, the initial gain value and the current offset value;
[0140] Step S34: Determine the second offset value based on the second pixel value and the second preset condition.
[0141] When performing AFE offset correction, the gain value of the analog front end can be kept unchanged at the initial gain value, for example, the gain value of the AFE is kept at 1. Turn off all lights (i.e., the RGB lights on the CIS scanning bar are not on), set the default AFE offset value (empirical value), and adjust the offset value by dichotomy. Each time an adjustment is made, the second scanned pixel value of the scanning correction white bar is obtained, and the pixel value of each pixel point is calculated according to the above formula (1), and the pixel values of the 2592 pixel points are averaged to obtain the second pixel value in the embodiment of the present invention. The second pixel value is compared with the second reference pixel value (such as 7). When the error is within the second error range (such as plus or minus 3), the current offset value is recorded and determined as the second offset value of the AFE. The specific offset correction process can refer to the aforementioned embodiment, and the embodiment of the present invention will not be further described here.
[0142] It should be noted that the AFE offset value correction is to correct the black pixel value when the light is off. Adjusting the second reference pixel value to about 7 can facilitate the subsequent image shadow processing.
[0143] Optionally, adjusting the initial gain value until the scanned pixel value of the scanning device meets a third preset condition includes:
[0144] Step S41: Calculate the average exposure time corresponding to each of the three primary color lights, and set the exposure time of the image sensor to the average exposure time;
[0145] Step S42: adjusting the initial gain value based on the second offset value to obtain a current gain value;
[0146] Step S43: acquiring a third scan pixel value based on the current gain value; the third scan pixel value is the current scan pixel value of the scanning device;
[0147] Step S44, calculating a third pixel value according to the third scanned pixel value, the second offset value and the current gain value;
[0148] Step S45: Determine the second gain value based on the third pixel value and the third preset condition.
[0149] When performing AFE gain calibration, the AFE offset setting can be adjusted based on the calibrated offset value. Based on the calibrated second exposure time of the three primary color lights, the average exposure time of the RGB lights is calculated, and the exposure time of the CIS is set to the average exposure time.
[0150] Next, set the default AFE gain value (empirical value) and adjust the AFE gain value by dichotomy. Each time the adjustment is made, obtain the third scanned pixel value of the scanned correction white bar, and calculate the pixel value of each pixel point according to the above formula (1). The pixel values of 2592 pixels are averaged to obtain the third pixel value in the embodiment of the present invention. Compare the third pixel value with the third reference pixel value (such as 220). When the error is within the third error range (such as plus or minus 5), record the current gain value and determine the current gain value as the second gain value of the AFE. The specific gain correction process can refer to the above embodiment.
[0151] After calibration is complete, the AFE gain, offset, and CIS RGB light exposure duration parameters are written to the file system. The configuration information in the file system can be in JSON or binary format and includes fields such as RGB light exposure duration, AFE gain, and AFE offset.
[0152] Optionally, the method further includes:
[0153] Step S51: If the configuration information is found, scan the calibration white bar to obtain a fourth scanned pixel value; the fourth scanned pixel value represents an actual scanned pixel value obtained by the scanning device under the current environment and device state;
[0154] Step S52: Calculate a fourth pixel value according to the fourth scanned pixel value and the configuration information;
[0155] Step S53: performing error analysis based on the fourth pixel value to determine first configuration information;
[0156] Step S54: perform scanning processing according to the first configuration information.
[0157] In an embodiment of the present invention, if the scanning device is started and configuration information is found in the file system, the various correction parameters in the configuration information can be fine-tuned according to the actual environment and device status of the scanning device (such as changes in light brightness and sensor sensitivity).
[0158] Specifically, the exposure time, the offset value and the gain value of the AFE in the configuration information can be read first, and the CIS and the AFE can be set according to the read parameters. Then, the white bar can be scanned and corrected, and the pixel value of each pixel point can be calculated according to the above formula (1) based on the fourth scanned pixel value obtained. The pixel values of each pixel point are averaged to obtain the fourth pixel value in the embodiment of the present invention.
[0159] An error analysis is performed based on the fourth pixel value. For example, if the difference between the fourth pixel value and the target pixel value is within the target error range, the configuration information is determined as the first configuration information. If the difference between the fourth pixel value and the target pixel value is outside the target error range, the configuration parameters in the configuration information are adjusted according to the parameter value range corresponding to the scanning device, and the white bar is rescanned to correct the white bar.
[0160] For example, the fourth pixel value is compared with the target pixel value. When the error is within the target error range (such as plus or minus 5), the correction parameters in the current configuration information can be kept unchanged. If the error exceeds the target error range, the configuration parameters in the configuration information can be adjusted according to the parameter value range corresponding to the scanning device, and the white bar can be rescanned and corrected, the pixel value can be recalculated, and error analysis can be performed.
[0161] It should be noted that the first configuration information in embodiments of the present invention may include second configuration information written to the file system after a comprehensive calibration of the scanning device when the scanning device is first started. It is understood that the environment in which the scanning device is located may change, and the relevant parameters in the second configuration information, such as exposure time, AFE gain, and offset value, may not necessarily be applicable to the current environment. For example, if the ambient light suddenly changes, it is necessary to scan the calibration white bar, compare the actual value with the reference value, determine the magnitude of the change in light brightness, and dynamically adjust the exposure time, AFE gain, offset value, etc. based on the magnitude of the light brightness change to return the scanned pixel values of the calibration white bar to the reference range, thereby compensating for the impact of the light brightness change on the scanning effect.
[0162] Alternatively, the first configuration information in the embodiment of the present invention may be configuration information obtained after the scanning device has been used for a period of time and the second configuration information written when it was first started has been adjusted one or more times. It is understandable that the sensitivity of an image sensor (such as a CMOS / CCD) will change with usage time, temperature, or aging. When the sensitivity decreases, the electrical signal generated under the same light intensity is weakened, resulting in a lower pixel value; when the sensitivity increases, the pixel value is higher. Assuming that a new image sensor scans a calibration white bar under standard light intensity and obtains a pixel value of 255, after one year of use, the sensitivity decreases by 10%, and the pixel value may become 230 under the same light intensity. The degree of sensor sensitivity attenuation can be determined by detecting the long-term offset of the pixel value. Furthermore, the sensitivity change can be compensated by adjusting the gain or offset of the image sensor. For example, when the sensitivity decreases by 10%, the gain is increased by 10% to restore the scanned pixel value of the calibration white bar to the reference value, ensuring the accuracy of subsequent scans.
[0163] It's understandable that changes in light brightness and sensor sensitivity can coexist, such as sudden changes in ambient light and sensor aging. Changes in the scanned pixel values during the white bar correction are the result of both. Large fluctuations in pixel values over a short period of time are primarily attributed to changes in light brightness, such as interference from external light sources. Slow, long-term drift in pixel values is likely due to sensor sensitivity aging, such as degradation of semiconductor material performance.
[0164] After each scan of the calibration white bar, the current calibration parameters, such as the light source brightness coefficient and sensor gain value, are updated, forming a closed loop of "scan white bar → analyze pixel values → update parameters → apply new parameters." Subsequent scans are based on the initial configuration information to ensure consistent scan quality despite environmental changes.
[0165] The embodiment of the present invention can ensure that the various correction parameters in the first configuration information can adapt to the current environment and device status, guarantee the continued effectiveness of the correction effect, and help improve the consistency and stability of the scanning quality.
[0166] In summary, an embodiment of the present invention provides a calibration method for a scanning device. This method performs a comprehensive calibration when the scanning device is started for the first time, and writes the corrected configuration information into the file system. The configuration information stored in the file system can be directly used the next time the device is started without the need for comprehensive calibration again, thereby significantly reducing the calibration time and improving the calibration efficiency.
[0167] Device embodiment
[0168] Reference Figure 2 , shows a structural block diagram of an embodiment of a calibration device for a scanning device of the present invention, wherein the calibration device 200 includes a processor 201, an image sensor 202, and an analog front end 203; the processor is configured to:
[0169] Querying the configuration information of the scanning device from the file system;
[0170] If the configuration information is not found, recording the first characteristic parameter corresponding to the exposure time correction of the image sensor and the second characteristic parameter corresponding to the offset correction and the gain correction of the analog front end, respectively, to obtain the second configuration information;
[0171] The second configuration information is written into the file system so as to be called after the scanning device is restarted.
[0172] Optionally, the processor is specifically configured to:
[0173] Setting an initial gain value and an initial offset value for the analog front end;
[0174] Turning on the three primary color lights of the image sensor for separate exposure until the first scan pixel values corresponding to the three primary color lights meet the first preset condition, and recording the second exposure time of the three primary color lights;
[0175] Turning off the three primary color lights of the image sensor and adjusting the initial offset value until the scanned pixel value of the scanning device meets a second preset condition, thereby obtaining a second offset value;
[0176] Adjusting the initial gain value based on the second exposure time and the second offset value until the scanned pixel value of the scanning device meets a third preset condition, thereby obtaining a second gain value;
[0177] The second configuration information is generated according to the second exposure duration, the second offset value, and the second gain value.
[0178] Optionally, the processor is specifically configured to:
[0179] Adjusting the exposure time for each primary color lamp to obtain a first scanned pixel value respectively; the first scanned pixel value represents the scanned pixel value of the scanning device when the analog front end does not modify the analog quantity;
[0180] Calculating first pixel values according to the first scanned pixel value, the initial gain value, and the initial offset value;
[0181] Error analysis is performed based on the first pixel values to determine the second exposure time corresponding to each of the primary color lights.
[0182] Optionally, the processor is specifically configured to:
[0183] When the analog front end maintains the initial gain value unchanged, adjusting the initial offset value to obtain a current offset value;
[0184] Based on the current offset value, a second scanned pixel value is acquired; the second scanned pixel value represents a scanned pixel value when the primary color lamp is turned off;
[0185] Calculating a second pixel value according to the second scanned pixel value, the initial gain value, and the current offset value;
[0186] The second offset value is determined based on the second pixel value and the second preset condition.
[0187] Optionally, the processor is specifically configured to:
[0188] Calculating the average exposure time corresponding to each of the three primary color lights, and setting the exposure time of the image sensor to the average exposure time;
[0189] Adjusting the initial gain value based on the second offset value to obtain a current gain value;
[0190] Based on the current gain value, obtaining a third scan pixel value; the third scan pixel value is the current scan pixel value of the scanning device;
[0191] Calculating a third pixel value according to the third scanned pixel value, the second offset value, and the current gain value;
[0192] The second gain value is determined based on the third pixel value and the third preset condition.
[0193] Optionally, the processor is further configured to:
[0194] If the configuration information is found, the calibration white bar is scanned to obtain a fourth scanned pixel value; the fourth scanned pixel value represents an actual scanned pixel value obtained by the scanning device under the current environment and device state;
[0195] Calculating a fourth pixel value according to the fourth scanned pixel value and the configuration information;
[0196] Performing an error analysis based on the fourth pixel value to determine first configuration information;
[0197] Scanning is performed according to the first configuration information.
[0198] In summary, an embodiment of the present invention provides a correction device for a scanning device. The correction device performs a comprehensive correction when the scanning device is started for the first time, and writes the corrected configuration information into the file system. The configuration information stored in the file system can be directly used when the scanning device is started next time without the need for comprehensive correction again, which significantly reduces the correction time and improves the correction efficiency.
[0199] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0200] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0201] Figure 3 6 is a block diagram showing a structure of an electronic device 600 according to an exemplary embodiment. For example, the electronic device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0202] Reference Figure 3, the electronic device 600 may include one or more of the following components: a processing component 602 , a memory 604 , a power component 606 , a multimedia component 608 , an audio component 610 , an input / output (I / O) interface 612 , a sensor component 614 , and a communication component 616 .
[0203] The processing component 602 generally controls the overall operation of the electronic device 600, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 602 may include one or more modules to facilitate interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.
[0204] The memory 604 is configured to store various types of data to support operations on the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phone book data, messages, pictures, videos, etc. The memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
[0205] The power supply assembly 606 provides power to the various components of the electronic device 600. The power supply assembly 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 600.
[0206] The multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the electronic device 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.
[0207] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 600 is in an operating mode, such as a call mode, a recording mode, and a voice information processing mode. The received audio signal can be further stored in the memory 604 or transmitted via the communication component 616. In some embodiments, the audio component 610 also includes a speaker for outputting audio signals.
[0208] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as a keyboard, click wheel, buttons, etc. These buttons may include but are not limited to: a home button, volume buttons, a start button, and a lock button.
[0209] The sensor assembly 614 includes one or more sensors for providing various aspects of status assessment for the electronic device 600. For example, the sensor assembly 614 can detect the open / closed state of the electronic device 600, the relative positioning of components, such as the display and keypad of the device 600. The sensor assembly 614 can also detect changes in the position of the electronic device 600 or a component of the electronic device 600, the presence or absence of user contact with the electronic device 600, the orientation or acceleration / deceleration of the electronic device 600, and temperature changes of the electronic device 600. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0210] The communication component 616 is configured to facilitate wired or wireless communication between the electronic device 600 and other devices. The electronic device 600 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency information processing (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0211] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0212] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, and the instructions can be executed by the processor 620 of the electronic device 600 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0213] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device (server or terminal), enables the processor to perform Figure 1 The calibration method of the scanning device shown.
[0214] The correction method, device and electronic device of a scanning device provided by the present invention are introduced in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for general technical personnel in this field, according to the ideas of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A calibration method for a scanning device, characterized in that: The scanning device includes an image sensor and an analog front end, and the method includes: Querying the configuration information of the scanning device from the file system; If the configuration information is not found, recording the first characteristic parameter corresponding to the exposure time correction of the image sensor and the second characteristic parameter corresponding to the offset correction and the gain correction of the analog front end, respectively, to obtain the second configuration information; The second configuration information is written into the file system so as to be called after the scanning device is restarted.
2. The method according to claim 1, characterized in that The recording of the first characteristic parameter corresponding to the exposure time correction of the image sensor and the second characteristic parameter corresponding to the offset correction and the gain correction of the analog front end respectively includes: Setting an initial gain value and an initial offset value for the analog front end; Turning on the three primary color lights of the image sensor for separate exposure until the first scan pixel values corresponding to the three primary color lights meet the first preset condition, and recording the second exposure time of the three primary color lights; Turning off the three primary color lights of the image sensor and adjusting the initial offset value until the scanned pixel value of the scanning device meets a second preset condition, thereby obtaining a second offset value; Based on the second exposure time and the second offset value, the initial gain value is adjusted until the scanned pixel value of the scanning device meets a third preset condition, thereby obtaining a second gain value.
3. The method according to claim 2, characterized in that The step of turning on the three primary color lights of the image sensor to perform separate exposures until the first scan pixel values corresponding to the three primary color lights meet the first preset condition includes: Adjusting the exposure time for each primary color lamp and obtaining a first scanned pixel value respectively; the first scanned pixel value represents the scanned pixel value when the analog front end does not modify the analog quantity; Calculating first pixel values according to the first scanned pixel value, the initial gain value, and the initial offset value; Error analysis is performed based on the first pixel values to determine the second exposure time corresponding to each of the primary color lights.
4. The method according to claim 2, characterized in that The adjusting the initial offset value until the scanned pixel value of the scanning device meets a second preset condition includes: When the analog front end maintains the initial gain value unchanged, adjusting the initial offset value to obtain a current offset value; Based on the current offset value, a second scanned pixel value is acquired; the second scanned pixel value represents a scanned pixel value when the primary color lamp is turned off; Calculating a second pixel value according to the second scanned pixel value, the initial gain value, and the current offset value; The second offset value is determined based on the second pixel value and the second preset condition.
5. The method according to claim 2, characterized in that The adjusting the initial gain value until the scanned pixel value of the scanning device meets a third preset condition includes: Calculating the average exposure time corresponding to each of the three primary color lights, and setting the exposure time of the image sensor to the average exposure time; Adjusting the initial gain value based on the second offset value to obtain a current gain value; Based on the current gain value, obtaining a third scanned pixel value; the third scanned pixel value is the current scanned pixel value; Calculating a third pixel value according to the third scanned pixel value, the second offset value, and the current gain value; The second gain value is determined based on the third pixel value and the third preset condition.
6. The method according to claim 1, characterized in that The method further comprises: If the configuration information is found, the white bar is scanned and corrected to obtain a fourth scanned pixel value; the fourth scanned pixel value represents an actual scanned pixel value obtained by scanning under the current environment and device state; Calculating a fourth pixel value according to the fourth scanned pixel value and the configuration information; Performing an error analysis based on the fourth pixel value to determine first configuration information; Scanning is performed according to the first configuration information.
7. A calibration device for a scanning device, characterized in that: The correction device includes a processor, an image sensor and an analog front end; the processor is used to: Querying the configuration information of the scanning device from the file system; If the configuration information is not found, recording the first characteristic parameter corresponding to the exposure time correction of the image sensor and the second characteristic parameter corresponding to the offset correction and the gain correction of the analog front end, respectively, to obtain the second configuration information; The second configuration information is written into the file system so as to be called after the scanning device is restarted.
8. The device according to claim 7, characterized in that The processor is specifically configured to: Setting an initial gain value and an initial offset value for the analog front end; Turning on the three primary color lights of the image sensor for separate exposure until the first scan pixel values corresponding to the three primary color lights meet the first preset condition, and recording the second exposure time of the three primary color lights; Turning off the three primary color lights of the image sensor and adjusting the initial offset value until the scanned pixel value of the scanning device meets a second preset condition, thereby obtaining a second offset value; Based on the second exposure time and the second offset value, the initial gain value is adjusted until the scanned pixel value of the scanning device meets a third preset condition, thereby obtaining a second gain value.
9. An electronic device, characterized in that: The electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to execute the calibration method of the scanning device according to any one of claims 1 to 6 by one or more processors.
10. A readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the processor is enabled to execute the calibration method for a scanning device according to any one of claims 1 to 6.