CN115720299A - Black level correction method and device, computer readable storage medium and terminal - Google Patents

Black level correction method and device, computer readable storage medium and terminal Download PDF

Info

Publication number
CN115720299A
CN115720299A CN202110977445.5A CN202110977445A CN115720299A CN 115720299 A CN115720299 A CN 115720299A CN 202110977445 A CN202110977445 A CN 202110977445A CN 115720299 A CN115720299 A CN 115720299A
Authority
CN
China
Prior art keywords
black
black level
pixels
value
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110977445.5A
Other languages
Chinese (zh)
Inventor
钟立源
张黎黎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Galaxycore Shanghai Ltd Corp
Original Assignee
Galaxycore Shanghai Ltd Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Galaxycore Shanghai Ltd Corp filed Critical Galaxycore Shanghai Ltd Corp
Priority to CN202110977445.5A priority Critical patent/CN115720299A/en
Publication of CN115720299A publication Critical patent/CN115720299A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Facsimile Image Signal Circuits (AREA)

Abstract

A black level correction method and device, a computer readable storage medium and a terminal are provided, wherein the black level correction method comprises the following steps: acquiring a current frame image to be subjected to image black level correction; partitioning all pixels of the current frame image along a set direction to obtain a plurality of block areas, wherein each block area comprises photosensitive pixels and black shading pixels, and the set direction is a row direction or a column direction; aiming at each block of area of the current frame image, obtaining a black level value of the area according to the brightness of black-covered pixels in the area; and aiming at each block of the current frame image, carrying out image black level correction on the brightness of the photosensitive pixels in the block by adopting the black level numerical value of the block to obtain a corrected image. The scheme can improve the black level correction effect of the image and effectively avoid the phenomena of image color cast and flicker.

Description

Black level correction method and device, computer readable storage medium and terminal
Technical Field
The embodiment of the invention relates to the technical field of image processing, in particular to a black level correction method and device, a computer readable storage medium and a terminal.
Background
In the process of image processing, it is usually necessary to perform black level correction on an image captured by an image sensor. At present, in the black level correction, the black-masked pixels in the black-masked array pixel area are usually used to calculate the average black level of the black-masked pixel area, and then the calculated average black level is subtracted from each pixel in the photosensitive array pixel area to perform the black level correction.
However, the accuracy of the image values output by the above black level correction method is low.
Disclosure of Invention
The technical problem solved by the embodiment of the invention is how to improve the accuracy of the image value obtained after the black level correction.
To solve the above technical problem, an embodiment of the present invention provides a black level correction method, including: acquiring a current frame image to be subjected to image black level correction; partitioning all pixels of the current frame image along a set direction to obtain a plurality of areas, wherein each area comprises photosensitive pixels and black shading pixels, and the set direction is a row direction or a column direction; aiming at each block of area of the current frame image, obtaining a black level value of the area according to the brightness of black-shielded pixels in the area; and aiming at each area of the current frame image, carrying out image black level correction on the brightness of the photosensitive pixels in the area by adopting the black level value of the area to obtain a corrected image.
Optionally, the blocking all pixels of the current frame image along the set direction includes: respectively taking a first edge area and a second edge area at two ends of the current frame image along the set direction; calculating the absolute value of the difference value between the black level value of the black shading pixel in the first edge domain and the black level value of the black shading pixel in the second edge domain; determining the number of partitions according to the absolute value of the difference, wherein the absolute value of the difference is positively correlated with the number of partitions; and partitioning all pixels of the current frame image along the set direction according to the determined number of partitions.
Optionally, the determining the number of blocks according to the absolute value of the difference includes: acquiring a plurality of preset interval ranges, wherein each interval range corresponds to the number of the blocks; and determining the number of blocks according to the interval range in which the absolute value of the difference is positioned, so that the difference of the black level values of adjacent areas is smaller than a preset first value after the blocks are divided.
Optionally, the black level value of the black-shielded pixel in each region is obtained by the following method: if the set direction is the row direction, selecting partial row black-shielded pixels from the black-shielded pixels in all the rows; and respectively calculating the black level value of the black-shielded pixels corresponding to each block area based on the brightness of the black-shielded pixels of the selected partial row.
Optionally, the selecting a part of the row black-shielded pixels from the black-shielded pixels in all the rows includes: and selecting partial black-shielded pixels in the middle from the black-shielded pixels in all the lines.
Optionally, the selecting a part of the black-shielded pixels in the rows from the black-shielded pixels in all the rows includes: and selecting black-shielded pixels which are positioned in the middle and have half of the number of the lines of all the black-shielded pixels from the black-shielded pixels of all the lines.
Optionally, the selecting a part of the row black-shielded pixels from the black-shielded pixels in all the rows includes: if the set direction is a row direction, the brightness of each row of black-shielded pixels is calculated respectively; selecting the minimum value of the brightness of all the black-shielded pixels in the row, and respectively calculating the difference between the brightness value of each black-shielded pixel in the row and the minimum value; and selecting the black-shielded pixels of the row with the difference smaller than a preset second numerical value according to the difference between the brightness value of each row of black-shielded pixels and the minimum value.
Optionally, the calculating the brightness value of each row of black-covered pixels includes: and regarding each row of black-shielded pixels, taking the average value of the brightness values of all the black-shielded pixels in the row as the brightness value of the black-shielded pixels in the row.
Optionally, the performing, for each area of the current frame image, image black level correction on the brightness of photosensitive pixels in the area by using the black level value of the area to obtain a corrected image includes: respectively subtracting the black level value of each region from the brightness of the photosensitive pixels in the region aiming at each region of the current frame image, and carrying out image black level correction; and obtaining the corrected image based on the brightness of the photosensitive pixels obtained after the black level correction of the image is carried out on each area.
Optionally, the obtaining, for each block of the region of the current frame image, a black level value of the region according to brightness of black-covered pixels in the region includes: acquiring black level values of all block areas in the previous frame of image; and adjusting the black level value of each block area in the current frame image according to the black level value of each block area in the previous frame image, and taking the adjusted black level value of each block area as the black level value of each block area of the current frame image.
Optionally, the adjusting the black level value of each block area in the current frame image according to the black level value of each block area in the previous frame image, and taking the adjusted black level value of each block area as the black level value of each block area of the current frame image includes: acquiring a first weight corresponding to the previous frame of image and a second weight corresponding to the current frame of image; for each block area, weighting the black level value of the block area in the previous frame image by adopting the first weight to obtain a first weighting result, and weighting the black level value of the block area in the current frame image by adopting the second weight to obtain a second weighting result; and taking the sum of the first weighting result and the second weighting result as the black level value of the block area.
Optionally, the performing, for each region of the current frame image, image black level correction on the brightness of the photosensitive pixels in the region by using the black level value of the region to obtain a corrected image includes: aiming at each block of area of the current frame, grouping photosensitive pixels and black-covered pixels in each block of area according to color channels respectively; and aiming at the pixels of each group of color channels in each block area, respectively adopting the black level values of the black-shielded pixels of the same color channel to carry out image black level correction on the photosensitive pixels to obtain the corrected image.
An embodiment of the present invention further provides a black level correction apparatus, including: the device comprises an acquisition unit, a correction unit and a control unit, wherein the acquisition unit is used for acquiring a current frame image to be subjected to image black level correction; a blocking unit, configured to block all pixels of the current frame image along a set direction to obtain a plurality of blocks, where each block includes photosensitive pixels and black-covered pixels, and the set direction is a row direction or a column direction; the calculating unit is used for obtaining a black level value of each area of the current frame image according to the brightness of the black-shielded pixels in the area; and the correcting unit is used for carrying out image black level correction on the brightness of the photosensitive pixels in each area of the current frame image by adopting the black level value of the area to obtain a corrected image.
Embodiments of the present invention further provide a computer-readable storage medium, which is a non-volatile storage medium or a non-transitory storage medium, and has a computer program stored thereon, where the computer program is executed by a processor to perform any of the above-mentioned steps of the black level correction method.
The embodiment of the present invention further provides a terminal, which includes a memory and a processor, where the memory stores a computer program capable of running on the processor, and the processor executes any of the above steps of the black level correction method when running the computer program.
Compared with the prior art, the technical scheme of the embodiment of the invention has the following beneficial effects:
the method comprises the steps that all pixels of a current frame image to be subjected to image black level correction are partitioned along a set direction to obtain a plurality of areas, each area comprises photosensitive pixels and black shading pixels, and when the photosensitive pixels of the area are subjected to image black level correction aiming at each area, the adopted black level value is obtained according to the brightness of the black shading pixels in the area, so that the adopted black level value of each area is obtained according to the black shading pixels of the area, the difference of different areas can be considered, compared with the condition that all photosensitive array pixel areas are corrected by adopting uniform black level values, the accuracy of the image value obtained after the black level correction can be improved, and image color cast and flicker phenomena are effectively avoided.
Drawings
FIG. 1 is a schematic diagram of a pixel distribution in an image sensor according to an embodiment of the invention;
FIG. 2 is a flow chart of a black level correction method according to an embodiment of the present invention;
FIG. 3 is a block diagram of a pixel in an embodiment of the invention;
fig. 4 is a schematic structural diagram of a black level correction apparatus in an embodiment of the present invention.
Detailed Description
Referring to fig. 1, a schematic diagram of a pixel distribution in an image sensor in an embodiment of the present invention is shown. Taking a Complementary Metal Oxide Semiconductor (CMOS) sensor as an example, the CMOS sensor generally includes a light shielding region and a light sensing region. The black shading effect is generally realized through the process metal routing, and a black shading pixel area is obtained, wherein pixels corresponding to the area of the process metal routing are called black shading pixels and can also be called dark pixels; the blackout region may also be referred to as a blackout region. The photosensitive region generally refers to a pixel that actually participates in image formation at the time of image formation.
As described above, conventionally, in the black level correction, the black level average value of the black-masked pixel region is counted using the black-masked pixels of the black-masked pixel region, and then the counted black level average value is subtracted from each pixel of the photosensitive array pixel region to perform the black level correction. The image value output by adopting the black level correction mode has low accuracy, and the phenomena of image color cast and flicker of the image obtained after the black level correction are easy to occur.
The research shows that the accuracy of the image value output by the black level correction mode is low, and the phenomena of image color cast and flicker are easy to occur because the voltage in the analog-to-digital (AD) conversion circuit design of the image sensor is single-side driving, so that the voltages obtained in the AD conversion process of different columns from left to right are different, and the data (such as brightness) obtained after the final conversion between the columns also is different.
In order to solve the above problems, in the embodiment of the present invention, along a set direction, all pixels of a current frame image to be subjected to image black level correction are blocked to obtain a plurality of blocks of regions, each block of region includes photosensitive pixels and black-masked pixels, and when image black level correction is performed on the photosensitive pixels of the block of region for each block of region, an adopted black level value is obtained according to brightness of the black-masked pixels in the region, so that the black level value adopted by each block of region is obtained according to the black-masked pixels in the block of region, differences of different regions can be considered, compared with the case that all photosensitive array pixel regions are corrected by adopting uniform black level values, accuracy of image values obtained after black level correction can be improved, and image color cast and flicker phenomena are effectively avoided.
In order to make the aforementioned objects, features and advantages of the embodiments of the present invention more comprehensible, specific embodiments accompanied with figures are described in detail below.
Referring to fig. 2, a flowchart of a black level correction method in an embodiment of the present invention is shown, where the black level correction method provided in the embodiment of the present invention may specifically include the following steps:
and step S21, acquiring the current frame image to be subjected to image black level correction.
And S22, partitioning all pixels of the current frame image along a set direction to obtain a plurality of block areas.
In a specific implementation, when all pixels of a current frame image are partitioned, a setting direction is related to the distribution of photosensitive pixels and black-blocking pixels in the image, the setting direction can be a row direction or a column direction, and it is only required to ensure that each obtained block area includes photosensitive pixels and black-blocking pixels.
When the distribution of the black-blocking pixels and the photosensitive pixels in the image sensor is as shown in fig. 1, that is, the black-blocking pixels and the photosensitive pixels are distributed in rows, all pixels of the current frame image may be blocked along the row direction to obtain N blocks of regions, where each block of regions includes one or more columns with reference to the pixel blocking diagram shown in fig. 3. The black-shielded pixel area is divided into N blocks along the row direction, the photosensitive pixels are also divided into N blocks along the row direction, and each column of pixels comprises the black-shielded pixels and the photosensitive pixels.
In a specific implementation, when the black-masked pixels and the photosensitive pixels in the image sensor are distributed in columns, all pixels of the current frame image may be partitioned along the column direction to obtain a plurality of block regions, each block region includes one or more rows, and each row of pixels includes the black-masked pixels and the photosensitive pixels.
Step S23, for each block of the current frame image, obtaining a black level value of the block according to the brightness of the black-covered pixels in the block.
For example, with reference to fig. 3, the black-masked pixel region is divided into N blocks along the row direction, and for each black-masked pixel, the black level values in the block region are obtained according to the brightness of the black-masked pixel in the block region, and are respectively denoted as Xd1, xd2, \8230 \ 8230;, xdN-1, and XdN.
And step S24, aiming at each block of area of the current frame image, carrying out image black level correction on the brightness of the photosensitive pixels in the area by adopting the black level numerical value of the area to obtain a corrected image.
In a specific implementation, for each block of the current frame image, the black level value of the area is subtracted from the brightness of the photosensitive pixel in the area, so as to perform image black level correction; and obtaining the corrected image based on the brightness of the photosensitive pixels obtained by correcting the black level of the image in each area.
For example, with continued reference to fig. 3, for each block of the current frame image, when performing image black level correction on the brightness of photosensitive pixels in each block, the following may be adopted:
for the photosensitive pixels in the A1 region, the black level correction is calculated by: p _ A1 (i) -Xd1.P _ A1 (i) is the brightness of the photosensitive pixels in the A1 region, and Xd1 is the black level value corresponding to the A1 region.
For the photosensitive pixels in the A2 region, the black level correction is calculated by: p _ A2 (i) -Xd2.P _ A2 (i) is the brightness of the photosensitive pixels in the A2 region, and Xd2 is the black level value corresponding to the A2 region.
……
For the photosensitive pixels in the AN area, the calculation mode of black level correction is as follows: 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.
Where i represents different photosensitive pixel locations, i =1,2, \8230;, M are positive integers.
For example, the 1 st block region includes black-out pixels in the X1 region and photosensitive pixels in the A1 region; the 2 nd area comprises black-shielded pixels in the X2 area and photosensitive pixels in the A2 area; for example, the N-1 th block region comprises black-shielded pixels in AN XN-1 region and photosensitive pixels in AN AN-1 region; for example, the nth block area includes black-out pixels in the XN area and photosensitive pixels in the AN area.
It can be known from the above that, along a set direction, all pixels of a current frame image to be subjected to image black level correction are blocked to obtain a plurality of block regions, each block region includes photosensitive pixels and black shading pixels, and for each block region, when the image black level correction is performed on the photosensitive pixels of the block region, the adopted black level value is obtained according to the brightness of the black shading pixels in the region, so that the black level value adopted by each block region is obtained according to the black shading pixels of the block region, and thus differences of different regions can be considered.
In a specific implementation, in step S22, when all the pixels of the current frame image are partitioned along the setting direction, the current frame image may be partitioned equally or unequally.
In some non-limiting embodiments, step S22 may also be implemented by: respectively taking a first edge region and a second edge region at two ends of the current frame image along the set direction; calculating the absolute value of the difference value between the black level value of the black shading pixel in the first edge domain and the black level value of the black shading pixel in the second edge domain; determining the number of partitions according to the absolute value of the difference, wherein the absolute value of the difference is positively correlated with the number of partitions; and partitioning all pixels of the current frame image along the set direction according to the determined number of partitions.
For example, the width of the image is W, and a 5% area at the leftmost side of the photosensitive pixels in the image can be taken as a first edge area L, that is, the width of the first edge area L is 5% W; the rightmost 5% of the photosensitive pixels in the image is taken as the second edge region R, i.e., the width of the second edge region R is 5% W. And counting the black level data value of the first edge domain L in the black shading state and recording the black level data value as XL, and counting the black level data value of the second edge domain R in the black shading state and recording the black level data value as XR. Calculate | XL-XR |, and record the result of | XL-XR |, as delta (which can be expressed as Δ), and Δ = | XL-XR |. The number of partitions is determined from Δ.
Further, when the number of the blocks is determined according to the absolute value of the difference, a plurality of preset interval ranges can be obtained, and each interval range corresponds to the number of the blocks; and determining the number of blocks according to the interval range in which the absolute value of the difference is positioned, so that the difference of the black level values of adjacent areas is smaller than a preset first value after the blocks are divided. 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 is, the smaller the first value is.
For example, the interval range [0,1] is set, and the corresponding block number N is 1, namely, the block is not divided, namely, when delta is less than or equal to 1DN, the block is not divided. The method comprises the steps of setting an interval range (1, 4), setting the corresponding block Number N to be 8, namely delta meeting 1DN <. DELTA. < 4DN, determining the block Number to be 8 blocks, setting the interval range (4, 8), setting the corresponding block Number N to be 16, namely delta meeting 4DN <. DELTA. < 8DN, determining the block Number to be 16 blocks, setting the interval range (8, + ∞) to be 32, namely delta meeting delta > 8DN, determining the block Number to be 32 blocks, wherein DN value (Digital Number) is the gray value of a recorded object.
It should be understood that the above example is only an illustrative example, and in practical applications, the interval range may be configured according to a requirement, and the number of the blocks corresponding to each interval range may also be configured according to a requirement. This is not exemplified here.
In a specific implementation, normally, the black-masked pixel regions are located at the edges of the entire pixel region, and since the lines at the edges are easy to leak light, in order to improve the black level correction effect, in some non-limiting embodiments, in step S23, when the black level values of the black-masked pixels in each block region are calculated, if the set direction is the line direction, a part of the lines of the black-masked pixels are selected from the black-masked pixels in all the lines, and based on the brightness of the selected part of the lines of the black-masked pixels, the black level values of the black-masked pixels corresponding to each block region are respectively calculated.
In some non-limiting embodiments, from among the black-shielded pixels of all the rows, a part of the black-shielded pixels of the rows at the intermediate position may be selected.
Further, from among the black-shielded pixels of all the rows, black-shielded pixels at the intermediate position and having the number of rows half that of all the black-shielded pixels may be selected. That is, the middle 1/2 line of all the black-shaded pixel lines is selected as the black-shaded pixel line for counting the black level value.
For example, the black-masked pixels have M rows, and the middle M/2 row is selected as the black-masked pixel row for counting the black level value.
If the black-shielded pixel rows have 16 rows, namely row 1, row 2, \8230, line 8230, line 16, then row 5 is selected, and row 6, \8230, line 12 is selected, and line 8 is selected.
In other non-limiting embodiments, if the set direction is a row direction, the brightness of each row of black-covered pixels is calculated; selecting the minimum value of the brightness of all the black-shielded pixels in the row, and respectively calculating the difference between the brightness value of each black-shielded pixel in the row and the minimum value; and selecting the black-shielded pixels of the row with the difference smaller than a preset second numerical value according to the difference between the brightness value of each row of black-shielded pixels and the minimum value.
The specific value of the preset second value can be configured as required, and the specific value of the preset second value is not limited here.
Further, when the brightness value of each row of black-shielded pixels is calculated, the average value of the brightness values of all the black-shielded pixels in the row is taken as the brightness value of the black-shielded pixels in the row aiming at each row of black-shielded pixels.
For example, the black-masked pixel rows have a total of M rows, and the brightness values of the black-masked pixel rows of the 1 st, 2 nd, 3 th, \8230;, M rows are counted from the 1 st row and labeled as P1, P2, P3, \8230;, PM, respectively. The brightness value of the black-shielded pixel row may be an average value of the brightness of all black-shielded pixels in the row. Then, the minimum value of P1, P2, P3, \8230; PM is taken as Pmin. P1, P2, P3, \8230: \, PM is differentiated from Pmin respectively, namely P1-Pmin, P2-Pmin, P3-Pmin, \8230:, PM-Pmin. And selecting black shading pixel lines with the difference value smaller than a preset second value, wherein the selected black shading pixel lines can be used for calculating the black level value. The preset second value may be 1DN, and it is understood that the preset second value may also be other values, such as 2DN, and the like, which are not illustrated here one by one.
In a specific implementation, to further improve the black level correction effect, step S23 may be implemented as follows: acquiring black level values of all block areas in the previous frame of image; and adjusting the black level value of each block area in the current frame image according to the black level value of each block area in the previous frame image, and taking the adjusted black level value of each block area as the black level value of each block area of 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 the frame images is considered in the time domain, and the adoption of the time domain processing mode is equivalent to performing time domain filtering on the black level value in the time domain, so that the problems of flicker, color cast and the like in the time domain can be avoided, and the black level correction effect is further improved.
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, weighting the black level value of the block area in the previous frame image by adopting the first weight to obtain a first weighting result, and weighting the black level value of the block area in the current frame image by adopting the second weight to obtain a second weighting result; and taking the sum of the first weighting result and the second weighting result as the black level value of the block area.
For example, for the same block area, the sum black level value of the previous frame image is denoted as a, and the first weight is denoted as P; and recording the black level value of the current frame image as b, recording the second weight as Q, and adjusting the black level value b of the current frame image according to the sum of the black level value a of the previous frame image, so that the black level value actually used for black level correction is c, and c = pa + Q, where P + Q =1. The way of calculating the black level value in the subsequent image frame is analogized, and the description is omitted here.
To further improve the black level correction effect and avoid color cast of the black level corrected image, in some non-limiting embodiments of the present invention, step S24 may be implemented as follows: grouping photosensitive pixels and black-shielded pixels in each block area according to color channels respectively aiming at each block area of the current frame; and aiming at the pixels of each group of color channels in each block area, respectively adopting the black level values of the black shading pixels of the same color channel to carry out image black level correction on the photosensitive pixels, so as to obtain the corrected image.
For example, pixel pixels are generally divided into four channels, i.e., a red (R) channel, two green (Gr and Gb) channels, and a blue (B) channel, and when black level correction calculation is performed, calculation of black level values of black-shielded pixels of the color channels and black level correction processing are performed separately according to pixel color grouping.
The image sensor circuit design can have area difference of columns and rows, when black level correction is carried out, the same set of conversion circuit is used for black shading pixels and photosensitive pixels in the same column during circuit AD conversion, when black level correction is carried out on the pixels in the photosensitive area, the black level value of the black shading pixels of the corresponding block area is subtracted for each block area, and the area difference of different columns can be considered, so that the problem of column difference of images from left to right can be effectively solved, the black level correction effect is improved, and the problems of flicker, color cast and the like of the obtained images are avoided.
It should be noted that when there is a row-to-row difference in the image sensor circuit design, the blocking may be performed along the column direction when all the pixels of the current frame image are blocked. When the blocking and the subsequent black level correction process are performed according to the row direction, reference may be made to the related description in the blocking performed according to the row direction given in the above embodiments, and details are not described here again.
Referring to fig. 4, which is a schematic structural diagram of a black level correction apparatus in an embodiment of the present invention, the black level correction apparatus 40 may include:
an obtaining unit 41, configured to obtain a current frame image to be subjected to image black level correction;
a blocking unit 42, configured to block all pixels of the current frame image along a set direction to obtain a plurality of block regions, where each block region includes photosensitive pixels and black-blocking pixels, and the set direction is a row direction or a column direction;
a calculating unit 43, configured to obtain, for each block of the current frame image, a black level value of the block according to brightness of black-blocked pixels in the block;
and the correcting unit 44 is configured to, for each area of the current frame image, perform image black level correction on the brightness of the photosensitive pixels in the area by using the black level value of the area, so as to obtain a corrected image.
In a specific implementation, the specific working principle and the working process of the black level correction device 40 may refer to the description of the black level correction method provided in any of the above embodiments of the present invention, and are not described herein again.
An embodiment of the present invention further provides a computer-readable storage medium, which is a non-volatile storage medium or a non-transitory storage medium, and has a computer program stored thereon, where the computer program is executed by a processor to perform the steps of the black level correction method provided in any of the above embodiments.
The embodiment of the present invention further provides a terminal, which includes a memory and a processor, where the memory stores a computer program capable of running 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.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in any computer readable storage medium, and the storage medium may include: ROM, RAM, magnetic or optical disks, and the like.
Although the present invention is disclosed above, the present invention is not limited thereto. Various changes and modifications may be effected by one skilled in the art without departing from the spirit and scope of the invention, as defined in the appended claims.

Claims (15)

1. A black level correction method, comprising:
acquiring a current frame image to be subjected to image black level correction;
partitioning all pixels of the current frame image along a set direction to obtain a plurality of block areas, wherein each block area comprises photosensitive pixels and black shading pixels, and the set direction is a row direction or a column direction; aiming at each block of area of the current frame image, obtaining a black level value of the area according to the brightness of black-covered pixels in the area;
and aiming at each area of the current frame image, carrying out image black level correction on the brightness of the photosensitive pixels in the area by adopting the black level value of the area to obtain a corrected image.
2. The black level correction method according to claim 1, wherein said blocking all pixels of said current frame image in a set direction comprises:
respectively taking a first edge region and a second edge region at two ends of the current frame image along the set direction;
calculating the absolute value of the difference value between the black level value of the black shading pixel in the first edge domain and the black level value of the black shading pixel in the second edge domain;
determining the number of partitions according to the absolute value of the difference, wherein the absolute value of the difference is positively correlated with the number of partitions;
and partitioning all pixels of the current frame image along the set direction according to the determined number of partitions.
3. The black level correction method according to claim 2, wherein said determining the number of blocks based on the absolute value of the difference comprises:
acquiring a plurality of preset interval ranges, wherein each interval range corresponds to the number of the blocks;
and determining the number of blocks according to the interval range in which the absolute value of the difference is positioned, so that the difference of the black level values of adjacent areas is smaller than a preset first value after the blocks are divided.
4. The black level correction method according to claim 1, wherein the black level values of the black-shaded pixels in the respective regions are obtained by:
if the set direction is the row direction, selecting partial row black-shielded pixels from the black-shielded pixels in all the rows; and respectively calculating the black level value of the black-shielded pixels corresponding to each block area based on the brightness of the black-shielded pixels of the selected partial row.
5. The black level correction method according to claim 4, wherein said selecting a part of the row black-shaded pixels from the black-shaded pixels of all the rows comprises:
and selecting partial black-shielded pixels in the middle from the black-shielded pixels in all the lines.
6. The black level correction method according to claim 5, wherein said selecting a part of the row black-shaded pixels from the black-shaded pixels of all the rows, comprises:
and selecting black-shielded pixels which are positioned in the middle and have half of the number of the lines of all the black-shielded pixels from the black-shielded pixels of all the lines.
7. The black level correction method according to claim 4, wherein said selecting a part of the row black-shaded pixels from the black-shaded pixels of all the rows comprises:
if the set direction is a row direction, the brightness of each row of black-shielded pixels is calculated respectively;
selecting the minimum value of the brightness of all the black-shielded pixels in the row, and respectively calculating the difference between the brightness value of each black-shielded pixel in the row and the minimum value;
and selecting the black-shielded pixels of the row with the difference smaller than a preset second value according to the difference between the brightness value of each row of black-shielded pixels and the minimum value.
8. The black level correction method according to claim 7, wherein said calculating the luminance value of each line of the black-shaded pixels comprises:
and regarding each row of black-shielded pixels, taking the average value of the brightness values of all the black-shielded pixels in the row as the brightness value of the black-shielded pixels in the row.
9. The black level correction method according to claim 1, wherein said performing, for each region of the current frame image, image black level correction on the brightness of the photosensitive pixels in the region using the black level value of the region to obtain a corrected image comprises:
respectively subtracting the black level value of each region from the brightness of the photosensitive pixels in the region aiming at each region of the current frame image, and carrying out image black level correction;
and obtaining the corrected image based on the brightness of the photosensitive pixels obtained by correcting the black level of the image in each area.
10. The black level correction method according to any one of claims 1 to 9, wherein said obtaining, for each block of the current frame image, a black level value of the block according to the luminance of the black-masked pixels in the block comprises:
acquiring black level values of all block areas in the previous frame of image;
and adjusting the black level value of each block area in the current frame image according to the black level value of each block area in the previous frame image, and taking the adjusted black level value of each block area as the black level value of each block area of the current frame image.
11. The black level correction method according to claim 10, wherein the adjusting the black level value of each block area in the current frame image according to the black level value of each block area in the previous frame image and using the adjusted black level value of each block area as the black level value of each block area in the current frame image comprises:
acquiring a first weight corresponding to the previous frame of image and a second weight corresponding to the current frame of image;
for each block area, weighting the black level value of the block area in the previous frame image by adopting the first weight to obtain a first weighting result, and weighting the black level value of the block area in the current frame image by adopting the second weight to obtain a second weighting result;
and taking the sum of the first weighting result and the second weighting result as the black level value of the block area.
12. The black level correction method according to any one of claims 1 to 9, wherein said performing, for each region of the current frame image, image black level correction on the brightness of photosensitive pixels in the region using the black level value of the region to obtain a corrected image comprises:
grouping photosensitive pixels and black-shielded pixels in each block area according to color channels respectively aiming at each block area of the current frame;
and aiming at the pixels of each group of color channels in each block area, respectively adopting the black level values of the black shading pixels of the same color channel to carry out image black level correction on the photosensitive pixels, so as to obtain the corrected image.
13. A black level correction apparatus, comprising:
the device comprises an acquisition unit, a correction unit and a control unit, wherein the acquisition unit is used for acquiring a current frame image to be subjected to image black level correction;
the block unit is used for blocking all pixels of the current frame image along a set direction to obtain a plurality of block areas, each block area comprises photosensitive pixels and black shading pixels, and the set direction is a row direction or a column direction;
the calculating unit is used for obtaining a black level value of each block of the current frame image according to the brightness of the black-shielded pixels in the block;
and the correcting unit is used for carrying out image black level correction on the brightness of the photosensitive pixels in each area of the current frame image by adopting the black level value of the area to obtain a corrected image.
14. A computer-readable storage medium, being a non-volatile storage medium or a non-transitory storage medium, having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the steps of the black level correction method according to any one of claims 1 to 12.
15. A terminal comprising a memory and a processor, the memory having stored thereon a computer program operable on the processor, wherein the processor executes the computer program to perform the steps of the black level correction method according to any one of claims 1 to 12.
CN202110977445.5A 2021-08-24 2021-08-24 Black level correction method and device, computer readable storage medium and terminal Pending CN115720299A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110977445.5A CN115720299A (en) 2021-08-24 2021-08-24 Black level correction method and device, computer readable storage medium and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110977445.5A CN115720299A (en) 2021-08-24 2021-08-24 Black level correction method and device, computer readable storage medium and terminal

Publications (1)

Publication Number Publication Date
CN115720299A true CN115720299A (en) 2023-02-28

Family

ID=85254826

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110977445.5A Pending CN115720299A (en) 2021-08-24 2021-08-24 Black level correction method and device, computer readable storage medium and terminal

Country Status (1)

Country Link
CN (1) CN115720299A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115866159A (en) * 2023-03-02 2023-03-28 北京小米移动软件有限公司 Black level correction method and device, electronic equipment, chip and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115866159A (en) * 2023-03-02 2023-03-28 北京小米移动软件有限公司 Black level correction method and device, electronic equipment, chip and storage medium
CN115866159B (en) * 2023-03-02 2023-04-25 北京小米移动软件有限公司 Black level correction method and device, electronic equipment, chip and storage medium

Similar Documents

Publication Publication Date Title
EP3804294B1 (en) Hdr image generation from single-shot hdr color image sensors
US8576309B2 (en) Pixel defect correction device, imaging apparatus, pixel defect correction method, and program
CN110650334B (en) Dead pixel detection and correction method and device, storage medium and terminal
US10044952B2 (en) Adaptive shading correction
CN100474935C (en) Pixel defect detecting/correcting device and pixel defect detecting/correcting method
US7689059B2 (en) Image processing method and image processing circuit
US8902336B2 (en) Dynamic, local edge preserving defect pixel correction for image sensors with spatially arranged exposures
WO2011152174A1 (en) Image processing device, image processing method and program
CN110149486B (en) Automatic detection method, correction method and system for newly-added abnormal points
US7916790B2 (en) Pixel compensation method for an image sensor
JP5524133B2 (en) Image processing device
CN115720299A (en) Black level correction method and device, computer readable storage medium and terminal
US9832400B2 (en) Image sensor and method of sensing image
CN103563360B (en) Imaging device and imaging method
TWI670708B (en) Color-shift calibration method and device
CN109788261B (en) Color offset correction method and device
US8938120B2 (en) Image sensing device and image data processing method using the same
US7508430B1 (en) Method for locally reducing row noise
US8957997B2 (en) Image sensor and image data processing method using the same
US9013626B2 (en) Signal processing circuit of solid-state imaging element, signal processing method of solid-state imaging element, and electronic apparatus
CN113096046A (en) Image processing method and device
US20060146149A1 (en) Hue correction for electronic imagers
US8442359B2 (en) Image interpolation method and apparatus using reference block based on direction
CN112689141B (en) Method and device for balancing image green channel
KR101896992B1 (en) Method for processing video and computer readable recording medium thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination