CN115661008A - Image enhancement processing method, device, equipment and medium - Google Patents
Image enhancement processing method, device, equipment and medium Download PDFInfo
- Publication number
- CN115661008A CN115661008A CN202211203878.6A CN202211203878A CN115661008A CN 115661008 A CN115661008 A CN 115661008A CN 202211203878 A CN202211203878 A CN 202211203878A CN 115661008 A CN115661008 A CN 115661008A
- Authority
- CN
- China
- Prior art keywords
- histogram
- mapping
- corrected
- image
- 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
- 238000003672 processing method Methods 0.000 title claims abstract description 11
- 238000013507 mapping Methods 0.000 claims abstract description 151
- 238000010008 shearing Methods 0.000 claims abstract description 59
- 238000012545 processing Methods 0.000 claims abstract description 45
- 239000011159 matrix material Substances 0.000 claims abstract description 17
- 230000005484 gravity Effects 0.000 claims description 37
- 238000012937 correction Methods 0.000 claims description 35
- 238000000034 method Methods 0.000 claims description 33
- 230000001186 cumulative effect Effects 0.000 claims description 11
- 230000035945 sensitivity Effects 0.000 claims description 10
- 230000000007 visual effect Effects 0.000 claims description 10
- 238000013016 damping Methods 0.000 claims description 9
- 238000004590 computer program Methods 0.000 claims description 7
- 238000004458 analytical method Methods 0.000 claims description 6
- 238000004891 communication Methods 0.000 claims description 6
- 238000005315 distribution function Methods 0.000 claims description 5
- 238000010586 diagram Methods 0.000 description 14
- 238000004422 calculation algorithm Methods 0.000 description 11
- 238000012986 modification Methods 0.000 description 7
- 230000004048 modification Effects 0.000 description 7
- 230000008569 process Effects 0.000 description 7
- 230000000694 effects Effects 0.000 description 6
- 230000003044 adaptive effect Effects 0.000 description 4
- 238000006243 chemical reaction Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 230000000903 blocking effect Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000007796 conventional method Methods 0.000 description 2
- 239000013256 coordination polymer Substances 0.000 description 2
- 238000001914 filtration Methods 0.000 description 2
- 238000010606 normalization Methods 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 230000016776 visual perception Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 150000001875 compounds Chemical class 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
Images
Landscapes
- Image Processing (AREA)
Abstract
An image enhancement processing method, device, equipment and medium, which obtains an original histogram of an input image and parameter information of the original histogram, wherein the parameter information comprises the number of effective gray levels; correcting the original histogram to obtain a corrected histogram, and acquiring parameter information of the corrected histogram, wherein the parameter information comprises the number of effective gray levels of the corrected histogram; analyzing the original histogram and the corrected histogram to determine the mapping range of the corrected histogram; determining a shearing coefficient of the corrected histogram according to the effective gray number of the image histogram and the corrected histogram; shearing the corrected histogram by utilizing the shearing coefficient, carrying out equalization processing on the sheared histogram based on the mapping range, and taking a mapping relation matrix obtained after processing as a histogram mapping rule; and based on the histogram mapping rule, performing image enhancement processing on the image to be processed, and outputting the image.
Description
Technical Field
The present application relates to the field of image processing technologies, and in particular, to an image enhancement method, apparatus, device, and medium.
Background
The main purpose of image enhancement is to improve the quality and recognizability of the image, making the image more useful for observation or further analysis processing. Generally, an image enhancement technology emphasizes or enhances certain features of an image, such as edge information, contour information, contrast and the like, purposefully emphasizes the whole or local features of the image, changes an original unclear image into clear or emphasizes certain interesting features, enlarges differences among different object features in the image, and inhibits the uninteresting features, so that the image quality is improved, the information content is enriched, useful information of the image is better displayed, the image interpretation and identification effects are enhanced, and the requirements of certain special analysis are met.
At present, the image enhancement processing method generally adopts a CLAHE algorithm (a contrast-limited adaptive histogram equalization algorithm) to achieve the contrast of an enhanced image, the existing CLAHE algorithm divides an image to be processed into non-overlapping sub-blocks with equal size, calculates a histogram of each sub-block, and then performs threshold value shearing on each histogram, although the method can enhance the local processing of the image, the processed image has an obvious blocking effect in a flat area or a regular characteristic area, and the existing CLAHE algorithm has the problem of poor enhancement effect when the high-brightness image or a wide dynamic image is enhanced, so the existing CLAHE algorithm is generally suitable for natural scenery, infrared images and the like, and the application range is narrow.
Content of application
In view of the above drawbacks of the prior art, the present application provides an image enhancement processing method, system, device and medium to solve the technical problems of blocking effect and poor image enhancement effect of the image enhancement processing.
In a first aspect, the present application provides an image enhancement processing method, including:
acquiring an original histogram of an input image and parameter information of the original histogram, wherein the parameter information comprises the number of effective gray levels;
correcting the original histogram to obtain a corrected histogram, and acquiring parameter information of the corrected histogram, wherein the parameter information comprises the number of effective gray levels of the corrected histogram;
analyzing the original histogram and the corrected histogram to determine the mapping range of the corrected histogram;
determining a shearing coefficient of the corrected histogram according to the effective gray number of the image histogram and the corrected histogram;
shearing the corrected histogram by utilizing the shearing coefficient, carrying out equalization processing on the sheared histogram based on the mapping range, and taking a mapping relation matrix obtained after processing as a histogram mapping rule;
and based on the histogram mapping rule, performing image enhancement processing on the image to be processed, and outputting the image.
In a possible implementation, analyzing the original histogram and the modified histogram to determine a mapping range of the modified histogram includes:
the parameter information of the original histogram and the corrected histogram further comprises a minimum gray value and a maximum gray value respectively;
and determining the minimum gray value and the maximum gray value of the input image according to the minimum gray value and the maximum gray value of the original histogram and the corrected histogram, and determining the mapping range of the corrected histogram based on the minimum gray value and the maximum gray value of the input image.
In a possible embodiment, determining the mapping range of the modified histogram based on the minimum gray value and the maximum gray value of the input image further includes:
the parameter information of the original histogram further comprises a gray scale gravity center;
determining a lower limit gain of a mapping range according to the minimum gray value and the maximum gray value of the input image, determining a lower limit of mapping based on the lower limit gain, the minimum gray value of the input image, the gray gravity center of the original histogram and a preset visual sensitivity gravity center, and taking the minimum mapping gray value as the lower limit of mapping if the lower limit of mapping is smaller than the preset minimum mapping gray value;
determining the upper limit gain of a mapping range according to the maximum gray value and the minimum gray value of an input image, the gray gravity center of an original histogram and a preset visual sensitivity gravity center, determining a mapping upper limit based on the upper limit gain, and taking the maximum mapping gray value as the mapping upper limit if the mapping upper limit is larger than the preset maximum mapping gray value;
the lower limit gain and the lower limit gain are both in a set gain range;
and determining the mapping range of the modified histogram based on the lower mapping limit and the upper mapping limit.
In one possible implementation, determining a shear coefficient of the modified histogram according to the image histogram and the number of effective gray levels of the modified histogram includes:
determining the number of actual gray levels according to the number of effective gray levels of the original histogram and the corrected histogram;
based on the number of actual gray levels, a shearing system model is established, and the specific model is as follows,
in the formula, kclip represents the initial shear coefficient, grayNum represents the number of actual gray levels, V l ,V m ,V h Respectively representing a lower limit value, a middle value and an upper limit value of a preset shearing coefficient; thr (Thr) l ,Thr m ,Thr h Respectively representing a lower limit value, a middle value and an upper limit value of the number of preset gray levels;
and determining an intensity correction coefficient according to the gravity center shift degree of the input image, and determining a final shearing coefficient based on the intensity correction coefficient.
In a possible embodiment, the method for performing a clipping process on the modified histogram by using the clipping coefficient, performing an equalization process on the clipped histogram based on the mapping range, and using the mapping relationship matrix obtained after the processing as a histogram mapping rule includes:
according to the shearing coefficient, determining a shearing limit value and pixels exceeding the shearing limit value, and performing threshold shearing on the corrected histogram to obtain a contrast limited histogram;
and determining a mapping relation matrix for the contrast limited histogram subjected to threshold value shearing based on a cumulative distribution function, and taking the mapping relation matrix as a histogram mapping rule.
In one possible embodiment, the method further comprises:
if the input image is a plurality of continuous frames of images in the video, determining a damping adjustment amount according to a histogram mapping rule of two adjacent frames of images in the video, and adjusting the histogram mapping rule once through damping adjustment;
and taking the mean difference of two adjacent frames of images in the video as an offset adjustment amount, and performing secondary adjustment on the once-adjusted mapping rule through the offset adjustment amount.
In a possible embodiment, modifying the original histogram to obtain a modified histogram includes:
determining the number of gray levels contained in the original histogram;
fitting a self-adaptive correction model based on a prior method, and inputting the number of gray levels contained in the initial histogram into the self-adaptive correction model to obtain a dynamic correction value;
and performing index adjustment and correction on the initial histogram through the dynamic correction value to obtain a corrected histogram.
In a second aspect, the present application also provides an image enhancement processing apparatus, comprising:
the histogram acquisition module is used for acquiring an original histogram of an input image and parameter information of the original histogram, wherein the parameter information comprises the number of effective gray levels of the original histogram;
the histogram correction module is used for correcting the original histogram to obtain a corrected histogram and acquiring parameter information of the corrected histogram, wherein the parameter information comprises the number of effective gray levels of the corrected histogram;
the histogram analysis module is used for analyzing the original histogram and the corrected histogram and determining the mapping range of the corrected histogram;
the shearing coefficient determining module is used for determining the shearing coefficient of the corrected histogram according to the effective gray number of the image histogram and the corrected histogram;
the mapping rule obtaining module is used for shearing the corrected histogram by utilizing the shearing coefficient, carrying out equalization processing on the sheared histogram based on the mapping range and taking a mapping relation matrix obtained after processing as a histogram mapping rule;
and the image processing module is used for performing image enhancement processing on the image to be processed based on the histogram mapping rule and outputting the image.
In a third aspect, the present application also provides an electronic device comprising a processor, a memory, and a communication bus;
the communication bus is used for connecting the processor and the memory;
the processor is configured to execute a computer program stored in the memory to implement the image enhancement processing method according to any one of the above embodiments.
In a fourth aspect, a computer-readable storage medium is characterized by having stored thereon a computer program for causing a computer to execute an image enhancement processing method according to any one of the above-described embodiments.
The beneficial effects of the above technical scheme are that: according to the method, the histogram is regarded as a whole to be obtained, the original histogram is corrected, the information of the original histogram is preprocessed, the obtained corrected histogram is compared with the original histogram, the proportion of the gray value in the corrected histogram to a small scale can be improved, the detailed information of the image is visualized, the original histogram and the corrected histogram are comprehensively analyzed, the reasonable shearing coefficient and the mapping range are determined, the shearing range and the distribution range of the histogram are more reasonable, the gray scale of the image is subjected to gray scale mapping in a proper range, therefore, the signal-to-noise ratio of the image can be improved, the gradation of the gray scale information is richer, the visualized information is prominent, the information of each signal interval is displayed in high quality, and the visual perception effect of the image is integrally improved.
Drawings
Fig. 1 is a schematic flow chart of an image enhancement processing method provided in an embodiment of the present application;
FIG. 2 is a block flow diagram of an image enhancement algorithm provided in an embodiment of the present application;
FIG. 3 is a block flow diagram of histogram modification provided in an embodiment of the present application;
FIG. 4 is a schematic diagram of piecewise linear enhancement provided in an embodiment of the present application;
FIG. 5 is a block diagram of a bias adjustment process for histogram mapping rules provided in an embodiment of the present application;
fig. 6 is a block diagram of an image enhancement processing apparatus provided in an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application is provided by way of specific examples, and other advantages and effects of the present application will be readily apparent to those skilled in the art from the disclosure herein. The present application is capable of other and different embodiments and its several details are capable of modifications and/or changes in various respects, all without departing from the spirit of the present application. It is to be noted that the features in the following embodiments and examples may be combined with each other without conflict.
It should be noted that the drawings provided in the following embodiments are only for illustrating the basic idea of the present application, and the drawings only show the components related to the present application and are not drawn according to the number, shape and size of the components in actual implementation, the type, quantity and proportion of each component in actual implementation may be changed freely, and the layout of the components may be more complicated.
In the following description, numerous details are set forth to provide a more thorough explanation of the embodiments of the present application, however, it will be apparent to one skilled in the art that the embodiments of the present application may be practiced without these specific details, and in other embodiments, well-known structures and devices are shown in block diagram form rather than in detail in order to avoid obscuring the embodiments of the present application.
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.
Referring to fig. 1, a flow chart of an image enhancement processing method according to an embodiment of the present application is schematically illustrated, and is described in detail below,
step S110, acquiring an original histogram of an input image and parameter information of the original histogram, wherein the parameter information comprises the number of effective gray levels;
specifically, the input image is regarded as a whole, an original histogram is obtained according to gray levels, the input image is prevented from being divided into a plurality of non-overlapping sub-blocks, the original histogram is the gray histogram, if the input image is a color image, the input image can be converted into the gray image, and the original histogram is obtained from the gray image.
Step S120, correcting the original histogram to obtain a corrected histogram, and acquiring parameter information of the corrected histogram, wherein the parameter information comprises the number of effective gray levels of the corrected histogram;
specifically, determining the number of gray levels of an original histogram;
fitting a self-adaptive correction model based on a prior method, inputting the number of gray levels contained in the initial histogram into the self-adaptive correction model to obtain a dynamic correction value, wherein the dynamic correction value can be automatically obtained by the self-adaptive correction model according to different scenes, so that the information entropy of an input image is higher, and the detail information of the input image is more and richer;
and performing index adjustment and correction on the initial histogram through the dynamic correction value to obtain a corrected histogram.
Step S130, analyzing the original histogram and the corrected histogram, and determining the mapping range of the corrected histogram;
specifically, the parameter information of the original histogram and the modified histogram further include a minimum gray value and a maximum gray value, respectively;
eliminating the interference value in the gray value of the original histogram to obtain the corresponding minimum gray value and the maximum gray value, and eliminating the interference value in the gray value of the corrected histogram to obtain the corresponding minimum gray value and the maximum gray value;
determining the minimum gray value and the maximum gray value corresponding to the input image after the interference value is removed according to the minimum gray value and the maximum gray value of the original histogram and the corrected histogram, and determining the mapping range of the corrected histogram based on the minimum gray value and the maximum gray value of the input image;
further, the parameter information of the original histogram further includes a gray scale center of gravity, and the gray scale center of gravity may be calculated by calculating a first center of gravity of the original histogram through cumulative distribution from low to high according to gray scale values, and then calculating a second center of gravity of the original histogram through cumulative distribution from high to low, and a weighted value of the first center of gravity and the second center of gravity is taken as the gray scale center of gravity of the original histogram;
determining a lower limit gain of a mapping range according to the minimum gray value and the maximum gray value of the input image, determining a lower limit of mapping based on the lower limit gain, the minimum gray value of the input image, the gray gravity center of the original histogram and a preset visual sensitivity gravity center, and taking the minimum mapping gray value as the lower limit of mapping if the lower limit of mapping is smaller than the preset minimum mapping gray value;
determining the upper limit gain of a mapping range according to the maximum gray value, the minimum gray value, the gray gravity center of the original histogram and a preset visual sensitivity gravity center of an input image, determining a mapping upper limit based on the upper limit gain, and taking the maximum mapping gray value as the mapping upper limit if the mapping upper limit is larger than the preset maximum mapping gray value;
the lower limit gain and the lower limit gain are both in a set gain range;
and determining the mapping range of the modified histogram based on the lower mapping limit and the upper mapping limit.
Step S140, determining a shearing coefficient of the corrected histogram according to the effective gray number of the image histogram and the corrected histogram;
specifically, the number of actual gray levels is determined according to the number of effective gray levels of the original histogram and the corrected histogram;
based on the number of actual gray levels, a shearing system model is established, and the specific model is as follows,
in the formula, kclip represents the initial shearing coefficient, grayNum represents the number of actual gray levels, and V l ,V m ,V h Respectively representing a lower limit value, a middle value and an upper limit value of a preset shearing coefficient; thr (Thr) l ,Thr m ,Thr h Respectively representing a lower limit value, a middle value and an upper limit value of the number of preset gray levels;
determining an intensity correction coefficient according to the gravity center offset degree of the input image, and determining a final shearing coefficient based on the intensity correction coefficient;
step S150, shearing the corrected histogram by utilizing the shearing coefficient, carrying out equalization processing on the sheared histogram based on the mapping range, and taking the mapping relation matrix obtained after processing as a histogram mapping rule;
specifically, according to the shearing coefficient, a shearing limit value and pixels exceeding the shearing limit value are determined, threshold shearing is carried out on the corrected histogram, and a contrast limited histogram is obtained;
and determining a mapping relation matrix for the contrast limited histogram subjected to threshold shearing based on the cumulative distribution function, and taking the mapping relation matrix as a histogram mapping rule.
Step S160, based on histogram mapping rule, processing image enhancement for input image, and outputting;
and enhancing each pixel point of the input image according to a histogram mapping rule, and finally outputting the enhanced image.
Referring to fig. 2, which is a flow chart of the image enhancement algorithm of the present application, in this embodiment, taking an image of an input image from a video as an example, the enhanced processing of the input image by using the improved CLAHE algorithm of the present application is as follows;
1. modifying the original histogram
1) Obtaining an original histogram of an input image, wherein the formula is as follows:
p′(s k )=n k k=0,1,...,L-1
where k is the gray level, L is the highest gray level of the input image, and L =2 m M denotes the bit width of the input image, typically 8bit k Is the k-th gray level, n k For an input image with a grey level s k The number of (2).
2) The original histogram is subjected to a normalization process,
in the formula, n is the sum of the number of input image pixels.
3) The number of grey levels comprised by the original histogram is determined,
where k is the gray level, L is the highest gray level of the input image, s k Is the k-th gray scale, p(s) k ) Thr is an engineering experience threshold value for the original histogram after normalization processing;
4) Calculating dynamic correction values, fitting the adaptive correction model based on a prior method, and determining the dynamic correction values according to the adaptive correction model,
Pow=K1×C b1
in the formula, C is the number of gray levels included in the original histogram, pow is a dynamic correction value which can be automatically obtained according to different application scenes, and K1 and b1 are coefficients preset according to experience, and different numerical values can be selected according to actual conditions.
5) Histogram modification, which is an exponential adjustment modification to the original histogram, as shown in fig. 3, is a flow chart of the histogram modification of the present application,
p rev (s k )=(p(s k )) Pow
wherein k is a gray scale, p(s) k ) Is the normalized original histogram.
2. Histogram analysis
The mapping range of the modified histogram is calculated adaptively according to the histogram distribution of the input image, and referring to fig. 4, which is a schematic diagram of piecewise linear enhancement according to the present application, the parameters in the diagram are described as follows,
Ax 1 representing the minimum gray value of the eliminated interference value in the original histogram;
Bx 1 representing the maximum gray value of the eliminated interference value in the original histogram;
gx represents the gray scale gravity center of the original histogram and is obtained by cumulative distribution calculation;
gy represents a preset visual sensitivity center of gravity;
ay represents a lower mapping limit;
by represents the upper mapping limit;
GrayL represents a preset minimum mapping gray value;
GrayH represents a preset maximum mapping gray value.
1) And calculating the gravity center Gx of the original histogram, calculating a first gravity center of the original histogram through cumulative distribution according to the gray value from low to high, and calculating a second gravity center of the original histogram through cumulative distribution from high to low, wherein the weighted value of the first gravity center and the second gravity center is taken as the gray gravity center Gx of the original histogram.
2) Calculating the corresponding minimum gray value Ax and the maximum gray value Bx of the input image after eliminating the interference value,
2-1) presetting a control parameter S1=0.02, namely a histogram area S1, and calculating a minimum gray value Ax of the original histogram corresponding to S1 1 And calculating the minimum gray value Ax of the corrected histogram corresponding to S1 2 ;
2-2) presetting a control parameter S2=0.98, namely a histogram area S2, and calculating a maximum gray value Bx of the original histogram corresponding to S2 1 And calculating the maximum gray value Bx of the corrected histogram corresponding to S2 2 ;
2-3) calculating the minimum gray value Ax and the maximum gray value Bx of the input image after eliminating the interference value:
3) And determining the visual sensitivity gravity center Gy of the actual enhanced image according to the visual sensitivity of human eyes and engineering experience.
4) Calculating the bandwidth of the original histogram and the mapping range of the modified histogram:
4-1) calculating the lower limit Ay of the mapping
(1) The lower gain K2 of the mapping range is determined,
in the formula, ax is the minimum gray value of the input image after the interference value is removed, bx is the maximum gray value of the input image after the interference value is removed, and K2 belongs to [ K ] min ,K max ],K min And K max Setting a preset gain minimum value and a preset gain maximum value;
(2) calculating a mapping lower bound
Ay=K2×(Ax-Gx)+Gy
In the formula, gx is the gray scale gravity center of an original histogram, gy is a preset visual sensitivity gravity center, and Ax is the minimum gray scale value of the input image after an interference value is removed;
(3) underflow limit of mapping lower bound Ay:
if Ay < GrayL, then, ay = GrayL
In the formula, grayL is usually 35.
4-2) calculating the mapping upper limit By
(1) The upper gain K3 of the mapping range is determined,
wherein K3 is E [ K ∈ [ ] min ,K max ],K min And K max Setting a preset gain minimum value and a preset gain maximum value;
(2) calculating a mapping ceiling
By=K3×(Bx-Ax)+Ay
In the formula, ay is a lower mapping limit, ax is a minimum gray value of the input image after the interference value is removed, and Bx is a maximum gray value of the input image after the interference value is removed;
(3) overflow judgment of mapping upper limit By
If By > GrayH, then By = GrayH
In the formula, grayH is usually 255.
4-3) calculating a mapping range of the modified histogram and a shearing value distribution range of the modified histogram:
Bin=By-Ay+1
in the formula, bin is the mapping range of the correction histogram;
Bin x =Bx-Ax+1
in the formula, bin x A range is assigned for the clipped value of the modified histogram.
5) Determination of shear coefficient
5-1) calculating a shearing coefficient KClip in a CLAHE algorithm:
in the CLAHE algorithm, the normalized shearing coefficient KClip needs to be automatically adjusted according to the image, and the calculation process is as follows:
(1) determining the number of histogram gray levels
Calculating P(s) k ) And P rev (s k ) Effective number of gray levels GrayEfc 1 And GrayEfc 2 ;
The actual number of gray levels gray num is determined,
(2) calculating the shear coefficient
Establishing a shear coefficient model:
in the formula, grayNum represents the number of gray levels, V l ,V m And V h Respectively representing a lower limit value, a middle value and an upper limit value of a preset shearing coefficient; thr (Thr) l ,Thr m And Thr h And respectively representing a lower limit value, a middle value and an upper limit value of the preset number of gray levels.
5-2) determining intensity correction factor of shear factor
(1) Degree of correction of histogram shift center of gravity:
(2) calculating an intensity correction coefficient:
HistMul=K4×b2 BwMul
BwMul represents the degree of deviation of the center of gravity of the median of the input image, and K4 and b2 are model adjustable parameter values and can be set according to experience;
5-3) determining the final shear coefficient N clip
N clip =Kclip×HistMul
To smooth the video picture, the final clipping factor N is adjusted clip Recursive filtering is performed.
3. Clipping and assigning modified histograms
1) Shearing processing is carried out on image histogram
1-1) calculating an average pixel value of gray levels of pixels of an input image
In the formula, bin x Assigning ranges for the clipped values of the modified histogram, N x And N y Which respectively represent the number of pixels in the row direction and the column direction of the input image.
1-2) calculating the actual shear limit CL:
in the formula (I), the compound is shown in the specification,denotes rounding down, N clip Is normalized shear limit coefficient, and 0<N clip <1 in the sense that the number of pixels contained in each gray level is limited not to allow exceeding N of the mean number clip And (4) doubling.
1-3) assume that the gray level pixel in the original image is P (i 0, where i = i) 0 ,i 1 ,...,i n Clipping all pixels exceeding the clipping limit CL for the gray level of the image, setting the number of pixels clipped to CP:
CP=∑(max(P(i)-CL,0))
1-4) calculate the ratio ACP (Average Clip Pixels) of the number of clipped Pixels averaged over each gray level of the image:
N=∑(P(i)>CL)
in the formula, N is the sum of the number of gray levels of which the image histogram is greater than the clipping value.
1-5) the contrast-limited histogram CH is obtained by:
2) And carrying out histogram equalization processing on the histogram after the threshold value is cut, and obtaining a mapping relation matrix after the image histogram equalization.
2-1) calculating the cumulative distribution function of the new histogram CH
Wherein N is x And N y Which respectively represent the number of pixels in the row and column direction of the image. cumsum denotes the cumulative sum, map (i) denotes the cumulative distribution function.
2-2) histogram mapping
Where Bin denotes a mapping range of the correction histogram, and ML (i 0 denotes a histogram mapping rule).
In an embodiment of the present application, as shown in fig. 5, which is a block diagram of an offset adjustment flow of a histogram mapping rule, when an input image is a plurality of consecutive frames of images in a video, in order to make the image quality of the video meet subjective visual perception and make abrupt scenes smooth and excessive, the histogram mapping rule is adjusted in a damping manner, and the image flicker is suppressed by using a mean difference between adjacent enhanced image frames as an offset.
When the input image is a plurality of continuous frames of images in the video, determining a damping adjustment amount according to a histogram mapping rule of two adjacent frames of images in the video, and adjusting the histogram mapping rule once through damping adjustment;
and performing secondary adjustment on the mapping rule after the primary adjustment by using the mean difference of two adjacent frames of images in the video as an offset adjustment amount, wherein the secondary adjustment is as follows:
1) Histogram mapping rule damping adjustment
In order to make the algorithm more adaptive, especially in a fast sudden change scene, damping adjustment is performed on the mapping rule, and then filtering processing is performed on the histogram mapping rule ML.
Adjustment amount of histogram mapping rule:
step3=K5×|ML n -ML n-1 |
the filtered mapping rule ML _ adj _ f is:
where n is the sequence number of the video frame, ML n-1 Mapping rules, ML, of the output image for the previous frame n For the mapping rule of the current frame, ML n-1 And ML n Represents a one-dimensional matrix, rather than a number; step3 is the adjustment amount, which is self-adaptive by the above formula, and K5 is the gain multiple of step 3.
2) Adjusting the offset
The offset adjustment is calculated as follows:
M_adj=step4×(M n -M n-1 )
where n is the sequence number of the video frame, M n-1 Mean, M, of the output image of the previous frame n The mean value of the input image of the current frame, and K5 is the gain multiple of step 4; step4 is an adjustment amount, and is adaptively determined by the above equation.
3) Histogram mapping rule update
The mapping rule after the offset adjustment is as follows:
ML_f_adj(k)=ML_f(k)+M_adj,k=0,1,...,L′-1
where k is the gray level and L' is the highest gray level of the image bit width.
4) Outputting an image
And performing image enhancement on the input image based on the histogram mapping rule. If a certain pixel point of the input image is set as L in Then, the enhanced output value L out Comprises the following steps:
L out (i,j)=ML_f_adj(L in (i,j)+1)
in the formula, L in (i, j) represents the pixel point to be processed, L out And (i, j) represents the pixel points after enhancement processing.
In an embodiment of the present application, if an input image is a color image, the color image is first converted into a grayscale image, and the conversion method uses a conventional method, for example, each pixel in the color image is extracted, then R, G, and B components of the pixel are respectively taken, and gray values corresponding to the R, G, and B components are respectively calculated by using a conventional grayscale conversion formula, which is a conventional technology, and details are not described here, the method is adopted to perform image enhancement on the grayscale image obtained by conversion, and finally recover the grayscale image after enhancement into the color image, and the recovery method can adopt various conventional methods, and the following formula adopted in this embodiment is used to recover the grayscale image:
Y(i,j)=0.299*R(i,j)+0.587*G(i,j)+0.114*B(i,j)
in the formula, R '(i, j) is a recovered red component, R (i, j) is a red component of the input image, G' (i, j) is a recovered green component, G (i, j) is a green component of the input image, B '(i, j) is a recovered blue component, B (i, j) is a blue component of the input image, Y' (i, j) is a grayscale image after enhancement processing, and Y (i, j) is a grayscale image converted from the color image before enhancement processing.
As shown in fig. 6, the present embodiment provides an image enhancement processing apparatus including:
a histogram obtaining module 601, configured to obtain an original histogram of an input image and parameter information of the original histogram, where the parameter information includes the number of effective gray levels of the original histogram;
a histogram modification module 602, configured to modify the original histogram to obtain a modified histogram, and obtain parameter information of the modified histogram, where the parameter information includes the number of effective gray levels of the modified histogram;
a histogram analysis module 603, configured to analyze the original histogram and the modified histogram, and determine a mapping range of the modified histogram;
a shearing coefficient determining module 604, configured to determine a shearing coefficient of the modified histogram according to the image histogram and the number of effective grays of the modified histogram;
a mapping rule obtaining module 605, configured to perform a shearing process on the modified histogram by using the shearing coefficient, perform an equalization process on the sheared histogram based on the mapping range, and use a mapping relationship matrix obtained after the processing as a histogram mapping rule;
and the image processing module 606 is configured to perform image enhancement processing on the image to be processed based on the histogram mapping rule, and output the image.
If the input image is a color image, the image enhancement processing apparatus of the present embodiment should further include a grayscale conversion module for converting the color image into a grayscale image, and a color restoration module for restoring the grayscale image after the enhancement processing into the color image.
In this embodiment, the system is substantially provided with a plurality of modules for executing the method in the above embodiments, and specific functions and technical effects may refer to the above method embodiments, which are not described herein again.
As shown in fig. 7, the present embodiment further provides an electronic device 700, which includes a processor 701, a memory 702, and a communication bus 703;
the communication bus 703 is used for connecting the processor 701 and the memory 702;
the processor 701 is configured to execute a computer program stored in the memory to implement the above-described method.
Embodiments of the present application also provide a non-transitory readable storage medium, where one or more modules (programs) are stored in the storage medium, and when the one or more modules are applied to a device, the device may execute instructions (instructions) included in an embodiment of the present application.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may be separate and not incorporated into the electronic device.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The above embodiments are merely illustrative of the principles and utilities of the present application and are not intended to limit the application. Any person skilled in the art can modify or change the above-described embodiments without departing from the spirit and scope of the present application. Accordingly, it is intended that all equivalent modifications or changes which can be made by those skilled in the art without departing from the spirit and technical concepts disclosed in the present application shall be covered by the claims of the present application.
Claims (10)
1. An image enhancement processing method, characterized in that the method comprises:
acquiring an original histogram of an input image and parameter information of the original histogram, wherein the parameter information comprises the number of effective gray levels;
correcting the original histogram to obtain a corrected histogram, and acquiring parameter information of the corrected histogram, wherein the parameter information comprises the number of effective gray levels of the corrected histogram;
analyzing the original histogram and the corrected histogram to determine the mapping range of the corrected histogram;
determining a shearing coefficient of the corrected histogram according to the effective gray number of the image histogram and the corrected histogram;
shearing the corrected histogram by utilizing the shearing coefficient, carrying out equalization processing on the sheared histogram based on the mapping range, and taking a mapping relation matrix obtained after processing as a histogram mapping rule;
and based on the histogram mapping rule, performing image enhancement processing on the image to be processed, and outputting the image.
2. The method of claim 1, wherein analyzing the original histogram and the modified histogram to determine a mapping range of the modified histogram comprises:
the parameter information of the original histogram and the corrected histogram further respectively comprises a minimum gray value and a maximum gray value;
and determining the minimum gray value and the maximum gray value of the input image according to the minimum gray value and the maximum gray value of the original histogram and the corrected histogram, and determining the mapping range of the corrected histogram based on the minimum gray value and the maximum gray value of the input image.
3. The method of claim 2, wherein determining the mapping range of the modified histogram based on the minimum gray value and the maximum gray value of the input image further comprises:
the parameter information of the original histogram further comprises a gray scale gravity center;
determining a lower limit gain of a mapping range according to the minimum gray value and the maximum gray value of the input image, determining a mapping lower limit based on the lower limit gain, the minimum gray value of the input image, the gray gravity center of the original histogram and a preset visual sensitivity gravity center, and taking the minimum mapping gray value as the mapping lower limit if the mapping lower limit is smaller than the preset minimum mapping gray value;
determining the upper limit gain of a mapping range according to the maximum gray value and the minimum gray value of an input image, the gray gravity center of an original histogram and a preset visual sensitivity gravity center, determining a mapping upper limit based on the upper limit gain, and taking the maximum mapping gray value as the mapping upper limit if the mapping upper limit is larger than the preset maximum mapping gray value;
the lower limit gain and the lower limit gain are both in a set gain range;
and determining the mapping range of the modified histogram based on the lower mapping limit and the upper mapping limit.
4. A method as claimed in any one of claims 1 to 3 wherein determining the shear coefficient for the modified histogram based on the image histogram and the number of effective gray levels in the modified histogram comprises:
determining the number of actual gray levels according to the number of effective gray levels of the original histogram and the corrected histogram;
based on the number of actual gray levels, a shearing system model is established, and the specific model is as follows,
in the formula, kclip represents the initial shear coefficient, grayNum represents the number of actual gray levels, V l ,V m ,V h Respectively representing a lower limit value, a middle value and an upper limit value of a preset shearing coefficient; thr (Thr) l ,Thr m ,Thr h Respectively represent presetThe lower limit value, the middle value and the upper limit value of the number of gray levels;
and determining an intensity correction coefficient according to the gravity center offset degree of the input image, and determining a final shearing coefficient based on the intensity correction coefficient.
5. The method according to any one of claims 1 to 3, wherein the shearing processing is performed on the modified histogram by using a shearing coefficient, the equalization processing is performed on the sheared histogram based on the mapping range, and the mapping relation matrix obtained after the processing is used as a histogram mapping rule, and the method comprises the following steps:
according to the shearing coefficient, determining a shearing limit value and pixels exceeding the shearing limit value, and performing threshold shearing on the corrected histogram to obtain a contrast limited histogram;
and determining a mapping relation matrix for the contrast limited histogram subjected to threshold value shearing based on a cumulative distribution function, and taking the mapping relation matrix as a histogram mapping rule.
6. The method of claim 1, further comprising:
if the input image is a plurality of continuous frames of images in the video, determining a damping adjustment amount according to a histogram mapping rule of two adjacent frames of images in the video, and adjusting the histogram mapping rule once through damping adjustment;
and taking the mean difference of two adjacent frames of images in the video as an offset adjustment amount, and performing secondary adjustment on the once-adjusted mapping rule through the offset adjustment amount.
7. The method of claim 1, wherein modifying the original histogram to obtain a modified histogram comprises:
determining the number of gray levels contained in the original histogram;
fitting a self-adaptive correction model based on a prior method, and inputting the number of gray levels contained in the initial histogram into the self-adaptive correction model to obtain a dynamic correction value;
and performing index adjustment and correction on the initial histogram through the dynamic correction value to obtain a corrected histogram.
8. An image enhancement processing apparatus characterized by comprising:
the histogram acquisition module is used for acquiring an original histogram of an input image and parameter information of the original histogram, wherein the parameter information comprises the number of effective gray levels of the original histogram;
the histogram correction module is used for correcting the original histogram to obtain a corrected histogram and acquiring parameter information of the corrected histogram, wherein the parameter information comprises the number of effective gray levels of the corrected histogram;
the histogram analysis module is used for analyzing the original histogram and the corrected histogram and determining the mapping range of the corrected histogram;
the shearing coefficient determining module is used for determining the shearing coefficient of the corrected histogram according to the effective gray number of the image histogram and the corrected histogram;
the mapping rule acquisition module is used for shearing the corrected histogram by utilizing the shearing coefficient, carrying out equalization processing on the sheared histogram based on the mapping range and taking a mapping relation matrix obtained after processing as a histogram mapping rule;
and the image processing module is used for performing image enhancement processing on the image to be processed based on the histogram mapping rule and outputting the image.
9. An electronic device comprising a processor, a memory, and a communication bus;
the communication bus is used for connecting the processor and the memory;
the processor is configured to execute a computer program stored in the memory to implement the method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that a computer program is stored thereon for causing a computer to perform the method of any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211203878.6A CN115661008A (en) | 2022-09-29 | 2022-09-29 | Image enhancement processing method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211203878.6A CN115661008A (en) | 2022-09-29 | 2022-09-29 | Image enhancement processing method, device, equipment and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115661008A true CN115661008A (en) | 2023-01-31 |
Family
ID=84985844
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211203878.6A Pending CN115661008A (en) | 2022-09-29 | 2022-09-29 | Image enhancement processing method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115661008A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116703888A (en) * | 2023-07-28 | 2023-09-05 | 菏泽城建新型工程材料有限公司 | Auxiliary abnormality detection method and system for bored pile construction |
CN117218043A (en) * | 2023-11-09 | 2023-12-12 | 深圳市锐能安防科技有限公司 | Camera regulation and control method based on monitoring image quality |
CN118413640A (en) * | 2024-07-02 | 2024-07-30 | 杭州海康威视数字技术股份有限公司 | Image display method, device, electronic equipment and program product |
-
2022
- 2022-09-29 CN CN202211203878.6A patent/CN115661008A/en active Pending
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116703888A (en) * | 2023-07-28 | 2023-09-05 | 菏泽城建新型工程材料有限公司 | Auxiliary abnormality detection method and system for bored pile construction |
CN116703888B (en) * | 2023-07-28 | 2023-10-20 | 菏泽城建新型工程材料有限公司 | Auxiliary abnormality detection method and system for bored pile construction |
CN117218043A (en) * | 2023-11-09 | 2023-12-12 | 深圳市锐能安防科技有限公司 | Camera regulation and control method based on monitoring image quality |
CN117218043B (en) * | 2023-11-09 | 2024-02-02 | 深圳市锐能安防科技有限公司 | Camera regulation and control method based on monitoring image quality |
CN118413640A (en) * | 2024-07-02 | 2024-07-30 | 杭州海康威视数字技术股份有限公司 | Image display method, device, electronic equipment and program product |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Chang et al. | Automatic contrast-limited adaptive histogram equalization with dual gamma correction | |
CN103295194B (en) | The controlled tone mapping method with Hemifusus ternatanus of brightness | |
CN115661008A (en) | Image enhancement processing method, device, equipment and medium | |
WO2016206087A1 (en) | Low-illumination image processing method and device | |
Wang et al. | A fast single-image dehazing method based on a physical model and gray projection | |
US20090317017A1 (en) | Image characteristic oriented tone mapping for high dynamic range images | |
CN110599415A (en) | Image contrast enhancement implementation method based on local adaptive gamma correction | |
CN103353982A (en) | Method for tone mapping based on histogram equalization | |
CN103778900B (en) | A kind of image processing method and system | |
CN101981911A (en) | Image processing method and apparatus | |
CN110428371A (en) | Image defogging method, system, storage medium and electronic equipment based on super-pixel segmentation | |
CN109389569B (en) | Monitoring video real-time defogging method based on improved DehazeNet | |
CN107895350B (en) | HDR image generation method based on self-adaptive double gamma transformation | |
CN107424124B (en) | Image enhancement method and device | |
CN107292830A (en) | Low-light (level) image enhaucament and evaluation method | |
CN112116536A (en) | Low-illumination image enhancement method and system | |
CN113496531B (en) | Infrared image dynamic range compression method and system | |
CN112634384A (en) | Method and device for compressing high dynamic range image | |
CN110175967B (en) | Image defogging processing method, system, computer device and storage medium | |
CN109859138B (en) | Infrared image enhancement method based on human visual characteristics | |
CN111192213A (en) | Image defogging adaptive parameter calculation method, image defogging method and system | |
CN109345479B (en) | Real-time preprocessing method and storage medium for video monitoring data | |
CN108765337B (en) | Single color image defogging processing method based on dark channel prior and non-local MTV model | |
CN108898561A (en) | A kind of defogging method, server and the system of the Misty Image containing sky areas | |
CN117876233A (en) | Mapping image enhancement method based on unmanned aerial vehicle remote sensing technology |
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 |