CN112070682A - Method and device for compensating image brightness - Google Patents
Method and device for compensating image brightness Download PDFInfo
- Publication number
- CN112070682A CN112070682A CN201910498002.0A CN201910498002A CN112070682A CN 112070682 A CN112070682 A CN 112070682A CN 201910498002 A CN201910498002 A CN 201910498002A CN 112070682 A CN112070682 A CN 112070682A
- Authority
- CN
- China
- Prior art keywords
- pixel
- highlight
- brightness
- value
- determining
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 38
- 230000001419 dependent effect Effects 0.000 claims description 14
- 238000004364 calculation method Methods 0.000 claims description 13
- 230000006870 function Effects 0.000 description 74
- 238000010586 diagram Methods 0.000 description 6
- 238000013507 mapping Methods 0.000 description 4
- 230000015654 memory Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 3
- 239000000126 substance Substances 0.000 description 3
- 238000009499 grossing Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000012886 linear function Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 238000012887 quadratic function Methods 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000001356 surgical procedure Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/90—Dynamic range modification of images or parts thereof
- G06T5/94—Dynamic range modification of images or parts thereof based on local image properties, e.g. for local contrast enhancement
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
Abstract
The application discloses a method and a device for compensating image brightness, and belongs to the field of image processing. The method comprises the following steps: determining a highlight central point meeting a preset high-brightness condition in a target image; determining a highlight area taking the highlight central point as a center in the target image; and performing brightness positive gain compensation on the image outside the highlight area in the target image, and performing brightness negative gain compensation on the image in the highlight area. By adopting the method and the device, the image can be compensated, so that the image cannot lose details due to over brightness or over darkness.
Description
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to a method and an apparatus for compensating image brightness.
Background
When image capturing is performed in some scenes, there may be a large contrast between light and dark on the captured image due to environmental problems. For example, in an operating room, when a camera is used to photograph a surgical procedure, an image corresponding to a portion of the shadowless lamp that is vertically illuminated by light will be bright, and the remaining portion will be relatively dim. Such images may lose detail partly due to being too dark and partly due to being too bright.
Disclosure of Invention
In order to solve the problems of the related art, embodiments of the present application provide a method and an apparatus for image brightness compensation. The technical scheme is as follows:
in a first aspect, a method for image brightness compensation is provided, the method comprising:
determining a highlight central point meeting a preset high-brightness condition in a target image;
determining a highlight area taking the highlight central point as a center in the target image;
and performing brightness positive gain compensation on the image outside the highlight area in the target image, and performing brightness negative gain compensation on the image in the highlight area.
Optionally, the determining, in the target image, a highlight central point meeting a preset highlight condition includes:
determining an image block with the largest pixel value sum in image blocks with preset sizes in a target image, and determining a central point of the image block with the largest pixel value sum as a highlight central point;
alternatively, the first and second electrodes may be,
determining pixel points with pixel values larger than a preset threshold value in a target image;
and performing weighted average calculation on the row coordinates of the pixel points with the pixel values larger than the preset threshold value by taking the pixel values of the corresponding pixel points as weights to obtain the row coordinates of the highlight central point, and performing weighted average calculation on the column coordinates of the pixel points with the pixel values larger than the preset threshold value by taking the pixel values of the corresponding pixel points as weights to obtain the column coordinates of the highlight central point.
Optionally, the determining the highlight region centered on the highlight central point includes:
and determining the circular area with the circle center as the highlight central point and the radius as a preset numerical value as a highlight area.
Optionally, the performing brightness positive gain compensation on the image outside the highlight region in the target image includes:
acquiring a preset initial positive gain compensation function, wherein the initial positive gain compensation function comprises an unknown coefficient, the independent variable of the initial positive gain compensation function is the distance from a pixel point to the highlight central point, and the dependent variable is a brightness gain value;
determining a logarithmic entropy expression of the compensated target image based on the initial positive gain compensation function;
determining logarithmic entropy values corresponding to different values of the unknown coefficient based on the logarithmic entropy expression;
substituting the value of the unknown coefficient corresponding to the minimum logarithmic entropy value into the initial positive gain compensation function to obtain a positive gain compensation function to be used;
and for each pixel point which is positioned outside the highlight area in the target image, determining a brightness gain value corresponding to the pixel point based on the distance from the pixel point to the highlight central point and the positive gain compensation function, and multiplying the original pixel value of the pixel point by the corresponding brightness gain value to obtain the pixel value of the pixel point after the positive gain compensation of the brightness.
Optionally, the performing brightness negative gain compensation on the image outside the highlight region in the target image includes:
acquiring a preset negative gain compensation function, wherein the independent variable of the preset negative gain compensation function is the distance from the pixel point to the highlight central point, and the dependent variable is a brightness gain value;
and for each pixel point in the target image in the highlight area, determining a brightness gain value corresponding to the pixel point based on the distance from the pixel point to the highlight central point and the negative gain compensation function, and multiplying the original pixel value of the pixel point by the corresponding brightness gain value to obtain a pixel value of the pixel point after brightness negative gain compensation.
In a second aspect, there is provided an apparatus for image brightness compensation, the apparatus comprising:
the first determination module is used for determining a highlight central point meeting a preset highlight condition in the target image;
the second determining module is used for determining a highlight area taking the highlight central point as a center in the target image;
and the compensation module is used for performing brightness positive gain compensation on the image outside the highlight area in the target image and performing brightness negative gain compensation on the image in the highlight area.
Optionally, the first determining module is configured to:
determining an image block with the largest pixel value sum in image blocks with preset sizes in a target image, and determining a central point of the image block with the largest pixel value sum as a highlight central point;
alternatively, the first and second electrodes may be,
determining pixel points with pixel values larger than a preset threshold value in a target image;
and performing weighted average calculation on the row coordinates of the pixel points with the pixel values larger than the preset threshold value by taking the pixel values of the corresponding pixel points as weights to obtain the row coordinates of the highlight central point, and performing weighted average calculation on the column coordinates of the pixel points with the pixel values larger than the preset threshold value by taking the pixel values of the corresponding pixel points as weights to obtain the column coordinates of the highlight central point.
Optionally, the second determining module is configured to:
and determining the circular area with the circle center as the highlight central point and the radius as a preset numerical value as a highlight area.
Optionally, the compensation module is configured to:
acquiring a preset initial positive gain compensation function, wherein the initial positive gain compensation function comprises an unknown coefficient, the independent variable of the initial positive gain compensation function is the distance from a pixel point to the highlight central point, and the dependent variable is a brightness gain value;
determining a logarithmic entropy expression of the compensated target image based on the initial positive gain compensation function;
determining logarithmic entropy values corresponding to different values of the unknown coefficient based on the logarithmic entropy expression;
substituting the value of the unknown coefficient corresponding to the minimum logarithmic entropy value into the initial positive gain compensation function to obtain a positive gain compensation function to be used;
and for each pixel point which is positioned outside the highlight area in the target image, determining a brightness gain value corresponding to the pixel point based on the distance from the pixel point to the highlight central point and the positive gain compensation function, and multiplying the original pixel value of the pixel point by the corresponding brightness gain value to obtain the pixel value of the pixel point after the positive gain compensation of the brightness.
Optionally, the compensation module is configured to:
acquiring a preset negative gain compensation function, wherein the independent variable of the preset negative gain compensation function is the distance from the pixel point to the highlight central point, and the dependent variable is a brightness gain value;
and for each pixel point in the target image in the highlight area, determining a brightness gain value corresponding to the pixel point based on the distance from the pixel point to the highlight central point and the negative gain compensation function, and multiplying the original pixel value of the pixel point by the corresponding brightness gain value to obtain a pixel value of the pixel point after brightness negative gain compensation.
In a third aspect, an electronic device is provided, where the terminal includes a processor and a memory, and the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the method for image brightness compensation according to the first aspect.
In a fourth aspect, there is provided a computer readable storage medium having stored therein at least one instruction, which is loaded and executed by the processor, to implement the method of image brightness compensation as described in the first aspect above.
The beneficial effects brought by the technical scheme provided by the embodiment of the application at least comprise:
in the embodiment of the application, for a target image needing brightness compensation, a highlight central point meeting a preset highlight condition is determined in the target image. Then, the highlight area is determined with the highlight center point as the center. The highlight region may be understood as a region with higher brightness in the target image, and the brightness of the image outside the highlight region is smaller. And then, brightness negative gain compensation is carried out on the high brightness area, so that the loss of details caused by overexposure due to overlarge brightness is avoided, and two-preferred positive gain compensation is carried out on the images outside the brightness area, so that the loss of details caused by undersize brightness is avoided.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a method for compensating image brightness according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an image provided by an embodiment of the present application;
FIG. 3 is a schematic diagram of an image provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of a segmentation function provided by an embodiment of the present application;
FIG. 5 is a schematic structural diagram of an apparatus for image brightness compensation according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a terminal according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The embodiment of the application provides a method for compensating image brightness, which can be realized by a terminal. The terminal can be a desktop computer, a notebook computer, a tablet computer and the like. The method can process the image with the following characteristics: there is a region of higher brightness in the image, and the greater the distance from the region in the image, the lower the brightness. Such images can be formed in a wide variety of situations. For example, due to the optical characteristics of the camera lens, a wide-angle image can be captured with a bright central area and a lower brightness at a distance from the central area. For another example, when an image of an object is taken because light is irradiated perpendicularly to a certain portion of the object, the brightness of the image corresponding to a region irradiated perpendicularly by the light is high, the brightness of the image outside the region is relatively small, and the brightness of the image corresponding to the distance from the region is smaller.
As shown in fig. 1, the processing flow of the method may include the following steps:
in step 101, a highlight center point satisfying a preset highlight condition is determined in a target image.
In practice, a highlight center point is first determined in the target image before the brightness compensation is performed on the target image. There are several ways for determining the highlight center point, several of which are described below by way of example.
In the first method, in image blocks with preset sizes included in a target image, an image block with the largest pixel value sum is determined, and a central point of the image block with the largest pixel value sum is determined as a highlight central point.
In implementation, a sliding window method may be adopted, as shown in fig. 2, each small cell in the drawing represents one pixel point, and an image block of a preset size, that is, an image block of m × n size, is determined from the left side of the image, where m represents that the image block has m pixel points in length, and n represents that the image block has n pixel points in width, and may also be understood as that the image block has m × n pixel points. For the setting of the preset size, a technician can set the preset size according to various requirements such as precision, time delay and the like. And then sequentially determining the image blocks with the preset sizes rightward according to a preset step length, when the determined image blocks comprise the pixels in the rightmost column, determining the image blocks with the preset sizes by taking the initially determined image blocks as a reference, moving the preset step length downwards to determine the image blocks with the preset sizes, then sequentially determining the image blocks with the preset sizes rightward, and repeating the steps until all the pixels in the image are in the determined image blocks, and stopping the operation. For setting the preset step length, a technician may also set the preset step length to be one pixel according to various requirements such as precision, time delay, and the like. Here, it should be noted that there are other different sliding window methods for the sliding window method described above, and the specific type of the sliding window method used in the embodiment of the present application is not limited.
And calculating the sum of pixel values of all pixel points of each image block with the preset size in the determined target image, and determining the central pixel of the image block with the largest pixel sum as a highlight central point. Here, when the image block of the predetermined size is determined by the sliding window method, the sum of the pixel values may be calculated every time an image block of the predetermined size is determined. The embodiment of the present application does not limit when the sum of the pixel values of the pixel block is calculated.
Determining pixel points with pixel values larger than a preset threshold value in a target image, performing weighted average calculation on row coordinates of the pixel points with the pixel values larger than the preset threshold value by taking the pixel values of the corresponding pixel points as weights to obtain row coordinates of a highlight central point, and performing weighted average calculation on column coordinates of the pixel points with the pixel values larger than the preset threshold value by taking the pixel values of the corresponding pixel points as weights to obtain column coordinates of the highlight central point.
In implementation, first, in the target image, a pixel point with a pixel value greater than a preset threshold is determined, where the preset threshold may be specifically determined according to actual requirements, such as 120, 100, and the like.
Then, substituting the pixel value of the pixel point with the pixel value larger than the preset threshold value into the following formula:
the coordinates of the highlight center point can be obtained, whereinThe coordinate of the brightness center point, I is the row coordinate of the pixel point with the pixel value larger than the preset threshold, j is the column coordinate of the pixel point with the pixel value larger than the preset threshold, and I (I, j) is the pixel value of the pixel point with the row-column coordinate (I, j).
In step 102, a highlight region centered on a highlight center point is determined in the target image.
Wherein the highlight region may be a circular region.
In implementation, in the target image, a circular area with the highlight central point as a center and a radius of a preset numerical value is used as the highlight area of the target image. The preset value may be set empirically by a technician. As shown in FIG. 3, the point o is the highlight center, the circular area is the highlight area, and the radius is r0. The radius here can be generally 0.3 to 0.5, and the radius here (the distance from the pixel point on the edge of the highlight region to the highlight center point) is the normalized result, that is, the farthest distance between the pixel point in the target image and the highlight center point is 1.
In step 103, the image outside the highlight region in the target image is subjected to the luminance positive gain compensation, and the image inside the highlight region is subjected to the luminance negative gain compensation.
Wherein, the positive gain compensation of the brightness is that the pixel value of the pixel point after compensation is larger than the original pixel value, and the negative gain compensation of the brightness is that the pixel value of the pixel point after compensation is smaller than the original pixel value.
In implementation, the luminance compensation is performed on the pixel point, that is, a gain value is determined for the pixel point, and the pixel value of the pixel point after the luminance compensation is obtained by multiplying the original pixel value of the pixel point by the gain value. Determining the gain value for each pixel point may be performed as follows. Selecting a plurality of pixel points with different distances from a highlight central point in a target image, firstly setting a gain value for the selected pixel points, wherein the selected pixel points comprise at least one pixel point in a highlight area, at least one pixel point at the edge of the highlight area and at least one pixel point outside the highlight area, the gain value set for the selected pixel points in the highlight area is smaller than 1, namely the pixel value after brightness compensation is smaller than the original pixel value, the gain value set for the selected pixel points at the edge of the highlight area is equal to 1, namely the gain value after brightness compensation is still the original pixel value, the gain value set for the selected pixel points outside the highlight area is larger than 1, namely the gain value after brightness compensation is larger than the original pixel value. The selected pixel points are used as sample pixel points, a continuously increasing function can be fitted based on the preset gain values of the sample pixel points, the dependent variable of the function is the gain value of the pixel points, the independent variable is the distance from the pixel points to the highlight central point, the distance can be a normalized distance, and the distance is between 0 and 1. The gain value corresponding to the pixel point determined by the function has the characteristics that the gain value corresponding to the pixel point in the highlight area is smaller than 1, the gain value corresponding to the pixel point on the edge of the highlight area is equal to 1, and the gain value corresponding to the pixel point outside the highlight area is larger than 1. Based on the function, the brightness positive gain compensation can be carried out on the image outside the highlight area in the target image, and the brightness negative gain compensation can be carried out on the image in the highlight area.
Optionally, corresponding gain compensation functions may be respectively determined for the image in the highlight region and the image outside the highlight region, and accordingly, for the image outside the highlight region, the processing in step 103 may be as follows: and acquiring a preset initial positive gain compensation function. Determining a logarithmic entropy expression of the compensated target image based on the initial positive gain compensation function; and determining logarithmic entropy values corresponding to different values of the unknown coefficient based on the logarithmic entropy expression. And substituting the value of the unknown coefficient corresponding to the minimum logarithmic entropy value into the initial positive gain compensation function to obtain the positive gain compensation function to be used. And for each pixel point which is positioned outside the highlight area in the target image, determining a brightness gain value corresponding to the pixel point based on the distance from the pixel point to the highlight central point and the positive gain compensation function, and multiplying the original pixel value of the pixel point by the corresponding brightness gain value to obtain the pixel value of the pixel point after the positive gain compensation of the brightness.
The initial positive gain compensation function comprises an unknown coefficient, the independent variable of the initial positive gain compensation function is the distance from the pixel point to the highlight central point, and the dependent variable is a brightness gain value.
In implementation, an initial positive gain compensation function is first obtained, and specifically, the initial positive gain compensation function may be:
ga,b,c(r)=1+ar2+br4+cr6
wherein, ga,b,cAnd (r) is a gain value corresponding to a pixel point with the distance r from the highlight center point, a, b and c are constant coefficients to be determined, and r is the distance between the pixel point and the highlight center. The following formula can be used for the calculation of r:
wherein x and y are row coordinates and column coordinates of the pixel points,andthe row and column coordinates of the highlight center point.Andthe above-described method one and method two can be used for determination. As can be seen from the positive gain compensation function, each pixel point corresponds to a gain value, and the gain value is related to the distance between the pixel point and the highlight central point.
The pixel value expression of the pixel point after the brightness gain compensation can be expressed as:
Lcorr(x,y)=Lorig(x,y)·ga,b,c(r)
wherein L iscorr(x, y) is the pixel value after brightness compensation is carried out on the pixel point with the coordinate of (x, y), namely, the distance between the pixel point and the highlight central point is r, and L isorigAnd (x, y) is an original pixel value which has no brightness compensation and has the coordinate of (x, y), namely, the pixel point which has the distance of r from the highlight central point. Since the pixel point in the target image has a larger distance from the highlight center point and a smaller brightness, the gain value should be correspondingly larger, so the positive gain compensation function should be monotonically increasing, i.e. the first derivative of the positive gain compensation function with respect to r should be greater than 0, then:
and because the value of r is between 0 and 1, the above equation can be converted into:
a+2br2+3cr4>0
if let r2Q, then the above equation can be converted to:
a+2bq+3cq2>0
from the nature of the quadratic inequality, one can obtain:
the following are conditions a, b, c that should be satisfied in order to satisfy the above conditions:
wherein the content of the first and second substances,
C1=(c≥0∧4b2-12ac<0),
C2=(c≥0∧4b2-12ac≥0∧q-≤0∧q+≤0)
C3=(c≥0∧4b2-12ac≥0∧q-≥0∧q+≥0)
C4=(c<0∧q-≤0∧q+≥0)
C5=(c<0∧q-≥0∧q+≤0)
then, a logarithmic entropy expression of the target image is established, and a method of establishing the logarithmic entropy expression is listed below.
Firstly, mapping pixel values in a target image into a color level range of [0, N-1] based on a logarithmic relation, wherein a specific mapping expression can be as follows:
wherein i (L)corr(x, y)) is a tone scale obtained by mapping the pixel value of the pixel point based on a logarithmic relation, and N can generally take the value of 256. It can be seen that i (L) is obtained by the mapping expressioncorr(x, y)) should be a decimal number, then when counting the mapped tone scale histogram, the following formula can be followed:
wherein the content of the first and second substances,which means that the rounding is made up,indicating rounding down, k is the value of the color gradation at [0, N-1]],nkRepresenting the statistical number of levels k. Thus, a histogram of color levels can be obtained, and then the histogram of color levels can be subjected to gaussian smoothing or linear smoothing to obtain a new histogram of color levels. The logarithmic entropy expression for the target image may be:
wherein the content of the first and second substances,representing the statistical probability of the tone scale k,
in summary, there are unknown parameters a, b, and c in the logarithmic entropy expression of the target image. The above condition can be satisfied by traversalThe values of a, b and c are substituted into the logarithmic entropy expression. Each substitution of a, b, c into a set of a, b, c yields a logarithmic entropy value H, and further, determines a, b, c that minimizes the logarithmic entropy, thereby yielding a positive gain compensation function.
Since the positive gain compensation function is to be used on images outside the highlight region, it can be modified, which can be in the form:
ga,b,c(r)=1+a(r-r0)2+b(r-r0)4+c(r-r0)6
wherein r is0The radius of the highlight region.
After the positive gain compensation function is determined, the distance from the pixel point of the image outside the highlight area of the target image to the highlight central point is substituted into the gain compensation function, and then the brightness gain value corresponding to the pixel point can be obtained. And then, multiplying the original pixel value of the pixel point by the corresponding brightness gain value to obtain the pixel value after the positive gain compensation of the pixel point brightness.
For images in highlight regions, the processing in step 103 may be as follows: and acquiring a preset negative gain compensation function, and determining a brightness gain value corresponding to the pixel point based on the distance from the pixel point to the highlight central point and the negative gain compensation function for each pixel point in the highlight area in the target image. And multiplying the original pixel value of the pixel point by the corresponding brightness gain value to obtain the pixel value after the negative gain compensation of the pixel point brightness.
The independent variable of the preset negative gain compensation function is the distance from the pixel point to the highlight central point, and the dependent variable is the brightness gain value.
In an implementation, the negative gain compensation function may be set by a technician prior to performing brightness compensation on the target image. The setting process of the negative gain compensation function can be as follows, firstly, a plurality of pixel points with different distances from the highlight center are selected in the highlight area of the image under a certain scene, the gain value is preset, and then, the pixel points at the edge of the highlight area, namely the distance from the highlight center is r0The pixel of (1) sets its gain value to 1. Based on selectionThe distance between the pixel point and the highlight central point and the preset gain value of the pixel point can be fitted to form a monotonically increasing negative gain compensation function, the function dependent variable is the gain value of the pixel point, and the independent variable is the distance between the pixel point and the highlight central point. Wherein the value of the negative gain compensation function is greater than 0 and less than 1, and the distance value is greater than 0 and less than r0. Here, the negative gain compensation function is a non-linear function, such as a gamma function, or a quadratic function. For images taken in the same scene, the position and brightness of the highlight area are similar, for example, in the environment of shadowless lamp of operating table, if the camera is taken at a fixed position, the position and brightness of the highlight area in each image taken is similar, and then the same negative gain compensation function can be selected to be used when each image is processed. In a specific implementation, the constant parameter in the negative gain compensation function may be adjusted according to the brightness of the highlight region in the image to be actually subjected to brightness compensation. After the negative gain compensation function is obtained, the distance from the pixel point of the image outside the highlight area of the target image to the highlight central point can be substituted into the gain compensation function, and then the brightness gain value corresponding to the pixel point can be obtained. And then, multiplying the original pixel value of the pixel point by the corresponding brightness gain value to obtain the pixel value after the positive gain compensation of the pixel point brightness.
It should be noted that, the brightness compensation can be performed on the target image at the same time, and after the positive gain compensation function and the negative gain compensation function are determined, a piecewise function can be obtained, in which the value range of the independent variable (the distance from the pixel point to the highlight central point) is from 0 to r0The value range of the independent variable is larger than r for the negative gain compensation function0Is a positive gain compensation function and has a distance r from the center point of the highlight0The corresponding luminance gain value of the pixel point of (a) is 1. In this way, a piecewise function as shown in fig. 4 can be obtained which is continuous at a luminance gain value of 1. The target image may be luminance compensated based on the piecewise function.
Based on the same technical concept, an embodiment of the present application further provides a device for reading a meter, where the device may be the image capturing apparatus with certain image processing capability in the foregoing embodiment, as shown in fig. 5, the device includes: a first determination module 510, a second determination module 520, and a compensation module 530.
A first determining module 510, configured to determine, in a target image, a highlight central point that meets a preset highlight condition;
a second determining module 520, configured to determine, in the target image, a highlight region centered on the highlight central point;
the compensation module 530 is configured to perform brightness positive gain compensation on an image outside a highlight region in the target image, and perform brightness negative gain compensation on an image inside the highlight region.
Optionally, the first determining module 510 is configured to:
determining an image block with the largest pixel value sum in image blocks with preset sizes in a target image, and determining a central point of the image block with the largest pixel value sum as a highlight central point;
alternatively, the first and second electrodes may be,
determining pixel points with pixel values larger than a preset threshold value in a target image;
and performing weighted average calculation on the row coordinates of the pixel points with the pixel values larger than the preset threshold value by taking the pixel values of the corresponding pixel points as weights to obtain the row coordinates of the highlight central point, and performing weighted average calculation on the column coordinates of the pixel points with the pixel values larger than the preset threshold value by taking the pixel values of the corresponding pixel points as weights to obtain the column coordinates of the highlight central point.
Optionally, the second determining module 520 is configured to:
and determining the circular area with the circle center as the highlight central point and the radius as a preset numerical value as a highlight area.
Optionally, the compensation module 530 is configured to:
acquiring a preset initial positive gain compensation function, wherein the initial positive gain compensation function comprises an unknown coefficient, the independent variable of the initial positive gain compensation function is the distance from a pixel point to the highlight central point, and the dependent variable is a brightness gain value;
determining a logarithmic entropy expression of the compensated target image based on the initial positive gain compensation function;
determining logarithmic entropy values corresponding to different values of the unknown coefficient based on the logarithmic entropy expression;
substituting the value of the unknown coefficient corresponding to the minimum logarithmic entropy value into the initial positive gain compensation function to obtain a positive gain compensation function to be used;
and for each pixel point which is positioned outside the highlight area in the target image, determining a brightness gain value corresponding to the pixel point based on the distance from the pixel point to the highlight central point and the positive gain compensation function, and multiplying the original pixel value of the pixel point by the corresponding brightness gain value to obtain the pixel value of the pixel point after the positive gain compensation of the brightness.
Optionally, the compensation module 530 is configured to:
acquiring a preset negative gain compensation function, wherein the independent variable of the preset negative gain compensation function is the distance from the pixel point to the highlight central point, and the dependent variable is a brightness gain value;
and for each pixel point in the target image in the highlight area, determining a brightness gain value corresponding to the pixel point based on the distance from the pixel point to the highlight central point and the negative gain compensation function, and multiplying the original pixel value of the pixel point by the corresponding brightness gain value to obtain a pixel value of the pixel point after brightness negative gain compensation.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
It should be noted that: in the image brightness compensation device provided in the above embodiment, only the division of the above functional modules is illustrated when performing image brightness compensation, and in practical applications, the above functions may be distributed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to complete all or part of the above described functions. In addition, the image brightness compensation device provided in the above embodiment and the image brightness compensation method embodiment belong to the same concept, and specific implementation processes thereof are described in the method embodiment and are not described herein again.
In an exemplary embodiment, a computer-readable storage medium is further provided, in which at least one instruction is stored, and the at least one instruction is loaded and executed by a processor to implement the method for identifying an action category in the above embodiments. For example, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Fig. 6 is a schematic structural diagram of a terminal according to an embodiment of the present application, where the computer device 600 may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 601 and one or more memories 602, where the memory 602 stores at least one instruction, and the at least one instruction is loaded and executed by the processor 601 to implement the method for image brightness compensation.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims (10)
1. A method of image brightness compensation, the method comprising:
determining a highlight central point meeting a preset high-brightness condition in a target image;
determining a highlight area taking the highlight central point as a center in the target image;
and performing brightness positive gain compensation on the image outside the highlight area in the target image, and performing brightness negative gain compensation on the image in the highlight area.
2. The method according to claim 1, wherein the determining, in the target image, a highlight central point satisfying a preset highlight condition comprises:
determining an image block with the largest pixel value sum in image blocks with preset sizes in a target image, and determining a central point of the image block with the largest pixel value sum as a highlight central point;
alternatively, the first and second electrodes may be,
determining pixel points with pixel values larger than a preset threshold value in a target image, performing weighted average calculation on row coordinates of the pixel points with the pixel values larger than the preset threshold value by taking the pixel values of the corresponding pixel points as weights to obtain row coordinates of a highlight central point, and performing weighted average calculation on column coordinates of the pixel points with the pixel values larger than the preset threshold value by taking the pixel values of the corresponding pixel points as weights to obtain column coordinates of the highlight central point.
3. The method of claim 1, wherein the determining a highlight region centered at the highlight center point comprises:
and determining the circular area with the circle center as the highlight central point and the radius as a preset numerical value as a highlight area.
4. The method of claim 3, wherein the performing positive gain compensation for brightness on the image outside the highlight region in the target image comprises:
acquiring a preset initial positive gain compensation function, wherein the initial positive gain compensation function comprises an unknown coefficient, the independent variable of the initial positive gain compensation function is the distance from a pixel point to the highlight central point, and the dependent variable is a brightness gain value;
determining a logarithmic entropy expression of the compensated target image based on the initial positive gain compensation function;
determining logarithmic entropy values corresponding to different values of the unknown coefficient based on the logarithmic entropy expression;
substituting the value of the unknown coefficient corresponding to the minimum logarithmic entropy value into the initial positive gain compensation function to obtain a positive gain compensation function to be used;
and for each pixel point which is positioned outside the highlight area in the target image, determining a brightness gain value corresponding to the pixel point based on the distance from the pixel point to the highlight central point and the positive gain compensation function, and multiplying the original pixel value of the pixel point by the corresponding brightness gain value to obtain the pixel value of the pixel point after the positive gain compensation of the brightness.
5. The method of claim 3, wherein the performing negative gain compensation for brightness on the image outside the highlight region in the target image comprises:
acquiring a preset negative gain compensation function, wherein the independent variable of the preset negative gain compensation function is the distance from the pixel point to the highlight central point, and the dependent variable is a brightness gain value;
and for each pixel point in the target image in the highlight area, determining a brightness gain value corresponding to the pixel point based on the distance from the pixel point to the highlight central point and the negative gain compensation function, and multiplying the original pixel value of the pixel point by the corresponding brightness gain value to obtain a pixel value of the pixel point after brightness negative gain compensation.
6. An apparatus for image brightness compensation, the apparatus comprising:
the first determination module is used for determining a highlight central point meeting a preset highlight condition in the target image;
the second determining module is used for determining a highlight area taking the highlight central point as a center in the target image;
and the compensation module is used for performing brightness positive gain compensation on the image outside the highlight area in the target image and performing brightness negative gain compensation on the image in the highlight area.
7. The apparatus of claim 6, wherein the first determining module is configured to:
determining an image block with the largest pixel value sum in image blocks with preset sizes in a target image, and determining a central point of the image block with the largest pixel value sum as a highlight central point;
alternatively, the first and second electrodes may be,
determining pixel points with pixel values larger than a preset threshold value in a target image;
and performing weighted average calculation on the row coordinates of the pixel points with the pixel values larger than the preset threshold value by taking the pixel values of the corresponding pixel points as weights to obtain the row coordinates of the highlight central point, and performing weighted average calculation on the column coordinates of the pixel points with the pixel values larger than the preset threshold value by taking the pixel values of the corresponding pixel points as weights to obtain the column coordinates of the highlight central point.
8. The apparatus of claim 6, wherein the second determining module is configured to:
and determining the circular area with the circle center as the highlight central point and the radius as a preset numerical value as a highlight area.
9. The apparatus of claim 8, wherein the compensation module is configured to:
acquiring a preset initial positive gain compensation function, wherein the initial positive gain compensation function comprises an unknown coefficient, the independent variable of the initial positive gain compensation function is the distance from a pixel point to the highlight central point, and the dependent variable is a brightness gain value;
determining a logarithmic entropy expression of the compensated target image based on the initial positive gain compensation function;
determining logarithmic entropy values corresponding to different values of the unknown coefficient based on the logarithmic entropy expression;
substituting the value of the unknown coefficient corresponding to the minimum logarithmic entropy value into the initial positive gain compensation function to obtain a positive gain compensation function to be used;
and for each pixel point which is positioned outside the highlight area in the target image, determining a brightness gain value corresponding to the pixel point based on the distance from the pixel point to the highlight central point and the positive gain compensation function, and multiplying the original pixel value of the pixel point by the corresponding brightness gain value to obtain the pixel value of the pixel point after the positive gain compensation of the brightness.
10. The apparatus of claim 8, wherein the compensation module is configured to:
acquiring a preset negative gain compensation function, wherein the independent variable of the preset negative gain compensation function is the distance from the pixel point to the highlight central point, and the dependent variable is a brightness gain value;
and for each pixel point in the target image in the highlight area, determining a brightness gain value corresponding to the pixel point based on the distance from the pixel point to the highlight central point and the negative gain compensation function, and multiplying the original pixel value of the pixel point by the corresponding brightness gain value to obtain a pixel value of the pixel point after brightness negative gain compensation.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910498002.0A CN112070682A (en) | 2019-06-10 | 2019-06-10 | Method and device for compensating image brightness |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910498002.0A CN112070682A (en) | 2019-06-10 | 2019-06-10 | Method and device for compensating image brightness |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112070682A true CN112070682A (en) | 2020-12-11 |
Family
ID=73658241
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910498002.0A Pending CN112070682A (en) | 2019-06-10 | 2019-06-10 | Method and device for compensating image brightness |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112070682A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113284062A (en) * | 2021-05-19 | 2021-08-20 | 展讯半导体(南京)有限公司 | Lens shadow correction method, device, medium and terminal |
CN114495858A (en) * | 2022-02-09 | 2022-05-13 | Tcl华星光电技术有限公司 | Image display method, device and storage medium |
WO2023010751A1 (en) * | 2021-08-02 | 2023-02-09 | 中国科学院深圳先进技术研究院 | Information compensation method and apparatus for highlighted area of image, device, and storage medium |
Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060044459A1 (en) * | 2004-08-31 | 2006-03-02 | Casio Computer Co., Ltd. | Image pickup apparatus, exposure control method, and computer program installed in the image pickup apparatus |
CN101076087A (en) * | 2006-05-17 | 2007-11-21 | 索尼株式会社 | Image correction circuit, image correction method and image display |
CN101340523A (en) * | 2008-08-14 | 2009-01-07 | 北京中星微电子有限公司 | Method and apparatus for exposure compensating digital image |
CN101635126A (en) * | 2008-07-25 | 2010-01-27 | 三星电子株式会社 | Method of boosting a display image, controller unit for performing the method, and display apparatus having the controller unit |
US20110188774A1 (en) * | 2010-01-29 | 2011-08-04 | Samsung Electronics Co., Ltd. | Image generating apparatus and method for emphasizing edge based on image characteristics |
JP2015146961A (en) * | 2014-02-07 | 2015-08-20 | キヤノン株式会社 | Ophthalmologic apparatus, and control method of ophthalmologic apparatus |
CN105592270A (en) * | 2015-12-18 | 2016-05-18 | 广东欧珀移动通信有限公司 | Image brightness compensation method and device, and terminal device |
CN106101588A (en) * | 2016-07-08 | 2016-11-09 | 成都易瞳科技有限公司 | The compensation method of panoramic picture gradual halation phenomena |
CN106328079A (en) * | 2016-08-25 | 2017-01-11 | 深圳市华星光电技术有限公司 | Image brightness compensation method |
US20180130188A1 (en) * | 2015-04-28 | 2018-05-10 | Dolby Laboratories Licensing Corporation | Image highlight detection and rendering |
CN108280836A (en) * | 2018-01-24 | 2018-07-13 | 中科创达软件股份有限公司 | A kind of image processing method and device |
WO2019061766A1 (en) * | 2017-09-27 | 2019-04-04 | 深圳市华星光电半导体显示技术有限公司 | Image processing method and device |
CN109727216A (en) * | 2018-12-28 | 2019-05-07 | Oppo广东移动通信有限公司 | Image processing method, device, terminal device and storage medium |
-
2019
- 2019-06-10 CN CN201910498002.0A patent/CN112070682A/en active Pending
Patent Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060044459A1 (en) * | 2004-08-31 | 2006-03-02 | Casio Computer Co., Ltd. | Image pickup apparatus, exposure control method, and computer program installed in the image pickup apparatus |
CN101076087A (en) * | 2006-05-17 | 2007-11-21 | 索尼株式会社 | Image correction circuit, image correction method and image display |
CN101635126A (en) * | 2008-07-25 | 2010-01-27 | 三星电子株式会社 | Method of boosting a display image, controller unit for performing the method, and display apparatus having the controller unit |
CN101340523A (en) * | 2008-08-14 | 2009-01-07 | 北京中星微电子有限公司 | Method and apparatus for exposure compensating digital image |
US20110188774A1 (en) * | 2010-01-29 | 2011-08-04 | Samsung Electronics Co., Ltd. | Image generating apparatus and method for emphasizing edge based on image characteristics |
JP2015146961A (en) * | 2014-02-07 | 2015-08-20 | キヤノン株式会社 | Ophthalmologic apparatus, and control method of ophthalmologic apparatus |
US20180130188A1 (en) * | 2015-04-28 | 2018-05-10 | Dolby Laboratories Licensing Corporation | Image highlight detection and rendering |
CN105592270A (en) * | 2015-12-18 | 2016-05-18 | 广东欧珀移动通信有限公司 | Image brightness compensation method and device, and terminal device |
CN106101588A (en) * | 2016-07-08 | 2016-11-09 | 成都易瞳科技有限公司 | The compensation method of panoramic picture gradual halation phenomena |
CN106328079A (en) * | 2016-08-25 | 2017-01-11 | 深圳市华星光电技术有限公司 | Image brightness compensation method |
WO2019061766A1 (en) * | 2017-09-27 | 2019-04-04 | 深圳市华星光电半导体显示技术有限公司 | Image processing method and device |
CN108280836A (en) * | 2018-01-24 | 2018-07-13 | 中科创达软件股份有限公司 | A kind of image processing method and device |
CN109727216A (en) * | 2018-12-28 | 2019-05-07 | Oppo广东移动通信有限公司 | Image processing method, device, terminal device and storage medium |
Non-Patent Citations (3)
Title |
---|
朱方洲: "一种具有亮度补偿和背景融合的图像增强算法研究", 苏州科技学院学报(自然科学版), vol. 31, no. 2, pages 65 - 69 * |
陆守一: "《地理信息系统》", 31 August 2004, 北京: 高等教育出版社, pages: 145 - 147 * |
陶明慧: "基于反射镜拼接的图像渐晕处理技术研究", 中国博士学位论文全文数据库 (信息科技辑), pages 138 - 63 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113284062A (en) * | 2021-05-19 | 2021-08-20 | 展讯半导体(南京)有限公司 | Lens shadow correction method, device, medium and terminal |
WO2023010751A1 (en) * | 2021-08-02 | 2023-02-09 | 中国科学院深圳先进技术研究院 | Information compensation method and apparatus for highlighted area of image, device, and storage medium |
CN114495858A (en) * | 2022-02-09 | 2022-05-13 | Tcl华星光电技术有限公司 | Image display method, device and storage medium |
CN114495858B (en) * | 2022-02-09 | 2024-03-08 | Tcl华星光电技术有限公司 | Image display method, device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10990825B2 (en) | Image processing method, electronic device and computer readable storage medium | |
WO2021057848A1 (en) | Network training method, image processing method, network, terminal device and medium | |
WO2017121018A1 (en) | Method and apparatus for processing two-dimensional code image, and terminal and storage medium | |
US9020243B2 (en) | Image adjustment | |
CN112070682A (en) | Method and device for compensating image brightness | |
WO2021068618A1 (en) | Method and device for image fusion, computing processing device, and storage medium | |
CN111368587B (en) | Scene detection method, device, terminal equipment and computer readable storage medium | |
CN109117806B (en) | Gesture recognition method and device | |
CN115496668A (en) | Image processing method, image processing device, electronic equipment and storage medium | |
CN111225162A (en) | Image exposure control method, system, readable storage medium and camera equipment | |
CN114429476A (en) | Image processing method, image processing apparatus, computer device, and storage medium | |
CN117152182A (en) | Ultralow-illumination network camera image processing method and device and electronic equipment | |
CN115760653B (en) | Image correction method, device, equipment and readable storage medium | |
CN116485645A (en) | Image stitching method, device, equipment and storage medium | |
CN111539975A (en) | Method, device and equipment for detecting moving target and storage medium | |
CN114255193A (en) | Board card image enhancement method, device, equipment and readable storage medium | |
CN113077422B (en) | Foggy image detection method, model training method and device | |
CN109829859B (en) | Image processing method and terminal equipment | |
CN111383237B (en) | Image analysis method and device and terminal equipment | |
CN114219744B (en) | Image generation method, device, equipment and storage medium | |
CN114519683A (en) | Image processing method and image processing device using same | |
CN113870156A (en) | Image enhancement method and related equipment | |
CN114972707A (en) | Image processing method, device, equipment and storage medium | |
CN117649694A (en) | Face detection method, system and device based on image enhancement | |
CN117690048A (en) | Method and system for identifying linear target object under high temperature of strong light with uneven air density |
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 |