CN111739110B - Method and device for detecting image over-darkness or over-exposure - Google Patents

Method and device for detecting image over-darkness or over-exposure Download PDF

Info

Publication number
CN111739110B
CN111739110B CN202010786655.1A CN202010786655A CN111739110B CN 111739110 B CN111739110 B CN 111739110B CN 202010786655 A CN202010786655 A CN 202010786655A CN 111739110 B CN111739110 B CN 111739110B
Authority
CN
China
Prior art keywords
image
detected
brightness
preset
over
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.)
Active
Application number
CN202010786655.1A
Other languages
Chinese (zh)
Other versions
CN111739110A (en
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.)
Beijing Meishe Network Technology Co ltd
Original Assignee
Beijing Meishe Network Technology Co ltd
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 Beijing Meishe Network Technology Co ltd filed Critical Beijing Meishe Network Technology Co ltd
Priority to CN202010786655.1A priority Critical patent/CN111739110B/en
Publication of CN111739110A publication Critical patent/CN111739110A/en
Application granted granted Critical
Publication of CN111739110B publication Critical patent/CN111739110B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/40Image enhancement or restoration by the use of histogram techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Abstract

The embodiment of the invention provides a method and a device for detecting image over-darkness or over-exposure, wherein the method comprises the following steps: firstly, acquiring an image to be detected; the image to be detected is a gray image; then calculating the characteristic index of the image to be detected; the characteristic indexes comprise an image brightness mean value, an image brightness standard deviation and the total brightness of target pixel points in the image; the brightness of the target pixel point is greater than a preset pixel point brightness threshold value; determining the image state of the image to be detected based on the size relation between the characteristic index and a preset characteristic index threshold; the image state comprises image over-darkness or image over-exposure; and finally, outputting a first state mark corresponding to the image state. In the embodiment of the invention, an auxiliary detector is not needed, whether the image is too dark or overexposed can be judged only by acquiring the image to be detected, the scene adaptability is strong, and the complexity and the cost of required hardware are low. Meanwhile, the image state is comprehensively judged through a plurality of characteristic indexes, and the detection accuracy can be improved to a certain extent.

Description

Method and device for detecting image over-darkness or over-exposure
Technical Field
The present invention relates to the field of image processing, and in particular, to a method and an apparatus for detecting over-darkness or over-exposure of an image.
Background
In the field of photography, exposure refers to the amount of light that is allowed to enter the lens to shine on a photosensitive medium (the negative of a film camera or the image sensor of a digital camera) during photography. Due to the reasons of too slow shutter, too strong background light and the like, local brightness of a picture is too high, a picture is whitened, details are lost, and at the moment, the picture is overexposed; the picture is too dark due to too dark ambient light, which affects the beauty of the photo, and the image is too dark at this time.
At present, in various application scenes such as image shooting and video clipping, too dark or overexposure of an image picture is often required to be detected. In the prior art, when detecting whether an image is too dark or overexposed, the judgment is performed according to the light entering amount of a lens, and a special detector is often required to assist in judging the light entering amount during the judgment, which increases the complexity and cost of a shooting device.
Disclosure of Invention
The embodiment of the invention provides a method and a device for detecting image over-darkness or over-exposure, which aim to solve the problems of high complexity and high cost in the prior art.
In order to solve the above problem, the embodiment of the present invention is implemented as follows:
in a first aspect, an embodiment of the present invention discloses a method for detecting image over-darkness or over-exposure, including:
acquiring an image to be detected; the image to be detected is a gray image;
calculating the characteristic index of the image to be detected; the characteristic indexes comprise an image brightness mean value, an image brightness standard deviation and the total brightness of target pixel points in the image; the brightness of the target pixel point is greater than a preset pixel point brightness threshold value;
determining the image state of the image to be detected based on the size relation between the characteristic index and a preset characteristic index threshold value; the image state comprises image over-darkness or image over-exposure;
and outputting a first state mark corresponding to the image state.
In a second aspect, an embodiment of the present invention discloses an image over-dark or over-exposure detection apparatus, including:
the acquisition module is used for acquiring an image to be detected; the image to be detected is a gray image;
the calculation module is used for calculating the characteristic index of the image to be detected; the characteristic indexes comprise an image brightness mean value, an image brightness standard deviation and the total brightness of target pixel points in the image; the brightness of the target pixel point is greater than a preset pixel point brightness threshold value;
the determining module is used for determining the image state of the image to be detected based on the size relation between the characteristic indexes and a preset characteristic index threshold value; the image state comprises image over-darkness or image over-exposure;
and the first output module is used for outputting a first state mark corresponding to the image state.
In a third aspect, an embodiment of the present invention further provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor, where the computer program, when executed by the processor, implements the steps of the image over-dark or over-exposure detection method according to the first aspect.
In a fourth aspect, the embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the image over-dark or over-exposure detection method according to the first aspect.
In the embodiment of the invention, an image to be detected is obtained firstly; the image to be detected is a gray image; then calculating the characteristic index of the image to be detected; the characteristic indexes comprise an image brightness mean value, an image brightness standard deviation and the total brightness of target pixel points in the image; the brightness of the target pixel point is greater than a preset pixel point brightness threshold value; determining the image state of the image to be detected based on the size relation between the characteristic index and a preset characteristic index threshold; the image state comprises image over-darkness or image over-exposure; and finally, outputting a first state mark corresponding to the image state. In the embodiment of the invention, an auxiliary detector is not needed, whether the image is too dark or overexposed can be judged only by acquiring the image to be detected, the scene adaptability is strong, and the complexity and the cost of required hardware are low. Meanwhile, the image state is comprehensively judged through a plurality of characteristic indexes, and the detection accuracy can be improved to a certain extent.
Drawings
FIG. 1 is a flow chart illustrating the steps of a method for detecting over-darkness or over-exposure of an image according to the present invention;
FIG. 2 is a flow chart illustrating the steps of another method of image over-dark or over-exposure detection of the present invention;
FIG. 3 is a schematic diagram of a video frame over-dark or over-exposure detection method according to the present invention;
FIG. 4 illustrates a flow chart of an example of image over-dark or over-exposure detection of the present invention;
fig. 5 shows a block diagram of an image over-dark or over-exposure detection apparatus according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, there is shown a flow chart of the steps of a method for detecting image over-darkness or exposure according to the present invention, the method comprising:
step 101, obtaining an image to be detected; the image to be detected is a gray image.
In the embodiment of the present invention, the image to be detected may be an image that needs to be subjected to over-dark or over-exposure detection. The grayscale image may be an image with only one sample color per pixel, and the grayscale image is typically displayed as a grayscale from darkest black to brightest white. The pixel value in the gray image is a gray value, and the gray value can be used for representing the brightness of a single pixel point and ranges from 0 to 255, wherein 0 is black, and 255 is white.
102, calculating the characteristic index of the image to be detected; the characteristic indexes comprise an image brightness mean value, an image brightness standard deviation and the total brightness of target pixel points in the image; and the brightness of the target pixel point is greater than a preset pixel point brightness threshold value.
In this step, the image brightness may be represented by a gray value of the image, and the larger the gray value is, the brighter the pixel point is represented. The image brightness Mean (Mean) may be an arithmetic Mean of brightness of all pixel points in the image, and specifically may be obtained by dividing a sum of gray values of all pixel points in the image by a total number of all pixel points. The Standard Deviation (Std) of the luminance of the image may be an average of the distance of the luminance of each pixel point from the mean of the luminance of the image.
The preset pixel brightness threshold value can be used for expressing the brightness degree of the pixel, and when the preset pixel brightness threshold value is higher than the preset pixel brightness threshold value, the pixel is brighter. The preset pixel brightness threshold can be set by a user based on actual impression, for example, for a gray value of 0-255, the user can adjust the image display effect by continuously setting the gray value in the test image, and if the user considers that the gray value is greater than 200 according to the actual impression, the pixel is brighter, the preset pixel brightness threshold can be set to 200. When the brightness of the pixel point is greater than or equal to the preset pixel point brightness threshold value, the pixel point can be judged to be a highlight point, namely a target pixel point. The total brightness of the target pixel points in the image may be the sum of the gray values of all the target pixel points in the image, that is, the sum of the gray values of the highlight points in the image to be detected.
Specifically, in this step, the image brightness Mean value can be calculated by the following formula:
Mean=(1/N)*∑(Pi) (i is 1 to N)
Where N represents the total number of pixels in the image to be detected, for example, for a 500 × 500 image, the total number of pixels N =500 × 500, that is, 250000. PiRepresenting the gray value of the ith pixel of the image to be detected.
In this step, the standard deviation Std of the image brightness can be calculated by the following formula:
Std=sqrt{(1/N)*∑[(Pi- Mean)2]} (i is 1 to N) (sqrt is the open square root)
In this step, the total brightness I of the target pixel point in the imageoverThe calculation can be made by the following formula:
Iover=∑[threshold(Pi;Tover)](i is 1 to N);
when P is presentiGreater than or equal to ToverTime, threshold (P)i;Tover)=Pi
When P is presentiLess than ToverTime, threshold (P)i;Tover)=0
Wherein, ToverRepresenting a preset pixel brightness threshold; threshold is a judgment function when the parameter P isiGreater than or equal to ToverWhen the value of threshold is PiWhen the parameter P isiLess than ToverWhen the threshold value is 0.
It should be noted that, in the embodiment of the present invention, there is also a case where the brightness of all the pixel points in the image to be detected is lower than the preset pixel point brightness threshold, that is, the brightness P of each pixel pointiAre all less than ToverAt this time, the target pixel pointThe number is 0, and correspondingly, the total brightness I of the target pixel points in the imageoverAlso 0.
In the embodiment of the invention, the brightness condition of the image to be detected can be accurately and comprehensively reflected by calculating the characteristic indexes in the image to be detected, namely the image brightness mean value, the image brightness standard deviation and the total brightness of the target pixel points in the image, so that an accurate data basis is provided for the judgment of the subsequent image state.
103, determining the image state of the image to be detected based on the size relation between the characteristic index and a preset characteristic index threshold value; the image state includes image over-darkness or image over-exposure.
In the embodiment of the invention, the over-brightness of the image may mean that the scene in the image is over-bright, and the over-bright part has no hierarchy and detail. Too dark an image may mean that the image is dark and does not truly reflect the color of the scene. The preset feature index threshold may be used to determine the image status, and the threshold may be set by the user according to actual needs. In this step, the size of the characteristic index is compared with a preset characteristic index threshold value, so that whether the image to be detected is too dark or overexposed can be determined.
And 104, outputting a first state mark corresponding to the image state.
In the embodiment of the present invention, the first state flag may be used to characterize an image state of an image to be detected, and the first state flag may specifically be in the form of a feature value, for example, the feature value 1 may correspond to overexposure of the image, and the feature value-1 may correspond to over-darkness of the image. In the step, after the image state of the image to be detected is determined, the first state identifier can be output and displayed to a user, so that the user can know the image state of the image to be detected in time to perform subsequent adjustment processing.
In summary, in the image over-dark or over-exposure detection method provided by the embodiment of the present invention, an image to be detected is obtained first; the image to be detected is a gray image; then calculating the characteristic index of the image to be detected; the characteristic indexes comprise an image brightness mean value, an image brightness standard deviation and the total brightness of target pixel points in the image; the brightness of the target pixel point is greater than a preset pixel point brightness threshold value; determining the image state of the image to be detected based on the size relation between the characteristic index and a preset characteristic index threshold; the image state comprises image over-darkness or image over-exposure; and finally, outputting a first state mark corresponding to the image state. In the embodiment of the invention, an auxiliary detector is not needed, whether the image is too dark or overexposed can be judged only by acquiring the image to be detected, the scene adaptability is strong, and the complexity and the cost of required hardware are low. Meanwhile, the image state is comprehensively judged through a plurality of characteristic indexes, and the detection accuracy can be improved to a certain extent.
Referring to fig. 2, there is shown a flow chart of steps of another method for detecting image over-darkness or exposure according to the present invention, the method comprising:
step 201, obtaining an image to be detected; the image to be detected is a gray image.
Optionally, the step 201 may be specifically implemented by the following sub-steps 2011 to 2014:
sub-step 2011, receiving an input image.
In the embodiment of the present invention, the input image may be an original image that needs to be detected. Specifically, the step of receiving the input image may be when the shooting device shoots a picture or a video, that is, performing image detection on a real-time picture in a viewfinder frame of the shooting device before shooting, and determining whether the picture is too dark or overexposed, so that the shooting device can be assisted to adjust an aperture shutter, and intelligent adjustment of the shooting device can be realized or a user can be reminded to manually adjust shooting parameters. At this time, the real-time picture in the camera viewfinder is the input image.
The embodiment of the invention can also detect the video or the image on the storage device, so that the video pictures with over-dark and over-exposure and the video pictures with good image quality can be distinguished, the video and the image can be classified according to the image, and a user can conveniently and efficiently sort the files. At this time, the image in the storage device and the video frame picture of the video are the input images.
In the embodiment of the invention, the input image receiving can also be during video clipping, namely, the image detection is carried out on the video frame picture, the excessively dark and excessively exposed segments can be eliminated, the clipping efficiency of the video is improved, and the excessively dark and excessively exposed segments can be prevented from being clipped into a film unintentionally. At this time, the video frame is the input image.
Of course, the input image in this step may be another input image, which is not limited in this embodiment of the present invention.
Substep 2012, scaling the input image to a preset size.
In the embodiment of the present invention, the preset size may be a preset fixed image size. The image size can be set based on the hardware operation performance of the processor, the operation performance of the processor is high, and a larger image size can be set; the processor has low operation performance, and can properly reduce the image size to improve the processing speed. For example, the preset size may be set to 500 × 500.
In the embodiment of the invention, the input image is reduced or enlarged to the preset fixed size, so that each parameter can be ensured not to be changed due to different sizes of the input image in the subsequent detection process, the accuracy of image detection is ensured, the actual processing capability of a processor can be matched, the processing speed can be increased, the efficiency of image detection is improved, and for a larger input image, the real-time requirement of image detection can be met due to the higher operation speed after the image is zoomed.
And a substep 2013 of determining the input image as the image to be detected if the input image is a gray image.
In the embodiment of the invention, when the input image is a gray scale image, the input image can be directly used as the image to be detected. Specifically, in this step, whether the input image is a grayscale image may be determined by a certain determination method, and the specific determination method of whether the input image is a grayscale image is not limited in the embodiment of the present invention.
And a substep 2014 of converting the input image into a gray image if the input image is not a gray image, and determining the gray image as the image to be detected.
In the embodiment of the present invention, when it is determined that the input image is not a grayscale image, the input image needs to be converted into a grayscale image, and the converted grayscale image is used as an image to be detected.
Specifically, in the conversion, assuming that the format of the input image is an RGB color image, the step may be converted by the following conversion formula one:
Gray=R*0.299+G*0.587+B*0.114
wherein R, G, B represent the red, green, and blue channels of the input image, respectively.
Alternatively, the conversion may be performed by the following conversion formula two:
Gray=R/3+G/3+B/3
of course, other ways may also be adopted to convert the input image into the grayscale image, which is not limited in this embodiment of the present invention.
In the embodiment of the invention, an input image is received and is zoomed to a preset size, then whether the input image is a gray image or not is judged, and if the input image is the gray image, the input image is directly used as an image to be detected; if the input image is not a gray image, the input image is converted into the gray image, and the gray image obtained after conversion is used as the image to be detected, so that the image to be detected is guaranteed to be the gray image, a standard image data basis can be provided for the subsequent step of calculating the characteristic index, and the accuracy of the subsequent image detection can be further guaranteed.
202, calculating the characteristic index of the image to be detected; the characteristic indexes comprise an image brightness mean value, an image brightness standard deviation and the total brightness of target pixel points in the image; and the brightness of the target pixel point is greater than a preset pixel point brightness threshold value.
Optionally, the image to be detected belongs to at least two consecutive frames of video pictures.
In the embodiment of the invention, when the video is edited, the excessively dark and excessively exposed segments are often required to be eliminated, and at the moment, the video picture needs to be detected. Specifically, in this step, the video may be decomposed into a plurality of consecutive video frame pictures for image detection, respectively.
Accordingly, the step 202 can be specifically realized by the following substeps 2021 to 2022:
substep 2021, calculating the image brightness mean value of the image to be detected and the total brightness of the target pixel points in the image under the condition that the image to be detected is the first frame video picture in the at least two frames of video pictures; and calculating the image brightness standard deviation of the image to be detected based on the image brightness mean value of the image to be detected.
In the embodiment of the invention, if the image to be detected is the first frame video picture of the video, the image brightness mean value can be calculated in the first algorithm cycle, and then the image brightness standard deviation of the current frame (1 st frame) is calculated by using the image brightness mean value of the current frame (1 st frame) in the second algorithm cycle. The total brightness of the target pixel point in the image may be calculated in the first algorithm cycle or may be calculated in the second algorithm cycle, which is not limited in the embodiment of the present invention.
The substep 2022, under the condition that the image to be detected is not the first frame video picture, calculating the image brightness mean value of the image to be detected, and meanwhile, calculating the image brightness standard deviation of the image to be detected based on the image brightness mean value of the last video frame picture of the image to be detected, and calculating the total brightness of the target pixel points in the image.
In the embodiment of the invention, if the image to be detected is not the first frame video frame picture of the video, an acceleration algorithm can be adopted, namely, the image brightness mean value and the total brightness of the target pixel points in the image are calculated in one algorithm cycle, and meanwhile, the image brightness standard deviation of the current frame (i-th frame) is calculated by utilizing the image brightness mean value of the previous frame video frame picture (i-1 th frame).
In the embodiment of the invention, under the condition that the image to be detected belongs to continuous video frame pictures, when the image to be detected is a first frame video picture of a video, the average value of the image brightness, the standard deviation of the image brightness and the total brightness of target pixel points in the image are obtained through two cyclic calculations; when the image to be detected is not the first frame video picture of the video, the image brightness standard deviation of the current frame can be calculated by using the image brightness mean value of the previous frame, so that the image brightness mean value, the image brightness standard deviation and the total brightness of target pixel points in the image can be calculated in one cycle, namely, in the video frame picture processing process, all characteristic indexes can be calculated in one cycle for the image which is not the first frame video picture, the calculation time is shortened, the image detection efficiency is improved, and the real-time requirement on image detection in video shooting and video editing can be met.
For example, fig. 3 is a schematic diagram illustrating a method for detecting over-dark or over-exposure of a video frame according to an embodiment of the present invention. As shown in fig. 3, after the algorithm for calculating the feature index starts, it is first determined whether the image to be detected is a 1 st frame video frame, and if the image to be detected is the first frame, the image brightness mean value and the total brightness of the target pixel points in the image are calculated in the first cycle, and in the second cycle, the image brightness standard deviation is calculated by using the image brightness mean value of the current image (the 1 st frame). If the image to be detected is not the first frame video image, in the first cycle, the image brightness mean value and the total brightness of the target pixel points in the image are calculated, and the image brightness standard deviation of the current frame is calculated by using the image brightness mean value of the previous frame, so that three characteristic indexes can be calculated in one cycle in the subsequent video frame image detection, and the operation speed is improved.
Of course, the embodiment of the present invention may also use the method of calculating the image brightness mean value and the total brightness of the target pixel point in the image in the first cycle for each frame of the video, and calculate the image brightness standard deviation by using the image brightness mean value of the current image in the second cycle, so as to improve the accuracy of image detection, which is not limited in the embodiment of the present invention.
Step 203, determining the image state of the image to be detected based on the size relation between the characteristic index and a preset characteristic index threshold value; the image state includes image over-darkness or image over-exposure.
Optionally, the preset feature index threshold includes a first preset average brightness threshold, a second preset average brightness threshold, a preset standard deviation threshold, and a preset total brightness threshold; the first preset average brightness threshold is less than the second preset average brightness threshold.
In the embodiment of the present invention, the first preset average brightness threshold and the second preset average brightness threshold may be used to represent the overall brightness of the image, and the specific numerical value may be set according to the size of the image and the actual impression of the user, for example, the user may continuously set the threshold in the test image to adjust the image display effect, and when the value is lower than a certain threshold, for example, when the gray value is 50, the image is too dark overall, the threshold may be used as the first preset average brightness threshold, that is, the low average brightness threshold; when the gray value is higher than a certain threshold, for example, when the gray value is 200, the entire image is overexposed, and then the threshold may be used as a second preset average brightness threshold, that is, a high average brightness threshold.
The preset standard deviation threshold value can be used for representing the dispersion degree of the brightness of the image pixel points, and the threshold value can be specifically set according to the size of the image and the actual impression of a user. For example, the user may continuously set a threshold in the test image to adjust the image display effect, for example, set the threshold to 50, and when the threshold is higher than the threshold, the contrast of light and shade in the image is stronger, and there are some pixels with higher brightness, the threshold may be set to the preset standard deviation threshold.
The preset total brightness threshold may be a threshold of a sum of brightness of target pixel points in the image, and the threshold may be specifically set according to the size of the image and the actual impression of the user. For example, a user may continuously set a threshold in the test image to adjust the image display effect, when the threshold is higher than the threshold, there are more pixels (target pixels) in the image that are higher than the preset pixel brightness threshold, and the threshold may be used as the preset total brightness threshold if the image is overexposed as a whole. The embodiment of the present invention does not limit the specific value of the preset total brightness threshold.
Correspondingly, the step 203 can be specifically realized by the following substeps 2031 to 2032:
substep 2031, determining the image state of the image to be detected to be too dark if the image brightness mean value is smaller than the first preset average brightness threshold value and the image brightness standard deviation is smaller than the preset standard deviation threshold value.
In the embodiment of the invention, if the image brightness mean value is smaller than a first preset average brightness threshold value, that is, the average brightness of the pixel points of the image to be detected is lower than a low average brightness threshold value; and the standard deviation of the image brightness is smaller than a preset standard deviation threshold value, namely the difference between the gray value of the pixel point and the average value of the brightness is small, the gray value of the pixel point of the image to be detected fluctuates in an interval with small difference from the average value of the image brightness, and the pixel point with large difference from the average value does not exist, so that the whole image to be detected is determined to be too dark.
Substep 2032, if the total brightness of the target pixel points in the image is greater than the preset total brightness threshold value, and the image brightness mean value is greater than the second preset average brightness threshold value, determining that the image state of the image to be detected is image overexposure.
In the embodiment of the invention, the total brightness of the target pixel points in the image is greater than the preset total brightness threshold value, namely, the total brightness of the target pixel points (highlight points) in the image to be detected is greater, and the whole of the target pixel points of the image is brighter; and the image brightness mean value is greater than a second preset average brightness threshold value, namely the brightness mean value of the whole image pixel points is greater than a high average brightness threshold value, the pixel point mean value of the image to be detected is greater, at the moment, the whole image to be detected is brighter, and the high-bright-spot part is brighter, so that the overexposure of the image to be detected can be determined at the moment.
And step 204, outputting a first state mark corresponding to the image state.
Specifically, the implementation manner of this step may refer to the step 104, and details of the embodiment of the present invention are not described herein.
Step 205, outputting a second state flag when the image state of the image to be detected is not too dark or too exposed; and the second state mark represents that the image state of the image to be detected is normal.
In this embodiment of the present invention, the second status flag may be used to indicate that the image status of the image to be detected is normal, and the second status flag may specifically be in the form of a characteristic value, for example, the characteristic value 0 may be used to indicate that the image is normal. When the characteristic index of the image to be detected does not meet the condition of over-dark of the image or the condition of over-exposure of the image, the state of the image can be determined to be normal.
In the embodiment of the invention, the characteristic index of the image to be detected is compared with the preset characteristic index threshold value, and the state mark corresponding to the image state is output according to the comparison result, so that whether the image is too dark or too exposed can be simultaneously detected in a set of algorithm, the detection speed is accelerated, and the detection accuracy is improved.
For example, the image status identifier may be output according to the following program codes in the embodiment of the present invention:
if Mean<Tlow,and Std<Tstd,then
return -1;
else
if Iover>TI,and Mean>Thigh,then
return 1;
else
return 0。
wherein, -1 represents the image is too dark, 1 represents the image is overexposed, and 0 represents the image is normal. T islowRepresenting a first preset average luminance threshold, ThighRepresenting a second preset average luminance threshold, TstdRepresenting a predetermined standard deviation threshold, TIAnd representing a preset total brightness threshold value of the target pixel point.
For example, fig. 4 is a flowchart illustrating an example of detecting over-dark or over-exposure of an image according to an embodiment of the present invention. As shown in fig. 4, after receiving an input image, first scaling the input image to a preset fixed size, then converting the scaled image into a gray-scale image, and then calculating an image brightness mean value, an image brightness standard deviation and a total brightness of a target pixel point in the image based on the gray-scale image. Then, if the image brightness mean value is smaller than a first preset average brightness threshold value TlowAnd the standard deviation of the image brightness is less than a preset standard deviation threshold value TstdDetermining that the image is too dark; if it is a figureThe image brightness mean value is larger than a second preset average brightness threshold value ThighAnd, the total brightness I of the target pixel point in the imageoverGreater than the preset total brightness threshold T of the target pixel pointIDetermining the overexposure of the image; and if the two conditions are not met, determining that the image to be detected is normal.
It should be noted that, in an implementation manner, the image to be detected may also be partitioned, multiple statistics are calculated for each partitioned image block, and multiple types of histograms corresponding to each image block are counted, the image over-dark or over-exposure detection method needs to traverse the image multiple times to obtain multiple types of histograms and statistics, and the detection efficiency is low, so that the real-time performance of image detection is poor, and real-time detection during shooting cannot be achieved. The image over-dark or over-exposure detection method provided by the embodiment of the invention can obtain the image to be detected, directly calculate the characteristic index based on the gray image to be detected, and then compare and judge according to the size relation between the characteristic index and the preset threshold value, so as to directly obtain the image state of the image to be detected. The method and the device calculate the characteristic indexes on the basis of the gray level image, do not need to traverse the image for many times, do not need to acquire various types of histograms, judge only the size of the characteristic indexes and the preset threshold value in the judging process, have simple calculating and judging process, high image detection efficiency and high algorithm real-time performance, and can realize real-time detection during shooting.
It should be noted that, in another implementation, different detection algorithms may be respectively used for detecting the image state of the image to be detected, for example, whether the image is too dark may be determined by using an image over-dark detection algorithm, and whether the image is over-exposed may be determined by using an image over-exposure detection algorithm. The image detection mode needs to detect the same image to be detected for multiple times by adopting different detection algorithms, and has lower detection efficiency and lower accuracy. In the image over-dark or over-exposure detection method provided by the embodiment of the invention, the image state of the image to be detected is determined to be the image over-dark or the image over-exposure by calculating the characteristic index of the image to be detected and based on the size relation between the characteristic index and the preset characteristic index threshold value, so that whether the image is over-dark or over-exposed can be detected simultaneously in one detection process, the operation speed of image detection can be accelerated, and the detection accuracy can be improved.
In summary, in the image over-dark or over-exposure detection method provided by the embodiment of the present invention, an image to be detected is obtained first; the image to be detected is a gray image; then calculating the characteristic index of the image to be detected; the characteristic indexes comprise an image brightness mean value, an image brightness standard deviation and the total brightness of target pixel points in the image; the brightness of the target pixel point is greater than a preset pixel point brightness threshold value; determining the image state of the image to be detected based on the size relation between the characteristic index and a preset characteristic index threshold; the image state comprises image over-darkness or image over-exposure; outputting a first state mark corresponding to the image state; outputting a second state mark under the condition that the image state of the image to be detected is not too dark or overexposed; the second state flag indicates that the image state of the image to be detected is normal. In the embodiment of the invention, an auxiliary detector is not needed, whether the image is too dark or overexposed can be judged only by acquiring the image to be detected, the scene adaptability is strong, and the complexity and the cost of required hardware are low. Meanwhile, the image state is comprehensively judged through a plurality of characteristic indexes, and the detection accuracy can be improved to a certain extent.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 5, a block diagram of an image over-dark or over-exposure detecting apparatus 50 according to the present invention is shown, wherein the apparatus may include the following modules:
an obtaining module 501, configured to obtain an image to be detected; the image to be detected is a gray image.
A calculating module 502, configured to calculate a characteristic index of the image to be detected; the characteristic indexes comprise an image brightness mean value, an image brightness standard deviation and the total brightness of target pixel points in the image; and the brightness of the target pixel point is greater than a preset pixel point brightness threshold value.
A determining module 503, configured to determine an image state of the image to be detected based on a size relationship between the feature index and a preset feature index threshold; the image state includes image over-darkness or image over-exposure.
A first output module 504, configured to output a first status flag corresponding to the image status.
Optionally, the preset feature index threshold includes a first preset average brightness threshold, a second preset average brightness threshold, a preset standard deviation threshold, and a preset total brightness threshold; the first preset average brightness threshold is smaller than the second preset average brightness threshold; the determining module 503 is specifically configured to:
if the image brightness mean value is smaller than the first preset average brightness threshold value and the image brightness standard deviation is smaller than the preset standard deviation threshold value, determining that the image state of the image to be detected is too dark; and if the total brightness of the target pixel points in the image is greater than the preset total brightness threshold value and the image brightness mean value is greater than the second preset average brightness threshold value, determining that the image state of the image to be detected is image overexposure.
Optionally, the image to be detected belongs to at least two continuous frames of video pictures; the calculating module 502 is specifically configured to:
under the condition that the image to be detected is the first frame video picture in the at least two frames of video pictures, calculating the image brightness mean value of the image to be detected and the total brightness of target pixel points in the image; calculating the image brightness standard deviation of the image to be detected based on the image brightness mean value of the image to be detected; under the condition that the image to be detected is not the first frame video picture, calculating the image brightness mean value of the image to be detected, and meanwhile, calculating the image brightness standard deviation of the image to be detected and calculating the total brightness of target pixel points in the image based on the image brightness mean value of the last frame video picture of the image to be detected.
Optionally, the obtaining module 501 is specifically configured to:
receiving an input image; scaling the input image to a preset size; if the input image is a gray image, determining the input image as the image to be detected; and if the input image is not a gray image, converting the input image into a gray image, and determining the gray image as the image to be detected.
Optionally, the apparatus 50 further includes:
the second output module is used for outputting a second state mark under the condition that the image state of the image to be detected is not too dark or too exposed; and the second state mark represents that the image state of the image to be detected is normal.
In summary, the image over-dark or over-exposure detection device provided in the embodiment of the present invention first obtains an image to be detected; the image to be detected is a gray image; then calculating the characteristic index of the image to be detected; the characteristic indexes comprise an image brightness mean value, an image brightness standard deviation and the total brightness of target pixel points in the image; the brightness of the target pixel point is greater than a preset pixel point brightness threshold value; determining the image state of the image to be detected based on the size relation between the characteristic index and a preset characteristic index threshold; the image state comprises image over-darkness or image over-exposure; and finally, outputting a first state mark corresponding to the image state. In the embodiment of the invention, an auxiliary detector is not needed, whether the image is too dark or overexposed can be judged only by acquiring the image to be detected, the scene adaptability is strong, and the complexity and the cost of required hardware are low. Meanwhile, the image state is comprehensively judged through a plurality of characteristic indexes, and the detection accuracy can be improved to a certain extent.
Optionally, an embodiment of the present invention further provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and when the computer program is executed by the processor, the steps of the embodiments of the image over-dark or over-exposure detection method are implemented.
Optionally, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the embodiments of the image over-dark or over-exposure detection method described above are implemented.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As is readily imaginable to the person skilled in the art: any combination of the above embodiments is possible, and thus any combination between the above embodiments is an embodiment of the present invention, but the present disclosure is not necessarily detailed herein for reasons of space.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the invention and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (8)

1. An image over-dark or over-exposure detection method, comprising:
acquiring an image to be detected; the image to be detected is a gray image;
calculating the characteristic index of the image to be detected; the characteristic indexes comprise an image brightness mean value, an image brightness standard deviation and the total brightness of target pixel points in the image; the brightness of the target pixel point is greater than a preset pixel point brightness threshold value;
determining the image state of the image to be detected based on the size relation between the characteristic index and a preset characteristic index threshold value; the image state comprises image over-darkness or image over-exposure;
outputting a first state mark corresponding to the image state;
wherein, the image to be detected belongs to at least two continuous frames of video pictures; the characteristic index of the image to be detected is calculated, and the method comprises the following steps:
under the condition that the image to be detected is the first frame video picture in the at least two frames of video pictures, calculating the image brightness mean value of the image to be detected and the total brightness of target pixel points in the image; calculating the image brightness standard deviation of the image to be detected based on the image brightness mean value of the image to be detected;
under the condition that the image to be detected is not the first frame video picture, calculating the image brightness mean value of the image to be detected, and meanwhile, calculating the image brightness standard deviation of the image to be detected and calculating the total brightness of target pixel points in the image based on the image brightness mean value of the last frame video picture of the image to be detected.
2. The method of claim 1, wherein the preset feature indicator threshold comprises a first preset average brightness threshold, a second preset average brightness threshold, a preset standard deviation threshold, and a preset total brightness threshold; the first preset average brightness threshold is smaller than the second preset average brightness threshold;
the determining the image state of the image to be detected based on the size relation between the characteristic indexes and the preset characteristic index threshold value comprises the following steps:
if the image brightness mean value is smaller than the first preset average brightness threshold value and the image brightness standard deviation is smaller than the preset standard deviation threshold value, determining that the image state of the image to be detected is too dark;
and if the total brightness of the target pixel points in the image is greater than the preset total brightness threshold value and the image brightness mean value is greater than the second preset average brightness threshold value, determining that the image state of the image to be detected is image overexposure.
3. The method according to claim 1, wherein the acquiring the image to be detected comprises:
receiving an input image;
scaling the input image to a preset size;
if the input image is a gray image, determining the input image as the image to be detected;
and if the input image is not a gray image, converting the input image into a gray image, and determining the gray image as the image to be detected.
4. The method according to any one of claims 1 to 3, further comprising:
outputting a second state mark under the condition that the image state of the image to be detected is not too dark or overexposed; and the second state mark represents that the image state of the image to be detected is normal.
5. An image over-dark or over-exposure detection device, comprising:
the acquisition module is used for acquiring an image to be detected; the image to be detected is a gray image;
the calculation module is used for calculating the characteristic index of the image to be detected; the characteristic indexes comprise an image brightness mean value, an image brightness standard deviation and the total brightness of target pixel points in the image; the brightness of the target pixel point is greater than a preset pixel point brightness threshold value;
the determining module is used for determining the image state of the image to be detected based on the size relation between the characteristic indexes and a preset characteristic index threshold value; the image state comprises image over-darkness or image over-exposure;
the first output module is used for outputting a first state mark corresponding to the image state;
wherein, the image to be detected belongs to at least two continuous frames of video pictures; the calculation module is specifically configured to:
under the condition that the image to be detected is the first frame video picture in the at least two frames of video pictures, calculating the image brightness mean value of the image to be detected and the total brightness of target pixel points in the image; calculating the image brightness standard deviation of the image to be detected based on the image brightness mean value of the image to be detected;
under the condition that the image to be detected is not the first frame video picture, calculating the image brightness mean value of the image to be detected, and meanwhile, calculating the image brightness standard deviation of the image to be detected and calculating the total brightness of target pixel points in the image based on the image brightness mean value of the last frame video picture of the image to be detected.
6. The apparatus of claim 5, wherein the predetermined characteristic indicator threshold comprises a first predetermined average brightness threshold, a second predetermined average brightness threshold, a predetermined standard deviation threshold, and a predetermined total brightness threshold; the first preset average brightness threshold is smaller than the second preset average brightness threshold;
the determining module is specifically configured to:
if the image brightness mean value is smaller than a first preset average brightness threshold value and the image brightness standard deviation is smaller than a preset standard deviation threshold value, determining that the image state of the image to be detected is too dark;
and if the total brightness of the target pixel points in the image is greater than a preset total brightness threshold value and the image brightness mean value is greater than a second preset average brightness threshold value, determining the image state of the image to be detected as image overexposure.
7. An electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the image over-dark or over-exposure detection method according to any one of claims 1 to 4.
8. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of image over-dark or over-exposure detection according to any one of claims 1 to 4.
CN202010786655.1A 2020-08-07 2020-08-07 Method and device for detecting image over-darkness or over-exposure Active CN111739110B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010786655.1A CN111739110B (en) 2020-08-07 2020-08-07 Method and device for detecting image over-darkness or over-exposure

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010786655.1A CN111739110B (en) 2020-08-07 2020-08-07 Method and device for detecting image over-darkness or over-exposure

Publications (2)

Publication Number Publication Date
CN111739110A CN111739110A (en) 2020-10-02
CN111739110B true CN111739110B (en) 2020-11-27

Family

ID=72658220

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010786655.1A Active CN111739110B (en) 2020-08-07 2020-08-07 Method and device for detecting image over-darkness or over-exposure

Country Status (1)

Country Link
CN (1) CN111739110B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112767392A (en) * 2021-03-02 2021-05-07 百果园技术(新加坡)有限公司 Image definition determining method, device, equipment and storage medium
CN113421209A (en) * 2021-06-21 2021-09-21 安谋科技(中国)有限公司 Image processing method, system on chip, electronic device, and medium
CN113947602B (en) * 2021-12-21 2022-03-18 山东信通电子股份有限公司 Image brightness detection method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102724405A (en) * 2012-06-21 2012-10-10 无锡市中兴光电子技术有限公司 Method and device for automatic exposure compensation of backlit scenes in video imaging system
CN105828065A (en) * 2015-01-08 2016-08-03 中国移动通信集团浙江有限公司 Method and device for detecting video picture overexposure
CN105959585A (en) * 2016-05-12 2016-09-21 深圳众思科技有限公司 Multi-grade backlight detection method and device
CN110322450A (en) * 2018-03-30 2019-10-11 张�杰 The method for improving binarization threshold selection accuracy

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2860089B1 (en) * 2003-09-23 2005-11-11 Do Labs METHOD AND SYSTEM FOR DIFFERENTIALLY AND DIFFERENTLY REGULAR DIGITAL IMAGE MODIFICATION BY PIXEL
CN111340749A (en) * 2018-12-17 2020-06-26 顺丰科技有限公司 Image quality detection method, device, equipment and storage medium
CN111489395A (en) * 2020-04-13 2020-08-04 展讯通信(上海)有限公司 Image signal direction judging method and related equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102724405A (en) * 2012-06-21 2012-10-10 无锡市中兴光电子技术有限公司 Method and device for automatic exposure compensation of backlit scenes in video imaging system
CN105828065A (en) * 2015-01-08 2016-08-03 中国移动通信集团浙江有限公司 Method and device for detecting video picture overexposure
CN105959585A (en) * 2016-05-12 2016-09-21 深圳众思科技有限公司 Multi-grade backlight detection method and device
CN110322450A (en) * 2018-03-30 2019-10-11 张�杰 The method for improving binarization threshold selection accuracy

Also Published As

Publication number Publication date
CN111739110A (en) 2020-10-02

Similar Documents

Publication Publication Date Title
CN111739110B (en) Method and device for detecting image over-darkness or over-exposure
US7551797B2 (en) White balance adjustment
CN107635102B (en) Method and device for acquiring exposure compensation value of high-dynamic-range image
US8451371B2 (en) Exposure control for an imaging system
JP5719418B2 (en) High dynamic range image exposure time control method
US20070047803A1 (en) Image processing device with automatic white balance
US20110090365A1 (en) Method and apparatus for controlling multiple exposures
US7590346B2 (en) Digital camera
CN108616689B (en) Portrait-based high dynamic range image acquisition method, device and equipment
US7970271B2 (en) Brightness correction apparatus for moving images, and method and program for controlling same
US9204113B1 (en) Method and/or apparatus for implementing high dynamic range image processing in a video processing system
JP5693271B2 (en) Image processing apparatus and method
CN107846556B (en) Imaging method, imaging device, mobile terminal and storage medium
JP2007173933A (en) Digital camera, gain calculation apparatus, and gain calculation method
CN108337446B (en) High dynamic range image acquisition method, device and equipment based on double cameras
JP2003348438A (en) Image photographing method and apparatus, image selecting method and apparatus, and program
US9020269B2 (en) Image processing device, image processing method, and recording medium
JP2007266680A (en) Imaging apparatus
JP2004173251A (en) Camera
CN113691724A (en) HDR scene detection method and device, terminal and readable storage medium
JP2003348339A (en) Image processing method, apparatus and program
AU2005203381B2 (en) White balance adjustment
JP2014179755A (en) Image processing device, control method therefor and control program
CN113822819A (en) HDR scene detection method and device, terminal and readable storage medium
CN114143419A (en) Dual-sensor camera system and depth map calculation method 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
GR01 Patent grant
GR01 Patent grant