Disclosure of Invention
The invention aims to solve the technical problem of providing a method and a system for adjusting the automatic exposure of the sectional exposure imaging, which can prevent overexposure and improve the overall contrast of an image.
In order to solve the above problems, the present invention provides an automatic exposure adjustment method for segmented exposure imaging, comprising the following steps:
s1: setting initial values of time T1 of the first exposure section and total time T of the two exposure sections aiming at the first exposure section and the second exposure section in the exposure process;
s2: carrying out exposure under the condition, and counting the average brightness Ya of the image, the proportion K% of the non-overexposed area in the image and the average brightness Yk of the non-overexposed area;
s3: comparing the average brightness Yk of the non-overexposure area with a target brightness value range, and adjusting the total time T of the two sections of exposure sections according to the comparison result;
s4: comparing the proportion K% of the non-overexposed area in the image with the overexposure ratio beta%:
if the proportion K% of the non-overexposure area in the image is greater than the overexposure ratio beta%, comparing the average brightness Ya of the image with the target brightness value range, and continuously adjusting the total time T of the two sections of exposure sections according to the comparison result;
otherwise, the average brightness Ya of the image is compared with the target brightness value range, and the time T1 of the first exposure segment is adjusted according to the comparison result.
According to an embodiment of the present invention, the step S3, adjusting the total time T of the two segments of exposure according to the comparison result includes: if the average brightness Yk of the non-overexposure area is smaller than the minimum value of the target brightness value range, the total time T of the two sections of exposure sections is increased, and if the average brightness Yk of the non-overexposure area is larger than the maximum value of the target brightness value range, the total time T of the two sections of exposure sections is decreased.
According to an embodiment of the present invention, the step S4, the continuously adjusting the total time T of the two exposure segments according to the comparison result includes: if the average brightness Ya of the image is smaller than the minimum value of the target brightness value range, the total time T of the two exposure sections is increased, and if the average brightness Ya of the image is larger than the maximum value of the target brightness value range, the total time T of the two exposure sections is decreased.
According to an embodiment of the present invention, the adjusting the time T1 of the first exposure period according to the comparison result in the step S4 includes: if the average brightness Ya of the image is larger than the maximum value of the target brightness value range, the time T1 of the first exposure section is increased, the total time T of the two exposure sections is kept unchanged, and if the average brightness Ya of the image is smaller than the minimum value of the target brightness value range, the time T1 of the first exposure section is decreased, and the total time T of the two exposure sections is kept unchanged.
In accordance with one embodiment of the present invention,
after the execution of the step S4 is finished, the step S2 is returned to and executed continuously until the average brightness Yk of the non-overexposed region is adjusted to fall within the target brightness value range in the step S3 and the average brightness Ya of the image is adjusted to fall within the target brightness value range in the step S4;
or, in the step S3, the comparison and the adjustment are repeated until the average brightness Yk of the non-overexposed region falls within the target brightness value range; and, in step S4, the comparison and adjustment are repeated until the average brightness Ya of the image is adjusted to fall within the target brightness value range.
According to an embodiment of the present invention, when the number of the exposure segments of the entire exposure process is two, the initial values of the time T1 of the first exposure segment and the total time T of the exposure process are set for the two exposure segments in the step S1, and the subsequent steps are performed to complete the exposure adjustment;
and when the number of the exposure segments in the whole exposure process is more than two segments, selecting the last two exposure segments, executing the step S1, based on the adjusted exposure process, moving one exposure segment from back to front, selecting the corresponding two exposure segments, and executing the step S1, and repeating the steps until all the exposure segments are adjusted.
According to an embodiment of the present invention, the target luminance value ranges from (1-alpha) Yt to (1+ alpha) Yt; wherein Yt is a target brightness value; alpha is an allowable error range and takes a value of 0-0.05.
According to an embodiment of the present invention, in the step S1, the initial value of the time T1 of the first exposure period is set to 0, and the initial value of the total time T of the two exposure periods is set to default values.
According to an embodiment of the present invention, the overexposure ratio beta% takes a value of 80% to 100%.
The invention also provides a sectional exposure imaging automatic exposure adjusting system, which comprises:
an initial setting module: setting initial values of time T1 of the first exposure section and total time T of the two exposure sections aiming at the first exposure section and the second exposure section in the exposure process;
an exposure statistics module: carrying out exposure under the condition, and counting the average brightness Ya of the image, the proportion K% of the non-overexposed area in the image and the average brightness Yk of the non-overexposed area;
a first adjustment module: comparing the average brightness Yk of the non-overexposure area with a target brightness value range, and adjusting the total time T of the two sections of exposure sections according to the comparison result;
a second adjustment module: comparing the proportion K% of the image of the non-overexposed area with the overexposure ratio beta%:
if the proportion K% of the non-overexposure area in the image is greater than the overexposure ratio beta%, comparing the average brightness Ya of the image with the target brightness value range, and continuously adjusting the total time T of the two sections of exposure sections according to the comparison result;
otherwise, the average brightness Ya of the image is compared with the target brightness value range, and the time T1 of the first exposure segment is adjusted according to the comparison result.
After the technical scheme is adopted, compared with the prior art, the invention has the following beneficial effects:
in the invention, exposure adjustment is carried out by setting two adjustment stages, in the first adjustment stage, the influence of the total time T on the average brightness of the image is adjusted, so that the condition that the non-overexposure area of the image is too dark is avoided, and in the second adjustment stage, the two stages of exposure time are adjusted according to the overexposure degree, on one hand, the influence of the total time T on the average brightness of the non-overexposure area is adjusted, on the other hand, the influence of the time T1 of the first exposure stage on the average brightness of the non-overexposure area is adjusted, so that the original contrast of the non-overexposure area is kept while the overexposure area is adjusted, and the overall contrast and dynamic range of the image are enhanced.
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. 2, in one embodiment, a segmented exposure imaging auto-exposure adjustment method includes the steps of:
s1: setting initial values of time T1 of the first exposure section and total time T of the two exposure sections aiming at the first exposure section and the second exposure section in the exposure process;
s2: carrying out exposure under the condition, and counting the average brightness Ya of the image, the proportion K% of the non-overexposed area in the image and the average brightness Yk of the non-overexposed area;
s3: comparing the average brightness Yk of the non-overexposure area with a target brightness value range, and adjusting the total time T of the two sections of exposure sections according to the comparison result;
s4: comparing the proportion K% of the non-overexposed area in the image with the overexposure ratio beta%:
if the proportion K% of the non-overexposure area in the image is greater than the overexposure ratio beta%, comparing the average brightness Ya of the image with the target brightness value range, and continuously adjusting the total time T of the two sections of exposure sections according to the comparison result;
otherwise, the average brightness Ya of the image is compared with the target brightness value range, and the time T1 of the first exposure segment is adjusted according to the comparison result.
The following is a description of the method for adjusting the automatic exposure in the segmented exposure imaging according to the embodiment of the present invention, but the method is not limited thereto, and may be applied to an image sensor adopting a segmented exposure mode, and may be divided into two-segment exposure or into multiple-segment (more than three-segment) exposure, specifically, without limitation.
Steps S1-S4 are performed for each of the two exposure segments in the exposure process, so that if the exposure process is divided into two exposures, the selected first exposure segment and the second exposure segment together constitute the entire exposure process; and if the exposure process is divided into a plurality of exposure sections, the selected first exposure section and the second exposure section are two of the two exposure sections in the whole exposure process.
In step S1, for the first exposure segment and the second exposure segment in the exposure process, the initial values of the time T1 of the first exposure segment and the total time T of the two segments of exposure segments are set. The first exposure segment precedes the second exposure segment, and is temporally subsequent thereto.
Preferably, in the step S1, the initial value of the time T1 of the first exposure period is set to 0, and the initial value of the total time T of the two exposure periods is set to a default value. Obviously, T is greater than T1 (both represent the time length, and of course, in the case of the exposure process divided into two segments, both may also represent the end-of-segment time), and the default value may be a default value initially set, may be set as required, or may be a value updated on the basis of the previous adjustment. It will be appreciated that the time T1 of the first exposure period may also be set to other initial values.
And step 2 is executed, exposure is carried out under the condition of the exposure time set in step 1, a corresponding exposure image is obtained, and the average brightness Ya of the image, the proportion K% of the non-overexposed area in the image and the average brightness Yk of the non-overexposed area are counted. The non-overexposure area, i.e. the pixel point set with the luminance value less than 255, can be determined by judging the luminance value of each pixel point. The average brightness Ya of the image is the average value of the brightness values of all the pixel points of the image. The average brightness Yk of the non-overexposure area is the average value of the brightness values of the pixel points of the non-overexposure area.
Then, step S3 is executed to compare the average brightness Yk of the non-overexposed region with the target brightness value range, and adjust the total time T of the two exposure segments according to the comparison result. The non-overexposed area may have too dark brightness, and the problem of too dark non-overexposed area can be solved by comparing and adjusting the total time T.
Preferably, in step S3, the adjusting the total time T of the two exposure segments according to the comparison result includes: if the average brightness Yk of the non-overexposure area is smaller than the minimum value of the target brightness value range, the total time T of the two sections of exposure sections is increased, and if the average brightness Yk of the non-overexposure area is larger than the maximum value of the target brightness value range, the total time T of the two sections of exposure sections is decreased. The increment and the decrement of each time can be set, so that the adjustment can be finished without one time, and the whole process is a loop process for adjusting feedback.
Next, step S4 is executed to compare the ratio K% of the non-overexposed area to the image with the overexposed ratio beta%, according to the difference of the comparison results. The two exposure times can be adjusted differently according to the degree of overexposure.
The overexposure ratio may be determined as desired. Preferably, the value of the overexposure ratio beta% is 80% -100%, so that the overexposure degree can be better distinguished.
If the proportion K% of the non-overexposure area in the image is larger than the overexposure ratio beta%, the scene overexposure ratio is smaller, namely the proportion of the non-overexposure area is larger, the exposure time T is continuously adjusted, the average brightness Ya of the image is compared with the target brightness value range, and the total time T of the two sections of exposure sections is continuously adjusted according to the comparison result.
Preferably, in step S4, the step of continuously adjusting the total time T of the two exposure segments according to the comparison result includes: if the average brightness Ya of the image is smaller than the minimum value of the target brightness value range, the total time T of the two exposure sections is increased, and if the average brightness Ya of the image is larger than the maximum value of the target brightness value range, the total time T of the two exposure sections is decreased.
Otherwise, the overexposure ratio is larger and the overexposure degree is heavier, the time T1 of the first exposure segment is adjusted to solve the overexposure problem, the average brightness Ya of the image is compared with the target brightness value range, and the time T1 of the first exposure segment is adjusted according to the comparison result. Of course, the total time T of the two exposure segments remains unchanged as the time T1 of the first exposure segment is adjusted.
Preferably, the adjusting the time T1 of the first exposure period according to the comparison result in the step S4 includes: if the average brightness Ya of the image is larger than the maximum value of the target brightness value range, the time T1 of the first exposure section is increased, the total time T of the two exposure sections is kept unchanged, and if the average brightness Ya of the image is smaller than the minimum value of the target brightness value range, the time T1 of the first exposure section is decreased, and the total time T of the two exposure sections is kept unchanged.
Preferably, the target brightness value range is (1-alpha) Yt to (1+ alpha) Yt; wherein Yt is a target brightness value; alpha is an allowable error range and takes a value of 0-0.05. That is, (1+ alpha) Yt is the maximum value of the target luminance value range, and (1-alpha) Yt is the minimum value of the target luminance value range.
In one embodiment, the execution of step S4 is ended, and the step S2 is returned to, and the execution is continued until the average brightness Yk of the non-overexposed region is adjusted to fall within the target brightness value range in step S3 and the average brightness Ya of the image is adjusted to fall within the target brightness value range in step S4. Every time the steps S2-S4 are executed, the adjustment of the total time T of the two exposure segments or the time T1 of the first exposure segment is made for the current exposure condition, the actual condition of the exposure adjustment is reflected by the next exposure, and then the appropriate adjustment is carried out, so that the steps S2 are returned to continue to be executed to gradually approach the optimal exposure condition.
Or, in the step S3, the comparison and the adjustment are repeated until the average brightness Yk of the non-overexposed region falls within the target brightness value range; and, in step S4, the comparison and adjustment are repeated until the average brightness Ya of the image is adjusted to fall within the target brightness value range.
Referring to fig. 3, an example of a flow chart of a segmented exposure imaging auto-exposure adjustment method is given. Firstly, setting a time T1 as 0, and setting the total time T as a default value; then entering a first adjusting stage, comparing the average brightness Yk of the non-overexposure area with a target brightness range, if Yk is smaller than (1-alpha) Yt, increasing the exposure time T, judging once every time of adjustment until Yk is adjusted to be not smaller than (1-alpha) Yt, if Yk is larger than (1+ alpha) Yt, reducing the total time T, judging once every time of adjustment until Yk is adjusted to be not larger than (1-alpha) Yt, and indicating that Yk meets the target brightness range, and executing the next step; and then entering a second adjusting stage, comparing the proportion K% of the non-overexposure area to the image with the overexposure ratio beta%, if the proportion K% is greater than beta%, judging that the scene overexposure ratio is smaller, and continuously adjusting the total time T to enable the Ya to meet the target brightness Yt, wherein the description is omitted, otherwise, adjusting the time T1 to enable the Ya to meet the target brightness range, wherein the adjusting mode is similar to that of adjusting Yk, namely if the Ya is greater than (1+ alpha) Yt, increasing T1, and if the Ya is less than (1-alpha) Yt, reducing T1.
In one embodiment, when the number of exposure segments of the whole exposure process is two, there are only two exposure segments, and thus the adjustment is completed for the two exposure segments. The initial values of the time T1 of the first exposure segment and the total time T of the exposure process are set for the two exposure segments in the step S1, and the subsequent steps are performed to complete the exposure adjustment without changing the exposure segment to continue the execution.
And when the number of the exposure segments in the whole exposure process is more than two segments, selecting the last two exposure segments, executing the step S1, based on the adjusted exposure process, moving one exposure segment from back to front, selecting the corresponding two exposure segments, and executing the step S1, and repeating the steps until all the exposure segments are adjusted. 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 exposure adjustment is completed.
The whole automatic exposure adjusting method for the segmented exposure imaging can be realized by processing through a corresponding program built in the image imaging device, and the adjustment of the image exposure time can be automatically realized.
The invention also provides a sectional exposure imaging automatic exposure adjusting system, which comprises:
an initial setting module: setting initial values of time T1 of the first exposure section and total time T of the two exposure sections aiming at the first exposure section and the second exposure section in the exposure process;
an exposure statistics module: carrying out exposure under the condition, and counting the average brightness Ya of the image, the proportion K% of the non-overexposed area in the image and the average brightness Yk of the non-overexposed area;
a first adjustment module: comparing the average brightness Yk of the non-overexposure area with a target brightness value range, and adjusting the total time T of the two sections of exposure sections according to the comparison result;
a second adjustment module: comparing the proportion K% of the image of the non-overexposed area with the overexposure ratio beta%:
if the proportion K% of the non-overexposure area in the image is greater than the overexposure ratio beta%, comparing the average brightness Ya of the image with the target brightness value range, and continuously adjusting the total time T of the two sections of exposure sections according to the comparison result;
otherwise, the average brightness Ya of the image is compared with the target brightness value range, and the time T1 of the first exposure segment is adjusted according to the comparison result.
For details of the segmented exposure imaging automatic exposure adjustment system according to the embodiment of the present invention, reference may be made to the description of the segmented exposure imaging automatic exposure adjustment 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.