Sensor module screening method and related device
By acquiring typical and actual white balance parameters of the sensor module, calculating the tolerance range, and determining the burning direction, the problem of low white balance calibration efficiency of the sensor module is solved, achieving efficient screening and parameter consistency control, and improving imaging quality and stability.
Patent Information
- Application Number
- CN202611023219.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-09
- Publication Date
- 2026-11-27
Smart Images

Figure CN123185340A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image sensor module technology, and in particular to a method for screening sensor modules and related apparatus. Background Technology
[0002] Currently, the white balance calibration of camera modules generally adopts a "approaching typical values" approach. This approach uses the white balance parameters measured by a reference sample under a standard light source as typical values, and then calibrates the ratios of the red and green channels, and the blue and green channels of all modules to be calibrated to within ±2% of the typical values by burning in the gain parameters.
[0003] However, the single calibration logic of "approaching typical values" can only screen products with natural deviations from a large number of modules or repeatedly debug and burn parameters. It cannot be calibrated to the limit threshold according to different deviation scenarios. This results in extremely low screening efficiency, poor parameter consistency, high labor costs, and long production cycles, making it difficult to meet the needs of batch verification. Summary of the Invention
[0004] This application provides a method and related apparatus for screening sensor modules to solve the technical problems of low screening efficiency and long screening cycle caused by traditional single calibration logic.
[0005] To address the aforementioned technical problems, this application provides a method, electronic device, and storage medium for screening sensor modules, comprising: acquiring typical white balance parameters of a reference module of the sensor, and obtaining the tolerance range of the typical white balance parameters based on a preset deviation ratio to generate first white balance data; acquiring actual white balance parameters of the module to be screened in a preset image area to generate second white balance data; comparing the first white balance data and the second white balance data, and determining the burning direction of the module to be screened based on the comparison result; calculating the gain parameter of the module to be screened using the burning direction, calibrating the second white balance parameter of the module to be screened based on the gain parameter, and screening the module to be screened based on whether the calibrated second white balance parameter is qualified.
[0006] The first white balance data includes the ratio of typical values of the first color channel to the second color channel, the ratio of typical values of the third color channel to the second color channel, and the tolerance range; the second white balance data includes the ratio of actual values of the first color channel to the second color channel, and the ratio of actual values of the third color channel to the second color channel; the step of comparing the first white balance data and the second white balance data and determining the burning direction of the module to be screened based on the comparison results includes: comparing the ratio of actual values of the first color channel to the second color channel with the ratio of typical values, and comparing the ratio of actual values of the third color channel to the second color channel with the ratio of typical values, and determining the burning direction of the module to be screened based on the comparison results.
[0007] The steps of comparing the ratio of the actual value of the first color channel to the ratio of the typical value of the second color channel, and comparing the ratio of the actual value of the third color channel to the ratio of the typical value of the second color channel, and determining the burning direction of the module to be screened based on the comparison results, include: in response to the actual value ratio of the first color channel to the second color channel being greater than the typical value ratio, and the actual value ratio of the third color channel to the second color channel being greater than the typical value ratio, determining the burning direction as calibration towards the lower limit threshold of the first color channel and the lower limit threshold of the third color channel; in response to the actual value ratio of the first color channel to the second color channel being greater than the typical value ratio, and the actual value ratio of the third color channel to the second color channel being less than the typical value ratio, determining the burning direction as calibration towards the lower limit threshold of the third color channel. The lower threshold of the first color channel and the upper threshold of the third color channel are calibrated; in response to the ratio of the actual value of the first color channel to the second color channel being less than the ratio of the typical value, and the ratio of the actual value of the third color channel to the second color channel being greater than the ratio of the typical value, the burning direction is determined to be the calibration of the upper threshold of the first color channel and the lower threshold of the third color channel; in response to the ratio of the actual value of the first color channel to the second color channel being less than the ratio of the typical value, and the ratio of the actual value of the third color channel to the second color channel being less than the ratio of the typical value, the burning direction is determined to be the calibration of the upper threshold of the first color channel and the upper threshold of the third color channel; wherein, the tolerance range of the first white balance parameter includes the upper and lower thresholds of the first color channel and the upper and lower thresholds of the third color channel.
[0008] The process includes the following steps: calculating the gain parameters of the modules to be screened using the burning direction; calibrating the second white balance parameters of the modules to be screened based on the gain parameters; and screening the modules to be screened based on the calibrated second white balance parameters. These steps include: calculating the gain values of the first color channel, the second color channel, and the third color channel according to the burning direction to generate gain parameters; wherein the gain values of the first color channel, the second color channel, and the third color channel are all greater than or equal to 1; burning the gain parameters to the storage unit of the screening module and simultaneously writing them to the corresponding registers; and screening the modules to be screened based on the burned second white balance parameters and the tolerance range.
[0009] The step of screening modules based on the second white balance parameters and tolerance range after programming includes: obtaining the second white balance parameters of the module to be screened in a preset image area after programming; in response to the second white balance parameters being within the tolerance range, the module to be screened is a qualified module; in response to the second white balance parameters being outside the tolerance range, the module to be screened is an unqualified module.
[0010] The steps of acquiring typical white balance parameters of the sensor's reference module and obtaining the tolerance range of the typical white balance parameters based on a preset deviation ratio to generate first white balance data include: acquiring the ratio of typical values of the first color channel to the second color channel and the ratio of typical values of the third color channel to the second color channel of the reference module; calculating the lower and upper threshold values of the ratio of typical values of the first and second color channels, and the upper and lower threshold values of the ratio of typical values of the third and second color channels, based on the preset deviation ratio, to generate a tolerance range; and generating first white balance data based on the tolerance range, the ratio of typical values of the first and second color channels, and the ratio of typical values of the third and second color channels.
[0011] The preset deviation ratio range is 5% to 10%.
[0012] The step of collecting the actual white balance parameters of the module to be screened in a preset image area and generating second white balance data includes: collecting the values of a first color channel, a second color channel, and a third color channel in the preset image area; calculating the ratio of the actual values of the first color channel to the second color channel based on the first color channel value and the second color channel value; calculating the ratio of the actual values of the third color channel to the second color channel value based on the third color channel value and the second color channel value; and generating second white balance data based on the ratios of the actual values of the first color channel to the second color channel and the ratios of the actual values of the third color channel to the second color channel value.
[0013] To address the aforementioned technical problems, this application provides an electronic device, comprising: a memory and a processor coupled to each other, wherein the processor is used to execute program instructions stored in the memory to implement the sensor module screening method as described above.
[0014] To address the aforementioned technical problems, this application provides a computer-readable storage medium storing program data that can be executed to implement the sensor module screening method as described above.
[0015] The beneficial effects of this application are as follows: This application provides a method for screening sensor modules. It obtains typical white balance parameters of a reference module and calculates the tolerance range of these parameters based on a preset deviation ratio to generate first white balance data. It then collects actual white balance parameters of the module to be screened in a preset image region to generate second white balance data. Based on the comparison between the first and second white balance data, it divides deviation scenarios and determines the burning direction. It calculates gain parameters according to the burning direction and burns these parameters into the storage unit of the module to be screened, thus screening the module. By dividing the module into deviation scenarios and calculating gain parameters based on orientation, the screening process does not rely on natural deviations, thereby significantly improving screening efficiency. Furthermore, the method allows for flexible setting of preset deviation ratios, making it adaptable to different verification needs and facilitating strong versatility, while ensuring that white balance parameter errors are controlled within a reasonable range. Attached Figure Description
[0016] Figure 1 This is a flowchart illustrating one embodiment of the sensor module screening method provided in this application; Figure 2 This is a flowchart illustrating another embodiment of the sensor module screening method provided in this application; Figure 3 This is a schematic diagram of one embodiment of the electronic device provided in this application; Figure 4 This is a schematic diagram of an embodiment of the computer-readable storage medium provided in this application. Detailed Implementation
[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0018] It should be noted that if the embodiments of this application involve directional indicators (such as up, down, left, right, front, back, etc.), the directional indicators are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicators will also change accordingly.
[0019] Furthermore, if the embodiments of this application involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.
[0020] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the sensor module screening method provided in this application.
[0021] S11: Obtain the typical white balance parameters of the sensor's reference module, and obtain the tolerance range of the typical white balance parameters based on the preset deviation ratio to generate the first white balance data.
[0022] Under standard lighting conditions, typical values of the first, second, and third color channels of the sensor's reference module are acquired. The ratios of these typical values are then calculated, along with the ratio of the third color channel's typical value to the second color channel's typical value. Based on preset deviation ratios, the tolerance ranges for these ratios are calculated to generate the first white balance parameter. Specifically, using a camera module reference sample as the reference module's sample, under a 5000K standard lighting environment and illuminance uniformity of no less than 90%, channel separation statistics are performed on all pixels in a designated area of the sample output image to acquire the typical values of the first, second, and third color channels. For example, using the red channel as the first color channel, the green channel as the second color channel, and the blue channel as the third color channel, the brightness values of all red pixels are counted and their arithmetic mean is calculated to obtain the typical value R_Golden for the red channel; the brightness values of all green pixels are counted and their arithmetic mean is calculated to obtain the typical value G_Golden for the green channel; and the brightness values of all blue pixels are counted and their arithmetic mean is calculated to obtain the typical value B_Golden for the blue channel. Based on these three typical values, the ratio of the typical values of the red channel to the green channel is calculated as R / G_Typical = R_Golden / G_Golden, and the ratio of the typical values of the blue channel to the green channel is calculated as B / G_Typical = B_Golden / G_Golden. A preset deviation ratio is set to limit the maximum fluctuation of the white balance parameters of the actual module relative to the typical ratio. For example, the set range is between 5% and 10%, and 5%, 8%, or 10% can be selected and adjusted flexibly according to different verification scenarios. Specifically, the preset deviation ratio is set to △, the lower limit threshold for the ratio of the red channel to the green channel is R / G_Min = R / G_Typical × (1 - △), the upper limit threshold is R / G_Max = R / G_Typical × (1 + △), and the tolerance range for the blue channel is: the lower limit threshold is B / G_Min = B / G_Typical × (1 - △), and the upper limit threshold is B / G_Max = B / G_Typical × (1 + △). Finally, the first white balance data is generated based on the typical value ratio of the red channel to the green channel R / G_Typical, the typical value ratio of the blue channel to the green channel B / G_Typical, and the tolerance ranges R / G_Min, R / G_Max, B / G_Min, and B / G_Max.
[0023] In a specific application scenario, under a 5000K standard light source environment, using the benchmark sample of this camera module as a reference, pixel data of the central 1 / 5 area of its output image is extracted through an image acquisition card. The typical values for the red channel (R_Golden) are calculated as R_Golden=1200, the green channel (G_Golden) as well as the blue channel (B_Golden) as 1560. This results in the ratio of the typical values of the red and green channels (R / G_Typical) being 1, and the ratio of the typical values of the blue and green channels (B / G_Typical) being 1.3. Based on the fluctuation range of mass production processes and image quality requirements, a preset deviation ratio Δ=8% is set, and the tolerance range is calculated as follows: lower threshold R / G_Min=0.9200, upper threshold R / G_Max=1.0800 for the red channel direction; lower threshold B / G_Min=1.1960, upper threshold B / G_Max=1.4040 for the blue channel direction.
[0024] S12: Collect the actual white balance parameters of the module to be screened in the preset image area and generate the second white balance data.
[0025] The data acquisition module collects the first, second, and third color channel values of the preset image region of the module to be screened, and calculates the ratio of the actual values of the first and second color channels and the ratio of the actual values of the third and second color channels to generate second white balance data. The execution order of S11 and S12 is not critical and can be flexibly adjusted based on actual conditions or data processing. The data acquisition module can be a high-performance image acquisition card with 12-bit or higher precision. The preset image region can be selected as one-fifth, one-sixth, one-quarter, two-sevenths, or one-third of the image center area, or can be flexibly selected and adjusted according to different test scenarios, module characteristics, or verification requirements. For example, when it is necessary to evaluate the impact of module edge imaging quality on white balance, the image edge area can be selected as the preset image region; when the test scenario contains specific color targets or test cards, the preset image region can be dynamically defined based on the target's location. Specifically, the module to be screened is placed on the same test fixture as the benchmark module, ensuring that its shooting posture and distance are the same as in the benchmark test. A white balance test is performed on the module to be screened using an image acquisition card, and its raw output image data is collected. From the acquired output image, channel separation statistics are performed on all pixels within a preset image area, calculating the ratio of the actual values of the first color channel to the second color channel, and the ratio of the actual values of the third color channel to the third color channel. For example, using the red channel as the first color channel, the green channel as the second color channel, and the blue channel as the third color channel, the brightness values of all red pixels are counted and their arithmetic mean is calculated to obtain the current red channel statistical value R_Current; the brightness values of all green pixels are counted and their arithmetic mean is calculated to obtain the current green channel statistical value G_Current; the brightness values of all blue pixels are counted and their arithmetic mean is calculated to obtain the current blue channel statistical value B_Current. Based on the statistical values of the three channels mentioned above, the ratio of the current actual values of the red channel to the green channel, R / G_Current = R_Current / G_Current, and the ratio of the current actual values of the blue channel to the green channel, B / G_Current = B_Current / G_Current, are calculated. Finally, the second white balance data is generated based on the ratios R / G_Current of the red channel to the green channel and B / G_Current of the blue channel to the green channel.
[0026] In a specific application scenario, a channel separation and statistical analysis was performed on the pixels in the central one-fifth region of the image to be screened using an industrial-grade image acquisition card with 12-bit precision. The brightness values of the red pixels were found to be distributed between 980 and 1020, with an arithmetic mean R_Current = 1002.5; the brightness values of the green pixels were distributed between 1000 and 1040, with an arithmetic mean G_Current = 1020.8; and the brightness values of the blue pixels were distributed between 1250 and 1290, with an arithmetic mean B_Current = 1275.3. Based on the above statistical values, the current ratio of the actual values of the red channel to the green channel, R / G_Current, is calculated to be 1002.5 ÷ 1020.8 = 0.9821, and the current ratio of the actual values of the blue channel to the green channel, B / G_Current, is calculated to be 1275.3 ÷ 1020.8 = 1.2493. The ratio of the actual values of the red channel to the green channel, R / G_Current, and the ratio of the actual values of the blue channel to the green channel, B / G_Current, of this module are used as the second white balance data.
[0027] S13: Compare the first white balance data and the second white balance data, and determine the burning direction of the module to be screened based on the comparison results.
[0028] The parameter processing module compares the ratios of typical values of the first and second color channels and the third color channel to the second color channel in the first white balance data with the ratios of actual values of the first and second color channels in the second white balance data. Based on the comparison results, the burning direction is determined. The parameter processing module can be an industrial control computer. For example, taking the red channel as the first color channel, the green channel as the second color channel, and the blue channel as the third color channel, when the actual value ratio of the red channel to the green channel is greater than the typical value ratio of the red channel to the green channel, and the actual value ratio of the blue channel to the green channel is greater than the typical value ratio of the blue channel to the green channel, the burning direction is determined to be towards the lower limit threshold of the red channel to green channel ratio and the lower limit threshold of the blue channel to green channel ratio. When the actual value ratio of the red channel to the green channel is greater than the typical value ratio of the red channel to the green channel, and the actual value ratio of the blue channel to the green channel is less than the typical value ratio of the blue channel to the green channel, the burning direction is determined to be towards the lower limit threshold of the red channel to green channel ratio and the lower limit threshold of the blue channel to green channel ratio. The upper limit threshold of the ratio of the color channel to the green channel is calibrated in the following directions: When the actual value ratio of the red channel to the green channel is less than the typical value ratio of the red channel to the green channel, and the actual value ratio of the blue channel to the green channel is greater than the typical value ratio of the blue channel to the green channel, the burning direction is determined to be calibrated towards the upper limit threshold of the ratio of the red channel to the green channel and the lower limit threshold of the ratio of the blue channel to the green channel; When the actual value ratio of the red channel to the green channel is less than the typical value ratio of the red channel to the green channel, and the actual value ratio of the blue channel to the green channel is less than the typical value ratio of the blue channel to the green channel, it is classified into the fourth scenario, and the burning direction is determined to be calibrated towards the upper limit threshold of the ratio of the red channel to the green channel and the upper limit threshold of the ratio of the blue channel to the green channel.
[0029] S14: Calculate the gain parameters of the module to be screened using the burning direction, calibrate the second white balance parameters of the module to be screened based on the gain parameters, and screen the module to be screened based on the calibrated second white balance parameters to determine whether it is qualified.
[0030] The gain values of the first, second, and third color channels are calculated based on the burning direction and written to the storage unit of the module to be screened. Simultaneously, they are written to the corresponding registers to verify whether the calibrated white balance data falls within the tolerance range, thus selecting qualified modules from the pool of modules to be screened. When calculating the gain parameters, the principle of channel gain not being less than 1 must be followed; that is, the gain values of the red, green, and blue channels, as well as the first, second, and third color channels, must not be less than 1. Specifically, taking the red channel as the first color channel, the green channel as the second color channel, and the blue channel as the third color channel as an example, the target calibration values for the red and blue channels are determined based on the determined burning direction. For example, if the burning direction points to a lower threshold such as R / G_Min or B / G_Min, the target value is that lower threshold; if it points to an upper threshold such as R / G_Max or B / G_Max, the target value is that upper threshold. Based on the target calibration value, calculate the theoretical gain value of the three color channels. For example, the theoretical gain value of a channel = the ratio of the target calibration value to the actual value of the channel, and process the theoretical gain value of the three channels based on the preset gain parameter principle. For example, a lower limit threshold normalization method can be used. First, find the lower limit threshold between the theoretical gain value R_Gain_Theory of the red channel and the theoretical gain value B_Gain_Theory of the blue channel, denoted as Min_Gain. If Min_Gain is greater than or equal to 1, the final gain parameters are determined by directly referencing the theoretical gain value: R_Gain = R_Gain_Theory, B_Gain = B_Gain_Theory, and the theoretical gain value G_Gain of the green channel = 1.0000. If Min_Gain is less than 1, the channels in the red and blue channels with theoretical gain values less than 1 are forced to be set to 1.0000, and the gain G_Gain of the green channel is set to the reciprocal of Min_Gain, i.e., G_Gain = 1 / Min_Gain. For channels whose theoretical gain is originally greater than 1, their value is divided by Min_Gain for proportional scaling to ensure that the final gain of all channels is greater than or equal to 1, while maintaining the relative proportions of the red, blue, and green channels consistent with the theoretical target.In addition, other methods can be used to process the gain parameter. For example, the channel with the smaller theoretical gain value can be dynamically selected as the new benchmark, and its actual gain can be set to 1. The other channel and the green channel can be adjusted accordingly by dividing by the theoretical value of the benchmark to ensure that the gain of all channels is not less than 1. Alternatively, the common factor scaling method can be used. By finding the lower limit threshold of all theoretical gains (including 1 in the green channel), its reciprocal can be calculated as a common scaling factor to synchronously amplify the theoretical gain of all channels, so that all gain values reach above 1 while maintaining the original proportional relationship. Alternatively, the dual-channel enhancement method can be used. The part of the theoretical gain greater than 1 in the red and blue channels can be directly retained, and the part of the theoretical gain less than 1 can be taken as its reciprocal and concentratedly compensated to the green channel, so that the green channel can uniformly bear all the weights that need to be relatively attenuated.
[0031] After calculating the gain parameters, the generated R_Gain, G_Gain, and B_Gain are burned into the storage unit of the module to be screened and simultaneously written into the corresponding register of the image sensor module. Then, the white balance parameters within the preset image area of the module to be screened after burning are acquired, and it is verified whether they fall within the tolerance range of the first white balance parameters. Specifically, the ratio of the actual values of the red channel to the green channel and the ratio of the actual values of the blue channel to the green channel of the module to be screened after burning are acquired. The acquisition and calculation methods are the same as those used in the previous steps for acquiring the second white balance data. These ratios are compared with the tolerance ranges R / G_Min, R / G_Max, B / G_Min, and B / G_Max in the first white balance data. It is determined whether the ratio of the actual values of the red channel to the green channel falls within the [R / G_Min, R / G_Max] interval, and whether the ratio of the actual values of the blue channel to the green channel falls within the [B / G_Min, B / G_Max] interval. If both conditions are met, the module to be screened is a qualified module; otherwise, it is an unqualified module.
[0032] Through the above steps, this embodiment improves screening efficiency by introducing a directional calibration mechanism and calculates gain parameters based on the burning direction and preset gain channel principle, effectively converging the consistency error of white balance parameters to the ideal range, significantly improving the color reproduction accuracy and stability of the product. At the same time, by flexibly configuring the preset deviation ratio threshold, this method can adapt to diverse verification standards and production needs.
[0033] Please see Figure 2 , Figure 2 This is a flowchart illustrating another embodiment of the sensor module screening method provided in this application.
[0034] S21: Obtain the typical white balance parameters of the sensor's reference module, and obtain the tolerance range of the typical white balance parameters based on the preset deviation ratio to generate the first white balance data.
[0035] This step is the same as step S11 above. Please refer to the relevant description of step S11 for details, which will not be repeated here.
[0036] S22: Collect the actual white balance parameters of the module to be screened in the preset image area and generate the second white balance data.
[0037] This step is the same as step S12 mentioned above. Please refer to the relevant description of step S12 for details, which will not be repeated here.
[0038] S23: Compare the ratio of the actual value of the first color channel to the ratio of the typical value of the second color channel, and compare the ratio of the actual value of the third color channel to the ratio of the typical value of the second color channel, and determine the burning direction of the module to be screened based on the comparison results.
[0039] After the parameter acquisition module completes the acquisition of the first white balance data and the second white balance data, the parameter processing module acquires these two sets of data for subsequent comparative analysis and burning direction determination. The first white balance data is reference module white balance data acquired under a standard light source, which at least includes a typical value ratio of a first color channel to a second color channel, a typical value ratio of a third color channel to the second color channel, and a tolerance range. The second white balance data is white balance data of a to-be-screened module, which at least includes an actual value ratio of the first color channel to the second color channel and an actual value ratio of the third color channel to the second color channel. Specifically, taking a red channel as the first color channel, a green channel as the second color channel, and a blue channel as the third color channel as an example, four deviation scenarios are divided according to comparison results of an actual value ratio R / G_Current of the red channel to the green channel and a typical value ratio R / G_Typical of the red channel to the green channel, as well as an actual value ratio B / G_Current of the blue channel to the green channel and a typical value ratio B / G_Typical of the blue channel to the green channel. Specifically, when R / G_Current > R / G_Typical and B / G_Current > B / G_Typical, it is a first scenario, indicating that both the red channel and the blue channel of the to-be-screened module are on the high side, and the entire image is purplish red; when R / G_Current > R / G_Typical and B / G_Current < B / G_Typical, it is a second scenario, indicating that the red channel of the to-be-screened module is on the high side, the blue channel is on the low side, and the image is in a reddish-yellow warm tone; when R / G_Current < R / G_Typical and B / G_Current > B / G_Typical, it is a third scenario, indicating that the red channel of the to-be-screened module is on the low side, the blue channel is on the high side, and the image is in a cyan-blue cool tone; when R / G_Current < R / G_Typical and B / G_Current < B / G_Typical, it is a fourth scenario, indicating that both the red channel and the blue channel of the to-be-screened module are on the low side, and the image is greenish.
[0040] Based on the above scenario segmentation results, the burning direction can be determined according to the principle of "calibrating to the lower limit threshold when the value is too high, and calibrating to the upper limit threshold when the value is too low". Specifically, the first scenario corresponds to calibration towards the lower limit threshold R / G_Min of the ratio of red channel to green channel and the lower limit threshold B / G_Min of the ratio of blue channel to green channel, so as to reduce the proportion of red and blue channels at the same time; the second scenario corresponds to calibration towards R / G_Min and the upper limit threshold B / G_Max of the ratio of blue channel to green channel, so as to reduce the red channel and increase the blue channel; the third scenario corresponds to calibration towards the upper limit thresholds R / G_Max and B / G_Min of the ratio of red channel to green channel, so as to increase the red channel and reduce the blue channel; the fourth scenario corresponds to calibration towards R / G_Max and B / G_Max, so as to increase the proportion of red and blue channels at the same time.
[0041] S24: Calculate the gain values of the first color channel, the second color channel, and the third color channel according to the burning direction, and generate gain parameters; wherein, the gain values of the first color channel, the second color channel, and the third color channel are all greater than or equal to 1.
[0042] The gain values of the first, second, and third color channels are calculated based on the burning direction. These gain values are then processed to generate gain parameters based on a preset requirement that the channel gain value is greater than or equal to 1. A target threshold can be set for the burning direction, and the theoretical gain values for the red, green, and blue channels are calculated based on this. For example, the theoretical gain value is calculated as the ratio of the target threshold to the actual channel value. If a theoretical gain value is less than 1, the theoretical gain values for all three color channels are processed.Specifically, taking the red channel as the first color channel, the green channel as the second color channel, and the blue channel as the third color channel as an example, the burning direction corresponding to the first scene is calibration towards R / G_Min and B / G_Min. This can increase the signal strength of the green channel, effectively reducing the weight of the red and blue channels. For example, the gain value R_Gain of the red channel and the gain value G_Gain of the green channel are set to 1. The theoretical gain value of the red channel is calculated as R_Gain_Theory = (R / G_Min) / (R / G_Current) and the theoretical gain value of the blue channel is calculated as B_Gain_Theory = (B / G_Min) / (B / G_Current). The gain value G_Gain of the green channel is the reciprocal of the smaller value between R_Gain_Theory and B_Gain_Theory, i.e., G_Gain = 1 / min(R_Gain_Theory, B_Gain_Theory); The second scenario corresponds to the burning direction where the red channel needs to be calibrated towards R / G_Min and the blue channel needs to be calibrated towards B / G_Max. In this case, it is ensured that the weight of the red channel relative to the green channel is effectively reduced. For example, since R_Gain = (R / G_Min) / (R / G_Current) < 1, R_Gain is set to 1. B_Gain = (B / G_Max) / (B / G_Current) > 1 conforms to the principle of preset gain parameters, so the calculation result of B_Gain is retained, and G_Gain is set to the reciprocal of R_Gain, i.e., G_Gain = (R / G_Current) / (R / G_Min); The third scenario corresponds to the burning direction where the red channel needs to be calibrated towards R / G_Max and the blue channel needs to be calibrated towards B / G_Min. In this case, the weight of the red channel can be increased while the green channel is increased to effectively reduce the weight of the blue channel. For example, R_Gain = (R / G_Max) / If (R / G_Current) > 1, it can be applied directly. If B_Gain = (B / G_Min) / (B / G_Current) < 1, it needs to be reset to 1. Set G_Gain to the reciprocal of B_Gain, i.e., G_Gain = (B / G_Current) / (B / G_Min). The burning direction corresponding to the fourth scenario is to calibrate towards R / G_Max and B / G_Max. At this time, the red channel and blue channel are boosted at the same time. For example, if G_Gain is set to 1, R_Gain = (R / G_Max) / (R / G_Current) > 1 and B_Gain = (B / G_Max) / (B / G_Current) > 1 can be applied directly.The calculated R_Gain, G_Gain, and B_Gain parameters are all retained to four decimal places, and the calibrated data can accurately fall within the tolerance range.
[0043] S25: Burn the gain parameters to the storage unit of the screening module and write them to the corresponding register simultaneously; screen the modules to be screened based on the burned second white balance parameters and tolerance range.
[0044] After completing the above calculations and processing, these gain parameters are programmed into the storage unit of the module to be screened, such as OTP (One-Time Programmable) or EEPROM (Electrically Erasable Programmable Read-Only Memory), and simultaneously written into the corresponding registers to ensure that the module can correctly load these calibration parameters and achieve white balance correction during subsequent imaging. Specifically, taking the red channel as the first color channel, the green channel as the second color channel, and the blue channel as the third color channel as an example, the OTP programming module encapsulates the gain values of the red channel, green channel, and blue channel according to the data format specified by the module through the I2C (Inter-Integrated Circuit) bus, writes them into the corresponding address area in the OTP storage unit of the module to be screened, and simultaneously writes the gain parameters into the registers corresponding to the current working state of the image sensor module; after writing to the registers, the module immediately outputs images according to the new gain parameters.
[0045] After programming is completed, the white balance parameters of the preset image area of the module to be screened are collected and compared with the tolerance range in the first white balance data to screen the module to be screened. Specifically, the data acquisition module collects all pixels of the preset image area of the module to be screened after programming and performs channel separation and statistics to obtain the white balance parameters. For example, the brightness values of all red pixels are counted and their arithmetic mean is calculated to obtain the statistical average value of the red channel, R_Verify_Avg. The brightness values of all green pixels are counted and their arithmetic mean is calculated to obtain the statistical average value of the green channel, G_Verify_Avg. The brightness values of all blue pixels are counted and their arithmetic mean is calculated to obtain the statistical average value of the blue channel, B_Verify_Avg. The ratio of the actual values of the red channel to the green channel, R / G_Verify = (R_Verify_Avg) / (G_Verify_Avg), and the ratio of the actual values of the blue channel to the green channel, B / G_Verify = (B_Verify_Avg) / (G_Verify_Avg), are calculated. R / G_Verify and B / G_Verify are used as the white balance parameters after burning. Finally, it is determined whether R / G_Verify is greater than or equal to R / G_Min and less than or equal to R / G_Max, and at the same time, it is determined whether B / G_Verify is greater than or equal to B / G_Min and less than or equal to B / G_Max. If both conditions are met, the module to be screened is a qualified module; otherwise, it is an unqualified module.
[0046] Through the above steps, this embodiment achieves high efficiency in the screening process by intelligently classifying deviation scenarios and directionally calculating gain parameters. At the same time, the flexible configuration mechanism of preset deviation ratio gives the method excellent scenario adaptability, enabling it to quickly respond to the verification needs of different projects and ultimately improve the stability of product imaging quality.
[0047] Based on the same concept, this application also proposes an electronic device capable of executing the sensor module screening method of any of the above embodiments. Please refer to [link to relevant documentation]. Figure 3 , Figure 3 This is a schematic diagram of an embodiment of the electronic device provided in this application. The electronic device includes a processor 31 and a memory 32.
[0048] The processor 31 executes the program instructions stored in the memory 32 to implement the steps of the screening method for any of the aforementioned sensor modules. In a specific implementation scenario, the electronic device may include, but is not limited to, a microcomputer or a server. In addition, the electronic device may also include mobile devices such as laptops and tablets, which are not limited here.
[0049] Specifically, processor 31 controls itself and memory 32 to implement the steps of any of the above embodiments. Processor 31 may also be referred to as a CPU (Central Processing Unit). Processor 31 may be an integrated circuit chip with signal processing capabilities. Processor 31 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor. Furthermore, processor 31 may be implemented using integrated circuit chips.
[0050] Based on the same concept, this application also proposes a computer-readable storage medium, please refer to... Figure 4 , Figure 4 This is a schematic diagram of an embodiment of the computer-readable storage medium provided in this application. The computer-readable storage medium 40 stores at least one program data 41, which is used to implement any of the methods described above. In one embodiment, the computer-readable storage medium 40 includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0051] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0052] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0053] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0054] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium.
[0055] The above are merely embodiments of this application and do not limit the scope of this patent application. Any equivalent structural or procedural changes made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of this application.
Claims
1. A method for screening sensor modules, characterized in that, The sensor module is used for image processing, and the screening method includes: Obtain the typical white balance parameters of the reference module of the sensor, and obtain the tolerance range of the typical white balance parameters based on a preset deviation ratio to generate first white balance data; and Collect the actual white balance parameters of the modules to be screened in the preset image area and generate second white balance data; The first white balance data and the second white balance data are compared, and the burning direction of the module to be screened is determined based on the comparison result. The gain parameter of the module to be screened is calculated using the burning direction. The second white balance parameter of the module to be screened is calibrated based on the gain parameter. The module to be screened is then screened to determine whether it is qualified based on the calibrated second white balance parameter.
2. The screening method according to claim 1, characterized in that, The first white balance data includes the ratio of typical values of the first color channel to the second color channel, the ratio of typical values of the third color channel to the second color channel, and the tolerance range; the second white balance data includes the ratio of actual values of the first color channel to the second color channel, and the ratio of actual values of the third color channel to the second color channel. The step of comparing the first white balance data and the second white balance data, and determining the burning direction of the module to be screened based on the comparison result, includes: Compare the ratio of the actual value to the typical value of the first color channel and the second color channel, and... The ratio of the actual value of the third color channel to the ratio of the typical value of the second color channel is compared, and the burning direction of the module to be screened is determined based on the comparison result.
3. The screening method according to claim 2, characterized in that, The step of comparing the ratio of the actual value to the typical value of the first color channel and the second color channel, and comparing the ratio of the actual value to the typical value of the third color channel and the second color channel, and determining the burning direction of the module to be screened based on the comparison results, includes: In response to the fact that the ratio of the actual value of the first color channel to the second color channel is greater than the ratio of the typical value, and the ratio of the actual value of the third color channel to the second color channel is greater than the ratio of the typical value, the burning direction is determined to be calibration towards the lower limit threshold of the first color channel and the lower limit threshold of the third color channel; In response to the fact that the ratio of the actual value of the first color channel to the second color channel is greater than the ratio of the typical value, and the ratio of the actual value of the third color channel to the second color channel is less than the ratio of the typical value, the burning direction is determined to be calibration towards the lower threshold of the first color channel and the upper threshold of the third color channel. In response to the fact that the ratio of the actual value of the first color channel to the second color channel is less than the ratio of the typical value, and the ratio of the actual value of the third color channel to the second color channel is greater than the ratio of the typical value, the burning direction is determined to be calibration towards the upper limit threshold of the first color channel and the lower limit threshold of the third color channel; In response to the fact that the ratio of the actual value of the first color channel to the second color channel is less than the ratio of the typical value, and the ratio of the actual value of the third color channel to the second color channel is less than the ratio of the typical value, the burning direction is determined to be calibration towards the upper limit threshold of the first color channel and the upper limit threshold of the third color channel; The tolerance range of the first white balance parameter includes the upper and lower thresholds of the first color channel and the upper and lower thresholds of the third color channel.
4. The screening method according to any one of claims 1 to 3, characterized in that, The steps of calculating the gain parameter of the module to be screened using the burning direction, calibrating the second white balance parameter of the module to be screened based on the gain parameter, and screening the module to be screened based on the calibrated second white balance parameter include: Based on the burning direction, the gain values of the first color channel, the second color channel, and the third color channel are calculated to generate the gain parameters; wherein, the gain values of the first color channel, the second color channel, and the third color channel are all greater than or equal to 1; The gain parameters are programmed into the storage unit of the screening module and simultaneously written into the corresponding registers; The modules to be screened are selected based on the second white balance parameters after programming and the tolerance range.
5. The screening method according to claim 4, characterized in that, The step of screening the modules to be screened based on the second white balance parameter after programming and the tolerance range includes: Obtain the second white balance parameter of the module to be screened after burning in the preset image area; In response to the second white balance parameter being within the tolerance range, the module to be screened is a qualified module; If the second white balance parameter is outside the tolerance range, the module to be screened is a non-compliant module.
6. The screening method according to claim 1, characterized in that, The step of obtaining the typical white balance parameters of the reference module of the sensor, and obtaining the tolerance range of the typical white balance parameters based on a preset deviation ratio to generate the first white balance data includes: Obtain the typical value ratio of the first color channel to the second color channel and the typical value ratio of the third color channel to the second color channel of the reference module; Based on the preset deviation ratio, calculate the lower and upper threshold values of the ratio of the typical values of the first color channel to the second color channel, and the upper and lower threshold values of the ratio of the typical values of the third color channel to the second color channel, and generate the tolerance range. The first white balance data is generated based on the tolerance range, the ratio of the typical values of the first color channel to the second color channel, and the ratio of the typical values of the third color channel to the second color channel.
7. The screening method according to claim 6, characterized in that, The preset deviation ratio ranges from 5% to 10%.
8. The screening method according to claim 1, characterized in that, The step of collecting the actual white balance parameters of the module to be screened in a preset image area and generating second white balance data includes: The first color channel value, the second color channel value, and the third color channel value are acquired in the preset image area; The ratio of the actual values of the first color channel to the second color channel is calculated based on the first color channel value and the second color channel value. The ratio of the actual values of the third color channel value and the second color channel value is calculated based on the third color channel value and the second color channel value. The second white balance data is generated based on the ratio of the actual values of the first color channel to the second color channel and the ratio of the actual values of the third color channel to the second color channel.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor coupled to each other, the processor being configured to execute program instructions stored in the memory to implement the sensor module screening method as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program data that can be executed to implement the sensor module screening method as claimed in any one of claims 1 to 8.
