A wavelet domain brightness-preserving contrast-adjustable image enhancement method and device

The wavelet domain brightness-preserving contrast-adjustable image enhancement method addresses the challenge of maintaining brightness during contrast adjustment, achieving effective image enhancement by using wavelet decomposition and reconstruction techniques.

CN113112434BActive Publication Date: 2024-12-24JIANGSU UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010325623.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-23
Publication Date
2024-12-24
Estimated Expiration
2040-04-23

AI Technical Summary

Technical Problem

Existing image enhancement methods based on wavelet histogram cannot freely adjust the contrast of the enhanced image while maintaining brightness.

Method used

A wavelet domain brightness-preserving contrast-adjustable image enhancement method that involves wavelet decomposition, histogram segmentation, and reconstruction to allow for adjustable contrast while preserving brightness, using db series wavelets to process low-frequency and high-frequency sub-images.

Benefits of technology

Enables the free adjustment of image contrast while maintaining brightness, enhancing image quality effectively.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113112434B_ABST
    Figure CN113112434B_ABST
Patent Text Reader

Abstract

The present invention provides a contrast-adjustable image enhancement method and device with brightness preservation in wavelet domain. In the wavelet domain (i.e., frequency domain) of an image, based on a wavelet histogram, the present invention can automatically divide the wavelet histogram of a low-frequency sub-image of an input image into a plurality of block wavelet histograms according to a segmentation parameter, perform wavelet coefficient enhancement processing in each block, merge the wavelet low-frequency sub-images, and finally output an enhanced image through an inverse wavelet transform. The contrast of the enhanced image can be freely adjusted while keeping the image brightness basically unchanged, and the present invention can be applied to image processing systems of some consumer electronic products.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image contrast enhancement, and in particular to a contrast-adjustable image enhancement method and device with brightness preservation in wavelet domain. Background Art

[0002] Image enhancement, which improves the visual effect of images, is an important image preprocessing technology in machine vision applications. In the human visual sense, brightness and contrast have a more obvious stimulating effect on the human eye, and they are also two unique and objective image quality indicators in image enhancement. Among some image enhancement processing technologies, the image enhancement technology based on wavelet histogram is widely used. However, most image enhancement methods based on wavelet histogram cannot freely adjust the contrast of the enhanced image while maintaining the brightness. Summary of the invention

[0003] The present invention aims to provide a contrast-adjustable image enhancement method and device with brightness preservation in wavelet domain, which overcomes one of the above problems or at least partially solves any of the above problems.

[0004] To achieve the above object, the technical solution of the present invention is specifically implemented as follows:

[0005] On one hand, the present invention provides a wavelet domain brightness-preserving contrast-adjustable image enhancement method, comprising:

[0006] Perform a layer of wavelet decomposition on the input image I using the db series wavelet base db1 wavelet to obtain a low-frequency sub-image ca, a first high-frequency sub-image ch, a second high-frequency sub-image cv and a third high-frequency sub-image cd;

[0007] The low-frequency sub-image ca is rounded to obtain the rounded low-frequency sub-image ca1, and the maximum value Mca of the rounded low-frequency sub-image ca1 is calculated;

[0008] Determine the frequency of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1 in [0, Mca], and obtain the wavelet histogram h, length Mca;

[0009] Get the wavelet histogram calculation formula Calculate the probability of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1, where i is the wavelet coefficient, i = 0, 1, 2···Mca, and h is the frequency of each wavelet coefficient;

[0010] Set the new low-frequency sub-image ca2 to be the same as the low-frequency sub-image ca, set the value to zero matrix, set the wavelet histogram array hx1 for storing the segmentation and the remaining wavelet histogram array hx2, set the variable segmentation parameter px, and the variable segmentation parameter px value range is [0, 0.1];

[0011] Set the initial value of the loop variable n0 = 1, and set the loop calculation to conform to n0, where sum() is the summation function, and the segmented wavelet histogram array hx1 is obtained, hx1 = h(0 <h≤n0),n0=n0+1;

[0012] Calculate the remaining wavelet histogram array hx2 according to the segmented wavelet histogram array hx1, where hx2 = h-hx1;

[0013] Remove the non-zero elements in the segmented wavelet histogram array hx1, record the statistics through the first array h1, and record the corresponding wavelet coefficients through the first wavelet coefficient array id1; remove the non-zero elements in the remaining wavelet histogram array hx2, record the statistics through the second array h2, and record the corresponding wavelet coefficients through the second wavelet coefficient array id2;

[0014] The second array h2 is further divided, and the difference between two adjacent numbers in the second wavelet coefficient array id2 is recorded using the formula jgh2(x)=id2(x+1)-id2(x)x=1...n2-1, and the difference is placed in the jgh2 array. The value of jgh2(x)>=preset value is placed in the array jg2, and the number of divided blocks is 1+length(jg2);

[0015] The first public array variable Hx is set to store the acquired block wavelet histogram, and the second public array variable idx is set to store the wavelet coefficients of the first public array variable Hx, and the block wavelet histograms Hx in the second array h2 are obtained, wherein the acquisition method of the block wavelet histograms Hx in the second array h2 is: determine whether the array jg2 is empty, if it is empty, determine that the block wavelet histograms Hx in the second array h2 cannot be divided, then set the first public array variable Hx = h2, the second public array variable idx = id2, and the length of each block wavelet histogram Hx in the second array h2 is l ength(Hx), if it is not empty, it is determined that the block wavelet histogram Hx in the second array h2 can be divided again, and the number of blocks that can be divided is 1+length(jg2); for any block wavelet histogram in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), the wavelet coefficient of the corresponding block wavelet histogram is idx=id2(T2:jg2(i)), where i=1...n2-1, T2 variable is T2=1 when i=1, and T2=1+jg2(i) when i=2...n2-1;

[0016] Calculate the probability of each block wavelet histogram Hx Cumulative probability Where i = 1...length(Hx);

[0017] The wavelet histogram Hx of any block is calculated according to the following formula until all the wavelet histograms of the blocks are calculated, and the wavelet coefficients of the new low-frequency sub-graph ca2 are obtained:

[0018]

[0019] Where i=1...length(Hx), f(i) is the new wavelet coefficient value of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness, and contrast;

[0020] Map the wavelet coefficients of the first wavelet coefficient array id1 to the new low-frequency sub-image ca2;

[0021] Perform wavelet reconstruction on the new low-frequency sub-image ca2, the first high-frequency sub-image ch, the second high-frequency sub-image cv and the third high-frequency sub-image cd to obtain a reconstructed image I1;

[0022] Using the formula Convert the reconstructed image I1 to the grayscale display range of [0,255] and output a new enhanced image imageout.

[0023] The method further includes: setting an array idnew having the same length as the second wavelet coefficient array id2 for storing the wavelet coefficients of each block wavelet histogram Hx; mapping the wavelet coefficients of the first wavelet coefficient array id1 to the new low-frequency sub-image ca2 includes: setting a loop variable i=1:length(id1), comparing the wavelet coefficients id1(i) in the first wavelet coefficient array id1 with each wavelet coefficient in the second wavelet coefficient array id2 one by one, and determining the wavelet coefficient position idp closest to the wavelet coefficient id1(i), wherein [~, idp]=min(abs(id2(:)-id1(i))); after determining the position idp, determining the position in the rounded low-frequency sub-image ca1 in the new low-frequency sub-image ca2 that is equal to the wavelet coefficient id1(i), and assigning the array idnew to idnew(idp) at the same position in the new low-frequency sub-image ca2, until all the wavelet coefficients of the first wavelet coefficient array id1 are mapped.

[0024] Another aspect of the present invention provides a wavelet domain brightness-preserving contrast-adjustable image enhancement method, comprising:

[0025] Perform a layer of wavelet decomposition on the input image I using the db series wavelet base db1 wavelet to obtain a low-frequency sub-image ca, a first high-frequency sub-image ch, a second high-frequency sub-image cv and a third high-frequency sub-image cd;

[0026] The low-frequency sub-image ca is rounded to obtain the rounded low-frequency sub-image ca1, and the maximum value Mca of the rounded low-frequency sub-image ca1 is calculated;

[0027] Determine the frequency of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1 in [0, Mca], and obtain the wavelet histogram h, length Mca;

[0028] Get the wavelet histogram calculation formula Calculate the probability of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1, where i is the wavelet coefficient, i = 0, 1, 2···Mca, and h is the frequency of each wavelet coefficient;

[0029] Set the new low-frequency sub-image ca2 to be the same as the low-frequency sub-image ca, set the value to zero matrix, set the wavelet histogram array hx1 for storing the segmentation and the remaining wavelet histogram array hx2, set the variable segmentation parameter px, and the variable segmentation parameter px value range is [0, 0.1];

[0030] Set the initial value of the loop variable n0 = 1, and set the loop calculation to conform to n0, where sum() is the summation function, and the segmented wavelet histogram array hx1=h(0 <h≤n0),n0=n0+1;

[0031] Calculate the remaining wavelet histogram array hx2 according to the segmented wavelet histogram array hx1, where hx2 = h-hx1;

[0032] Remove the non-zero elements in the segmented wavelet histogram array hx1, record the statistics through the first array h1, and record the corresponding wavelet coefficients through the first wavelet coefficient array id1; remove the non-zero elements in the remaining wavelet histogram array hx2, record the statistics through the second array h2, and record the corresponding wavelet coefficients through the second wavelet coefficient array id2;

[0033] The first array h1 and the second array h2 are further divided, and the difference between two adjacent numbers in the first wavelet coefficient array id1 is recorded using the formula jgh1(x)=id1(x+1)-id1(x)x=1...n1-1, and the difference is placed in the jgh1 array, and the value of jgh1(x)>=preset value is placed in the array jg1, and the number of divided blocks is 1+length(jg1); the difference between two adjacent numbers in the second wavelet coefficient array id2 is recorded using the formula jgh2(x)=id2(x+1)-id2(x)x=1...n2-1, and the difference is placed in the jgh2 array, and the value of jgh2(x)>=preset value is placed in the array jg2, and the number of divided blocks is 1+length(jg2);

[0034] The first public array variable Hx is set to store the acquired block wavelet histogram, and the second public array variable idx is used to store the wavelet coefficients of the first public array variable Hx. The acquisition method of each block wavelet histogram Hx in the first array h1 is: determine whether the array jg1 is empty. If it is empty, it is determined that the block wavelet histogram Hx in the first array h1 cannot be divided, then the first public array variable Hx=h1, the second public array variable idx=id1, and the block wavelet histogram Hx in the first array h1 is The length is length(Hx); if it is not empty, it is determined that the block wavelet histogram Hx in the first array h1 can be divided again, and the number of divided blocks is 1+length(jg1); for any block wavelet histogram Hx in 1...(1+length(jg1)), Hx=h1(T1:jg1(i)), the wavelet coefficient corresponding to the block wavelet histogram Hx is idx=id1(T1:jg1(i)), where i=1...n1-1, and the T1 variable is when i=1 , T1=1, when i=2...n1-1, T1=1+jg1(i); the method of obtaining each block wavelet histogram Hx in the second array h2 is: determine whether the array jg2 is empty, if it is empty, determine that the block wavelet histogram Hx in the second array h2 cannot be divided, then set the first public array variable Hx=h2, the second public array variable idx=id2, and the length of the block wavelet histogram Hx in the second array h2 is length(Hx); if it is not empty, determine the block wavelet histogram Hx in the second array h2 The wavelet histogram Hx can be divided again, and the number of divided blocks is 1+length(jg2); for any block wavelet histogram Hx in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), the wavelet coefficient corresponding to the block wavelet histogram Hx is idx=id2(T2:jg2(i)), where i=1...n2-1, T2 variable is T2=1 when i=1, and T2=1+jg2(i) when i=2...n2-1;

[0035] Calculate the probability of each block wavelet histogram Hx Cumulative probability Where i = 1...length(Hx);

[0036] The arbitrary block wavelet histogram Hx is calculated according to the following formula until all block wavelet histograms are calculated:

[0037]

[0038] Where i=1...length(Hx), f(i) is the new wavelet coefficient value of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness, and contrast;

[0039] Perform wavelet reconstruction on the new low-frequency sub-image ca2, the first high-frequency sub-image ch, the second high-frequency sub-image cv and the third high-frequency sub-image cd to obtain a reconstructed image I1;

[0040] Using the formula Convert the reconstructed image I1 to the grayscale display range of [0,255] and output a new enhanced image imageout.

[0041] Among them, the value range of P1 is [0,1].

[0042] Among them, P1=0.1.

[0043] Among them, the default value is 20.

[0044] Another aspect of the present invention provides a wavelet domain brightness-preserving contrast-adjustable image enhancement device, comprising:

[0045] A decomposition module is used to perform a layer of wavelet decomposition on the input image I using the db series wavelet base db1 wavelet to obtain a low-frequency sub-image ca, a first high-frequency sub-image ch, a second high-frequency sub-image cv and a third high-frequency sub-image cd;

[0046] A first calculation module is used to round the low-frequency sub-image ca to obtain the rounded low-frequency sub-image ca1, and calculate the maximum value Mca of the rounded low-frequency sub-image ca1;

[0047] The first determination module is used to determine the frequency of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1 in [0, Mca] to obtain a wavelet histogram h with a length of Mca;

[0048] The second calculation module is used to obtain the wavelet histogram calculation formula Calculate the probability of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1, where i is the wavelet coefficient, i = 0, 1, 2···Mca, and h is the frequency of each wavelet coefficient;

[0049] The setting module is used to set the new low-frequency sub-image ca2 to be the same as the low-frequency sub-image ca, set the value to be a zero matrix, set the wavelet histogram array hx1 for storing the segmentation and the remaining wavelet histogram array hx2, and set the variable segmentation parameter px, the variable segmentation parameter px value range is [0, 0.1];

[0050] Get module, used to set the initial value of loop variable n0 = 1, set the loop calculation to meet n0, where sum() is the summation function, and the segmented wavelet histogram array hx1 is obtained, hx1 = h(0 <h≤n0),n0=n0+1;

[0051] The third calculation module is used to calculate the remaining wavelet histogram array hx2 according to the segmented wavelet histogram array hx1, wherein hx2=h-hx1;

[0052] A recording module is used to remove non-zero elements in the segmented wavelet histogram array hx1, record statistics through the first array h1, and record corresponding wavelet coefficients through the first wavelet coefficient array id1; remove non-zero elements in the remaining wavelet histogram array hx2, record statistics through the second array h2, and record corresponding wavelet coefficients through the second wavelet coefficient array id2;

[0053] The segmentation module is used to segment the second array h2 again, and use the formula jgh2(x)=id2(x+1)-id2(x)x=1...n2-1 to record the difference between two adjacent numbers in the second wavelet coefficient array id2, and put the difference into the jgh2 array, and put the value of jgh2(x)>=preset value into the array jg2, and the number of segmentation blocks is 1+length(jg2);

[0054] The second determination module is used to set the first public array variable Hx to store the acquired block wavelet histogram, and the second public array variable idx to store the wavelet coefficients of the first public array variable Hx, and obtain the block wavelet histograms Hx in the second array h2, wherein the acquisition method of the block wavelet histograms Hx in the second array h2 is: determine whether the array jg2 is empty, if it is empty, determine that the block wavelet histograms Hx in the second array h2 cannot be divided, then set the first public array variable Hx = h2, the second public array variable idx = id2, and the block wavelet histograms Hx in the second array h2 The length of is length(Hx). If it is not empty, it is determined that the block wavelet histogram Hx in the second array h2 can be divided again, and the number of blocks that can be divided is 1+length(jg2); for any block wavelet histogram in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), the wavelet coefficient of the corresponding block wavelet histogram is idx=id2(T2:jg2(i)), where i=1...n2-1, T2 variable is T2=1 when i=1, and T2=1+jg2(i) when i=2...n2-1;

[0055] The fourth calculation module calculates the probability of each block wavelet histogram Hx Cumulative probability Where i = 1...length(Hx);

[0056] The fifth calculation module is used to calculate any block wavelet histogram Hx according to the following formula until all block wavelet histograms are calculated to obtain the wavelet coefficients of the new low-frequency sub-graph ca2:

[0057]

[0058] Where i=1...length(Hx), f(i) is the new wavelet coefficient value of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness, and contrast;

[0059] A mapping module, used for mapping the wavelet coefficients of the first wavelet coefficient array id1 to the new low-frequency sub-image ca2;

[0060] A reconstruction module is used to perform wavelet reconstruction on the new low-frequency sub-image ca2, the first high-frequency sub-image ch, the second high-frequency sub-image cv and the third high-frequency sub-image cd to obtain a reconstructed image I1;

[0061] Output module for using formula Convert the reconstructed image I1 to the grayscale display range of [0,255] and output a new enhanced image imageout.

[0062] Among them, the setting module is also used to set an array idnew with the same length as the second wavelet coefficient array id2 for storing the wavelet coefficients of each block wavelet histogram Hx; the mapping module maps the wavelet coefficients of the first wavelet coefficient array id1 to the new low-frequency sub-image ca2 in the following manner: the mapping module is specifically used to set the loop variable i=1:length(id1), compare the wavelet coefficient id1(i) in the first wavelet coefficient array id1 with each wavelet coefficient in the second wavelet coefficient array id2 one by one, and determine the wavelet coefficient position idp closest to the wavelet coefficient id1(i), wherein [~,idp]=min(abs(id2(:)-id1(i))); after determining the position idp, determine the position in the rounded low-frequency sub-image ca1 that is equal to the wavelet coefficient id1(i) in the new low-frequency sub-image ca2, and assign idnew to idnew(idp) at the same position in the new low-frequency sub-image ca2 until all wavelet coefficients of the first wavelet coefficient array id1 are mapped.

[0063] In another aspect, the present invention provides a wavelet domain brightness-preserving contrast-adjustable image enhancement device, comprising:

[0064] A decomposition module is used to perform a layer of wavelet decomposition on the input image I using the db series wavelet base db1 wavelet to obtain a low-frequency sub-image ca, a first high-frequency sub-image ch, a second high-frequency sub-image cv and a third high-frequency sub-image cd;

[0065] A first calculation module is used to round the low-frequency sub-image ca to obtain the rounded low-frequency sub-image ca1, and calculate the maximum value Mca of the rounded low-frequency sub-image ca1;

[0066] The first determination module is used to determine the frequency of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1 in [0, Mca] to obtain a wavelet histogram h with a length of Mca;

[0067] The second calculation module obtains the wavelet histogram calculation formula Calculate the probability of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1, where i is the wavelet coefficient, i = 0, 1, 2···Mca, and h is the frequency of each wavelet coefficient;

[0068] The setting module is used to set the new low-frequency sub-image ca2 to be the same as the low-frequency sub-image ca, set the value to be a zero matrix, set the wavelet histogram array hx1 for storing the segmentation and the remaining wavelet histogram array hx2, and set the variable segmentation parameter px, the variable segmentation parameter px value range is [0, 0.1];

[0069] Get module, used to set the initial value of loop variable n0 = 1, set the loop calculation to meet n0, where sum() is the summation function, and the segmented wavelet histogram array hx1=h(0 <h≤n0),n0=n0+1;

[0070] The third calculation module is used to calculate the remaining wavelet histogram array hx2 according to the segmented wavelet histogram array hx1, wherein hx2=h-hx1;

[0071] A recording module is used to remove non-zero elements in the segmented wavelet histogram array hx1, record statistics through the first array h1, and record corresponding wavelet coefficients through the first wavelet coefficient array id1; remove non-zero elements in the remaining wavelet histogram array hx2, record statistics through the second array h2, and record corresponding wavelet coefficients through the second wavelet coefficient array id2;

[0072] A segmentation module is used to further segment the first array h1 and the second array h2, and use the formula jgh1(x)=id1(x+1)-id1(x)x=1...n1-1 to record the difference between two adjacent numbers in the first wavelet coefficient array id1, and put the difference into the jgh1 array, and put the value jgh1(x)>=preset value into the array jg1, and the number of segmentation blocks is 1+length(jg1); use the formula jgh2(x)=id2(x+1)-id2(x)x=1...n2-1 to record the difference between two adjacent numbers in the second wavelet coefficient array id2, and put the difference into the jgh2 array, and put the value jgh2(x)>=preset value into the array jg2, and the number of segmentation blocks is 1+length(jg2);

[0073] The second determination module is used to set the first public array variable Hx to store the acquired block wavelet histogram, and the second public array variable idx to store the wavelet coefficients of the first public array variable Hx, wherein the acquisition method of each block wavelet histogram Hx in the first array h1 is: determine whether the array jg1 is empty, if it is empty, determine that the block wavelet histogram Hx in the first array h1 cannot be divided, then set the first public array variable Hx = h1, the second public array variable idx = id1, and the block wavelet histogram Hx in the first array h1 is divided into two blocks. The length of the wave histogram Hx is length(Hx); if it is not empty, it is determined that the block wavelet histogram Hx in the first array h1 can be divided again, and the number of divided blocks is 1+length(jg1); for any block wavelet histogram Hx in 1...(1+length(jg1)), Hx=h1(T1:jg1(i)), the wavelet coefficient corresponding to the block wavelet histogram Hx is idx=id1(T1:jg1(i)), where i=1...n1-1, and the T1 variable is in When i=1, T1=1, when i=2...n1-1, T1=1+jg1(i); the method of obtaining each block wavelet histogram Hx in the second array h2 is: determine whether the array jg2 is empty, if it is empty, determine that the block wavelet histogram Hx in the second array h2 cannot be divided, then set the first public array variable Hx=h2, the second public array variable idx=id2, and the length of the block wavelet histogram Hx in the second array h2 is length(Hx); if it is not empty, determine the second array h2 The block wavelet histogram Hx can be divided again, and the number of divided blocks is 1+length(jg2); for any block wavelet histogram Hx in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), the wavelet coefficient corresponding to the block wavelet histogram Hx is idx=id2(T2:jg2(i)), where i=1...n2-1, T2 variable is T2=1 when i=1, and T2=1+jg2(i) when i=2...n2-1;

[0074] The fourth calculation module is used to calculate the probability of each block wavelet histogram Hx Cumulative probability Where i = 1...length(Hx);

[0075] The fifth calculation module is used to calculate any block wavelet histogram Hx according to the following formula until all block wavelet histograms are calculated:

[0076]

[0077] Where i=1...length(Hx), f(i) is the new wavelet coefficient value of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness, and contrast;

[0078] A reconstruction module is used to perform wavelet reconstruction on the new low-frequency sub-image ca2, the first high-frequency sub-image ch, the second high-frequency sub-image cv and the third high-frequency sub-image cd to obtain a reconstructed image I1;

[0079] Output module for using formula Convert the reconstructed image I1 to the grayscale display range of [0,255] and output a new enhanced image imageout.

[0080] Among them, the value range of P1 is [0,1].

[0081] Among them, P1=0.1.

[0082] Among them, the default value is 20.

[0083] It can be seen that the contrast-adjustable image enhancement method and device with brightness preservation in the wavelet domain provided by the embodiment of the present invention are based on the wavelet histogram in the image wavelet domain (i.e., frequency domain). The present invention can automatically divide the wavelet histogram of the low-frequency sub-image of the input image into a plurality of block wavelet histograms according to the segmentation parameters, perform wavelet coefficient enhancement processing in each block, merge the wavelet low-frequency sub-images, and finally output the enhanced image through the inverse wavelet transform. The contrast of the enhanced image can be freely adjusted while keeping the image brightness basically unchanged, and can be applicable to some consumer electronic product image processing systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0084] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. The accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0085] Figure 1 A flow chart of a contrast-adjustable image enhancement method with brightness preservation in the wavelet domain provided in Embodiment 1 of the present invention;

[0086] Figure 2 A schematic diagram of the structure of a contrast-adjustable image enhancement device with brightness preservation in the wavelet domain provided in Embodiment 1 of the present invention;

[0087] Figure 3 A curve diagram showing the change of the index with px between [0, 0.1] when p1=0.1 provided in Example 1 of the present invention;

[0088] Figure 4 A general brightness image provided in Example 1 of the present invention - a schematic diagram of a flower pot;

[0089] Figure 5A low-brightness image-landscape schematic diagram provided in Embodiment 1 of the present invention;

[0090] Figure 6 A schematic diagram of an infrared image provided by Embodiment 1 of the present invention;

[0091] Figure 7 A high-brightness image provided in Example 1 of the present invention - a plum blossom schematic diagram;

[0092] Figure 8 A flow chart of a contrast-adjustable image enhancement method with brightness preservation in the wavelet domain provided in Embodiment 2 of the present invention;

[0093] Fig. 9 A schematic diagram of the structure of a contrast-adjustable image enhancement device with brightness preservation in the wavelet domain provided in Embodiment 2 of the present invention;

[0094] Fig.10 A curve diagram showing the change of the index with px between [0, 0.1] when p1=0.1 provided in Example 2 of the present invention;

[0095] Fig.11 A low-contrast image provided in Example 2 of the present invention - Einstein schematic diagram;

[0096] Fig.12 A low-brightness image-landscape schematic diagram provided in Embodiment 2 of the present invention;

[0097] Fig.13 A schematic diagram of an infrared image provided by Embodiment 2 of the present invention;

[0098] Fig.14 A schematic diagram of a plum blossom, a high-brightness image, provided in Example 2 of the present invention. DETAILED DESCRIPTION

[0099] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0100] Example 1

[0101] Figure 1 A flowchart of a contrast-adjustable image enhancement method with brightness preservation in the wavelet domain provided by Embodiment 1 of the present invention is shown. Figure 1 The image enhancement method with adjustable contrast and brightness preservation in the wavelet domain provided by Embodiment 1 of the present invention comprises:

[0102] S1, use the db series wavelet base db1 wavelet to perform a layer of wavelet decomposition on the input image I to obtain a low-frequency sub-image ca, a first high-frequency sub-image ch, a second high-frequency sub-image cv and a third high-frequency sub-image cd.

[0103] Specifically, the input image I is decomposed into one layer of wavelet using the db1 wavelet in the db series wavelet base to obtain a low-frequency sub-image ca and three high-frequency sub-images ch, cv, and cd.

[0104] S2, rounding the low-frequency sub-image ca to obtain the rounded low-frequency sub-image ca1, and calculating the maximum value Mca of the rounded low-frequency sub-image ca1.

[0105] Specifically, the low-frequency sub-image ca is rounded to an integer, and the new sub-image after rounding is ca1, and the maximum value of ca1 is calculated as Mca.

[0106] S3, determining the frequency of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1 in [0, Mca], and obtaining a wavelet histogram h with a length of Mca.

[0107] Specifically, the frequency of occurrence of each wavelet coefficient of ca1 is counted in [0, Mca] (ie, wavelet histogram), the wavelet histogram is h, and the length is Mca.

[0108] S4, obtain the wavelet histogram calculation formula The probability of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1 is calculated, where i is a wavelet coefficient, i=0, 1, 2...Mca, and h is the frequency of each wavelet coefficient.

[0109] Specifically, using the formula Calculate the probability of occurrence of each wavelet coefficient, where i = 0·1·2···Mca.

[0110] S5, setting the new low-frequency sub-image ca2 to be the same as the low-frequency sub-image ca, setting the value to a zero matrix, setting the wavelet histogram array hx1 storing the segmentation and the remaining wavelet histogram array hx2, setting a variable segmentation parameter px, the variable segmentation parameter px has a value range of [0, 0.1].

[0111] Specifically, the new low-frequency sub-image ca2 is set to have the same size as ca, and the value is set to a zero matrix; the array hx1 for storing the segmented wavelet histogram is set to be zeros(Mca,1), the remaining array hx2 is set to be zeros(Mca,1), and the variable parameter px has a value range of [0,0.1]. The image size of the new low-frequency sub-image ca2 can be the same as the matrix of the rounded low-frequency sub-image ca1. For example, the matrix of the rounded low-frequency sub-image ca1 is 20×11, and the new low-frequency sub-image ca2 is also 20×11. In addition, the array hx1 for storing the segmented wavelet histogram can be set to be zeros(Mca,1), the remaining array hx2 is set to be zeros(Mca,1), and the variable segmentation parameter px has a value range of [0,0.1]. The variable segmentation parameter px is mainly used for the first segmentation of the wavelet histogram.

[0112] S6, set the initial value of the loop variable n0 = 1, set the loop calculation to conform to n0, where sum() is a summation function, and the segmented wavelet histogram array hx1 is obtained, where hx1=h(0 <h≤n0),n0=n0+1。

[0113] Specifically, in this step, the wavelet histogram is segmented for the first time and recorded in the wavelet histogram array hx1. After that, the remaining wavelet histogram array hx2 can be calculated based on the wavelet histogram array hx1 segmented for the first time.

[0114] S7, calculating the remaining wavelet histogram array hx2 according to the segmented wavelet histogram array hx1, wherein hx2=h-hx1

[0115] S8, remove the non-zero elements in the segmented wavelet histogram array hx1, record the statistics through the first array h1, and record the corresponding wavelet coefficients through the first wavelet coefficient array id1; remove the non-zero elements in the remaining wavelet histogram array hx2, record the statistics through the second array h2, and record the corresponding wavelet coefficients through the second wavelet coefficient array id2.

[0116] Specifically, the non-zero elements of hx1 are removed and recorded in the h1 array, that is, h1(1)...h1(n1) records the statistics; id1(1)...id1(n1) i.e., the id1 array records the corresponding wavelet coefficients; similarly, the non-zero elements of hx2 are removed and recorded in the h2 array, that is, h2(1)...h2(n2) records the statistics, id2(1)...id2(n2) i.e., the id2 array records the corresponding wavelet coefficients.

[0117] S9, further divide the second array h2, use the formula jgh2(x)=id2(x+1)-id2(x)x=1...n2-1, record the difference between two adjacent numbers in the second wavelet coefficient array id2, put the difference into the jgh2 array, put the value jgh2(x)>=preset value into the array jg2, and divide the number of blocks into 1+length(jg2).

[0118] As an optional implementation of the embodiment of the present invention, the preset value is 20. That is, in this step, the wavelet histogram h2 is further segmented. Using the formula jgh2(x)=id2(x+1)-id2(x)x=1...n2-1, the difference between two adjacent numbers in the id2 array is recorded, and the difference is placed in the jgh2 array. At the same time, the values ​​of jgh2(x)>=20 are placed in the array jg2, and the number of segmentation blocks is 1+length(jg2).

[0119] S10, set the first public array variable Hx to store the acquired block wavelet histogram, and the second public array variable idx to store the wavelet coefficients of the first public array variable Hx, and obtain the block wavelet histograms Hx in the second array h2, wherein the acquisition method of the block wavelet histograms Hx in the second array h2 is: determine whether the array jg2 is empty, if it is empty, determine that the block wavelet histograms Hx in the second array h2 cannot be divided, then set the first public array variable Hx = h2, the second public array variable idx = id2, and the block wavelet histograms Hx in the second array h2 are The length of Hx is length(Hx). If it is not empty, it is determined that the block wavelet histogram Hx in the second array h2 can be divided again, and the number of blocks that can be divided is 1+length(jg2); for any block wavelet histogram in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), the wavelet coefficient corresponding to the block wavelet histogram is idx=id2(T2:jg2(i)), where i=1...n2-1, T2 variable is T2=1 when i=1, and T2=1+jg2(i) when i=2...n2-1.

[0120] Specifically, set a public array variable Hx to store the obtained block wavelet histogram, and a public array variable idx to store the wavelet coefficients of Hx; obtain each block wavelet histogram Hx in the wavelet histogram h2: first, determine whether the array jg2 is empty (isempty(jg2) == 1), if it is empty, indicating that the wavelet histogram h2 cannot be divided, then Hx = h2, idx = id2, and the length of block Hx is length(Hx); secondly, if it is not empty, indicating that the wavelet histogram h2 can be divided again, and the number of blocks that can be divided is 1+length(jg2). For any block wavelet histogram in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), the wavelet coefficient of the corresponding block wavelet histogram is idx=id2(T2:jg2(i)), where i=1...n2-1, and when i=1, T2 variable takes T2=1, and when i=2...n2-1, T2 variable is the processed jg2(i)+1 of the previous block, that is, T2=1+jg2(i).

[0121] S11, calculate the probability of each block wavelet histogram Hx Cumulative probability Where i = 1...length(Hx);

[0122] S12, calculate any block wavelet histogram Hx according to the following formula until all block wavelet histograms are calculated, and obtain the wavelet coefficients of the new low-frequency sub-graph ca2:

[0123]

[0124] Wherein, i=1...length(Hx), f(i) is the new wavelet coefficient value of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness and contrast.

[0125] As an optional implementation of the embodiment of the present invention, P1 has a value range of [0,1]. Preferably, P1=0.1. Specifically, P1 can be changed as needed, and P1 can finely adjust the contrast and information entropy of the image. In the actual calculation process, selecting 0.1 can simplify the calculation and increase the calculation speed.

[0126] Specifically, any block wavelet histogram Hx is calculated according to the following formula until all block wavelet histograms are calculated; at the same time, an array idnew=zeros(size(id2)) with the same length as the id2 array is set to store the new wavelet coefficients of each block wavelet histogram Hx calculated by the following formula:

[0127]

[0128] Wherein i=1...length(Hx), f(i) is the new wavelet coefficient of the low-frequency sub-image ca2, P1 is the adjustment parameter of image details, brightness and contrast, and its value range is [0,1]. In the present invention, in order to improve the operation speed, P1=0.1.

[0129] S13, mapping the wavelet coefficients of the first wavelet coefficient array id1 to the new low-frequency sub-image ca2;

[0130] As an optional implementation of an embodiment of the present invention, the contrast-adjustable image enhancement method with brightness maintained in the wavelet domain provided by the embodiment of the present invention also includes: setting an array idnew having the same length as the second wavelet coefficient array id2 for storing the wavelet coefficients of each block wavelet histogram Hx; mapping the wavelet coefficients of the first wavelet coefficient array id1 to the new low-frequency sub-image ca2 includes: setting a loop variable i=1:length(id1), comparing the wavelet coefficient id1(i) in the first wavelet coefficient array id1 with each wavelet coefficient in the second wavelet coefficient array id2 one by one, and determining the wavelet coefficient position idp closest to the wavelet coefficient id1(i), wherein [~,idp]=min(abs(id2(:)-id1(i))); after determining the position idp, determining in the new low-frequency sub-image ca2 the position equal to the wavelet coefficient id1(i) in the rounded low-frequency sub-image ca1, and assigning the array idnew to idnew(idp) at the same position in the new low-frequency sub-image ca2, until all wavelet coefficients of the first wavelet coefficient array id1 are mapped. Specifically, the wavelet coefficient of id1 is mapped to the low-frequency sub-image ca2, specifically: set the loop variable i = 1:length(id1), compare the wavelet coefficient id1(i) in the array id1 with each wavelet coefficient in the array id2 one by one, and find the wavelet coefficient position idp closest to id1(i). The search formula is: [~, idp] = min(abs(id2(:)-id1(i))); after finding the position idp, in the low-frequency sub-image ca2, find the position of the wavelet coefficient equal to id1(i) in the low-frequency sub-image ca1, and assign idnew(idp) to the same position in the low-frequency sub-image ca2 until all wavelet coefficients in the array id1 are mapped.

[0131] S14, performing wavelet reconstruction on the new low-frequency sub-image ca2, the first high-frequency sub-image ch, the second high-frequency sub-image cv and the third high-frequency sub-image cd to obtain a reconstructed image I1.

[0132] Specifically, the new low-frequency sub-image ca2 is reconstructed with ch, cv, and cd by wavelet, and the reconstructed image is I1.

[0133] S15, using the formula Convert the reconstructed image I1 to the grayscale display range of [0,255] and output a new enhanced image imageout.

[0134] It can be seen that the contrast-adjustable image enhancement method with brightness preservation in the wavelet domain provided by the embodiment of the present invention is based on the wavelet histogram in the image wavelet domain (i.e., frequency domain). The present invention can automatically divide the wavelet histogram of the low-frequency sub-image of the input image into a plurality of block wavelet histograms according to the segmentation parameters, perform wavelet coefficient enhancement processing in each block, merge the wavelet low-frequency sub-images, and finally output the enhanced image through the inverse wavelet transform. The contrast of the enhanced image can be adjusted while keeping the image brightness basically unchanged, eliminating the over-brightness problem of wavelet histogram equalization enhancement, and solving the over-enhancement problem of traditional wavelet histogram equalization.

[0135] Figure 2 The schematic diagram of the structure of the image enhancement device with adjustable contrast and brightness in the wavelet domain provided by Embodiment 1 of the present invention is shown. The image enhancement device with adjustable contrast and brightness in the wavelet domain provided by the embodiment of the present invention is applied to the above method. The following is only a general description of the structure of the image enhancement device with adjustable contrast and brightness in the wavelet domain. For other matters not covered, please refer to the relevant description in the above wavelet domain brightness-maintaining and contrast-adjustable image enhancement method. Figure 2 The image enhancement device with adjustable contrast and brightness preservation in the wavelet domain provided by Embodiment 1 of the present invention comprises:

[0136] A decomposition module is used to perform a layer of wavelet decomposition on the input image I using the db series wavelet base db1 wavelet to obtain a low-frequency sub-image ca, a first high-frequency sub-image ch, a second high-frequency sub-image cv and a third high-frequency sub-image cd;

[0137] A first calculation module is used to round the low-frequency sub-image ca to obtain a rounded low-frequency sub-image ca1, and calculate a maximum value Mca of the rounded low-frequency sub-image ca1;

[0138] The first determination module is used to determine the frequency of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1 in [0, Mca] to obtain a wavelet histogram h with a length of Mca;

[0139] The second calculation module is used to obtain the wavelet histogram calculation formula Calculate the probability of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1, where i is the wavelet coefficient, i=0, 1, 2...Mca, and h is the frequency of each wavelet coefficient;

[0140] A setting module is used to set the new low-frequency sub-image ca2 to be the same as the low-frequency sub-image ca, set the value to be a zero matrix, set the wavelet histogram array hx1 for storing the segmentation and the remaining wavelet histogram array hx2, and set a variable segmentation parameter px, wherein the variable segmentation parameter px has a value range of [0, 0.1];

[0141] Get module, used to set the initial value of loop variable n0 = 1, set the loop calculation to meet n0, where sum() is a summation function, and the segmented wavelet histogram array hx1 is obtained, where hx1=h(0 <h≤n0),n0=n0+1;

[0142] A third calculation module is used to calculate the remaining wavelet histogram array hx2 according to the segmented wavelet histogram array hx1, wherein hx2=h-hx1;

[0143] A recording module, used for removing non-zero elements in the segmented wavelet histogram array hx1, recording statistics through the first array h1, and recording corresponding wavelet coefficients through the first wavelet coefficient array id1; removing non-zero elements in the remaining wavelet histogram array hx2, recording statistics through the second array h2, and recording corresponding wavelet coefficients through the second wavelet coefficient array id2;

[0144] A segmentation module is used to further segment the second array h2, and use the formula jgh2(x)=id2(x+1)-id2(x)x=1...n2-1 to record the difference between two adjacent numbers in the second wavelet coefficient array id2, and put the difference into the jgh2 array, and put the value of jgh2(x)>=preset value into the array jg2, and the number of segmentation blocks is 1+length(jg2);

[0145] The second determination module is used to set the first public array variable Hx to store the acquired block wavelet histogram, and the second public array variable idx to store the wavelet coefficients of the first public array variable Hx, and obtain the block wavelet histograms Hx in the second array h2, wherein the acquisition method of the block wavelet histograms Hx in the second array h2 is: determine whether the array jg2 is empty, if it is empty, determine that the block wavelet histograms Hx in the second array h2 cannot be divided, then set the first public array variable Hx = h2, the second public array variable idx = id2, and the block wavelet histograms Hx in the second array h2 are obtained. The length of the histogram Hx is length(Hx). If it is not empty, it is determined that the block wavelet histogram Hx in the second array h2 can be divided again, and the number of blocks that can be divided is 1+length(jg2); for any block wavelet histogram in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), the wavelet coefficient of the corresponding block wavelet histogram is idx=id2(T2:jg2(i)), where i=1...n2-1, T2 variable is T2=1 when i=1, and T2=1+jg2(i) when i=2...n2-1;

[0146] The fourth calculation module calculates the probability of each block wavelet histogram Hx Cumulative probability Where i = 1...length(Hx);

[0147] The fifth calculation module is used to calculate any block wavelet histogram Hx according to the following formula until all block wavelet histograms are calculated to obtain the wavelet coefficients of the new low-frequency sub-graph ca2:

[0148]

[0149] Where i=1...length(Hx), f(i) is the new wavelet coefficient value of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness, and contrast;

[0150] A mapping module, used for mapping the wavelet coefficients of the first wavelet coefficient array id1 to the new low-frequency sub-image ca2;

[0151] A reconstruction module, used for performing wavelet reconstruction on the new low-frequency sub-image ca2, the first high-frequency sub-image ch, the second high-frequency sub-image cv and the third high-frequency sub-image cd to obtain a reconstructed image I1;

[0152] Output module for using formula The reconstructed image I1 is converted to a grayscale display range of [0, 255], and a new enhanced image imageout is output.

[0153] As an optional implementation manner of an embodiment of the present invention, the setting module is also used to set an array idnew with the same array length as the second wavelet coefficient array id2 for storing the wavelet coefficients of each block wavelet histogram Hx; the mapping module maps the wavelet coefficients of the first wavelet coefficient array id1 to the new low-frequency sub-image ca2 in the following manner: the mapping module is specifically used to set the loop variable i=1:length(id1), compare the wavelet coefficient id1(i) in the first wavelet coefficient array id1 with each wavelet coefficient in the second wavelet coefficient array id2 one by one, and determine the wavelet coefficient position idp closest to the wavelet coefficient id1(i), where [~, idp]=min(abs(id2(:)-id1(i))); after determining the position idp, determine the position in the rounded low-frequency sub-image ca1 that is equal to the wavelet coefficient id1(i) in the new low-frequency sub-image ca2, and assign idnew to idnew(idp) at the same position in the new low-frequency sub-image ca2 until all wavelet coefficients of the first wavelet coefficient array id1 are mapped.

[0154] As an optional implementation of the embodiment of the present invention, P1 takes a value range of [0, 1].

[0155] As an optional implementation of the embodiment of the present invention, P1=0.1.

[0156] As an optional implementation manner of the embodiment of the present invention, the preset value is 20.

[0157] It can be seen that the contrast-adjustable image enhancement device with brightness preservation in the wavelet domain provided by the embodiment of the present invention can automatically divide the wavelet histogram of the low-frequency sub-image of the input image into a plurality of block wavelet histograms according to the segmentation parameters in the image wavelet domain (i.e., frequency domain), based on the wavelet histogram, and perform wavelet coefficient enhancement processing in each block, merge the wavelet low-frequency sub-images, and finally output the enhanced image through the inverse wavelet transform. Under the condition of keeping the image brightness basically unchanged, the contrast of the enhanced image can be adjusted, the over-brightness problem of wavelet histogram equalization enhancement is eliminated, and the over-enhancement problem of traditional wavelet histogram equalization is solved.

[0158] The following is a specific example to further illustrate the image enhancement method with adjustable contrast and brightness preservation in the wavelet domain provided in Embodiment 1 of the present invention:

[0159] In the implementation process of the invention, the contrast and average brightness change curve is the average value of 20 test images. When p1=0.1, the index changes with px between [0,0.1], as shown in the figure: Figure 3 As shown in the figure. Other effect pictures are enhanced images with px=0.03, such as Figure 4 , 5, 6, and 7.

[0160] Example 2

[0161] Figure 8 A flowchart of a contrast-adjustable image enhancement method with brightness preservation in the wavelet domain provided by Embodiment 2 of the present invention is shown. Figure 8 The wavelet domain brightness-preserving contrast-adjustable image enhancement method provided by Embodiment 2 of the present invention comprises:

[0162] S1, use the db series wavelet base db1 wavelet to perform a layer of wavelet decomposition on the input image I to obtain a low-frequency sub-image ca, a first high-frequency sub-image ch, a second high-frequency sub-image cv and a third high-frequency sub-image cd.

[0163] Specifically, the input image I is decomposed into one layer of wavelet using the db1 wavelet in the db series wavelet base to obtain a low-frequency sub-image ca and three high-frequency sub-images ch, cv, and cd.

[0164] S2, rounding the low-frequency sub-image ca to obtain the rounded low-frequency sub-image ca1, and calculating the maximum value Mca of the rounded low-frequency sub-image ca1.

[0165] Specifically, the low-frequency sub-image ca is rounded to an integer, and the new sub-image after rounding is ca1, and the maximum value of ca1 is calculated as Mca.

[0166] S3, determining the frequency of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1 in [0, Mca], and obtaining a wavelet histogram h with a length of Mca.

[0167] Specifically, the frequency of occurrence of each wavelet coefficient of ca1 is counted in [0, Mca] (ie, wavelet histogram), the wavelet histogram is h, and the length is Mca.

[0168] S4, obtain the wavelet histogram calculation formula The probability of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1 is calculated, where i is a wavelet coefficient, i=0, 1, 2...Mca, and h is the frequency of each wavelet coefficient.

[0169] Specifically, using the formula Calculate the probability of occurrence of each wavelet coefficient, where i = 0·1·2···Mca.

[0170] S5, setting the new low-frequency sub-image ca2 to be the same as the low-frequency sub-image ca, setting the value to a zero matrix, setting the wavelet histogram array hx1 storing the segmentation and the remaining wavelet histogram array hx2, setting a variable segmentation parameter px, the variable segmentation parameter px has a value range of [0, 0.1].

[0171] Specifically, the new low-frequency sub-image ca2 is set to be the same size as ca, and the value is set to a zero matrix; the array hx1 for storing the segmented wavelet histogram is set to be zeros(Mca,1), the remaining array hx2 is set to be zeros(Mca,1), and the variable parameter px has a value range of [0,0.1]. The image size of the new low-frequency sub-image ca2 can be the same as the matrix of the rounded low-frequency sub-image ca1. For example, the matrix of the rounded low-frequency sub-image ca1 is 20×11, and the new low-frequency sub-image ca2 is also 20×11. In addition, the array hx1 for storing the segmented wavelet histogram can be set to be zeros(Mca,1), the remaining array hx2 is set to be zeros(Mca,1), and the variable segmentation parameter px has a value range of [0,0.1]. The variable segmentation parameter px is mainly used for the first segmentation of the wavelet histogram.

[0172] S6, set the initial value of the loop variable n0 = 1, set the loop calculation to conform to n0, where sum() is the summation function, and the segmented wavelet histogram array hx1=h(0 <h≤n0),n0=n0+1。

[0173] Specifically, in this step, the wavelet histogram is segmented for the first time and recorded in the wavelet histogram array hx1, and then the remaining wavelet histogram array hx2 can be calculated according to the wavelet histogram array hx1 segmented for the first time.

[0174] S7, calculating the remaining wavelet histogram array hx2 according to the segmented wavelet histogram array hx1, wherein hx2=h-hx1;

[0175] S8, remove the non-zero elements in the segmented wavelet histogram array hx1, record the statistics through the first array h1, and record the corresponding wavelet coefficients through the first wavelet coefficient array id1; remove the non-zero elements in the remaining wavelet histogram array hx2, record the statistics through the second array h2, and record the corresponding wavelet coefficients through the second wavelet coefficient array id2.

[0176] Specifically, remove the non-zero elements of hx1 and record them in the h1 array, i.e., h1(1)...h1(n1) records the statistics; id1(1)...id1(n1) i.e., id1 array records the corresponding wavelet coefficients; similarly, remove the non-zero elements of hx2 and record them in the h2 array, i.e., h2(1)...h2(n2) records the statistics, id2(1)...id2(n2) i.e., id2 array records the corresponding wavelet coefficients. Where n1 is the number of wavelet histograms in the first array h1, and n2 is the number of wavelet histograms in the second array h2.

[0177] S9, further divide the first array h1 and the second array h2, and use the formula jgh1(x)=id1(x+1)-id1(x)x=1...n1-1 to record the difference between two adjacent numbers in the first wavelet coefficient array id1, and put the difference into the jgh1 array, and put the value jgh1(x)>=preset value into the array jg1, and the number of divided blocks is 1+length(jg1); use the formula jgh2(x)=id2(x+1)-id2(x)x=1...n2-1 to record the difference between two adjacent numbers in the second wavelet coefficient array id2, and put the difference into the jgh2 array, and put the value jgh2(x)>=preset value into the array jg2, and the number of divided blocks is 1+length(jg2).

[0178] As an optional implementation of the embodiment of the present invention, the preset value is 20. That is, in this step, the wavelet histograms h1 and h2 are further divided. Using the formula jgh1(x)=id1(x+1)-id1(x)x=1...n1-1, the difference between two adjacent numbers in the id1 array is recorded, and the difference is placed in the jgh1 array. At the same time, the values ​​of jgh1(x)>=20 are placed in the array jg1, and the number of divided blocks is 1+length(jg1); similarly, using the formula jgh2(x)=id2(x+1)-id2(x)x=1...n2-1, the difference between two adjacent numbers in the id2 array is recorded, and the difference is placed in the jgh2 array. At the same time, the values ​​of jgh2(x)>=20 are placed in the array jg2, and the number of divided blocks is 1+length(jg2).

[0179] S10, setting a first public array variable Hx for storing the acquired block wavelet histogram, and a second public array variable idx for storing the wavelet coefficients of the first public array variable Hx, wherein the acquisition method of each block wavelet histogram Hx in the first array h1 is: judging whether the array jg1 is empty, if it is empty, determining that the block wavelet histogram Hx in the first array h1 cannot be split, then setting the first public array variable Hx = h1, the second public array variable idx = id1, the first array h1 The length of the block wavelet histogram Hx is length(Hx); if it is not empty, it is determined that the block wavelet histogram Hx in the first array h1 can be divided again, and the number of divided blocks is 1+length(jg1); for any block wavelet histogram Hx in 1...(1+length(jg1)), Hx=h1(T1:jg1(i)), the wavelet coefficient corresponding to the block wavelet histogram Hx is idx=id1(T1:jg1(i)), where i=1...n1-1, and the T1 variable is in When i=1, T1=1, when i=2...n1-1, T1=1+jg1(i); the method of obtaining each block wavelet histogram Hx in the second array h2 is: judging whether the array jg2 is empty, if it is empty, determining that the block wavelet histogram Hx in the second array h2 cannot be divided, then setting the first public array variable Hx=h2, the second public array variable idx=id2, and the length of the block wavelet histogram Hx in the second array h2 is length(Hx); if it is not empty, determining the second The block wavelet histogram Hx in the array h2 can be divided again, and the number of divided blocks is 1+length(jg2); for any block wavelet histogram Hx in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), and the wavelet coefficient corresponding to the block wavelet histogram Hx is idx=id2(T2:jg2(i)), where i=1...n2-1, and when T2 variable i=1, T2=1, and when i=2...n2-1, T2=1+jg2(i).

[0180] Specifically, a public array variable Hx is set to store the obtained block wavelet histogram, and a public array variable idx is used to store the wavelet coefficients of Hx. The method for obtaining each block wavelet histogram Hx in the wavelet histogram h1 is: first, determine whether the array jg1 is empty (isempty(jg1) == 1). If it is empty, it indicates that the wavelet histogram h1 cannot be divided, then Hx = h1, idx = id1, and the length of block Hx is length(Hx); secondly, if it is not empty, it indicates that the wavelet histogram h1 can be divided again, and the number of blocks that can be divided is 1+length(jg1). For any block wavelet histogram in 1...(1+length(jg1)), Hx=h1(T1:jg1(i)), the wavelet coefficient of the corresponding block wavelet histogram is idx=id1(T1:jg1(i)), where i=1...n1-1, and when i=1, T1 variable takes T1=1, and when i=2...n1-1, T1 variable is the processed jg1(i)+1 of the previous block, that is, T1=1+jg1(i).

[0181] Similarly, obtain the wavelet histogram Hx of each block in the wavelet histogram h2. First, determine whether the array jg2 is empty (isempty(jg2) == 1). If it is empty, it means that the wavelet histogram h2 cannot be divided, then Hx = h2, idx = id2, and the length of the block Hx is length(Hx); secondly, if it is not empty, it means that the wavelet histogram h2 can be divided again, and the number of blocks that can be divided is 1+length(jg2). For any block wavelet histogram in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), the wavelet coefficient of the corresponding block wavelet histogram is idx=id2(T2:jg2(i)), where i=1...n2-1, and when i=1, T2 variable takes T2=1, and when i=2...n2-1, T2 variable is the processed jg2(i)+1 of the previous block, that is, T2=1+jg2(i).

[0182] S11, calculate the probability of each block wavelet histogram Hx Cumulative probability Where i = 1...length(Hx);

[0183] S12, calculate any block wavelet histogram Hx according to the following formula until all block wavelet histograms are calculated:

[0184]

[0185] Wherein, i=1...length(Hx), f(i) is the new wavelet coefficient value of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness and contrast.

[0186] As an optional implementation of the embodiment of the present invention, P1 has a value range of [0,1]. Preferably, P1=0.1. Specifically, P1 can be changed as needed, and P1 can finely adjust the contrast and information entropy of the image. In the actual calculation process, selecting 0.1 can simplify the calculation and increase the calculation speed.

[0187] S13, performing wavelet reconstruction on the new low-frequency sub-image ca2, the first high-frequency sub-image ch, the second high-frequency sub-image cv and the third high-frequency sub-image cd to obtain a reconstructed image I1.

[0188] Specifically, the new low-frequency sub-image ca2 is reconstructed with ch, cv, and cd by wavelet, and the reconstructed image is I1.

[0189] S14, using the formula Convert the reconstructed image I1 to the grayscale display range of [0,255] and output a new enhanced image imageout.

[0190] It can be seen that the contrast-adjustable image enhancement method with brightness preservation in the wavelet domain provided by the embodiment of the present invention can automatically divide the wavelet histogram of the low-frequency sub-image of the input image into a plurality of block wavelet histograms according to the segmentation parameters in the image wavelet domain (i.e., frequency domain), and perform wavelet coefficient enhancement processing in each block, merge the wavelet low-frequency sub-images, and finally output the enhanced image through the inverse wavelet transform. The contrast of the enhanced image can be freely adjusted while keeping the image brightness basically unchanged, and the method can be applied to image processing systems of some consumer electronic products.

[0191] Fig. 9 The schematic diagram of the structure of the image enhancement device with adjustable contrast and brightness in the wavelet domain provided by Embodiment 2 of the present invention is shown. The image enhancement device with adjustable contrast and brightness in the wavelet domain provided by the embodiment of the present invention is applied to the above method. The following is only a general description of the structure of the image enhancement device with adjustable contrast and brightness in the wavelet domain. For other matters not covered, please refer to the relevant description in the above wavelet domain brightness-maintaining and contrast-adjustable image enhancement method. Figure 2 , the contrast-adjustable image enhancement device with brightness preservation in the wavelet domain provided by Embodiment 2 of the present invention,

[0192] A decomposition module is used to perform a layer of wavelet decomposition on the input image I using the db series wavelet base db1 wavelet to obtain a low-frequency sub-image ca, a first high-frequency sub-image ch, a second high-frequency sub-image cv and a third high-frequency sub-image cd;

[0193] A first calculation module is used to round the low-frequency sub-image ca to obtain a rounded low-frequency sub-image ca1, and calculate a maximum value Mca of the rounded low-frequency sub-image ca1;

[0194] The first determination module is used to determine the frequency of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1 in [0, Mca] to obtain a wavelet histogram h with a length of Mca;

[0195] The second calculation module obtains the wavelet histogram calculation formula Calculate the probability of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1, where i is the wavelet coefficient, i=0, 1, 2...Mca, and h is the frequency of each wavelet coefficient;

[0196] A setting module is used to set the new low-frequency sub-image ca2 to be the same as the low-frequency sub-image ca, set the value to be a zero matrix, set the wavelet histogram array hx1 for storing the segmentation and the remaining wavelet histogram array hx2, and set a variable segmentation parameter px, wherein the variable segmentation parameter px has a value range of [0, 0.1];

[0197] Get module, used to set the initial value of loop variable n0 = 1, set the loop calculation to meet n0, where sum() is the summation function, and the segmented wavelet histogram array hx1=h(0 <h≤n0),n0=n0+1;

[0198] A third calculation module is used to calculate the remaining wavelet histogram array hx2 according to the segmented wavelet histogram array hx1, wherein hx2=h-hx1;

[0199] A recording module, used for removing non-zero elements in the segmented wavelet histogram array hx1, recording statistics through the first array h1, and recording corresponding wavelet coefficients through the first wavelet coefficient array id1; removing non-zero elements in the remaining wavelet histogram array hx2, recording statistics through the second array h2, and recording corresponding wavelet coefficients through the second wavelet coefficient array id2;

[0200] A segmentation module, used for further segmenting the first array h1 and the second array h2, using the formula jgh1(x)=id1(x+1)-id1(x)x=1...n1-1, recording the difference between two adjacent numbers in the first wavelet coefficient array id1, putting the difference into the jgh1 array, placing the value jgh1(x)>=preset value into the array jg1, and the number of segmentation blocks is 1+length(jg1); using the formula jgh2(x)=id2(x+1)-id2(x)x=1...n2-1, recording the difference between two adjacent numbers in the second wavelet coefficient array id2, putting the difference into the jgh2 array, placing the value jgh2(x)>=preset value into the array jg2, and the number of segmentation blocks is 1+length(jg2);

[0201] The second determination module is used to set the first public array variable Hx to store the acquired block wavelet histogram, and the second public array variable idx to store the wavelet coefficients of the first public array variable Hx, wherein the acquisition method of each block wavelet histogram Hx in the first array h1 is: determine whether the array jg1 is empty, if it is empty, determine that the block wavelet histogram Hx in the first array h1 cannot be divided, then set the first public array variable Hx = h1, the second public array variable idx = id1, the first array The length of the block wavelet histogram Hx in group h1 is length(Hx); if it is not empty, it is determined that the block wavelet histogram Hx in the first array h1 can be divided again, and the number of divided blocks is 1+length(jg1); for any block wavelet histogram Hx in 1...(1+length(jg1)), Hx=h1(T1:jg1(i)), the wavelet coefficient corresponding to the block wavelet histogram Hx is idx=id1(T1:jg1(i)), where i=1...n1-1, T1 becomes When i=1, T1=1, when i=2...n1-1, T1=1+jg1(i); the method for obtaining each block wavelet histogram Hx in the second array h2 is: judging whether the array jg2 is empty, if it is empty, determining that the block wavelet histogram Hx in the second array h2 cannot be divided, then setting the first public array variable Hx=h2, the second public array variable idx=id2, and the length of the block wavelet histogram Hx in the second array h2 is length(Hx); if it is not empty, determining the first public array variable Hx=h2, the second public array variable idx=id2, and the length of the block wavelet histogram Hx in the second array h2 is length(Hx); The block wavelet histogram Hx in the two arrays h2 can be divided again, and the number of divided blocks is 1+length(jg2); for any block wavelet histogram Hx in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), the wavelet coefficient corresponding to the block wavelet histogram Hx is idx=id2(T2:jg2(i)), where i=1...n2-1, T2 variable is T2=1 when i=1, and T2=1+jg2(i) when i=2...n2-1;

[0202] The fourth calculation module is used to calculate the probability of each block wavelet histogram Hx Cumulative probability Where i = 1...length(Hx);

[0203] A fifth computing module is used for

[0204] The arbitrary block wavelet histogram Hx is calculated according to the following formula until all block wavelet histograms are calculated:

[0205]

[0206] Where i=1...length(Hx), f(i) is the new wavelet coefficient value of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness, and contrast;

[0207] A reconstruction module, used for performing wavelet reconstruction on the new low-frequency sub-image ca2, the first high-frequency sub-image ch, the second high-frequency sub-image cv and the third high-frequency sub-image cd to obtain a reconstructed image I1;

[0208] Output module for using formula The reconstructed image I1 is converted to a grayscale display range of [0, 255], and a new enhanced image imageout is output.

[0209] As an optional implementation of the embodiment of the present invention, P1 takes a value range of [0, 1].

[0210] As an optional implementation of the embodiment of the present invention, P1=0.1.

[0211] As an optional implementation manner of the embodiment of the present invention, the preset value is 20.

[0212] It can be seen that, by using the contrast-adjustable image enhancement device with brightness preservation in the wavelet domain provided by the embodiment of the present invention, in the image wavelet domain (i.e., frequency domain), based on the wavelet histogram, the present invention can automatically divide the wavelet histogram of the low-frequency sub-image of the input image into a plurality of block wavelet histograms according to the segmentation parameters, perform wavelet coefficient enhancement processing in each block, merge the wavelet low-frequency sub-images, and finally output the enhanced image through the inverse wavelet transform. The contrast of the enhanced image can be freely adjusted while keeping the image brightness basically unchanged, and the present invention can be applied to image processing systems of some consumer electronic products.

[0213] The following is a specific example to further illustrate the image enhancement method with adjustable contrast and brightness preservation in the wavelet domain provided by Embodiment 2 of the present invention:

[0214] In the implementation process of the invention, the contrast and average brightness change curve is a curve diagram of the change of the index with px between [0,0.1] when the average value of 20 test images is P1=0.1, such as Fig.10 As shown in the figure. Other effect pictures are enhanced images with px=0.03, such as Fig.11 , 12 , 13, and 14.

[0215] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A contrast-adjustable image enhancement method with brightness preservation in wavelet domain, characterized in that: include: Perform a layer of wavelet decomposition on the input image I using the db series wavelet base db1 wavelet to obtain a low-frequency sub-image ca, a first high-frequency sub-image ch, a second high-frequency sub-image cv and a third high-frequency sub-image cd; Rounding the low-frequency sub-image ca to obtain a rounded low-frequency sub-image ca1, and calculating a maximum value Mca of the rounded low-frequency sub-image ca1; Determine the frequency of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1 in [0, Mca] to obtain a wavelet histogram h with a length of Mca; Get the wavelet histogram calculation formula Calculate the probability of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1, where i is the wavelet coefficient, i=0,1,2...Mca, and h is the frequency of each wavelet coefficient; Set the new low-frequency sub-image ca2 to be the same as the low-frequency sub-image ca, set the value to be a zero matrix, set the wavelet histogram array hx1 for storing the segmentation and the remaining wavelet histogram array hx2, set the variable segmentation parameter px, and the variable segmentation parameter px has a value range of [0, 0.1]; Set the initial value of the loop variable n0 = 1, and set the loop calculation to conform to n0, where sum() is a summation function, obtaining the segmented wavelet histogram array hx1, where hx1=h(0 <h≤n0),n0=n0+1; Calculating the remaining wavelet histogram array hx2 according to the segmented wavelet histogram array hx1, wherein hx2=h-hx1; The non-zero elements in the split wavelet histogram array hx1 are removed, the statistics are recorded by the first array h1, and the corresponding wavelet coefficients are recorded by the first wavelet coefficient array id1; the non-zero elements in the remaining wavelet histogram array hx2 are removed, the statistics are recorded by the second array h2, and the corresponding wavelet coefficients are recorded by the second wavelet coefficient array id2; The second array h2 is further divided, and the difference between two adjacent numbers in the second wavelet coefficient array id2 is recorded using the formula jgh2(x)=id2(x+1)-id2(x)x=1...n2-1, and the difference is placed in the jgh2 array, and the value of jgh2(x)>=preset value is placed in the array jg2, and the number of divided blocks is 1+length(jg2); The first public array variable Hx is set to store the acquired block wavelet histogram, and the second public array variable idx is used to store the wavelet coefficients of the first public array variable Hx, and the block wavelet histograms Hx in the second array h2 are obtained, wherein the acquisition method of the block wavelet histograms Hx in the second array h2 is: determine whether the array jg2 is empty, if it is empty, determine that the block wavelet histograms Hx in the second array h2 cannot be divided, then set the first public array variable Hx = h2, the first public array variable Hx = h2, and the second public array variable Hx = h2. The second public array variable idx=id2, the length of each block wavelet histogram Hx in the second array h2 is length(Hx), if it is not empty, it is determined that the block wavelet histogram Hx in the second array h2 can be divided again, and the number of blocks that can be divided is 1+length(jg2); for any block wavelet histogram in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), the wavelet coefficient of the corresponding block wavelet histogram is idx= id2(T2:jg2(i)), where i=1...n2-1, T2 variable is T2=1 when i=1, and T2=1+jg2(i) when i=2...n2-1; Calculate the probability of each block wavelet histogram Hx Cumulative probability Where i = 1...length(Hx); The wavelet histogram Hx of any block is calculated according to the following formula until all the wavelet histograms of the blocks are calculated, and the wavelet coefficients of the new low-frequency sub-graph ca2 are obtained: Where i=1...length(Hx), f(i) is the new wavelet coefficient value of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness, and contrast; Mapping the wavelet coefficients of the first wavelet coefficient array id1 to the new low-frequency sub-image ca2; Perform wavelet reconstruction on the new low-frequency sub-image ca2, the first high-frequency sub-image ch, the second high-frequency sub-image cv and the third high-frequency sub-image cd to obtain a reconstructed image I1; Using the formula The reconstructed image I1 is converted to a grayscale display range of [0, 255], and a new enhanced image imageout is output.

2. The method according to claim 1, characterized in that Also includes: Set an array idnew having the same length as the second wavelet coefficient array id2 to store the wavelet coefficients of each block wavelet histogram Hx; The mapping of the wavelet coefficients of the first wavelet coefficient array id1 to the new low-frequency sub-image ca2 comprises: Set loop variable i=1:length(id1), compare the wavelet coefficient id1(i) in the first wavelet coefficient array id1 with each wavelet coefficient in the second wavelet coefficient array id2 one by one, and determine the wavelet coefficient position idp closest to the wavelet coefficient id1(i), where [~, idp]=min(abs(id2(:)-id1(i))); After determining the position idp, determine the position in the rounded low-frequency sub-image ca1 that is equal to the wavelet coefficient id1(i) in the new low-frequency sub-image ca2, and assign the array idnew to idnew(idp) at the same position in the new low-frequency sub-image ca2 until all wavelet coefficients in the first wavelet coefficient array id1 are mapped.

3. A contrast-adjustable image enhancement method with brightness preservation in wavelet domain, characterized in that: include: Perform a layer of wavelet decomposition on the input image I using the db series wavelet base db1 wavelet to obtain a low-frequency sub-image ca, a first high-frequency sub-image ch, a second high-frequency sub-image cv and a third high-frequency sub-image cd; Rounding the low-frequency sub-image ca to obtain a rounded low-frequency sub-image ca1, and calculating a maximum value Mca of the rounded low-frequency sub-image ca1; Determine the frequency of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1 in [0, Mca] to obtain a wavelet histogram h with a length of Mca; Get the wavelet histogram calculation formula Calculate the probability of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1, where i is the wavelet coefficient, i=0,1,2...Mca, and h is the frequency of each wavelet coefficient; Set the new low-frequency sub-image ca2 to be the same as the low-frequency sub-image ca, set the value to be a zero matrix, set the wavelet histogram array hx1 storing the segmented wavelets and the remaining wavelet histogram array hx2, set the variable segmentation parameter px, and the variable segmentation parameter px has a value range of [0, 0.1]; Set the initial value of the loop variable n0 = 1, and set the loop calculation to conform to n0, where sum() is the sum function, and the segmented wavelet histogram array hx1=h(0 <h≤n0),n0=n0+1; Calculating the remaining wavelet histogram array hx2 according to the segmented wavelet histogram array hx1, wherein hx2=h-hx1; The non-zero elements in the split wavelet histogram array hx1 are removed, the statistics are recorded by the first array h1, and the corresponding wavelet coefficients are recorded by the first wavelet coefficient array id1; the non-zero elements in the remaining wavelet histogram array hx2 are removed, the statistics are recorded by the second array h2, and the corresponding wavelet coefficients are recorded by the second wavelet coefficient array id2; The first array h1 and the second array h2 are further divided, and the difference between two adjacent numbers in the first wavelet coefficient array id1 is recorded by the formula jgh1(x)=id1(x+1)-id1(x)x=1...n1-1, and the difference is placed in the jgh1 array, and the value of jgh1(x)>=preset value is placed in the array jg1, and the number of divided blocks is 1+length(jg1); the formula jgh2(x)=id2(x+1)-id2(x)x=1...n2-1 is used to record the difference between two adjacent numbers in the second wavelet coefficient array id2, and the difference is placed in the jgh2 array, and the value of jgh2(x)>=preset value is placed in the array jg2, and the number of divided blocks is 1+length(jg2); The first public array variable Hx is set to store the acquired wavelet histogram of the block wavelet, and the second public array variable idx is set to store the wavelet coefficients of the first public array variable Hx, wherein the acquisition method of each wavelet histogram Hx of the first array h1 is: determine whether the array jg1 is empty, if it is empty, determine that the wavelet histogram Hx of the block wavelet in the first array h1 cannot be divided, then set the first public array variable Hx = h1, the second public array variable idx = id1, the first array h 1, the length of the block wavelet histogram Hx is length(Hx); if it is not empty, it is determined that the block wavelet histogram Hx in the first array h1 can be divided again, and the number of divided blocks is 1+length(jg1); for any block wavelet histogram Hx in 1...(1+length(jg1)), Hx=h1(T1:jg1(i)), the wavelet coefficient corresponding to the block wavelet histogram Hx is idx=id1(T1:jg1(i)), where i=1...n1-1, T1 variable When i=1, T1=1, when i=2...n1-1, T1=1+jg1(i); the method for obtaining each block wavelet histogram Hx in the second array h2 is: determine whether the array jg2 is empty, if it is empty, determine that the block wavelet histogram Hx in the second array h2 cannot be divided, then set the first public array variable Hx=h2, the second public array variable idx=id2, and the length of the block wavelet histogram Hx in the second array h2 is length(Hx); if it is not empty, determine the first public array variable Hx=h2, the second public array variable idx=id2, and the length of the block wavelet histogram Hx in the second array h2 is length(Hx); if it is not empty, determine the first public array variable Hx=h2, the second public array variable idx=id2, and the length of the block wavelet histogram Hx in the second array h2 is length(Hx). The block wavelet histogram Hx in the two arrays h2 can be divided again, and the number of divided blocks is 1+length(jg2); for any block wavelet histogram Hx in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), the wavelet coefficient corresponding to the block wavelet histogram Hx is idx=id2(T2:jg2(i)), where i=1...n2-1, T2 variable is T2=1 when i=1, and T2=1+jg2(i) when i=2...n2-1; Calculate the probability of each block wavelet histogram Hx Cumulative probability Where i = 1...length(Hx); The arbitrary block wavelet histogram Hx is calculated according to the following formula until all block wavelet histograms are calculated: Where i=1...length(Hx), f(i) is the new wavelet coefficient value of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness, and contrast; Perform wavelet reconstruction on the new low-frequency sub-image ca2, the first high-frequency sub-image ch, the second high-frequency sub-image cv and the third high-frequency sub-image cd to obtain a reconstructed image I1; Using the formula The reconstructed image I1 is converted to a grayscale display range of [0, 255], and a new enhanced image imageout is output.

4. The method according to claim 1 or 3, characterized in that: The value range of P1 is [0,1].

5. The method according to claim 4, characterized in that The P1=0.

1.

6. The method according to any one of claims 1 to 5, characterized in that: The preset value is 20.

7. A contrast-adjustable image enhancement device with brightness preservation in wavelet domain, characterized in that: include: A decomposition module is used to perform a layer of wavelet decomposition on the input image I using the db series wavelet base db1 wavelet to obtain a low-frequency sub-image ca, a first high-frequency sub-image ch, a second high-frequency sub-image cv and a third high-frequency sub-image cd; A first calculation module is used to round the low-frequency sub-image ca to obtain a rounded low-frequency sub-image ca1, and calculate a maximum value Mca of the rounded low-frequency sub-image ca1; The first determination module is used to determine the frequency of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1 in [0, Mca] to obtain a wavelet histogram h with a length of Mca; The second calculation module is used to obtain the wavelet histogram calculation formula Calculate the probability of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1, where i is the wavelet coefficient, i=0,1,2...Mca, and h is the frequency of each wavelet coefficient; A setting module is used to set the new low-frequency sub-image ca2 to be the same as the low-frequency sub-image ca, set the value to be a zero matrix, set the wavelet histogram array hx1 for storing the segmentation and the remaining wavelet histogram array hx2, and set a variable segmentation parameter px, wherein the variable segmentation parameter px has a value range of [0, 0.1]; Get module, used to set the initial value of loop variable n0 = 1, set the loop calculation to meet n0, where sum() is a summation function, and the segmented wavelet histogram array hx1 is obtained, where hx1=h(0 <h≤n0),n0=n0+1; A third calculation module is used to calculate the remaining wavelet histogram array hx2 according to the segmented wavelet histogram array hx1, wherein hx2=h-hx1; A recording module, used for removing non-zero elements in the segmented wavelet histogram array hx1, recording statistics through the first array h1, and recording corresponding wavelet coefficients through the first wavelet coefficient array id1; removing non-zero elements in the remaining wavelet histogram array hx2, recording statistics through the second array h2, and recording corresponding wavelet coefficients through the second wavelet coefficient array id2; A segmentation module is used to further segment the second array h2, and use the formula jgh2(x)=id2(x+1)-id2(x)x=1...n2-1 to record the difference between two adjacent numbers in the second wavelet coefficient array id2, and put the difference into the jgh2 array, and put the value of jgh2(x)>=preset value into the array jg2, and the number of segmentation blocks is 1+length(jg2); The second determination module is used to set the first public array variable Hx to store the acquired block wavelet histogram, and the second public array variable idx to store the wavelet coefficients of the first public array variable Hx, and obtain the block wavelet histograms Hx in the second array h2, wherein the acquisition method of the block wavelet histograms Hx in the second array h2 is: determine whether the array jg2 is empty, if it is empty, determine that the block wavelet histograms Hx in the second array h2 cannot be divided, then set the first public array variable Hx = h2, the second public array variable idx = id2, and the block wavelet histograms Hx in the second array h2 are obtained. The length of the histogram Hx is length(Hx). If it is not empty, it is determined that the block wavelet histogram Hx in the second array h2 can be divided again, and the number of blocks that can be divided is 1+length(jg2); for any block wavelet histogram in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), the wavelet coefficient of the corresponding block wavelet histogram is idx=id2(T2:jg2(i)), where i=1...n2-1, T2 variable is T2=1 when i=1, and T2=1+jg2(i) when i=2...n2-1; The fourth calculation module calculates the probability of each block wavelet histogram Hx Cumulative probability Where i = 1...length(Hx); The fifth calculation module is used to calculate any block wavelet histogram Hx according to the following formula until all block wavelet histograms are calculated to obtain the wavelet coefficients of the new low-frequency sub-graph ca2: Where i=1...length(Hx), f(i) is the new wavelet coefficient value of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness, and contrast; A mapping module, used for mapping the wavelet coefficients of the first wavelet coefficient array id1 to the new low-frequency sub-image ca2; A reconstruction module, used for performing wavelet reconstruction on the new low-frequency sub-image ca2, the first high-frequency sub-image ch, the second high-frequency sub-image cv and the third high-frequency sub-image cd to obtain a reconstructed image I1; Output module for using formula The reconstructed image I1 is converted to a grayscale display range of [0, 255], and a new enhanced image imageout is output.

8. The device according to claim 7, characterized in that The setting module is further used to set an array idnew having the same length as the second wavelet coefficient array id2 for storing the wavelet coefficients of each block wavelet histogram Hx; The mapping module maps the wavelet coefficients of the first wavelet coefficient array id1 to the new low-frequency sub-image ca2 in the following manner: The mapping module is specifically used to set the loop variable i=1:length(id1), compare the wavelet coefficient id1(i) in the first wavelet coefficient array id1 with each wavelet coefficient in the second wavelet coefficient array id2 one by one, and determine the wavelet coefficient position idp closest to the wavelet coefficient id1(i), wherein [~, idp]=min(abs(id2(:)-id1(i))); After determining the position idp, determine the position in the rounded low-frequency sub-image ca1 that is equal to the wavelet coefficient id1(i) in the new low-frequency sub-image ca2, and assign idnew to idnew(idp) at the same position in the new low-frequency sub-image ca2 until all wavelet coefficients in the first wavelet coefficient array id1 are mapped.

9. A wavelet domain brightness-preserving contrast-adjustable image enhancement device, characterized in that: include: A decomposition module is used to perform a layer of wavelet decomposition on the input image I using the db series wavelet base db1 wavelet to obtain a low-frequency sub-image ca, a first high-frequency sub-image ch, a second high-frequency sub-image cv and a third high-frequency sub-image cd; A first calculation module is used to round the low-frequency sub-image ca to obtain a rounded low-frequency sub-image ca1, and calculate a maximum value Mca of the rounded low-frequency sub-image ca1; The first determination module is used to determine the frequency of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1 in [0, Mca] to obtain a wavelet histogram h with a length of Mca; The second calculation module obtains the wavelet histogram calculation formula Calculate the probability of occurrence of each wavelet coefficient of the rounded low-frequency sub-graph ca1, where i is the wavelet coefficient, i=0,1,2...Mca, and h is the frequency of each wavelet coefficient; A setting module is used to set the new low-frequency sub-image ca2 to be the same as the low-frequency sub-image ca, set the value to be a zero matrix, set the wavelet histogram array hx1 for storing the segmentation and the remaining wavelet histogram array hx2, and set a variable segmentation parameter px, wherein the variable segmentation parameter px has a value range of [0, 0.1]; Get module, used to set the initial value of loop variable n0 = 1, set the loop calculation to meet n0, where sum() is the summation function, and the segmented wavelet histogram array hx1=h(0 <h≤n0),n0=n0+1; A third calculation module is used to calculate the remaining wavelet histogram array hx2 according to the segmented wavelet histogram array hx1, wherein hx2=h-hx1; A recording module, used for removing non-zero elements in the segmented wavelet histogram array hx1, recording statistics through the first array h1, and recording corresponding wavelet coefficients through the first wavelet coefficient array id1; removing non-zero elements in the remaining wavelet histogram array hx2, recording statistics through the second array h2, and recording corresponding wavelet coefficients through the second wavelet coefficient array id2; A segmentation module, used for further segmenting the first array h1 and the second array h2, using the formula jgh1(x)=id1(x+1)-id1(x)x=1...n1-1, recording the difference between two adjacent numbers in the first wavelet coefficient array id1, putting the difference into the jgh1 array, placing the value jgh1(x)>=preset value into the array jg1, and the number of segmentation blocks is 1+length(jg1); using the formula jgh2(x)=id2(x+1)-id2(x)x=1...n2-1, recording the difference between two adjacent numbers in the second wavelet coefficient array id2, putting the difference into the jgh2 array, placing the value jgh2(x)>=preset value into the array jg2, and the number of segmentation blocks is 1+length(jg2); The second determination module is used to set the first public array variable Hx to store the acquired block wavelet histogram, and the second public array variable idx to store the wavelet coefficients of the first public array variable Hx, wherein the acquisition method of each block wavelet histogram Hx in the first array h1 is: determine whether the array jg1 is empty, if it is empty, determine that the block wavelet histogram Hx in the first array h1 cannot be divided, then set the first public array variable Hx = h1, the second public array variable idx = id1, the first array The length of the block wavelet histogram Hx in group h1 is length(Hx); if it is not empty, it is determined that the block wavelet histogram Hx in the first array h1 can be divided again, and the number of divided blocks is 1+length(jg1); for any block wavelet histogram Hx in 1...(1+length(jg1)), Hx=h1(T1:jg1(i)), the wavelet coefficient corresponding to the block wavelet histogram Hx is idx=id1(T1:jg1(i)), where i=1...n1-1, T1 becomes When i=1, T1=1, when i=2...n1-1, T1=1+jg1(i); the method for obtaining each block wavelet histogram Hx in the second array h2 is: judging whether the array jg2 is empty, if it is empty, determining that the block wavelet histogram Hx in the second array h2 cannot be divided, then setting the first public array variable Hx=h2, the second public array variable idx=id2, and the length of the block wavelet histogram Hx in the second array h2 is length(Hx); if it is not empty, determining the first public array variable Hx=h2, the second public array variable idx=id2, and the length of the block wavelet histogram Hx in the second array h2 is length(Hx); The block wavelet histogram Hx in the two arrays h2 can be divided again, and the number of divided blocks is 1+length(jg2); for any block wavelet histogram Hx in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), the wavelet coefficient corresponding to the block wavelet histogram Hx is idx=id2(T2:jg2(i)), where i=1...n2-1, T2 variable is T2=1 when i=1, and T2=1+jg2(i) when i=2...n2-1; The fourth calculation module is used to calculate the probability of each block wavelet histogram Hx Cumulative probability Where i = 1...length(Hx); The fifth calculation module is used to calculate any block wavelet histogram Hx according to the following formula until all block wavelet histograms are calculated: Where i=1...length(Hx), f(i) is the new wavelet coefficient value of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness, and contrast; A reconstruction module, used for performing wavelet reconstruction on the new low-frequency sub-image ca2, the first high-frequency sub-image ch, the second high-frequency sub-image cv and the third high-frequency sub-image cd to obtain a reconstructed image I1; Output module for using formula The reconstructed image I1 is converted to a grayscale display range of [0, 255], and a new enhanced image imageout is output.

10. The device according to claim 7 or 9, characterized in that The value range of P1 is [0,1].

11. The device according to claim 10, characterized in that The P1=0.

1.

12. The device according to any one of claims 7 to 11, characterized in that The preset value is 20.