A black level correction method, device, equipment and computer readable storage medium
By generating a random decimal in the black level correction method and rounding process, the problem of decreasing accuracy when converting black level correction value into an integer in the prior art is solved, and the black level correction accuracy is improved without increasing the image decimal places, thereby improving the image accuracy.
Patent Information
- Application Number
- CN202411930623.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-04
AI Technical Summary
When the existing black level correction method converts the black level correction value to an integer, the conventional method of removing the fractional part will greatly reduce the accuracy of the black level correction value, thereby reducing the image accuracy.
By first determining the black level correction value with a decimal width not less than 2, and generating a random decimal value whose value is in the preset interval and whose bit width is within the preset bit width, then rounding the black level correction value with random decimals superimposed is obtained to obtain a black level correction value without decimals, which is used to perform black level correction for the effective pixel area of the image to be processed.
Without increasing the decimal places of the image to be processed, the accuracy when "black level correction value is converted to an integer" is improved, which is conducive to improving image accuracy and reducing the accuracy loss of the black level correction value.
Smart Images

Figure CN119767166A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a black level correction method, device, equipment and a computer-readable storage medium. Background Art
[0002] Black level refers to the level of the image sensor's output signal when there is no light (theoretically, it should output a pure black level). Due to differences in the characteristics of image sensors and circuit interference, there may be errors in the black level, so the image sensor's output signal needs to be corrected (BLC).
[0003] The relevant black level correction method is: according to the level value of each pixel point in the black level area of the image, a black level correction value is obtained, and then the black level correction value is subtracted from the level value of the effective pixel area. Since the level value of the effective pixel area usually has only integer digits, when "subtracting the black level correction value from the level value of the effective pixel area", it is usually necessary to convert the black level correction value into an integer. However, the conventional "method of removing the decimal part" will greatly reduce the accuracy of the black level correction value, thereby reducing the image accuracy.
[0004] Therefore, how to provide a solution to the above technical problems is a problem that those skilled in the art need to solve at present. Summary of the invention
[0005] The purpose of the present invention is to provide a black level correction method, device, equipment and computer-readable storage medium. First, a black level correction value with a decimal width not less than 2 is determined, then a random decimal with a value in a preset interval and a bit width within the preset bit width is generated, and then the black level correction value superimposed with the random decimal is rounded to obtain a black level correction value without decimal places. The black level correction is performed on the effective pixel area of the image to be processed by the black level correction value without decimal places. Under the premise of not increasing the decimal places of the image to be processed, the accuracy of "converting the black level correction value into an integer" can be improved, thereby facilitating the improvement of image accuracy.
[0006] In order to solve the above technical problems, the present invention provides a black level correction method, comprising:
[0007] Determine a black level correction value with decimal places according to the level value of each pixel point in the black level area of the image to be processed, wherein the black level correction value has decimal places with a preset bit width, and the preset bit width is at least 2;
[0008] For any pixel to be corrected in the effective pixel area of the image to be processed, a random decimal value within a preset range is correspondingly generated;
[0009] For any random decimal corresponding to a pixel to be corrected, the superposition value of the black level correction value and the random decimal is adjusted according to the preset interval to obtain a black level correction value without decimals corresponding to the pixel to be corrected;
[0010] For any pixel to be corrected, the black level correction is performed on the pixel to be corrected by using the corresponding black level correction value without decimal places.
[0011] On the other hand, according to the level value of each pixel point in the black level area of the image to be processed, determining the black level correction value with decimal places includes:
[0012] Determine the average black level of each pixel in the black level area of the image to be processed, wherein the average black level has decimal places;
[0013] A denoising process is performed on a black level average value of a black level region to obtain a black level correction value with decimal places in the black level region.
[0014] On the other hand, performing denoising on the black level average value of the black level area to obtain the black level correction value with decimal places in the black level area includes:
[0015] According to the black level correction value of the image to be processed in the previous frame and the black level average value of the image to be processed in the current frame, the black level average value of the black level area of the image to be processed in the current frame is denoised to obtain the black level correction value with decimal places in the black level area.
[0016] On the other hand, according to the black level correction value of the image to be processed in the previous frame and the black level average value of the image to be processed in the current frame, the black level average value of the black level area of the image to be processed in the current frame is subjected to denoising, and the black level correction value with decimal places in the black level area is obtained, which includes:
[0017] According to the black level correction value of the image to be processed in the previous frame and the black level average value of the image to be processed in the current frame, denoising is performed on the black level average value of the black level area of the image to be processed in the current frame by using a first relational expression to obtain a black level correction value with decimal places in the black level area;
[0018] The first relational expression includes:
[0019] ;
[0020] Among them, n represents the image to be processed in the current frame, n-1 represents the image to be processed in the previous frame, and DFB n Indicates the black level correction value of the image to be processed in the current frame, DAB nIndicates the average black level of the image to be processed in the current frame, DFB n-1 It represents the black level correction value of the image to be processed in the previous frame, A is the first preset coefficient, B is the second preset coefficient, and A+B=1.
[0021] On the other hand, performing denoising on the black level average value of the black level area to obtain the black level correction value with decimal places in the black level area includes:
[0022] The product of the black level average value of the black level area and the preset coefficient is used as the black level correction value with decimal places in the black level area.
[0023] On the other hand, the black level region of the image to be processed includes a plurality of black level sub-regions, and the effective pixel region of the image to be processed includes a plurality of effective pixel sub-regions, and the black level sub-regions correspond to the effective pixel sub-regions one by one;
[0024] According to the level value of each pixel point in the black level area of the image to be processed, the black level correction value with decimal places is determined, including:
[0025] For any black level sub-region of the black level region of the image to be processed, determining a black level correction value with decimal places according to the level values of each pixel point in the black level sub-region;
[0026] For any random decimal corresponding to a pixel to be corrected, the superposition value of the black level correction value and the random decimal is adjusted according to the preset interval to obtain a black level correction value without decimals corresponding to the pixel to be corrected, including:
[0027] For any random decimal corresponding to a pixel to be corrected, a data precision adjustment is performed corresponding to the preset interval on the black level correction value corresponding to the random decimal and the superimposed value of the random decimal to obtain a black level correction value without decimal places corresponding to the pixel to be corrected, wherein the black level correction value corresponding to the random decimal refers to the black level correction value of the black level sub-region corresponding to the valid pixel sub-region to which the random decimal belongs, and the valid pixel sub-region to which the random decimal belongs refers to the valid pixel sub-region to which the pixel to be corrected corresponding to the random decimal belongs.
[0028] On the other hand, generating a random decimal number with a value within a preset interval includes:
[0029] Generate a random decimal value within a preset range through a linear feedback shift register
[0030] In order to solve the above technical problems, the present invention further provides a black level correction device, comprising:
[0031] A determination module, configured to determine a black level correction value having decimal places according to the level value of each pixel point in the black level area of the image to be processed, wherein the black level correction value has decimal places of a preset width, and the preset width is at least 2;
[0032] A generating module, for generating a random decimal having a value within a preset range for any pixel point to be corrected in the effective pixel area of the image to be processed;
[0033] A processing module, for adjusting the data precision of the black level correction value and the superposition value of the random decimal corresponding to any pixel to be corrected, corresponding to the preset interval, to obtain a black level correction value without decimals corresponding to the pixel to be corrected;
[0034] The correction module is used for performing black level correction on any pixel to be corrected by using a corresponding black level correction value without decimal places.
[0035] In order to solve the above technical problems, the present invention further provides a black level correction device, comprising:
[0036] Memory for storing computer programs;
[0037] A processor is used to implement the steps of the black level correction method described above when executing the computer program.
[0038] To solve the above technical problem, the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the black level correction method described above are implemented.
[0039] Beneficial effect: The present invention provides a black level correction method. After analysis and verification, it is found that after adding a random decimal (the bit width is the preset bit width, and the value is in a preset interval) to the black level correction value with a decimal bit width of a preset bit width, and then adjusting the data accuracy of the black level correction value to "correspond to the preset interval" and obtaining a black level correction value in integer form, the accuracy loss of the black level correction value can be reduced under a large number of samples. Therefore, in the present invention, a black level correction value with a decimal bit width of not less than 2 is first determined, and then a random decimal with a value in the preset interval and a bit width within the preset bit width is generated for any pixel point to be corrected, and then the black level correction value superimposed with the random decimal is adjusted for data accuracy to obtain a black level correction value without decimal places. By performing black level correction on the pixel point to be corrected through the corresponding black level correction value without decimal places, the accuracy of "converting the black level correction value to an integer" can be improved without increasing the decimal places of the image to be processed, thereby helping to improve image accuracy.
[0040] The present invention also provides a black level correction device, equipment and computer-readable storage medium, which have the same beneficial effects as the above black level correction method. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the relevant technologies and the drawings required for use in the embodiments are briefly introduced below. 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.
[0042] Figure 1 A schematic flow chart of a black level correction method provided by the present invention;
[0043] Figure 2 A schematic diagram of a DSP image processing process provided by the present invention;
[0044] Figure 3 A schematic diagram of the structure of an image array provided by the present invention;
[0045] Figure 4 A schematic flow chart of another black level correction method provided by the present invention;
[0046] Figure 5 A first black level correction accuracy verification flow chart provided by the present invention;
[0047] Figure 6 A second black level correction accuracy verification flow chart provided by the present invention;
[0048] Figure 7 A third black level correction accuracy verification flow chart provided by the present invention;
[0049] Figure 8 A fourth black level correction accuracy verification flow chart provided by the present invention;
[0050] Fig. 9 A schematic diagram of the structure of a black level correction device provided by the present invention;
[0051] Fig.10 A schematic structural diagram of a black level correction device provided by the present invention. DETAILED DESCRIPTION
[0052] The core of the present invention is to provide a black level correction method, device, equipment and computer-readable storage medium. First, a black level correction value with a decimal width not less than 2 is determined, and then a random decimal with a value in a preset interval and a bit width within the preset bit width is generated. Then, the black level correction value superimposed with the random decimal is rounded to obtain a black level correction value without decimal places. The black level correction is performed on the effective pixel area of the image to be processed by the black level correction value without decimal places. The accuracy of "converting the black level correction value to an integer" can be improved without increasing the decimal places of the image to be processed, thereby helping to improve the image accuracy.
[0053] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] Please refer to Figure 1 , Figure 1 A schematic flow chart of a black level correction method provided by the present invention, the black level correction method comprising:
[0055] S101: determining a black level correction value with decimal places according to the level value of each pixel point in the black level area of the image to be processed, wherein the black level correction value has decimal places with a preset bit width, and the preset bit width is at least 2;
[0056] Specifically, considering the technical problems in the above background technology, if the decimal part is directly discarded when converting the black level correction value with decimal places into an integer without decimal places, the maximum error introduced is 1. If the black level correction value with decimal places is converted into an integer by rounding, the maximum error introduced is 0.5. Both methods will introduce higher errors. After correcting the image with the black level correction value with a large error, the overall brightness of the image will deviate, and the deviation will be further amplified when passing through the digital gain, which may eventually cause problems such as color cast or flickering in the image.
[0057] Specifically, in order to solve the above technical problems, in the embodiment of the present invention, it is intended to reduce the precision loss in the process of "converting the black level correction value with decimal places into an integer", thereby improving the accuracy of black level correction. Therefore, in the embodiment of the present invention, the black level correction value with decimal places can be first determined according to the level value of each pixel point in the black level area of the image to be processed, so as to use it as the data basis for subsequent steps.
[0058] Among them, in order to ensure that the black level correction method in the embodiment of the present invention can retain more accuracy of the black level correction value compared to "rounding", the black level correction value initially determined in the embodiment of the present invention has decimal places with a preset bit width, and the preset bit width is at least 2, which is not limited in the embodiment of the present invention.
[0059] S102: For any pixel to be corrected in the effective pixel area of the image to be processed, a random decimal whose value is within a preset range is generated;
[0060] Specifically, after analysis and verification by the staff, it was found that for the black level correction value with decimal places, if in the process of processing any pixel point to be corrected in the effective pixel area of the image to be processed, a random decimal whose value is within a preset range is superimposed on the "black level correction value with decimal places", and then the data accuracy adjustment corresponding to the preset range is performed, the accuracy of the black level correction value can be improved to 2 with the accumulation of more samples. N One-quarter, for example, when the preset bit width N is 2, the accuracy of the black level correction value can be one-quarter, and the larger the bit width, the higher the accuracy. Therefore, in the embodiment of the present invention, for any pixel point to be corrected in the valid pixel area of the image to be processed, a random decimal with a value within the preset interval can be generated, so as to be used as the data basis for subsequent steps.
[0061] Specifically, the preset interval may be of various types and may be pre-set autonomously, for example, it may be [-0.5, 0.5], [0, 1] or [-1, 0], etc., which is not limited in the embodiment of the present invention.
[0062] S103: For any random decimal corresponding to a pixel to be corrected, adjusting the data precision of the superposition value of the black level correction value and the random decimal corresponding to a preset interval to obtain a black level correction value without decimals corresponding to the pixel to be corrected;
[0063] Specifically, after obtaining the random decimal, the superimposed value of the black level correction value and the random decimal can be adjusted for data precision corresponding to the preset interval to obtain a black level correction value without decimal places corresponding to the pixel to be corrected, wherein the superimposed random decimal generated randomly within the preset interval is equivalent to a random disturbance of the black level correction value. Such random disturbance will result in different processing results for some values that would have been "carried" or "discarded" due to the "data precision adjustment corresponding to the preset interval", thereby reducing the impact of "deterministic rounding" caused by the "data precision adjustment corresponding to the preset interval" based solely on the decimal part of the black level correction value itself, thereby retaining more information of the original black level correction value during the rounding process to a certain extent, that is, retaining more precision of the black level correction value.
[0064] Among them, "data precision adjustment corresponding to the preset interval" can be in multiple specific forms. For example, when the preset interval is [-0.5, 0.5], the corresponding data progress adjustment is "rounding processing"; when the preset interval is [0, 1], the corresponding data progress adjustment is "discarding all decimal places"; when the preset interval is [-1, 0], the corresponding data progress adjustment is "discarding decimal places and adding 1 to the integer places". The data precision adjustment corresponding to the preset interval can be set independently, and the embodiments of the present invention are not limited here.
[0065] S104: For any pixel to be corrected, perform black level correction on the pixel to be corrected by using the corresponding black level correction value without decimal places.
[0066] Specifically, after obtaining the black level correction value without decimal places, for any pixel to be corrected, the black level correction can be performed on the pixel to be corrected by using the corresponding black level correction value without decimal places. When the random sample is large enough (that is, there are enough pixels to be corrected), the average value of the black level correction value of the entire image to be processed can be made close to the initial black level correction value with decimal places, that is, the entire image to be processed can obtain a more accurate black level correction as a whole, thereby improving the image color cast and flickering phenomena.
[0067] The present invention provides a black level correction method. After analysis and verification, it is found that after adding a random decimal (the bit width is the preset bit width and the value is in a preset interval) to a black level correction value whose decimal bit width is a preset bit width, the black level correction value is adjusted for data precision "corresponding to the preset interval" and a black level correction value in integer form is obtained, which can reduce the precision loss of the black level correction value under more samples. Therefore, in the present invention, a black level correction value whose decimal bit width is not less than 2 is first determined, and then a random decimal whose value is in the preset interval and whose bit width is within the preset bit width is generated for any pixel point to be corrected, and then the black level correction value superimposed with the random decimal is adjusted for data precision to obtain a black level correction value without decimal places. The black level correction is performed on the pixel point to be corrected by the corresponding black level correction value without decimal places, so that the precision of "converting the black level correction value into an integer" can be improved without increasing the decimal places of the image to be processed, thereby facilitating the improvement of the image precision.
[0068] Based on the above embodiments:
[0069] As an optional embodiment, determining the black level correction value with decimal places according to the level value of each pixel point in the black level area of the image to be processed includes:
[0070] Determine the average black level of each pixel in the black level area of the image to be processed, wherein the average black level has decimal places;
[0071] The black level average value of the black level area is subjected to denoising to obtain a black level correction value with decimal places in the black level area.
[0072] Specifically, in order to better illustrate the embodiments of the present invention, please refer to Figure 2 and Figure 3 , Figure 2 A schematic diagram of a DSP image processing flow provided by the present invention, Figure 3 A schematic diagram of the structure of an image array provided by the present invention, in Figure 2 In the embodiment, the analog circuit generates a signal of the image to be processed and inputs it into the DSP (Digital Signal Processing), the black level correction unit can perform black level correction on the image to be processed, the digital gain unit can perform digital gain on the image to be processed, the bad pixel correction can correct the bad pixel of the image to be processed, and there can be other processing units in the digital signal processor, such as an AEC (Automatic Exposure Control) unit, etc., which is not limited in the embodiments of the present invention.
[0073] in, Figure 3 The schematic diagram of the structure of an image array of an image to be processed is shown in the figure. The rows and columns of the image to be processed are marked in the figure, and the pixel values of each pixel in the figure can be converted from analog to digital through ADC (Analog-to-Digital Converter) for digital signal processing. In addition to the black level area in the upper part, the area below the black level area in the image to be processed is the effective pixel area. The level value in the black level area can be used to generate the black level correction value. B in the image array represents blue, R represents red, Gb (Green-blue) and Gr (Green-red) are two different green pixels, Gb is usually next to the blue pixel, and Gr is usually next to the red pixel. In this way, the color information in the image can be captured and restored more accurately.
[0074] Specifically, since each pixel in the black level area is in an obscured state, the electrical average value of each pixel in the black level area can accurately represent the relatively accurate level value of the black level of each pixel in the image sensor. Therefore, in the embodiment of the present invention, the black level average value of each pixel in the black level area of the image to be processed can be first determined. Considering that the noise in the circuit may affect the black level average value, in order to improve the accuracy of the black level average value, in the embodiment of the present invention, the black level average value of the black level area can be denoised to obtain a black level correction value with decimal places in the black level area, and use it as the data basis for subsequent steps.
[0075] As an optional embodiment, performing denoising on the black level average value of the black level region to obtain the black level correction value with decimal places in the black level region includes:
[0076] According to the black level correction value of the image to be processed in the previous frame and the black level average value of the image to be processed in the current frame, the black level average value of the black level area of the image to be processed in the current frame is denoised to obtain the black level correction value with decimal places in the black level area.
[0077] Specifically, considering that the noise in the black level correction values of the previous and next two frames of images is relatively close, referring to the black level correction value of the image to be processed in the previous frame is helpful to better eliminate the noise in the black level average value of the black level area of the image to be processed in the current frame. Therefore, in an embodiment of the present invention, the black level average value of the black level area of the image to be processed in the current frame can be denoised according to the black level correction value of the image to be processed in the previous frame and the black level average value of the image to be processed in the current frame, so as to obtain a black level correction value with decimal places in the black level area.
[0078] Of course, in addition to this method, “performing denoising on the black level average value of the black level area to obtain the black level correction value with decimal places in the black level area” may also be other various methods, which are not limited in the embodiment of the present invention.
[0079] As an optional embodiment, according to the black level correction value of the image to be processed in the previous frame and the black level average value of the image to be processed in the current frame, the black level average value of the black level area of the image to be processed in the current frame is subjected to denoising, and the black level correction value with decimal places in the black level area is obtained, which includes:
[0080] According to the black level correction value of the image to be processed in the previous frame and the black level average value of the image to be processed in the current frame, denoising is performed on the black level average value of the black level area of the image to be processed in the current frame by using the first relational expression to obtain the black level correction value with decimal places in the black level area;
[0081] The first relation includes:
[0082] ;
[0083] Among them, n represents the image to be processed in the current frame, n-1 represents the image to be processed in the previous frame, and DFB n Indicates the black level correction value of the image to be processed in the current frame, DAB n Indicates the average black level of the image to be processed in the current frame, DFB n-1 It represents the black level correction value of the image to be processed in the previous frame, A is the first preset coefficient, B is the second preset coefficient, and A+B=1.
[0084] Specifically, the first preset coefficient and the second preset coefficient can be set independently. For example, the first preset coefficient and the second preset coefficient can make the above formula present as follows:
[0085] ;
[0086] Among them, 2 B Represents the preset filter coefficient, and B is the preset value that can be configured through the register.
[0087] Specifically, the first relational expression above actually expresses the process of IIR (Infinite Impulse Response) filtering. IIR filtering can achieve denoising efficiently and accurately.
[0088] Of course, in addition to the specific forms described above, "denoising the black level average value of the black level area of the image to be processed in the current frame according to the black level correction value of the image to be processed in the previous frame and the black level average value of the image to be processed in the current frame to obtain the black level correction value with decimal places in the black level area" may also be in many other forms, and the embodiments of the present invention are not limited here.
[0089] As an optional embodiment, performing denoising on the black level average value of the black level region to obtain the black level correction value with decimal places in the black level region includes:
[0090] The product of the black level average value of the black level area and the preset coefficient is used as the black level correction value with decimal places in the black level area.
[0091] Specifically, by multiplying the black level average value of the black level area by a preset coefficient, the purpose of denoising the black level average value can also be achieved, and the amount of calculation is small.
[0092] Of course, in addition to this method, the black level average value may be denoised in many other ways, which are not limited in the embodiment of the present invention.
[0093] As an optional embodiment, the black level region of the image to be processed includes a plurality of black level sub-regions, the effective pixel region of the image to be processed includes a plurality of effective pixel sub-regions, and the black level sub-regions correspond to the effective pixel sub-regions one by one;
[0094] According to the level value of each pixel point in the black level area of the image to be processed, the black level correction value with decimal places is determined, including:
[0095] For any black level sub-region of the black level region of the image to be processed, a black level correction value with decimal places is determined according to the level value of each pixel point in the black level sub-region;
[0096] For any random decimal corresponding to a pixel to be corrected, the superposition value of the black level correction value and the random decimal is adjusted according to the preset interval, and the black level correction value without decimals corresponding to the pixel to be corrected is obtained, which includes:
[0097] For any random decimal corresponding to a pixel to be corrected, a data precision adjustment is performed corresponding to a preset interval on the black level correction value corresponding to the random decimal and the superimposed value of the random decimal, so as to obtain a black level correction value without decimal places corresponding to the pixel to be corrected, wherein the black level correction value corresponding to the random decimal refers to: the black level correction value of the black level sub-region corresponding to the valid pixel sub-region to which the random decimal belongs, and the valid pixel sub-region to which the random decimal belongs refers to the valid pixel sub-region to which the pixel to be corrected corresponding to the random decimal belongs.
[0098] Specifically, in order to perform black level correction more accurately, the black level area can be divided into multiple black level sub-areas, and the effective pixel area can be divided into multiple effective pixel sub-areas. The black level sub-areas correspond to the effective pixel sub-areas one by one. Then, the black level correction value can be generated for the corresponding effective pixel sub-area through the black level sub-area and the black level correction can be performed on the corresponding effective pixel sub-area.
[0099] There are many ways to group the black level areas and the effective pixel areas, for example, they can be grouped according to color arrangement, ADC structure, layout structure, etc., which is not limited in the embodiments of the present invention.
[0100] As an optional embodiment, generating a random decimal whose value is within a preset interval includes:
[0101] A random decimal number with a value within a preset interval is generated through a linear feedback shift register.
[0102] Specifically, a random decimal number with a value within a preset range can be generated efficiently and stably through a LFSR (Linear-Feedback Shift Register).
[0103] Of course, in addition to the linear feedback shift register, a random decimal whose value is within a preset interval may also be generated in other forms, which is not limited in the embodiment of the present invention.
[0104] As an optional embodiment, the linear feedback shift register includes:
[0105] ;
[0106] Among them, SEQ[22:0] is a random sequence with a bit width of 23 bits, SEQ[21:0] is the 0th to 21st bits of the random sequence, SEQ
[22] is the 22nd bit of the random sequence, SEQ
[17] is the 17th bit of the random sequence, xor is an exclusive OR operation, DITHER[5:0] is a random decimal, SEQ[4] is the 4th bit of the random sequence, CNT[4:0] is a loop counter with a bit width of 5 bits and used to count at each clock, and CNT[4] is the 4th bit of the loop counter.
[0107] Specifically, a random decimal in the range of [-16 / 32:15 / 32] with a step of 1 / 32 can be obtained through the above linear feedback shift register.
[0108] Of course, in addition to the above specific forms, the linear feedback shift register may also be in other forms, which are not limited in the embodiments of the present invention.
[0109] Specifically, in order to better illustrate the embodiments of the present invention, please refer to Figure 4 , Figure 4 A flow chart of another black level correction method provided by the present invention is provided, wherein in the data format SM.N, S represents a sign bit (for example, positive or negative), M is an integer bit, and N is a decimal bit. After obtaining a black level correction value, the black level correction unit can use a black level correction (module) to subtract the black level correction value from the pixel value in the input image (the format can be SM.0), thereby realizing black level correction and obtaining an output image (the format can be SM.0). The process of obtaining the black level correction value is as follows: first, a black level average value of a black level area is obtained by black level average value statistics (module) (the format can be SM.N), then a black level correction value calculation (module) is used to perform denoising to obtain a black level correction value (the format can be SM.N), and finally, a randomization + rounding process (module) is used to perform random decimal superposition and rounding on the black level correction value to obtain an integer black level correction value.
[0110] Specifically, two specific embodiments are listed here to verify the accuracy of the black level correction method in the embodiment of the present invention:
[0111] Example 1: Figure 5 As shown, Figure 5 This is a flow chart for verifying the first black level correction accuracy provided by the present invention. If the black level correction value calculated by the IIR filtering algorithm is 10.75 ( ), plus After the DITHER (random decimal) value, the result will be In the range of If the random sample is large enough, the probability of each value in the range will be very close. ; Then round the result to the nearest integer. The values in the range are rounded to 10, accounting for 25%; The values in the range are rounded to 11, accounting for 75%. Therefore, 25% of the pixels to be corrected use a black level correction value of 10, and 75% of the pixels to be corrected use a black level correction value of 11. The average correction amplitude of the entire image is 10*0.25+11*0.75=10.75, which avoids the errors caused by other methods and improves the image color cast and flickering.
[0112] Example 2: Figure 6 As shown, Figure 6 The second black level correction accuracy verification flow chart provided by the present invention, if the calculated black level correction value is 5.375 ( ), plus After the DITHER value, the result will be In the range of If the random sample is large enough, the probability of each value in the range will be very close. Then round the result to The values in the range are rounded to 5, accounting for 62.5%; The values in the range are rounded to 6, accounting for 37.5%. Therefore, 62.5% of the pixels to be corrected use a black level correction value of 5, and 37.5% of the pixels to be corrected use a black level correction value of 6. The average correction amplitude of the entire image is 5*0.625+6*0.375=5.375, which avoids the errors caused by other methods and improves the image color cast and flickering.
[0113] Example 3: Figure 7 As shown, Figure 7This is a third black level correction accuracy verification flow chart provided by the present invention. If the black level correction value calculated by the IIR filtering algorithm is 10.75 ( ), plus After the DITHER (random decimal) value, the result will be In the range of If the random sample is large enough, the probability of each value in the range will be very close. ; Then the result is processed by "truncate the decimal places", The value in the range is adjusted to 11, accounting for 75%; The value in the range is adjusted to 10, accounting for 25%. Therefore, 75% of the pixels to be corrected use a black level correction value of 11, and 25% of the pixels to be corrected use a black level correction value of 10. The average correction amplitude of the entire image is 11*0.75+10*0.25=10.75, which avoids the errors caused by other methods and improves the image color cast and flickering.
[0114] Example 4: Figure 8 As shown, Figure 8 This is a fourth black level correction accuracy verification flow chart provided by the present invention. If the black level correction value calculated by the IIR filtering algorithm is 10.75 ( ),minus The DITHER (random decimal) value (equivalent to adding The result will be in In the range of If the random sample is large enough, the probability of each value in the range will be very close. ; Then round the result to the nearest integer. The value in the range is adjusted to 11, accounting for 75%; The value in the range is adjusted to 10, accounting for 25%. Therefore, 25% of the pixels to be corrected use a black level correction value of 10, and 75% of the pixels to be corrected use a black level correction value of 11. The average correction amplitude of the entire image is 10*0.25+11*0.75=10.75, which avoids the errors caused by other methods and improves the image color cast and flickering.
[0115] Please refer to Fig. 9 , Fig. 9 A schematic diagram of the structure of a black level correction device provided by the present invention, the black level correction device comprises:
[0116] A determination module 91 is used to determine a black level correction value with decimal places according to the level value of each pixel point in the black level area of the image to be processed, wherein the black level correction value has decimal places with a preset width, and the preset width is at least 2;
[0117] A generating module 92 is used to generate a random decimal whose value is within a preset interval for any pixel to be corrected in the valid pixel area of the image to be processed, wherein the preset interval is: [-0.5, 0.5], and the bit width of the random decimal is the preset bit width;
[0118] The processing module 93 is used for rounding off the superposition value of the black level correction value and the random decimal corresponding to any pixel to be corrected, so as to obtain the black level correction value without decimals corresponding to the pixel to be corrected;
[0119] The correction module 94 is used for performing black level correction on any pixel to be corrected by using the corresponding black level correction value without decimal places.
[0120] For the introduction of the black level correction device provided by the embodiment of the present invention, please refer to the aforementioned embodiment of the black level correction method, and the embodiment of the present invention will not be described in detail here.
[0121] Please refer to Fig.10 , Fig.10 A schematic diagram of the structure of a black level correction device provided by the present invention, the black level correction device comprises:
[0122] A memory 101, used for storing computer programs;
[0123] The processor 102 is used to implement the steps of the black level correction method in the above embodiment when executing the computer program.
[0124] For an introduction to the black level correction device provided by the embodiment of the present invention, please refer to the aforementioned embodiment of the black level correction method, and the embodiment of the present invention will not be described in detail here.
[0125] The present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the black level correction method in the above-mentioned embodiment are implemented.
[0126] For an introduction to the computer-readable storage medium provided in the embodiment of the present invention, please refer to the aforementioned embodiment of the black level correction method, and the embodiment of the present invention will not be described in detail here.
[0127] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should also be noted that in this specification, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or equipment including the element.
[0128] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A black level correction method, characterized in that: include: Determine a black level correction value with decimal places according to the level value of each pixel point in the black level area of the image to be processed, wherein the black level correction value has decimal places with a preset bit width, and the preset bit width is at least 2; For any pixel to be corrected in the effective pixel area of the image to be processed, a random decimal value within a preset range is correspondingly generated; For any random decimal corresponding to a pixel to be corrected, the superposition value of the black level correction value and the random decimal is adjusted according to the preset interval to obtain a black level correction value without decimals corresponding to the pixel to be corrected; For any pixel to be corrected, the black level correction is performed on the pixel to be corrected by using the corresponding black level correction value without decimal places.
2. The black level correction method according to claim 1, characterized in that: According to the level value of each pixel point in the black level area of the image to be processed, the black level correction value with decimal places is determined, including: Determine the average black level of each pixel in the black level area of the image to be processed, wherein the average black level has decimal places; A denoising process is performed on a black level average value of a black level region to obtain a black level correction value with decimal places in the black level region.
3. The black level correction method according to claim 2, characterized in that: Denoising the black level average value of the black level region to obtain a black level correction value with decimal places in the black level region includes: According to the black level correction value of the image to be processed in the previous frame and the black level average value of the image to be processed in the current frame, the black level average value of the black level area of the image to be processed in the current frame is denoised to obtain the black level correction value with decimal places in the black level area.
4. The black level correction method according to claim 3, characterized in that: According to the black level correction value of the image to be processed in the previous frame and the black level average value of the image to be processed in the current frame, denoising is performed on the black level average value of the black level area of the image to be processed in the current frame, and the black level correction value with decimal places in the black level area is obtained, which includes: According to the black level correction value of the image to be processed in the previous frame and the black level average value of the image to be processed in the current frame, denoising is performed on the black level average value of the black level area of the image to be processed in the current frame by using a first relational expression to obtain a black level correction value with decimal places in the black level area; The first relational expression includes: ; Among them, n represents the image to be processed in the current frame, n-1 represents the image to be processed in the previous frame, and DFB n Indicates the black level correction value of the image to be processed in the current frame, DAB n Indicates the average black level of the image to be processed in the current frame, DFB n-1 It represents the black level correction value of the image to be processed in the previous frame, A is the first preset coefficient, B is the second preset coefficient, and A+B=1.
5. The black level correction method according to claim 2, characterized in that: Denoising the black level average value of the black level region to obtain a black level correction value with decimal places in the black level region includes: The product of the black level average value of the black level area and the preset coefficient is used as the black level correction value with decimal places in the black level area.
6. The black level correction method according to claim 1, characterized in that: The black level region of the image to be processed includes a plurality of black level sub-regions, and the effective pixel region of the image to be processed includes a plurality of effective pixel sub-regions, and the black level sub-regions correspond to the effective pixel sub-regions one by one; According to the level value of each pixel point in the black level area of the image to be processed, the black level correction value with decimal places is determined, including: For any black level sub-region of the black level region of the image to be processed, determining a black level correction value with decimal places according to the level values of each pixel point in the black level sub-region; For any random decimal corresponding to a pixel to be corrected, the superposition value of the black level correction value and the random decimal is adjusted according to the preset interval to obtain a black level correction value without decimals corresponding to the pixel to be corrected, including: For any random decimal corresponding to a pixel to be corrected, a data precision adjustment is performed corresponding to the preset interval on the black level correction value corresponding to the random decimal and the superimposed value of the random decimal to obtain a black level correction value without decimal places corresponding to the pixel to be corrected, wherein the black level correction value corresponding to the random decimal refers to the black level correction value of the black level sub-region corresponding to the valid pixel sub-region to which the random decimal belongs, and the valid pixel sub-region to which the random decimal belongs refers to the valid pixel sub-region to which the pixel to be corrected corresponding to the random decimal belongs.
7. The black level correction method according to any one of claims 1 to 6, characterized in that: Generating a random decimal number with a value within a preset range includes: A random decimal number with a value within a preset interval is generated through a linear feedback shift register.
8. A black level correction device, characterized in that: include: A determination module, configured to determine a black level correction value having decimal places according to the level value of each pixel point in the black level area of the image to be processed, wherein the black level correction value has decimal places of a preset width, and the preset width is at least 2; A generating module, for generating a random decimal having a value within a preset range for any pixel point to be corrected in the effective pixel area of the image to be processed; A processing module, for adjusting the data precision of the black level correction value and the superposition value of the random decimal corresponding to any pixel to be corrected, corresponding to the preset interval, to obtain a black level correction value without decimals corresponding to the pixel to be corrected; The correction module is used for performing black level correction on any pixel to be corrected by using a corresponding black level correction value without decimal places.
9. A black level correction device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the black level correction method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the black level correction method according to any one of claims 1 to 7 are implemented.