Black level correction method and device, computer readable storage medium, terminal
By chunking the image and calculating the black level value according to the brightness of the black-blocking pixels in each area, the problem of low accuracy of image values after black level correction in the prior art is solved, the accuracy of the image is improved and color cast and flickering are avoided.
Patent Information
- Application Number
- CN202110977445.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-24
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2041-08-24
AI Technical Summary
In the prior art, the image value output after black level correction is low in accuracy, and image color cast and flicker are prone to occur.
By blocking the current frame image to be corrected in the image black level in a set direction (row direction or column direction), several block areas are obtained, each area includes photosensitive pixels and black-blocking pixels. Then, the black level value of the black level in the area is calculated based on the brightness of the black-blocking pixels in each area, and the image black level correction is performed on the photosensitive pixels in the area.
By considering the differences between different regions, the region-specific black level values are used for correction, which improves the accuracy of the image values obtained after the black level correction, effectively avoiding image color casts and flickering.
Smart Images

Figure CN115720299B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of image processing technology, and in particular to a black level correction method and device, a computer-readable storage medium, and a terminal. Background Art
[0002] In the process of image processing, it is usually necessary to perform black level correction on the image collected by the image sensor. At present, when performing black level correction, the black level average value of the black level of the black level pixel area is usually calculated by masking the black pixels of the black pixel area, and then the black level correction is performed by subtracting the calculated black level average value from each pixel in the photosensitive array pixel area.
[0003] However, the accuracy of the image value outputted by the above black level correction method is low. Summary of the invention
[0004] The technical problem solved by the embodiments of the present invention is how to improve the accuracy of image values obtained after black level correction.
[0005] To solve the above technical problems, an embodiment of the present invention provides a black level correction method, comprising: obtaining a current frame image to be subjected to image black level correction; dividing all pixels of the current frame image into blocks along a set direction to obtain a plurality of block areas, each block area including photosensitive pixels and black-masked pixels, and the set direction is a row direction or a column direction; for each block area of the current frame image, obtaining a black level value of the area according to the brightness of the black-masked pixels in the area; for each block area of the current frame image, using the black level value of the area to perform image black level correction on the brightness of the photosensitive pixels in the area to obtain a corrected image.
[0006] Optionally, dividing all pixels of the current frame image into blocks along a set direction includes: taking a first edge domain and a second edge domain at both ends of the current frame image respectively along the set direction; calculating the absolute value of the difference between the black level value of the black-masked pixels in the first edge domain and the black level value of the black-masked pixels in the second edge domain; determining the number of blocks according to the absolute value of the difference, wherein the absolute value of the difference is positively correlated with the number of blocks; and dividing all pixels of the current frame image into blocks along the set direction according to the determined number of blocks.
[0007] Optionally, determining the number of blocks based on the absolute value of the difference includes: obtaining a plurality of preset interval ranges, each interval range corresponding to the number of blocks; determining the number of blocks based on the interval range in which the absolute value of the difference lies, so that after dividing the blocks, the difference in black level values of adjacent areas is less than a preset first value.
[0008] Optionally, the black level values of the black pixels in each area are obtained in the following manner: if the set direction is the row direction, some rows of black pixels are selected from all rows of black pixels; based on the brightness of the selected some rows of black pixels, the black level values of the black pixels corresponding to each area are calculated respectively.
[0009] Optionally, selecting some rows of black-masked pixels from all rows of black-masked pixels includes: selecting some rows of black-masked pixels in the middle position from all rows of black-masked pixels.
[0010] Optionally, selecting some rows of black-masked pixels from all rows of black-masked pixels includes: selecting, from all rows of black-masked pixels, black-masked pixels that are in the middle and whose number of rows is half of the number of rows of all black-masked pixels.
[0011] Optionally, the method of selecting some rows of black pixels from all rows of black pixels includes: if the set direction is the row direction, calculating the brightness of each row of black pixels respectively; selecting the minimum value of the brightness of all rows of black pixels, and calculating the difference between the brightness value of each row of black pixels and the minimum value respectively; and based on the difference between the brightness value of each row of black pixels and the minimum value, selecting the black pixels of the rows where the difference is less than a preset second value.
[0012] Optionally, the calculating the brightness value of each row of black-masked pixels includes: for each row of black-masked pixels, taking an average of the brightness values of all black-masked pixels in the row as the brightness value of the black-masked pixels in the row.
[0013] Optionally, for each area of the current frame image, the black level value of the area is used to perform image black level correction on the brightness of the photosensitive pixels in the area to obtain a corrected image, including: for each area of the current frame image, subtracting the black level value of the area from the brightness of the photosensitive pixels in the area to perform image black level correction; and obtaining the corrected image based on the brightness of the photosensitive pixels obtained after the image black level correction is performed on each area.
[0014] Optionally, for each area of the current frame image, the black level value of the area is obtained according to the brightness of the black-masked pixels in the area, including: obtaining the black level values of each block area in the previous frame image; adjusting the black level values of each block area in the current frame image according to the black level values of each block area in the previous frame image, and using the adjusted black level values of each block area as the black level values of each area of the current frame image.
[0015] Optionally, the black level values of each block area in the current frame image are adjusted according to the black level values of each block area in the previous frame image, and the adjusted black level values of each block area are used as the black level values of each block area in the current frame image, including: obtaining a first weight corresponding to the previous frame image and a second weight corresponding to the current frame image; for each block area, using the first weight to weight the black level value of the block area in the previous frame image to obtain a first weighted result, and using the second weight to weight the black level value of the block area in the current frame image to obtain a second weighted result; and using the sum of the first weighted result and the second weighted result as the black level value of the block area.
[0016] Optionally, for each area of the current frame image, the black level value of the area is used to perform image black level correction on the brightness of the photosensitive pixels in the area to obtain a corrected image, including: for each area of the current frame, the photosensitive pixels and black-masked pixels in each area are grouped according to color channels; for pixels of each group of color channels in each area, the black level values of the black-masked pixels of the same color channel are used to perform image black level correction on the photosensitive pixels to obtain the corrected image.
[0017] An embodiment of the present invention also provides a black level correction device, comprising: an acquisition unit, used to acquire a current frame image to be subjected to image black level correction; a blocking unit, used to block all pixels of the current frame image along a set direction to obtain a plurality of block areas, each block area includes photosensitive pixels and black-masked pixels, and the set direction is a row direction or a column direction; a calculation unit, used to obtain a black level value of each block area of the current frame image according to the brightness of the black-masked pixels in the area; and a correction unit, used to perform image black level correction on the brightness of the photosensitive pixels in the area using the black level value of the area for each block area of the current frame image, to obtain a corrected image.
[0018] An embodiment of the present invention further provides a computer-readable storage medium, which is a non-volatile storage medium or a non-transient storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above black level correction methods are executed.
[0019] An embodiment of the present invention further provides a terminal, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the steps of any one of the above black level correction methods when running the computer program.
[0020] Compared with the prior art, the technical solution of the embodiment of the present invention has the following beneficial effects:
[0021] Along the set direction, all pixels of the current frame image to be subjected to image black level correction are divided into blocks to obtain a plurality of block areas, each of which includes photosensitive pixels and black-masked pixels. For each block area, when performing image black level correction on the photosensitive pixels of the block area, the adopted black level value is obtained according to the brightness of the black-masked pixels in the area, so that the black level value adopted in each block area is obtained according to the black-masked pixels in the block area, so that the differences between different areas can be considered. Compared with all photosensitive array pixel areas being corrected with a uniform black level value, the accuracy of the image value obtained after the black level correction can be improved, and the image color cast and flickering can be effectively avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 is a schematic diagram of pixel distribution in an image sensor in an embodiment of the present invention;
[0023] Figure 2 is a flow chart of a black level correction method in an embodiment of the present invention;
[0024] Figure 3 is a schematic diagram of pixel block in an embodiment of the present invention;
[0025] Figure 4 It is a structural schematic diagram of a black level correction device in an embodiment of the present invention. DETAILED DESCRIPTION
[0026] Reference Figure 1 , a schematic diagram of pixel distribution in an image sensor in an embodiment of the present invention is given. Taking a complementary metal oxide semiconductor (CMOS) sensor as an example, it usually includes a shading area and a photosensitive area. Among them, the blackening effect is generally achieved by process metal routing, and a blackened pixel area is obtained, wherein the pixels corresponding to the area of the process metal routing are called blackened pixels, or dark pixels; the blackened area can also be called a shading area. The photosensitive area usually refers to the pixels that actually participate in imaging during imaging.
[0027] As mentioned above, at present, when calibrating the black level, the black-masked pixels of the black-masked pixel area are usually used to calculate the black level average value of the black-masked pixel area, and then the black level correction is performed by subtracting the calculated black level average value from each pixel in the photosensitive array pixel area. The image value output by the above black level correction method has low accuracy, and the image obtained after the black level correction is prone to color cast and flickering.
[0028] It has been found through research that the accuracy of the image value output by the black level correction method is low, and the image color cast and flickering are prone to occur. The reason is that the voltage in the analog-to-digital (AD) conversion circuit design of the image sensor is unilaterally driven, resulting in differences in the voltages obtained by different columns from left to right during the AD conversion process, thereby making the data (such as brightness) obtained after the final conversion between columns different. In the prior art, when black level correction is performed on each pixel in the photosensitive pixel area, the same black level average value is subtracted from all photosensitive pixels, which cannot eliminate the column area differences of the photosensitive array pixels, resulting in low accuracy of the image value obtained after black level correction.
[0029] To solve the above problem, in an embodiment of the present invention, all pixels of the current frame image to be subjected to image black level correction are divided into blocks along a set direction to obtain a plurality of block areas, each of which includes photosensitive pixels and black-masked pixels. For each block area, when performing image black level correction on the photosensitive pixels of the block area, the black level value used is obtained according to the brightness of the black-masked pixels in the area, so that the black level value used in each block area is obtained according to the black-masked pixels in the block area. Therefore, the differences between different areas can be taken into account. Compared with the case where all photosensitive array pixel areas are corrected using a uniform black level value, the accuracy of the image value obtained after the black level correction can be improved, and the image color cast and flickering can be effectively avoided.
[0030] In order to make the above-mentioned purposes, features and beneficial effects of the embodiments of the present invention more obvious and understandable, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0031] Reference Figure 2 , a flow chart of a black level correction method in an embodiment of the present invention is given. The black level correction method provided in an embodiment of the present invention may specifically include the following steps:
[0032] Step S21, obtaining a current frame image to be subjected to image black level correction.
[0033] Step S22, dividing all pixels of the current frame image into blocks along a set direction to obtain a plurality of block areas.
[0034] In a specific implementation, when all pixels of the current frame image are divided into blocks, the setting direction is related to the distribution of photosensitive pixels and black-masked pixels in the image. The setting direction can be a row direction or a column direction, and it is only necessary to ensure that each obtained area includes photosensitive pixels and black-masked pixels.
[0035] When the distribution of black-masked pixels and photosensitive pixels in the image sensor is as follows Figure 1 When the black-masked pixels and the light-sensitive pixels are distributed in rows, all pixels of the current frame image can be divided into blocks along the row direction to obtain N blocks of areas. Figure 3 The pixel block diagram is given, and each block area includes one or more columns. Thus, the black-masked pixel area is divided into N blocks along the row direction, and the photosensitive pixels are also divided into N blocks along the row direction, and each column of pixels includes black-masked pixels and photosensitive pixels.
[0036] In a specific implementation, when the black-masked pixels and photosensitive pixels in the image sensor are distributed in columns, all pixels of the current frame image can be divided into blocks along the column direction to obtain several block areas, each block area includes one or more rows, and each row of pixels includes black-masked pixels and photosensitive pixels.
[0037] Step S23, for each area of the current frame image, obtain the black level value of the area according to the brightness of the black-masked pixels in the area.
[0038] For example, continue to refer to Figure 3 The black-masked pixel area is divided into N blocks along the row direction. For each block of black-masked pixels, the black level value in the block is obtained according to the brightness of the black-masked pixels in the block, which are recorded as Xd1, Xd2, ..., XdN-1, XdN respectively.
[0039] Step S24, for each area of the current frame image, use the black level value of the area to perform image black level correction on the brightness of the photosensitive pixels in the area to obtain a corrected image.
[0040] In a specific implementation, for each area of the current frame image, the brightness of the photosensitive pixels in the area can be subtracted from the black level value of the area to perform image black level correction; based on the brightness of the photosensitive pixels obtained after the image black level correction is performed on each area, the corrected image is obtained.
[0041] For example, continue to refer to Figure 3 For each area of the current frame image, when performing image black level correction on the brightness of the photosensitive pixels in each area, the following method can be used:
[0042] For the photosensitive pixels in the A1 area, the black level correction calculation method is: P_A1(i)–Xd1. P_A1(i) is the brightness of the photosensitive pixels in the A1 area, and Xd1 is the black level value corresponding to the A1 area.
[0043] For the photosensitive pixels in the A2 area, the black level correction calculation method is: P_A2(i)–Xd2. P_A2(i) is the brightness of the photosensitive pixels in the A2 area, and Xd2 is the black level value corresponding to the A2 area.
[0044] …
[0045] For the photosensitive pixels in the AN area, the black level correction calculation method is: P_AN(i)–XdN. P_AN(i) is the brightness of the photosensitive pixels in the AN area, and XdN is the black level value corresponding to the AN area.
[0046] Wherein, i represents different photosensitive pixel positions, i=1, 2, ..., M, and M is a positive integer.
[0047] For example, the first block area includes the black-masked pixels in the X1 area and the photosensitive pixels in the A1 area; the second block area includes the black-masked pixels in the X2 area and the photosensitive pixels in the A2 area; the N-1 block area includes the black-masked pixels in the XN-1 area and the photosensitive pixels in the AN-1 area; the N block area includes the black-masked pixels in the XN area and the photosensitive pixels in the AN area.
[0048] From the above, it can be seen that along the set direction, all pixels of the current frame image to be subjected to image black level correction are divided into blocks to obtain several block areas, each of which includes photosensitive pixels and black-masked pixels. For each block area, when performing image black level correction on the photosensitive pixels of the block area, the black level value used is obtained according to the brightness of the black-masked pixels in the area, so that the black level value used in each block area is obtained according to the black-masked pixels in the block area, so that the differences between different areas can be taken into account. Compared with all photosensitive array pixel areas using a unified black level value for correction, the accuracy of the image value obtained after the black level correction can be improved, and the image color cast and flickering can be effectively avoided.
[0049] In a specific implementation, in step S22, when all pixels of the current frame image are divided into blocks along a set direction, the current frame image may be divided equally or unequally.
[0050] In some non-limiting embodiments, step S22 can also be implemented in the following manner: along the set direction, take the first edge domain and the second edge domain at both ends of the current frame image respectively; calculate the absolute value of the difference between the black level value of the black-masked pixels in the first edge domain and the black level value of the black-masked pixels in the second edge domain; determine the number of blocks according to the absolute value of the difference, wherein the absolute value of the difference is positively correlated with the number of blocks; and divide all pixels of the current frame image into blocks along the set direction according to the determined number of blocks.
[0051] For example, if the width of the image is W, the leftmost 5% area of the photosensitive pixels in the image can be taken as the first edge domain L, that is, the width of the first edge domain L is 5%*W; the rightmost 5% area of the photosensitive pixels in the image can be taken as the second edge domain R, that is, the width of the second edge domain R is 5%*W. The black level data value of the first edge domain L in the black-shielded state is counted, recorded as XL, and the black level data value of the second edge domain R in the black-shielded state is counted, recorded as XR. Calculate |XL-XR|, and record the result of |XL-XR| as delta (which can be expressed as △), △=|XL-XR|. Determine the number of blocks based on △.
[0052] Further, when determining the number of blocks according to the absolute value of the difference, a plurality of preset interval ranges can be obtained, each of which corresponds to the number of blocks; the number of blocks is determined according to the interval range in which the absolute value of the difference is located, so that after the blocks are divided, the difference in the black level values of adjacent areas is less than a preset first value. The preset first value is related to the accuracy requirement of the image value obtained after the black level correction, and the higher the accuracy requirement, the smaller the first value.
[0053] For example, the set interval range [0, 1] corresponds to a block number N of 1, that is, no block division, that is, when △ satisfies △≤1DN, no block division. The set interval range (1, 4] corresponds to a block number N of 8, that is, △ satisfies 1DN<△≤4DN, and the number of blocks is determined to be 8. The set interval range (4, 8] corresponds to a block number N of 16, that is, △ satisfies 4DN<△≤8DN, and the number of blocks is determined to be 16. The set interval range (8, +∞] corresponds to a block number N of 32, that is, △ satisfies △>8DN, and the number of blocks is determined to be 32, where the DN value (Digital Number) is the gray value of the recorded object.
[0054] It is understandable that the above examples are only for illustrative purposes, and in actual applications, the interval range can be configured according to requirements, and the number of blocks corresponding to each interval range can also be configured according to requirements.
[0055] In a specific implementation, the black-masked pixel area is usually located at the edge of the entire pixel area. Since the rows at the edge are prone to light leakage, in order to improve the effect of black level correction, in some non-limiting embodiments, in step S23, when calculating the black level values of the black-masked pixels in each block area, if the set direction is the row direction, some rows of black-masked pixels are selected from all rows of black-masked pixels, and based on the brightness of the selected some rows of black-masked pixels, the black level values of the black-masked pixels corresponding to each block area are calculated respectively.
[0056] In some non-limiting embodiments, from among all rows of black-masked pixels, some rows of black-masked pixels in the middle may be selected.
[0057] Furthermore, from all rows of black-shielded pixels, black-shielded pixels in the middle position and whose number is half of the number of rows of all black-shielded pixels can be selected, that is, the middle 1 / 2 rows of all black-shielded pixel rows are selected as black-shielded pixel rows for counting black level values.
[0058] For example, there are M rows of black-masked pixels in total, and the M / 2 rows in the middle are selected as the black-masked pixel rows for counting black level values.
[0059] If there are 16 blackened pixel rows, namely row 1, row 2, ..., row 16, then selection starts from row 5, and a total of 8 rows are selected, namely row 5, row 6, ..., row 12.
[0060] In other non-limiting embodiments, if the set direction is a row direction, the brightness of each row of black pixels is calculated separately; the minimum value of the brightness of all rows of black pixels is selected, and the difference between the brightness value of each row of black pixels and the minimum value is calculated separately; based on the difference between the brightness value of each row of black pixels and the minimum value, the black pixels of the row in which the difference is less than a preset second value are selected.
[0061] The specific value of the preset second value can be configured according to the requirements, and the specific value of the preset second value is not limited here.
[0062] Further, when calculating the brightness value of each row of black-masked pixels, for each row of black-masked pixels, the average brightness value of all black-masked pixels in the row is used as the brightness value of the black-masked pixels in the row.
[0063] For example, there are M rows of black-masked pixel rows. Starting from the first row, the brightness values of the black-masked pixel rows of the 1st, 2nd, 3rd, ...M rows are counted respectively, and marked as P1, P2, P3, ...PM respectively. Among them, the brightness value of the black-masked pixel row can be the average value of the brightness of all black-masked pixels in the row. Then take the minimum value among P1, P2, P3, ...PM and record it as Pmin. Subtract P1, P2, P3, ...PM from Pmin respectively, that is, P1-Pmin, P2-Pmin, P3-Pmin, ..., PM-Pmin. Select the black-masked pixel row whose difference is less than the preset second value, and the selected black-masked pixel row can be used to calculate the black level value. Among them, the preset second value can be 1DN. It can be understood that the preset second value can also be other values, such as 2DN, etc., which will not be given one by one here.
[0064] In a specific implementation, in order to further improve the black level correction effect, step S23 can be implemented in the following manner: obtaining the black level values of each block area in the previous frame image; adjusting the black level values of each block area in the current frame image according to the black level values of each block area in the previous frame image, and using the adjusted black level values of each block area as the black level values of each block area in the current frame image. When the black level correction is performed on the current frame image, the black level value of the previous frame image is considered, that is, the mutual influence of the black level values of each frame image is considered in the time domain. The use of such a time domain processing method is equivalent to performing a time domain filtering on the black level value in the time domain, which can avoid flickering and color cast problems in the time domain, and further improve the black level correction effect.
[0065] In some non-limiting embodiments, a first weight corresponding to the previous frame image and a second weight corresponding to the current frame image are obtained; for each block area, the first weight is used to weight the black level value of the block area in the previous frame image to obtain a first weighted result, and the second weight is used to weight the black level value of the block area in the current frame image to obtain a second weighted result; and the sum of the first weighted result and the second weighted result is used as the black level value of the block area.
[0066] For example, for the same area, the sum black level value of the previous frame image is recorded as a, and the first weight is recorded as P; the black level value of the current frame image is recorded as b, and the second weight is recorded as Q. The black level value b of the current frame image is adjusted according to the sum black level value a of the previous frame image, and the black level value actually used for black level correction is c, c = P*a + Q*b, where P + Q = 1. The calculation method of the black level value in the subsequent image frames is similar, and will not be repeated here.
[0067] In order to further improve the black level correction effect and avoid color cast of the image after black level correction, in some non-limiting embodiments of the present invention, step S24 can be implemented in the following way: for each area of the current frame, the photosensitive pixels and the black-masked pixels in each area are grouped according to the color channels; for the pixels of each group of color channels in each area, the black level values of the black-masked pixels of the same color channel are used to perform image black level correction on the photosensitive pixels to obtain the corrected image.
[0068] For example, pixels are generally divided into four channels, namely a red (R) channel, two green (Gr and Gb) channels, and a blue (B) channel. When performing black level correction calculations, the black level values of the black-masked pixels of each color channel are calculated and corrected separately according to the pixel color grouping.
[0069] Since there may be regional differences between columns in the circuit design of the image sensor, when performing black level correction, it is considered that the masked pixels and photosensitive pixels in the same column use the same set of conversion circuits during circuit AD conversion. When performing black level correction on the pixels in the photosensitive area, for each area, the black level value of the masked pixels in the corresponding area is subtracted. The regional differences between different columns can be taken into account, thereby effectively solving the column difference problem from left to right in the image, improving the black level correction effect, and avoiding problems such as flickering and color cast of the resulting image.
[0070] It should be noted that when there are differences between rows in the circuit design of the image sensor, when all pixels of the current frame image are divided into blocks, the blocks can be divided along the column direction. When dividing into blocks along the row direction and the subsequent black level correction process, the relevant description of dividing into blocks along the row direction given in the above embodiment can be referred to, and no further description is given here.
[0071] The embodiment of the present invention also provides a black level correction device, referring to Figure 4 , a schematic diagram of the structure of a black level correction device in an embodiment of the present invention is given, and the black level correction device 40 may include:
[0072] An acquisition unit 41 is used to acquire a current frame image to be subjected to image black level correction;
[0073] A block division unit 42 is used to divide all pixels of the current frame image into blocks along a set direction to obtain a plurality of block areas, each of which includes photosensitive pixels and black-shielded pixels. The set direction is a row direction or a column direction.
[0074] The calculation unit 43 is used to obtain the black level value of each area of the current frame image according to the brightness of the black-masked pixels in the area;
[0075] The correction unit 44 is used to perform image black level correction on the brightness of the photosensitive pixels in each area of the current frame image by using the black level value of the area to obtain a corrected image.
[0076] In a specific implementation, the specific working principle and working process of the black level correction device 40 can refer to the description of the black level correction method provided in any of the above embodiments of the present invention, which will not be repeated here.
[0077] An embodiment of the present invention further provides a computer-readable storage medium, which is a non-volatile storage medium or a non-transient 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 provided in any of the above embodiments are executed.
[0078] An embodiment of the present invention further provides a terminal, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the steps of the black level correction method provided in any of the above embodiments when running the computer program.
[0079] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the relevant hardware through a program, and the program can be stored in any computer-readable storage medium, which may include: ROM, RAM, disk or CD, etc.
[0080] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the claims.
Claims
1. A black level correction method, characterized in that: include: Obtaining a current frame image to be subjected to image black level correction; Divide all pixels of the current frame image into blocks along a set direction to obtain a plurality of regions, each of which includes photosensitive pixels and black-masked pixels, and the set direction is a row direction or a column direction; for each region of the current frame image, obtain a black level value of the region according to the brightness of the black-masked pixels in the region; For each area of the current frame image, the black level value of the area is used to perform image black level correction on the brightness of the photosensitive pixels in the area to obtain a corrected image.
2. The black level correction method according to claim 1, wherein: The dividing all pixels of the current frame image into blocks along the set direction includes: Along the set direction, respectively taking a first edge region and a second edge region at both ends of the current frame image; Calculating an absolute value of a difference between a black level value of a black-shielded pixel in the first edge region and a black level value of a black-shielded pixel in the second edge region; Determining the number of blocks according to the absolute value of the difference, wherein the absolute value of the difference is positively correlated with the number of blocks; According to the determined number of blocks, all pixels of the current frame image are divided into blocks along the set direction.
3. The black level correction method according to claim 2, wherein: The determining the number of blocks according to the absolute value of the difference comprises: Get multiple preset interval ranges, each interval range corresponds to the number of blocks; The number of blocks is determined according to the interval range of the absolute value of the difference, so that after the blocks are divided, the difference of the black level values of adjacent areas is less than a preset first value.
4. The black level correction method according to claim 1, wherein: The black level value of the black-masked pixel in each area is obtained in the following way: If the set direction is the row direction, some rows of black-masked pixels are selected from all rows of black-masked pixels; based on the brightness of the selected some rows of black-masked pixels, the black level values of the black-masked pixels corresponding to each area are calculated respectively.
5. The black level correction method according to claim 4, characterized in that: The step of selecting some rows of black-masked pixels from all rows of black-masked pixels comprises: From the black-masked pixels of all rows, select the black-masked pixels of some rows in the middle.
6. The black level correction method according to claim 5, characterized in that: The step of selecting some rows of black-masked pixels from all rows of black-masked pixels comprises: From all the rows of black-masked pixels, select the black-masked pixel that is in the middle and whose row number is half the number of rows of all the black-masked pixels.
7. The black level correction method according to claim 4, characterized in that: The step of selecting some rows of black-masked pixels from all rows of black-masked pixels comprises: If the setting direction is a row direction, the brightness of the black-out pixels in each row is calculated respectively; Select the minimum value of the brightness of all rows of black-masked pixels, and calculate the difference between the brightness value of each row of black-masked pixels and the minimum value; According to the difference between the brightness value of each row of black-masked pixels and the minimum value, the black-masked pixels of the row whose difference is smaller than a preset second value are selected.
8. The black level correction method according to claim 7, characterized in that: The step of calculating the brightness value of each row of black-masked pixels comprises: For each row of black-masked pixels, the average of the brightness values of all the black-masked pixels in the row is used as the brightness value of the black-masked pixels in the row.
9. The black level correction method according to claim 1, wherein: For each area of the current frame image, using the black level value of the area to perform image black level correction on the brightness of the photosensitive pixels in the area to obtain a corrected image, including: For each area of the current frame image, the brightness of the photosensitive pixels in the area is subtracted from the black level value of the area to perform image black level correction; The corrected image is obtained based on the brightness of the photosensitive pixels obtained after performing image black level correction on each area.
10. The black level correction method according to any one of claims 1 to 9, characterized in that: For each area of the current frame image, obtaining the black level value of the area according to the brightness of the black-masked pixels in the area includes: Get the black level value of each block area in the previous frame image; The black level values of each block area in the current frame image are adjusted according to the black level values of each block area in the previous frame image, and the adjusted black level values of each block area are used as the black level values of each block area in the current frame image.
11. The black level correction method according to claim 10, characterized in that: The step of adjusting the black level values of each block area in the current frame image according to the black level values of each block area in the previous frame image, and using the adjusted black level values of each block area as the black level values of each block area in the current frame image includes: Obtaining a first weight corresponding to the previous frame image and a second weight corresponding to the current frame image; For each block area, the first weight is used to weight the black level value of the block area in the previous frame image to obtain a first weighted result, and the second weight is used to weight the black level value of the block area in the current frame image to obtain a second weighted result; The sum of the first weighted result and the second weighted result is used as the black level value of the block area.
12. The black level correction method according to any one of claims 1 to 9, characterized in that: For each area of the current frame image, using the black level value of the area to perform image black level correction on the brightness of the photosensitive pixels in the area to obtain a corrected image, including: For each area of the current frame image, the photosensitive pixels and the black-masked pixels in each area are grouped according to the color channels; For pixels of each group of color channels in each area, the black level values of the black-masked pixels of the same color channel are respectively used to perform image black level correction on the photosensitive pixels to obtain the corrected image.
13. A black level correction device, characterized in that: include: An acquisition unit, used for acquiring a current frame image to be subjected to image black level correction; A blocking unit, used for blocking all pixels of the current frame image along a set direction to obtain a plurality of block areas, each of which includes photosensitive pixels and black-shielded pixels, and the set direction is a row direction or a column direction; A calculation unit, for obtaining a black level value of each area of the current frame image according to the brightness of the black-masked pixels in the area; The correction unit is used to perform image black level correction on the brightness of the photosensitive pixels in each area of the current frame image by using the black level value of the area to obtain a corrected image.
14. A computer-readable storage medium, wherein the computer-readable storage medium is a non-volatile storage medium or a non-transient storage medium, and a computer program is stored thereon, wherein: 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 12 are executed.
15. A terminal comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor runs the computer program, the steps of the black level correction method according to any one of claims 1 to 12 are performed.
Citation Information
Patent Citations
Adaptive black level correction method
CN105578082A
Black level calibration method and system of image sensor
CN108259793A