Disclosure of Invention
The invention aims to solve the technical problem of providing a high dynamic recovery method and a high dynamic recovery system for segmented exposure imaging, which can eliminate fixed deviation caused by segmented exposure without extra correction while recovering a high dynamic image.
In order to solve the above problems, the present invention provides a high dynamic recovery method for segmented exposure imaging, which comprises the following steps:
s1: acquiring the brightness value V1i of each pixel at the end-of-segment exposure time T1 of a first exposure segment and the brightness value Vi of each pixel at the end-of-segment exposure time T of a second exposure segment, wherein i is 1-n, n is the number of pixel points, and the first exposure segment is prior to the second exposure segment;
s2: calculating a slope value K of the current light intensity corresponding to each pixel point, wherein K is (Vi-V1 i)/(T-T1);
s3: calculating the current pixel brightness value Vxi of each pixel point as K T according to each slope value K and the total exposure time T of the two exposure sections;
s4: determining an overexposure comparison range according to the average overexposure value of the first exposure segment, and comparing and judging the brightness value V1i of each pixel:
if the pixel luminance value V1i does not reach the minimum value of the overexposure comparison range, the final pixel luminance value Voi is Vi;
if the pixel brightness value V1i exceeds the maximum value of the overexposure comparison range, the final pixel brightness value Voi is Vxi;
when the pixel luminance value V1i is within the overexposure comparison range, a blur determination is performed to determine the tendency thereof, and the final pixel luminance value Voi ═ Vi or the final pixel luminance value Voi ═ Vxi is determined in accordance with the tendency.
In accordance with one embodiment of the present invention,
when the whole exposure imaging process is divided into two segments, in the step S1, the two exposure segments are selected, the end-of-segment exposure time T1 of the first exposure segment is the exposure time of the segmentation point, the end-of-segment exposure time T of the second exposure segment is the exposure completion time, and the recovery is completed after the steps S2-S4 are executed;
when the number of the exposure segments is larger than two segments, two exposure segments are selected from the back to the front to execute the steps S1-S4, one exposure segment is moved forward based on the recovered pixel brightness value, and the corresponding two exposure segments are selected to execute the steps S1-S4, and the steps are repeated until all the exposure segments are recovered.
According to an embodiment of the present invention, the method further includes step S5, which is to compress and map the size of the recovered high-dynamic image into the bit width range of the output by means of gamma mapping curve.
According to an embodiment of the present invention, in the step S4, the overexposure comparison range is Vf-a to Vf + a, Vf is an average overexposure value of the first exposure segment, and a is a luminance deviation value.
According to an embodiment of the present invention, the average overexposure value of the first exposure segment is obtained by an offline test, and the value range of the brightness deviation value a is 0-20.
According to an embodiment of the present invention, in the step S4, the determining the trend of the blur and the final pixel luminance value Voi ═ Vi or the final pixel luminance value Voi ═ vx according to the trend includes:
selecting a certain area by taking the pixel point of the pixel brightness value V1i in the overexposure comparison range as a center;
respectively calculating the region mean value Vm of each pixel brightness value Vi in the region and the mean value Vxm of each current pixel brightness value Vxi;
respectively calculating the sum Vs of absolute values of differences between the brightness value Vi of each pixel in the region and the average value Vxm of the brightness value Vi of each pixel and the sum Vxs of absolute values of differences between the brightness value Vxi of each current pixel and the average value Vxm of the current pixel;
and judging that when Vxs is smaller than Vs, Voi is Vxi, and on the contrary, Voi is Vi.
According to an embodiment of the present invention, the selected area range is an area consisting of m × n pixels with the pixel brightness value V1i in the overexposure comparison range as the center, and the values of M, N are all 3-5.
According to an embodiment of the present invention, the pixel luminance value acquired in step S1 is obtained by: in the exposure imaging process, at the end-of-segment exposure time of an exposure segment which does not finish exposure finally, acquiring the brightness value of each pixel at the time and then storing the brightness value; after acquiring the brightness values of the pixels at the end-of-exposure time of the exposure segment in which exposure is finally completed, the stored brightness values of the pixels are collectively acquired, and the process proceeds to step S2.
The invention also provides a high dynamic recovery system for the segmented exposure imaging, which comprises:
a pixel brightness value acquisition module: acquiring the brightness value V1i of each pixel at the end-of-segment exposure time T1 of a first exposure segment and the brightness value Vi of each pixel at the end-of-segment exposure time T of a second exposure segment, wherein i is 1-n, n is the number of pixel points, and the first exposure segment is prior to the second exposure segment;
slope value calculation module: performing calculation of a slope value K of the current light intensity corresponding to each pixel point, wherein K is (Vi-V1 i)/(T-T1);
the current pixel brightness value calculation module: executing calculation according to each slope value K and the total exposure time T of the two exposure sections, and calculating the current pixel brightness value Vxi of each pixel point to be K T;
a recovery module: determining an overexposure comparison range according to the average overexposure value of the first exposure segment, and comparing and judging the brightness value V1i of each pixel:
if the pixel luminance value V1i does not reach the minimum value of the overexposure comparison range, the final pixel luminance value Voi is Vi;
if the pixel brightness value V1i exceeds the maximum value of the overexposure comparison range, the final pixel brightness value Voi is Vxi;
when the pixel luminance value V1i is within the overexposure comparison range, a blur determination is performed to determine the tendency thereof, and the final pixel luminance value Voi ═ Vi or the final pixel luminance value Voi ═ Vxi is determined in accordance with the tendency.
According to an embodiment of the present invention, further comprising:
and the curve mapping unit is used for compressing and mapping the size of the recovered high-dynamic image into the output bit width range in a gamma curve mapping mode.
After the technical scheme is adopted, compared with the prior art, the invention has the following beneficial effects:
in the invention, linear exposure is carried out through the pixel brightness values at the end-of-segment exposure time of the two exposure segments to obtain the current pixel brightness value considered based on linear exposure, whether the pixel is overexposed is judged through the pixel brightness value at the end-of-segment exposure time of the first exposure segment, and the fuzzy condition is further judged, so that the corresponding linear processing is carried out on the overexposure condition, and finally the high dynamic image is recovered through the pixel brightness value.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein, but rather construed as limited to the embodiments set forth herein.
Referring to fig. 1, in one embodiment, a segmented exposure imaging high dynamic recovery method includes the steps of:
s1: acquiring the brightness value V1i of each pixel at the end-of-segment exposure time T1 of a first exposure segment and the brightness value Vi of each pixel at the end-of-segment exposure time T of a second exposure segment, wherein i is 1-n, n is the number of pixel points, and the first exposure segment is prior to the second exposure segment;
s2: calculating a slope value K of the current light intensity corresponding to each pixel point, wherein K is (V-V1)/(T-T1);
s3: calculating the current pixel brightness value Vxi of each pixel point as K T according to each slope value K and the total exposure time T of the two exposure sections;
s4: determining an overexposure comparison range according to the average overexposure value of the first exposure segment, and comparing and judging the brightness value V1i of each pixel:
if the pixel luminance value V1i does not reach the minimum value of the overexposure comparison range, the final pixel luminance value Voi is Vi;
if the pixel brightness value V1i exceeds the maximum value of the overexposure comparison range, the final pixel brightness value Voi is Vxi;
when the pixel luminance value V1i is within the overexposure comparison range, a blur determination is performed to determine the tendency thereof, and the final pixel luminance value Voi ═ Vi or the final pixel luminance value Voi ═ Vxi is determined in accordance with the tendency.
The following is a description of the segmented exposure imaging high dynamic recovery method according to the embodiment of the present invention, but should not be taken as a limitation.
The high dynamic recovery method for segmented exposure imaging in the embodiment of the invention can be applied to an image sensor adopting a segmented exposure mode, can be divided into two-segment exposure or multi-segment (more than three-segment) exposure, and is not limited specifically. The method can solve the technical problem that the exposure value is possibly kept flat for a period of time when the point is close to the segmentation point in the segmentation exposure process, so that the high dynamic range is limited, and the high dynamic image can be recovered.
In step S1, since the method is calculated for two exposure segments each time, the corresponding data of the two exposure segments required for calculation are acquired first: the brightness value V1i of each pixel at the end-of-segment exposure time T1 of the first exposure segment and the brightness value Vi of each pixel at the end-of-segment exposure time T of the second exposure segment are obtained, i is 1-n, and n is the number of pixels.
The first exposure segment precedes the second exposure segment. For example, in the case where the entire exposure process is divided into two segments, 0-T1 is the first exposure segment, T1-T is the second exposure segment, the total exposure time is T, and the entire exposure is completed at time T. In the case that the whole exposure process is divided into multiple segments, T1-T is still the second exposure segment, and the first exposure segment is determined according to the segmentation point T1 and the previous segmentation point time.
The brightness values V1i and Vi of the pixels may be stored after being collected, and then corresponding data may be obtained from the memory in step S1, and the subsequent steps are performed.
Preferably, the luminance value of the pixel acquired in step S1 is obtained by: in the exposure imaging process, at the end-of-segment exposure time of an exposure segment which does not finish exposure finally, acquiring the brightness value of each pixel at the time and then storing the brightness value; after acquiring the brightness values of the pixels at the end-of-exposure time of the exposure segment in which exposure is finally completed, the stored brightness values of the pixels are collectively acquired, and the process proceeds to step S2. May be stored in a RAM (random access memory). Through the first storage of the first sampling, the data sampling at the moment of completing the exposure is directly calculated, so that the read-write consumption can be reduced, the processing speed is increased, and the real-time property of the high dynamic image recovery is improved.
For example, in the case of two exposure segments, during the exposure, when the end-of-segment exposure time T1 of the first exposure segment is reached, the brightness value V1i of each pixel at that time is acquired and stored in the memory, and when the end-of-segment exposure time T of the second exposure segment is reached, the brightness value Vi of each pixel at that time is acquired and the brightness value V1i of each pixel is collectively acquired from the memory and then executed in step S2. Of course, in the case that the exposure segment is a plurality of segments, the pixel brightness values acquired at the end-of-segment exposure times of the previous segments are all stored, and the pixel brightness values of the previous segments sequentially acquired after the end-of-segment exposure time of the last segment is acquired are executed in step S2.
Next, step S2 is executed, and for each pixel Vi at time T, the pixel value V1i of the pixel corresponding to time T1 can be read from the memory, and in consideration of linear exposure, the slope value K of the current light intensity corresponding to each pixel can be calculated, where K is (Vi-V1 i)/(T-T1). In the process, calculation can be performed on each pixel point of the whole image in a traversal mode, and the current light intensity slope value of each pixel point is obtained.
Next, step S3 is executed, and the current pixel brightness value vx i ═ K × T of each pixel point is calculated according to each slope value K and the total exposure time T of the two exposure segments. These current pixel intensity values Vxi are determined based on linear exposure, so if saturation of the exposure value occurs at a segmentation point in a strong light situation, the saturation situation can be recovered through the current pixel intensity values Vxi, and therefore how to automatically and quickly distinguish between saturation and unsaturation situations needs to be considered, and the embodiment of the present invention solves this problem through step S4.
Then, step S4 is executed to determine an overexposure comparison range according to the average overexposure value of the first exposure segment, compare and determine the brightness value V1i of each pixel, and determine the final brightness value of the pixel according to the determination result, wherein the overexposure comparison range is the range defined by the minimum value and the maximum value. This determination is made for each pixel luminance value V1i, and thus the determination and processing can be performed across these pixel luminance values V1 i.
If the pixel luminance value V1i does not reach the minimum value of the overexposure comparison range, the final pixel luminance value Voi is Vi; the pixel luminance value V1i is less than the minimum value of the overexposure comparison range, indicating that it is not overexposed, and is also a non-linear value, so the final pixel luminance value can be set to the pixel luminance value Vi sampled at the time of completion of exposure T.
If the pixel brightness value V1i exceeds the maximum value of the overexposure comparison range, the final pixel brightness value Voi is Vxi; the pixel intensity value V1i is less than the maximum value of the overexposure comparison range, indicating that overexposure occurred, and the final pixel intensity value is set to the current pixel intensity value Vxi that has been linearly processed.
When the pixel luminance value V1i is within the overexposure comparison range, a blur determination is performed to determine the tendency thereof, and the final pixel luminance value Voi ═ Vi or the final pixel luminance value Voi ═ Vxi is determined in accordance with the tendency. When the pixel luminance value V1i is within the overexposure comparison range, it is described that the value thereof is a nonlinear value, linear correction is required, and it is possible to perform blur determination on the value, and if the value is closer to the linearly processed current pixel luminance value Vxi, the final pixel luminance value Voi becomes Vxi, and if the value is closer to the pixel luminance value Vi sampled at the exposure completion time T, the final pixel luminance value Voi becomes Vi.
Thus, when the exposure is divided into two segments, the recovered high dynamic image can be obtained, and when the exposure is not divided into multiple segments, the high dynamic image can be recovered for the selected two segments.
Preferably, in step S4, the overexposure comparison range is Vf-a to Vf + a, Vf is the average overexposure value of the first exposure segment, and a is the luminance deviation value. That is, the minimum value of the overexposure comparison range is Vf-a, and the maximum value is Vf + a.
Optionally, the average overexposure value of the first exposure segment is obtained by offline testing, and the test result may be stored and then obtained for calculation; the brightness deviation value A ranges from 0 to 20, and 0 to 20 is 0 to 20 of the pixel brightness values from 0 to 255.
Preferably, in step S4, the blur determination unit determines whether the luminance value Voi of the final pixel is Vi or Vxi according to the tendency of the blur, and further includes:
selecting a certain area by taking the pixel point of the pixel brightness value V1i in the overexposure comparison range as a center;
respectively calculating the region mean value Vm of each pixel brightness value Vi in the region and the mean value Vxm of each current pixel brightness value Vxi;
respectively calculating the sum Vs of absolute values of differences between each pixel brightness value Vi and the mean value Vxm of the pixel brightness value Vi in the area (at the end-of-segment exposure time T of the second exposure segment) and the sum Vxs of absolute values of differences between each current pixel brightness value Vxi (of each calculated pixel point) and the mean value Vxm of the pixel brightness value Vxi;
and judging that when Vxs is smaller than Vs, Voi is Vxi, and on the contrary, Voi is Vi.
Preferably, the selected area range is an area formed by MxN pixels with the pixel brightness value V1i in the overexposure comparison range as the center, and the values of M, N are 3-5. Referring to fig. 4, P (y, x) is the pixel point with the pixel brightness value V1i in the overexposure comparison range, M and N both take values of 3, and three rows and three columns of pixel points with P (y, x) as the center are used as the selected area.
When the whole exposure imaging process is divided into two segments, in step S1, the two exposure segments (two exposure segments in total, and thus steps S1-S4 are performed in sequence), the end-of-segment exposure time T1 of the first exposure segment is the exposure time of the segmentation point, the end-of-segment exposure time T of the second exposure segment is the exposure completion time, and the steps S2-S4 are performed to complete the recovery.
When the number of the exposure segments is larger than two segments, two exposure segments are selected from the back to the front to execute the steps S1-S4, one exposure segment is moved forward based on the recovered pixel brightness value, and the corresponding two exposure segments are selected to execute the steps S1-S4, and the steps are repeated until all the exposure segments are recovered. That is, when the steps S1-S4 are performed for the first time, the two selected exposure segments are the last two exposure segments in the exposure process, and when the steps S1-S4 are performed for the second time, the two selected exposure segments are the 2 nd from last exposure segment and the 3 rd from last exposure segment in the exposure process, and the two selected exposure segments are sequentially moved forward by analogy in the following steps until all the exposure segments are processed, so that the high dynamic image restoration is completed.
In one embodiment, referring to fig. 3, on the basis of the foregoing embodiments, the segmented exposure imaging high dynamic recovery method further includes step S5, which is to compress and map the size of the recovered high dynamic image into the bit width range of the output by means of gamma mapping curve. The high dynamic image is compressed in a curve mode, and the effect is that the high dynamic range compression of the image can be realized due to the original linear compression mode.
The invention also provides a high dynamic recovery system for the segmented exposure imaging, which comprises:
a pixel brightness value acquisition module: acquiring the brightness value V1i of each pixel at the end-of-segment exposure time T1 of a first exposure segment and the brightness value Vi of each pixel at the end-of-segment exposure time T of a second exposure segment, wherein i is 1-n, n is the number of pixel points, and the first exposure segment is prior to the second exposure segment;
slope value calculation module: performing calculation of a slope value K of the current light intensity corresponding to each pixel point, wherein K is (Vi-V1 i)/(T-T1);
the current pixel brightness value calculation module: executing calculation according to each slope value K and the total exposure time T of the two exposure sections, and calculating the current pixel brightness value Vxi of each pixel point to be K T;
a recovery module: determining an overexposure comparison range according to the average overexposure value of the first exposure segment, and comparing and judging the brightness value V1i of each pixel:
if the pixel luminance value V1i does not reach the minimum value of the overexposure comparison range, the final pixel luminance value Voi is Vi;
if the pixel brightness value V1i exceeds the maximum value of the overexposure comparison range, the final pixel brightness value Voi is Vxi;
when the pixel luminance value V1i is within the overexposure comparison range, a blur determination is performed to determine the tendency thereof, and the final pixel luminance value Voi ═ Vi or the final pixel luminance value Voi ═ Vxi is determined in accordance with the tendency.
According to an embodiment of the present invention, further comprising:
and the curve mapping unit is used for compressing and mapping the size of the recovered high-dynamic image into the output bit width range in a gamma curve mapping mode.
For details of the segmented exposure imaging high dynamic recovery system according to the embodiment of the present invention, reference may be made to the description of the segmented exposure imaging high dynamic recovery method in the foregoing embodiment, and details are not repeated here.
Although the present invention has been described with reference to the preferred embodiments, it is not intended to limit the scope of the claims, and those skilled in the art can make various changes and modifications without departing from the spirit and scope of the invention.