CN111028185B - Histogram equalization method, device, equipment and storage medium - Google Patents

Histogram equalization method, device, equipment and storage medium Download PDF

Info

Publication number
CN111028185B
CN111028185B CN201911243104.4A CN201911243104A CN111028185B CN 111028185 B CN111028185 B CN 111028185B CN 201911243104 A CN201911243104 A CN 201911243104A CN 111028185 B CN111028185 B CN 111028185B
Authority
CN
China
Prior art keywords
clipping
value
amplitude limiting
amplitude
point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911243104.4A
Other languages
Chinese (zh)
Other versions
CN111028185A (en
Inventor
贾玉虎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201911243104.4A priority Critical patent/CN111028185B/en
Publication of CN111028185A publication Critical patent/CN111028185A/en
Application granted granted Critical
Publication of CN111028185B publication Critical patent/CN111028185B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/40Image enhancement or restoration by the use of histogram techniques
    • G06T5/90
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20004Adaptive image processing

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the application discloses a histogram equalization method, a device, equipment and a storage medium, wherein if the amplitude limiting condition of a histogram is met, a linear equation is determined based on a local linear relation between the actual clipping amplitude limiting value and the set clipping amplitude limiting value of at least two histograms; iteratively solving the linear equation based on the first cutting amplitude limiting point and the second cutting amplitude limiting point to obtain an intermediate set cutting amplitude limiting value; and if the iteration termination condition is met, taking the middle setting cutting amplitude limit value obtained by the last iteration solution as a target setting cutting amplitude value, and performing histogram equalization processing on at least two histograms. Therefore, a linear equation is obtained according to the local linear relation between the actual clipping amplitude limit value and the set clipping amplitude limit value, the target set clipping amplitude limit value can be obtained by carrying out iterative solution on the linear equation for a certain number of times, the operation amount is greatly reduced, and the processing efficiency of histogram equalization is improved.

Description

Histogram equalization method, device, equipment and storage medium
Technical Field
The present application relates to image processing technologies, and in particular, to a histogram equalization method, apparatus, device, and storage medium.
Background
Clipping and amplitude limiting in a Contrast-Limited Adaptive histogram equalization (CLAHE) algorithm are performed by clipping an original image histogram, and the clipped peaks are evenly distributed to all gray scales. Fig. 1 is a schematic diagram of clipping a histogram, and a portion that exceeds a clipping threshold value of the histogram ((a) graph grid portion) is uniformly distributed in the other portion of the histogram ((b) graph grid portion). However, the obtained new histogram floats up as a whole, so that the gray scale of the clipping position exceeds the clipping limit value set before ((b) the oblique line part of the graph), the maximum value after floating up is the determining factor influencing the maximum contrast of the stretching of the final image, and different image blocks in the same image have different histogram distribution, so that the floating heights of the histograms after setting the same clipping limit value are different, and the limitation of the maximum contrast of the final whole image also changes with different blocks. Generally, all image blocks are set to be the same clipping amplitude limit value, or the set clipping amplitude limit value is used as the maximum value after the histogram clipping and floating, and the accurate clipping amplitude limit value before the histogram clipping and floating of each image block is calculated by a multi-iteration method for each image block. The calculated iteration times of the clipping amplitude limiting value are excessive, the convergence speed is inversely proportional to the iteration times, and the convergence speed is slower and slower.
Disclosure of Invention
To solve the foregoing technical problems, embodiments of the present application are intended to provide a histogram equalization method, apparatus, device, and storage medium.
The technical scheme of the application is realized as follows:
in a first aspect, a histogram equalization method is provided, and the method includes:
performing histogram statistics on at least two image blocks in an original image to obtain at least two histograms;
if the clipping condition is met, determining a linear equation based on a local linear relation between the actual clipping limiting value and the set clipping limiting value of the at least two histograms;
acquiring a first clipping amplitude limiting point and a second clipping amplitude limiting point; the first cutting amplitude limiting point comprises a first set cutting amplitude limiting value and a first actual cutting amplitude limiting value; the second cutting amplitude limiting point comprises a second set cutting amplitude limiting value and a second actual cutting amplitude limiting value;
iteratively solving the linear equation based on the first clipping amplitude limiting point and the second clipping amplitude limiting point to obtain an intermediate set clipping amplitude limiting value;
and if the iteration termination condition is met, taking the intermediate set clipping amplitude limit value obtained by the last iteration solution as a target set clipping amplitude value, and performing histogram equalization processing on the at least two histograms.
In a second aspect, there is provided a histogram equalization apparatus, including:
the statistical unit is used for carrying out histogram statistics on at least two image blocks in the original image to obtain at least two histograms;
the processing unit is used for determining a linear equation based on a local linear relation between the actual clipping amplitude limit value and the set clipping amplitude limit value of the at least two histograms if the amplitude limit condition is met;
the acquisition unit is used for acquiring a first cutting amplitude limiting point and a second cutting amplitude limiting point; the first cutting amplitude limiting point comprises a first set cutting amplitude limiting value and a first actual cutting amplitude limiting value; the second cutting amplitude limiting point comprises a second set cutting amplitude limiting value and a second actual cutting amplitude limiting value;
the processing unit is further configured to iteratively solve the linear equation based on the first clipping amplitude limiting point and the second clipping amplitude limiting point to obtain an intermediate set clipping amplitude limiting value;
and the processing unit is further used for performing histogram equalization processing on the at least two histograms by taking the intermediate set clipping limit value obtained by the last iteration solution as a target set clipping amplitude value if the iteration termination condition is met.
In a third aspect, a histogram equalization apparatus is provided, including: a processor and a memory configured to store a computer program operable on the processor, wherein the processor is configured to perform the steps of the aforementioned method when executing the computer program.
In a fourth aspect, a computer-readable storage medium is provided, having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the aforementioned method.
By adopting the technical scheme, histogram statistics is carried out on at least two image blocks in an original image to obtain at least two histograms; if the clipping condition is met, determining a linear equation based on a local linear relation between the actual clipping limiting value and the set clipping limiting value of the at least two histograms; iteratively solving the linear equation based on the first clipping amplitude limiting point and the second clipping amplitude limiting point to obtain an intermediate set clipping amplitude limiting value; and if the iteration termination condition is met, taking the intermediate set clipping amplitude limit value obtained by the last iteration solution as a target set clipping amplitude value, and performing histogram equalization processing on the at least two histograms. Therefore, the linear equation is obtained according to the local linear relation between the actual cutting amplitude limit value and the set cutting amplitude limit value, the linear equation is subjected to iterative solution, the target set cutting amplitude limit value can be obtained after a certain number of iterations, the operation amount is greatly reduced, and the processing efficiency of histogram equalization is improved.
Drawings
FIG. 1 is a schematic diagram of a cropping histogram;
FIG. 2 is a first flowchart of a histogram equalization method according to an embodiment of the present application;
FIG. 3 is a second flowchart of a histogram equalization method according to an embodiment of the present application;
FIG. 4 is a third flowchart of a histogram equalization method according to an embodiment of the present application
Fig. 5 is a schematic structural diagram of a histogram equalization apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a histogram equalization apparatus in an embodiment of the present application.
Detailed Description
So that the manner in which the features and elements of the present embodiments can be understood in detail, a more particular description of the embodiments, briefly summarized above, may be had by reference to embodiments, some of which are illustrated in the appended drawings.
Adaptive Histogram Equalization (AHE) is a computer image processing technique used to improve the contrast of an image, and the AHE algorithm changes the image contrast by computing the local histogram of the image and then redistributing the luminance. Therefore, the AHE algorithm is more suitable for improving the local contrast of the image and obtaining more image details. The idea of AHE is simple: to improve local contrast, a block operation is employed. The Histogram Equalization (HE) is now optimal on every block, thus achieving local optimality. Further, to avoid the boundary effect, bilinear interpolation is used instead of simple merging when combining blocks. AHE, which performs better in a target area than HE, has a problem of excessively enlarging noise of the same area in an image, i.e., the background noise problem has not yet been solved.
The Contrast Limited Adaptive Histogram Equalization (CLAHE) algorithm can limit the undesirable amplification of noise. In CLAHE, contrast clipping must be used for each small region, which is mainly used to overcome the problem of over-amplified noise of AHE.
An embodiment of the present application provides a histogram equalization method, fig. 2 is a first flowchart diagram of the histogram equalization method in the embodiment of the present application, and as shown in fig. 2, the method may specifically include:
step 201: performing histogram statistics on at least two image blocks in an original image to obtain at least two histograms;
step 202: if the at least two histograms meet the clipping condition, determining a linear equation based on a local linear relationship between the actual clipping limiting value and the set clipping limiting value of the at least two histograms;
step 203: acquiring a first clipping amplitude limiting point and a second clipping amplitude limiting point; the first cutting amplitude limiting point comprises a first set cutting amplitude limiting value and a first actual cutting amplitude limiting value; the second cutting amplitude limiting point comprises a second set cutting amplitude limiting value and a second actual cutting amplitude limiting value;
step 204: iteratively solving the linear equation based on the first clipping amplitude limiting point and the second clipping amplitude limiting point to obtain an intermediate set clipping amplitude limiting value;
step 205: and if the iteration termination condition is met, taking the intermediate set clipping amplitude limit value obtained by the last iteration solution as a target set clipping amplitude value, and performing histogram equalization processing on the at least two histograms.
In practical application, an image acquisition device acquires an original image and divides the original image into at least two image blocks based on a preset image division strategy; performing histogram statistics and normalization on at least two image blocks to obtain at least two histograms; and judging whether the amplitude limiting condition is met according to the determined at least two histograms. Here, the image division strategy includes dividing the original image into image blocks of M rows and N columns.
In some embodiments, the clipping conditions include: the peak values of the at least two histograms are greater than the target actual clipping threshold values of the at least two histograms. Here, the target actual clipping margin value is a peak value of the processed histogram obtained after the histogram equalization processing.
Correspondingly, after at least two histograms are obtained, the peak values of the at least two histograms are determined; when the peak value is larger than the target actual cutting amplitude limit value, determining that histogram equalization processing is required; when the peak value is less than or equal to the target actual clipping margin value, it is determined that the histogram equalization processing is not necessary.
In practical application, a linear equation between the actual clipping amplitude limit value and the set clipping amplitude limit value is y = ax + b, the first clipping amplitude limit point is (x 1, y 1), and the second clipping amplitude limit point is (x 2, y 2), where x1 is the first set clipping amplitude limit value, y1 is the first actual clipping amplitude limit value, x2 is the second set clipping amplitude limit value, and y2 is the second actual clipping amplitude limit value. And (x 1, y 1) and (x 2, y 2) are utilized to solve a linear equation to obtain a coefficient term a and a constant term b.
Further, the actual clipping amplitude limiting value of the target is brought into the linear equation after the solution, and the intermediate set clipping amplitude limiting value is obtained. Here, the target actual clipping margin value is y3, and is substituted into the linear equation y = ax + b to obtain the intermediate set clipping margin value x3.
And after each iteration solution, updating the first cutting amplitude limiting point and the second cutting amplitude limiting point, continuously solving the linear equation by using the two updated points until the iteration termination condition is met, taking the middle set cutting amplitude limiting value obtained by the last iteration solution as a target set cutting amplitude limiting value, and performing histogram equalization treatment on the at least two histograms.
Here, the histogram equalization processing for at least two histograms includes: and based on the target setting clipping amplitude limit value, clipping the at least two histograms, and uniformly distributing parts, higher than the target setting clipping amplitude value, of the at least two histograms to each histogram to obtain the processed at least two histograms.
In some embodiments, the iteration termination condition comprises: the number of iterations is greater than or equal to a number threshold.
That is, after the linear equation is solved for the number of times specified by the number-of-times threshold, the intermediate set clipping limit value obtained by solving the linear equation for the last time is taken as the target set clipping limit value.
Further, if the iteration termination condition is not satisfied, setting a clipping amplitude value based on the middle, and updating the first clipping amplitude limiting point and the second clipping amplitude limiting point; and performing iterative solution on the linear equation by using the updated first cutting amplitude limiting point and the second cutting amplitude limiting point so as to update the middle set cutting amplitude limiting value.
That is, if the iteration termination condition is not satisfied, the first clipping limiting point and the second clipping limiting point are updated, and the step 304 is continuously executed by using the updated first clipping limiting point and the updated second clipping limiting point, so as to solve the linear equation for the next time. The calculated target clipping amplitude limit value enables the maximum value of the clipped histogram after floating to be accurately controlled, and the calculation iteration times are greatly reduced.
By adopting the technical scheme, although the set clipping limit value and the actual clipping limit value after the histogram is clipped and floated are in a nonlinear curve relationship, the set clipping limit value and the actual clipping limit value can be regarded as having a local linear relationship, a linear equation is obtained according to the local linear relationship between the actual clipping limit value and the set clipping limit value, the linear equation is subjected to iterative solution, and the target set clipping limit value can be obtained after iteration is carried out for a certain number of times, so that the operation amount is greatly reduced, and the processing efficiency of histogram equalization is improved.
On the basis of the foregoing embodiment, a more detailed histogram equalization method is further provided, and fig. 3 is a second flow chart of the histogram equalization method in the embodiment of the present application, as shown in fig. 3, the method includes:
step 301: performing histogram statistics on at least two image blocks in an original image to obtain at least two histograms;
specifically, an image acquisition device acquires an original image, and divides the original image into at least two image blocks based on a preset image division strategy; and carrying out histogram statistics and normalization on the at least two image blocks to obtain at least two histograms.
Step 302: judging whether the amplitude limiting condition is met, if not, executing step 303; if so, go to step 304;
specifically, the clipping conditions include: the peak values of the at least two histograms are greater than the target actual clipping limit values of the at least two histograms. Here, the target actual clipping margin value is a peak value of the processed histogram obtained after the histogram equalization processing.
That is to say, step 302 further includes obtaining peak values of at least two histograms, determining whether the peak value is greater than the target actual clipping threshold value, if so, performing a histogram clipping operation, and if not, performing the histogram clipping operation.
Step 303: and if the clipping condition is not met, taking the target actual clipping limiting value of the at least two histograms as the target set clipping limiting value.
Step 304: if the clipping condition is met, determining a linear equation based on a local linear relation between the actual clipping limiting value and the set clipping limiting value of the at least two histograms;
if the clipping condition is met, the method for iteratively solving the linear equation is adopted to quickly determine the target set clipping limiting value.
In practical application, the method further comprises the following steps: and if the amplitude limiting condition is met, setting the iteration times as an initial value. Correspondingly, if the iteration termination condition is not met, the iteration times are added by 1.
Here, the iteration number is used as monitoring information for judging whether the iteration is completed, before the first iteration, the initial value may be 0 or 1, after each iteration is completed, the iteration number is self-added by 1, until the iteration number is equal to the number threshold, it is determined that the iteration condition is satisfied, and the linear equation solution is exited.
Step 305: acquiring a first cutting amplitude limiting point and a second cutting amplitude limiting point; the first cutting amplitude limiting point comprises a first set cutting amplitude limiting value and a first actual cutting amplitude limiting value; the second cutting amplitude limiting point comprises a second set cutting amplitude limiting value and a second actual cutting amplitude limiting value;
in some embodiments, step 305 specifically includes: obtaining a first clipping limit point and a second clipping limit point, comprising: initializing the first set clipping limit value and the second set clipping limit value before performing a first iterative solution on the linear equation; based on the first set clipping amplitude limit value, performing histogram equalization processing on the at least two histograms to obtain a first actual clipping amplitude limit value; and performing histogram equalization processing on the at least two histograms based on the second set clipping margin value to obtain a second actual clipping margin value.
That is, if the clipping condition is satisfied, the first clipping point and the second clipping point are initialized first, acquiring an initialized first clipping amplitude limiting point and an initialized second clipping amplitude limiting point; after each iteration solution is completed, updating a first cutting amplitude limiting point and a second cutting amplitude limiting point by using a target set cutting amplitude limiting value obtained by the solution; and the linear equation is solved next time by using the updated first cutting limiting point and the second cutting limiting point.
Specifically, the initializing the first set clipping margin value and the second set clipping margin value includes: initializing the first set clipping limit value to 0; initializing the second set clipping limit value to a target actual clipping limit value of the two histograms.
Here, when the first set clipping margin value is 0, histogram equalization processing is performed on at least two histograms to obtain a first actual clipping margin value of 1/256; and setting the second cutting amplitude limiting value as a target actual cutting amplitude limiting value, and performing histogram equalization processing on the at least two histograms by using the target actual cutting amplitude limiting value to obtain a peak value of which the second actual cutting amplitude limiting value is the histogram equalization processed peak value. For example, the actual clipping limit value is generally 1/256 to 4/256.
Step 306: iteratively solving the linear equation based on the first clipping amplitude limiting point and the second clipping amplitude limiting point to obtain an intermediate set clipping amplitude limiting value;
in some embodiments, said iteratively solving said linear equations comprises: solving the linear equation based on the first cutting amplitude limiting point and the second cutting amplitude limiting point to obtain a coefficient term and a constant term of the linear equation; and substituting the target actual clipping amplitude limiting values of the two histograms into the solved linear equation to obtain an intermediate set clipping amplitude limiting value.
In practical application, a linear equation between the actual clipping amplitude limit value and the set clipping amplitude limit value is y = ax + b, the first clipping amplitude limit point is (x 1, y 1), and the second clipping amplitude limit point is (x 2, y 2), where x1 is the first set clipping amplitude limit value, y1 is the first actual clipping amplitude limit value, x2 is the second set clipping amplitude limit value, and y2 is the second actual clipping amplitude limit value. And (x 1, y 1) and (x 2, y 2) are utilized to solve a linear equation to obtain a coefficient term a and a constant term b.
And further, substituting the actual target cutting amplitude limiting value into the solved linear equation to obtain the intermediate set cutting amplitude limiting value. Here, the target actual clipping margin value is y3, and is substituted into the linear equation y = ax + b, resulting in an intermediate set clipping margin value x3. The intermediate set clipping limit value x3 and the target actual clipping limit value y3 constitute an intermediate clipping limit point (x 3, y 3).
Step 307: judging whether the iteration termination condition is met, if not, executing step 308; if so, go to step 309;
in some embodiments, the iteration termination condition comprises: the number of iterations is greater than or equal to a number threshold. Here, the number threshold is a positive integer, and for example, the number threshold is 2, 3, 4, or 5.
Step 308: if the iteration termination condition is not met, updating the first clipping amplitude limiting point and the second clipping amplitude limiting point based on the intermediate setting clipping amplitude value; and proceeds to step 306;
specifically, the intermediate cutting amplitude limiting value is set, and histogram equalization processing is performed on the at least two histograms to obtain an intermediate actual cutting amplitude limiting value; forming a middle cutting amplitude limiting point by using the middle set cutting amplitude limiting value and the middle actual cutting amplitude limiting value; and updating the first clipping amplitude limiting point by using the second clipping amplitude limiting point, and updating the second clipping amplitude limiting point by using the middle clipping amplitude limiting point.
Illustratively, taking the second clipping point (x 2, y 2) as the new first clipping point (x 1, y 1), the intermediate clipping point (x 3, y 3) is set as (x 2, y 2) as the new second clipping point.
Step 309: and if the iteration termination condition is met, taking the intermediate set clipping amplitude limit value obtained by the last iteration solution as a target set clipping amplitude value, and performing histogram equalization processing on the at least two histograms.
Specifically, the at least two histograms are clipped based on a target set clipping limit value, and parts of the at least two histograms which are higher than the target set clipping limit value are uniformly distributed to each histogram, so that the processed at least two histograms are obtained. The peak value of the processed histogram is smaller than or equal to the target actual clipping limit value.
By adopting the technical scheme, although the set clipping limit value and the actual clipping limit value after the histogram is clipped and floated are in a nonlinear curve relationship, the set clipping limit value and the actual clipping limit value can be regarded as having a local linear relationship, a linear equation is obtained according to the local linear relationship between the actual clipping limit value and the set clipping limit value, the linear equation is subjected to iterative solution, and the target set clipping limit value can be obtained after iteration is carried out for a certain number of times, so that the operation amount is greatly reduced, and the processing efficiency of histogram equalization is improved.
On the basis of the foregoing embodiment, a more detailed histogram equalization method is further provided, and fig. 4 is a third schematic flow chart of the histogram equalization method in the embodiment of the present application, as shown in fig. 4, the method includes:
step 401: performing histogram statistics and normalization on at least two image blocks in an original image;
step 402: acquiring a histogram peak value;
here, a peak value of each of at least two histograms is acquired, and the peak value of each histogram is compared to acquire a maximum peak value.
Step 403: judging whether the actual clipping amplitude limit value of the target is larger than or equal to the peak value; if yes, go to step 404; if not, go to step 405;
step 404: the target set clipping limit value is equal to the target actual clipping limit value, then step 412 is performed;
step 405: performing iteration initialization, namely, the iteration number =0, the first set clipping limit value =0, the first actual clipping limit value =1/256, and the second set clipping limit value = the target actual clipping limit value;
in practical application, the first set clipping limit value is represented by PerSetClipLimit, the first actual clipping limit value is represented by persevercliplimit, the second set clipping limit value is represented by SetClipLimit, the second actual clipping limit value is represented by RealClipLimit, the target set clipping limit value is represented by DstSetClipLimit, the target actual clipping limit value is represented by dstsreadcliplimit, the intermediate set clipping limit value is represented by MidSetClipLimit, and the intermediate actual clipping limit value is represented by midreadcliplimit.
Step 406: the iteration times are added by 1, and a second actual cutting amplitude limiting value is calculated by using a second set cutting amplitude limiting value;
specifically, the second set clipping margin value is a target actual clipping margin value, histogram equalization processing is performed on the at least two histograms by using the target actual clipping margin value, and a peak value of the second actual clipping margin value after the histogram equalization processing is obtained. For example, the target actual clipping limit value is generally 1/256 to 4/256.
Step 407: solving a linear equation by using the first cutting limiting point and the second cutting limiting point;
in practical application, a linear equation between the actual clipping amplitude limit value and the set clipping amplitude limit value is y = ax + b, the first clipping amplitude limit point is (x 1, y 1), and the second clipping amplitude limit point is (x 2, y 2), where x1 is the first set clipping amplitude limit value, y1 is the first actual clipping amplitude limit value, x2 is the second set clipping amplitude limit value, and y2 is the second actual clipping amplitude limit value. And (x 1, y 1) and (x 2, y 2) are utilized to solve a linear equation to obtain a coefficient term a and a constant term b.
Namely, the linear equation is solved by using two points (PreSetClipLimit, preRealClipLimit), (SetClipLimit, realClipLimit).
Step 408: substituting the target actual clipping amplitude limiting value into a linear equation to obtain a middle set clipping amplitude limiting value;
here, the target actual clipping margin value is y3, and is substituted into the linear equation y = ax + b, resulting in an intermediate set clipping margin value x3. The intermediate set clipping limit value x3 and the target actual clipping limit value y3 constitute an intermediate clipping limit point (x 3, y 3).
Namely, dstRealClipLimit is substituted into a linear equation to obtain MidSetClipLimit.
Step 409: judging whether the iteration times are more than or equal to 3, if not, executing a step 410; if yes, go to step 411;
step 410: the second cutting amplitude limiting point is used as a first cutting amplitude limiting point, and the middle cutting amplitude limiting point is used as a second cutting amplitude limiting point;
namely PreSetClipLimit = SetClipLimit;
PreRealClipLimit=realClipLimit;
calculating the MidRealClipLimit by using the MidSetClipLimit;
(MidSetClipLimit, midRealClipLimit) was defined as (SetClipLimit, realClipLimit).
Step 411: the target set clipping limit value is equal to the intermediate set clipping limit value, then step 412 is performed;
namely DstSetClipLimit = MidSetClipLimit.
Step 412: and performing histogram equalization processing on the at least two histograms by using the target setting cutting limiting value.
By adopting the technical scheme, although the set clipping limit value and the actual clipping limit value after the histogram is clipped and floated are in a nonlinear curve relationship, the set clipping limit value and the actual clipping limit value can be regarded as having a local linear relationship, a linear equation is obtained according to the local linear relationship between the actual clipping limit value and the set clipping limit value, the linear equation is subjected to iterative solution, and the target set clipping limit value can be obtained after iteration is carried out for a certain number of times, so that the operation amount is greatly reduced, and the processing efficiency of histogram equalization is improved.
An embodiment of the present application further provides a histogram equalization apparatus, as shown in fig. 5, the apparatus includes:
a statistical unit 501, configured to perform histogram statistics on at least two image blocks in an original image to obtain at least two histograms;
a processing unit 502, configured to determine a linear equation based on a local linear relationship between an actual clipping margin value and a set clipping margin value of the at least two histograms if the clipping condition is satisfied;
an obtaining unit 503, configured to obtain a first clipping limiting point and a second clipping limiting point; the first cutting amplitude limiting point comprises a first set cutting amplitude limiting value and a first actual cutting amplitude limiting value; the second cutting amplitude limiting point comprises a second set cutting amplitude limiting value and a second actual cutting amplitude limiting value;
the processing unit 502 is further configured to iteratively solve the linear equation based on the first clipping limiting point and the second clipping limiting point to obtain an intermediate set clipping limiting value;
the processing unit 502 is further configured to, if the iteration termination condition is satisfied, use the intermediate set clipping limit value obtained by the last iteration solution as a target set clipping amplitude value, and perform histogram equalization processing on the at least two histograms.
In some embodiments, the processing unit 502 is further configured to update the first clipping limit point and the second clipping limit point based on the intermediate set clipping amplitude value if the iteration termination condition is not satisfied; and carrying out iterative solution on the linear equation by using the updated first clipping amplitude limiting point and the second clipping amplitude limiting point so as to update the intermediate set clipping amplitude limiting value.
In some embodiments, the processing unit 502 is specifically configured to perform histogram equalization processing on the at least two histograms by using the intermediate set clipping margin value to obtain an intermediate actual clipping margin value; forming a middle cutting amplitude limiting point by using the middle set cutting amplitude limiting value and the middle actual cutting amplitude limiting value;
correspondingly, the obtaining unit 503 is further configured to update the first clipping limiting point by using the second clipping limiting point, and update the second clipping limiting point by using the intermediate clipping limiting point.
In some embodiments, the obtaining unit 503 is specifically configured to solve the linear equation based on the first clipping limiting point and the second clipping limiting point, so as to obtain a coefficient term and a constant term of the linear equation; and substituting the target actual cutting amplitude limiting values of the two histograms into the solved linear equation to obtain an intermediate set cutting amplitude limiting value.
In some embodiments, the iteration termination condition comprises: the number of iterations is greater than or equal to a number threshold.
In some embodiments, the processing unit 502 is further configured to set the number of iterations to an initial value if the clipping condition is satisfied; and if the iteration termination condition is not met, adding 1 to the iteration times.
In some embodiments, the processing unit 502 is further configured to, if the clipping condition is not satisfied, and taking the target actual clipping amplitude limiting values of the at least two histograms as the target set clipping amplitude limiting value.
In some embodiments, the clipping condition comprises: the peak values of the at least two histograms are greater than the target actual clipping limit values of the at least two histograms.
In some embodiments, the obtaining unit 503 is specifically configured to initialize the first set clipping limit value and the second set clipping limit value before performing the first iterative solution on the linear equation; based on the first set clipping amplitude limit value, performing histogram equalization processing on the at least two histograms to obtain a first actual clipping amplitude limit value; and performing histogram equalization processing on the at least two histograms based on the second set clipping margin value to obtain a second actual clipping margin value.
In some embodiments, the obtaining unit 503 is specifically configured to initialize the first set clipping limit value to 0; initializing the second set clipping margin value to a target actual clipping margin value of the two histograms.
By adopting the technical scheme, although the set clipping amplitude limit value and the actual clipping amplitude limit value after the histogram clipping and floating are in a nonlinear curve relationship, the set clipping amplitude limit value and the actual clipping amplitude limit value after the histogram clipping and floating can be regarded as having a local linear relationship, a linear equation is obtained according to the local linear relationship between the actual clipping amplitude limit value and the set clipping amplitude limit value, the linear equation is subjected to iterative solution, a target set clipping amplitude limit value can be obtained after iteration is carried out for a certain number of times, the operation amount is greatly reduced, and the processing efficiency of histogram equalization is improved.
An embodiment of the present application further provides another histogram equalization apparatus, as shown in fig. 6, the apparatus includes: a processor 601 and a memory 602 configured to store computer programs capable of running on the processor; the steps of the method in the embodiments of the present application when the processor 601 runs the computer program in the memory 602.
Of course, in practice, the various components of the device are coupled together by a bus system 603, as shown in FIG. 6. It is understood that the bus system 603 is used to enable communications among the components of the connection. The bus system 603 includes a power bus, a control bus, and a status signal bus in addition to a data bus. But for the sake of clarity the various buses are labeled as bus system 603 in figure 6.
The embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the method according to any of the embodiments.
In practical applications, the processor may be at least one of an Application Specific Integrated Circuit (ASIC), a Digital Signal Processing Device (DSPD), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a controller, a microcontroller, and a microprocessor. It is understood that the electronic devices for implementing the above processor functions may be other devices, and the embodiments of the present application are not limited in particular.
The Memory may be a volatile Memory (volatile Memory), such as a Random-Access Memory (RAM); or a non-volatile Memory (non-volatile Memory), such as a Read-Only Memory (ROM), a flash Memory (flash Memory), a Hard Disk (HDD), or a Solid-State Drive (SSD); or a combination of the above types of memories and provides instructions and data to the processor.
It should be noted that: "first," "second," and the like are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
The methods disclosed in the several method embodiments provided in the present application may be combined arbitrarily without conflict to obtain new method embodiments.
Features disclosed in several of the product embodiments provided in the present application may be combined in any combination to yield new product embodiments without conflict.
The features disclosed in the several method or apparatus embodiments provided herein may be combined in any combination to arrive at a new method or apparatus embodiment without conflict.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (13)

1. A histogram equalization method, comprising:
performing histogram statistics on at least two image blocks in an original image to obtain at least two histograms;
if the clipping condition is met, determining a linear equation based on a local linear relation between the actual clipping limiting value and the set clipping limiting value of the at least two histograms;
acquiring a first clipping amplitude limiting point and a second clipping amplitude limiting point; the first cutting amplitude limiting point comprises a first set cutting amplitude limiting value and a first actual cutting amplitude limiting value; the second cutting amplitude limiting point comprises a second set cutting amplitude limiting value and a second actual cutting amplitude limiting value;
iteratively solving the linear equation based on the first clipping amplitude limiting point and the second clipping amplitude limiting point to obtain an intermediate set clipping amplitude limiting value;
and if the iteration termination condition is met, taking the middle setting cutting amplitude limit value obtained by the last iteration solution as a target setting cutting amplitude value, and performing histogram equalization processing on the at least two histograms.
2. The method of claim 1, further comprising:
if the iteration termination condition is not met, updating the first clipping limiting point and the second clipping limiting point based on the intermediate set clipping limiting value;
and carrying out iterative solution on the linear equation by using the updated first clipping amplitude limiting point and the second clipping amplitude limiting point so as to update the intermediate set clipping amplitude limiting value.
3. The method of claim 2, wherein updating the first clipping limit point and the second clipping limit point based on the intermediate set clipping magnitude value comprises:
performing histogram equalization processing on the at least two histograms by using the intermediate set clipping amplitude limiting value to obtain an intermediate actual clipping amplitude limiting value;
forming a middle cutting amplitude limiting point by using the middle set cutting amplitude limiting value and the middle actual cutting amplitude limiting value;
and updating the first clipping limiting point by using the second clipping limiting point, and updating the second clipping limiting point by using the middle clipping limiting point.
4. The method of claim 1 or 2, wherein said iteratively solving said linear equations comprises:
solving the linear equation based on the first cutting amplitude limiting point and the second cutting amplitude limiting point to obtain a coefficient term and a constant term of the linear equation;
and substituting the target actual clipping amplitude limiting values of the two histograms into the solved linear equation to obtain an intermediate set clipping amplitude limiting value.
5. The method according to claim 1 or 2, wherein the iteration termination condition comprises: the number of iterations is greater than or equal to a number threshold.
6. The method of claim 5, further comprising:
if the amplitude limiting condition is met, setting the iteration times as an initial value;
and if the iteration termination condition is not met, adding 1 to the iteration times.
7. The method of claim 1, further comprising:
and if the clipping condition is not met, taking the target actual clipping limiting value of the at least two histograms as the target set clipping limiting value.
8. The method according to claim 1 or 7, wherein the clipping condition comprises: the peak values of the at least two histograms are greater than the target actual clipping limit values of the at least two histograms.
9. The method of claim 1, wherein obtaining the first clipping limit point and the second clipping limit point comprises:
initializing the first set clipping limit value and the second set clipping limit value before performing a first iterative solution on the linear equation;
based on the first set clipping amplitude limit value, performing histogram equalization processing on the at least two histograms to obtain a first actual clipping amplitude limit value;
and performing histogram equalization processing on the at least two histograms based on the second set clipping margin value to obtain a second actual clipping margin value.
10. The method of claim 9, wherein the initializing the first set clipping limit value and the second set clipping limit value comprises:
initializing the first set clipping limit value to 0;
initializing the second set clipping limit value to a target actual clipping limit value of the two histograms.
11. A histogram equalization apparatus, characterized in that the apparatus comprises:
the statistical unit is used for carrying out histogram statistics on at least two image blocks in the original image to obtain at least two histograms;
the processing unit is used for determining a linear equation based on a local linear relation between the actual clipping amplitude limit value and the set clipping amplitude limit value of the at least two histograms if the amplitude limit condition is met;
the acquisition unit is used for acquiring a first clipping amplitude limiting point and a second clipping amplitude limiting point; the first cutting amplitude limiting point comprises a first set cutting amplitude limiting value and a first actual cutting amplitude limiting value; the second cutting amplitude limiting point comprises a second set cutting amplitude limiting value and a second actual cutting amplitude limiting value;
the processing unit is further configured to iteratively solve the linear equation based on the first clipping amplitude limiting point and the second clipping amplitude limiting point to obtain an intermediate set clipping amplitude limiting value;
and the processing unit is further used for performing histogram equalization processing on the at least two histograms by taking the intermediate set clipping limit value obtained by the last iteration solution as a target set clipping amplitude value if the iteration termination condition is met.
12. A histogram equalization apparatus, the apparatus comprising: a processor and a memory configured to store a computer program capable of running on the processor,
wherein the processor is configured to perform the steps of the method of any one of claims 1 to 10 when running the computer program.
13. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 10.
CN201911243104.4A 2019-12-06 2019-12-06 Histogram equalization method, device, equipment and storage medium Active CN111028185B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911243104.4A CN111028185B (en) 2019-12-06 2019-12-06 Histogram equalization method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911243104.4A CN111028185B (en) 2019-12-06 2019-12-06 Histogram equalization method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111028185A CN111028185A (en) 2020-04-17
CN111028185B true CN111028185B (en) 2023-01-24

Family

ID=70207386

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911243104.4A Active CN111028185B (en) 2019-12-06 2019-12-06 Histogram equalization method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111028185B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104463816A (en) * 2014-12-02 2015-03-25 苏州大学 Image processing method and device
CN105825485A (en) * 2016-03-30 2016-08-03 努比亚技术有限公司 Image processing system and method
CN105844604A (en) * 2016-05-19 2016-08-10 湖南源信光电科技有限公司 Fast defogging algorithm based on local histogram enhancement
CN106296600A (en) * 2016-08-01 2017-01-04 大连理工大学 A kind of contrast enhancement process decomposed based on wavelet image

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100756318B1 (en) * 2006-01-16 2007-09-06 삼성전자주식회사 Image Processing Method and System Using Gain-Controllable Clipped Histogram Equalization
CN107403422B (en) * 2017-08-04 2020-03-27 上海兆芯集成电路有限公司 Method and system for enhancing image contrast

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104463816A (en) * 2014-12-02 2015-03-25 苏州大学 Image processing method and device
CN105825485A (en) * 2016-03-30 2016-08-03 努比亚技术有限公司 Image processing system and method
CN105844604A (en) * 2016-05-19 2016-08-10 湖南源信光电科技有限公司 Fast defogging algorithm based on local histogram enhancement
CN106296600A (en) * 2016-08-01 2017-01-04 大连理工大学 A kind of contrast enhancement process decomposed based on wavelet image

Also Published As

Publication number Publication date
CN111028185A (en) 2020-04-17

Similar Documents

Publication Publication Date Title
CN111062897B (en) Image equalization method, terminal and storage medium
CN108921868B (en) Improved Otsu threshold segmentation method
CN109973301B (en) Method and device for controlling pitch variation of wind generating set under extreme turbulent wind condition
CN107316291B (en) Mammary gland image processing method and mammary gland imaging equipment
CN110942483B (en) Function rapid convergence model construction method, device and terminal
CN111127341A (en) Image processing method and apparatus, and storage medium
CN111028179A (en) Stripe correction method and device, electronic equipment and storage medium
CN109816596B (en) Image denoising method and device
CN117173201B (en) Second order differential image segmentation method, system, medium and device
CN111028185B (en) Histogram equalization method, device, equipment and storage medium
CN109284062B (en) Touch data processing method, device, terminal and medium
CN111028182B (en) Image sharpening method, device, electronic equipment and computer readable storage medium
CN114092906A (en) Lane line segment fitting method and system, electronic device and storage medium
KR101617551B1 (en) Image processing method and system for improving face detection
CN105574831B (en) A kind of image de-noising method of modified image block expectation log-likelihood estimation
CN111507923A (en) Method, device, equipment and medium for processing noise of video image
CN113409338B (en) Super-pixel method based on probability distribution
CN111145108B (en) Image processing method, device, equipment and storage medium
CN110580706A (en) Method and device for extracting video background model
CN105635596B (en) System for controlling exposure of camera and method thereof
CN113781515A (en) Cell image segmentation method, device and computer readable storage medium
CN112116076A (en) Optimization method and optimization device for activation function
JPWO2021075134A5 (en)
US7936921B2 (en) Efficient fixed-point real-time thresholding for signal processing
CN117392038B (en) Medical image histogram equalization method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant