A method and device for enhancing image details by preserving brightness in wavelet domain
Through the image detail enhancement method of wavelet domain brightness maintenance, wavelet decomposition and histogram segmentation technology are used to solve the balance problem between image brightness maintenance and contrast enhancement, and high-quality image enhancement is achieved, including the improvement of brightness maintenance and detail presentation capabilities.
Patent Information
- Application Number
- CN202010325937.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-23
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2040-04-23
AI Technical Summary
The prior art is difficult to find a balance between image brightness retention and contrast enhancement, resulting in large brightness errors in the output image or insufficient detail presentation capabilities.
The image detail enhancement method of maintaining the brightness of the wavelet domain is adopted. Through wavelet decomposition and histogram segmentation technology, the histogram of the low-frequency sub-graph is automatically divided into several block histograms, and the wavelet coefficient enhancement processing is performed in each block, and the enhanced image is finally output through the wavelet inverse transformation.
On the basis of maintaining the consistency of the brightness of the input image, improve the contrast and detail presentation capabilities of the output image, reduce brightness errors, and enhance noise immunity.
Smart Images

Figure CN113112437B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image contrast enhancement, and in particular to a method and device for enhancing image details with brightness preservation in a wavelet domain. Background Art
[0002] Global histogram equalization is one of the commonly used methods for digital image enhancement. Although its algorithm is simple to implement, it is not suitable for image processing fields that require high image brightness. This is because in the process of histogram equalization enhancement, the change in the average brightness of the image before and after image enhancement is too high. In addition, the grayscale is merged, which often leads to the deterioration of the quality of the enhanced image and a large amount of information loss. In some image processing fields (such as consumer electronics and infrared image processing systems), on the one hand, the brightness of the processed image must be kept good with that of the input image, and on the other hand, the processed image must have a good contrast and clear details. In fact, brightness maintenance and contrast enhancement are mutually constrained issues. In other words, if the processed image is required to be consistent with the input image in brightness, the contrast of the enhanced image will be small, the details will be difficult to highlight, and the image visual perception will be unclear. In order to accurately maintain the brightness of the input image, brightness maintenance often makes the output image unable to achieve good contrast enhancement or local over-enhancement, and vice versa. Summary of the invention
[0003] The present invention aims to provide a method and device for image detail enhancement in a wavelet domain with brightness preservation, 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] The present invention provides a method for enhancing image details by preserving brightness in wavelet domain, 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 each wavelet coefficient in the low-frequency subgraph ca1 after rounding. Here, i is the wavelet coefficient, i = 0, 1, 2 ··· Mca, h is the frequency of each wavelet coefficient. Set the new low-frequency subgraph ca2 to be the same as the low-frequency subgraph ca, and the value is set to a zero matrix;
[0010] Use the first array h1 to record the wavelet histogram that meets the first rule, use the first wavelet coefficient array id1 to record the corresponding wavelet coefficients, use the second array h2 to record the wavelet histogram that meets the second rule, and use the second wavelet coefficient array id2 to record the corresponding wavelet coefficients. Here, the first rule includes 0 < p(i) <= 1 / Mca, and the second rule includes: p(i) > 1 / Mca;
[0011] Redivide the first array h1 and the second array h2. Use the jgh1 array to record the difference between two adjacent numbers in the first wavelet coefficient array id1, use the jg1 array to record the values where jgh1(x) >= a preset value, and the number of divided blocks is 1 + length(jg1); use the jgh2 array to record the difference between two adjacent numbers in the second wavelet coefficient array id2, use the jg2 array to record the values where jgh2(x) >= a preset value, and the number of divided blocks is 1 + length(jg2);
[0012] Set the first common array Hx to store the block wavelet histogram, and the second common array idx to store the wavelet coefficients of the first common array Hx. The way to obtain each block wavelet histogram Hx in the first array h1 is as follows: Judge whether the jg1 array is empty. If it is empty, it is determined that the first array h1 cannot be divided, then let the first common array Hx = h1, the second common array idx = id1, and the length of the block wavelet histogram stored in the first common array Hx is length(Hx); if it is not empty, it is determined that the first array h1 can be divided again, and the number of divided blocks is 1 + length(jg1). For any block wavelet histogram in 1...(1 + length(jg1)) is Hx = h1(T1:jg1(i)), and the wavelet coefficients corresponding to the block wavelet histogram are idx = id1(T1:jg1(i)), where i = 1...n1 - 1. When i = 1, T1 = 1, and when i = 2...n1 - 1, T1 = 1 + jg1(i); The way to obtain each block wavelet histogram Hx in the second array h2 is as follows: Judge whether the jg2 array is empty. If it is empty, it is determined that the second array h2 cannot be divided, then let the first common array Hx = h2, the second common array idx = id2, and the length of the block wavelet histogram stored in the first common array Hx is length(Hx); if it is not empty, it is determined that the second array h2 can be divided again, and the number of divided blocks is 1 + length(jg2). For 1...
[0013] Any block wavelet histogram in (1+length(jg2)) is Hx=h2(T2:jg2(i)), and the wavelet coefficient of the corresponding block wavelet histogram is idx=id2(T2:jg2(i)), where i=1...n2-1, when i=1, T2=1, when i=2...n2-1, T2=1+jg2(i);
[0014] Calculate the probability of each block wavelet histogram in the first common array Hx Cumulative probability Where i = 1...length(Hx);
[0015] The wavelet histogram of each block in the first public array Hx is calculated according to the following formula:
[0016]
[0017] Where i = 1...length(Hx), f(i) is the new wavelet coefficient of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness, and contrast;
[0018] 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;
[0019] Using the formula Convert the reconstructed image I1 to the grayscale display range of [0,255] and output a new enhanced image imageout.
[0020] Among them, P1 value range is [0,1].
[0021] Among them, P1=0.1.
[0022] Among them, the default value is 20.
[0023] Another aspect of the present invention provides an image detail enhancement device with brightness preservation in wavelet domain, comprising:
[0024] 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;
[0025] 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;
[0026] 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;
[0027] A second calculation module for obtaining a wavelet histogram calculation formula Calculate the probability of occurrence of each wavelet coefficient of the low-frequency sub-image ca1 after rounding, where i is the wavelet coefficient, i = 0, 1, 2 ··· Mca, 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, and the value is set to a zero matrix;
[0028] A recording module for recording the wavelet histogram that conforms to the first rule using the first array h1, recording the corresponding wavelet coefficients using the first wavelet coefficient array id1, recording the wavelet histogram that conforms to the second rule using the second array h2, and recording the corresponding wavelet coefficients using the second wavelet coefficient array id2, where the first rule includes 0 < p(i) <= 1 / Mca, and the second rule includes: p(i) > 1 / Mca;
[0029] A splitting module for re-splitting the first array h1 and the second array h2, using the jgh1 array to record the difference between two adjacent numbers in the first wavelet coefficient array id1, using the jg1 array to record the values where jgh1(x) >= a preset value, and the number of splitting blocks is 1 + length(jg1); using the jgh2 array to record the difference between two adjacent numbers in the second wavelet coefficient array id2, using the jg2 array to record the values where jgh2(x) >= a preset value, and the number of splitting blocks is 1 + length(jg2);
[0030] The second determination module is used to set the first public array Hx to store the block wavelet histogram, and the second public array idx to store the wavelet coefficients of the first public array Hx, wherein the method for obtaining each block wavelet histogram Hx in the first array h1 is: determine whether the jg1 array is empty, if it is empty, determine that the first array h1 cannot be divided, then set the first public array Hx=h1, the second public array idx=id1, and the length of the block wavelet histogram stored in the first public array Hx is length(Hx); if it is not empty, determine that the first array h1 can be divided again, the number of divided blocks 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)), wherein i=1...n1-1, when i=1, T 1=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 jg2 array is empty, if it is empty, determine that the second array h2 cannot be divided, then set the first public array Hx=h2, the second public array idx=id2, and the length of the block wavelet histogram stored in the first public array Hx is length(Hx); if it is not empty, determine that the second array h2 can be Divide again, the number of divided blocks is 1+length(jg2), and the wavelet histogram of any block in 1...(1+length(jg2)) is Hx=h2(T2:jg2(i)), and the wavelet coefficient of the corresponding block wavelet histogram is idx=id2(T2:jg2(i)), where i=1...n2-1, when i=1, T2=1, when i=2...n2-1, T2=1+jg2(i);
[0031] The third calculation module is used to calculate the probability of each block wavelet histogram in the first public array Hx Cumulative probability Where i = 1...length(Hx);
[0032] The fourth calculation module is used to calculate the wavelet histogram of each block in the first public array Hx according to the following formula:
[0033]
[0034] Where i = 1...length(Hx), f(i) is the new wavelet coefficient of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness, and contrast;
[0035] 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;
[0036] 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.
[0037] Among them, P1 value range is [0,1].
[0038] Among them, P1=0.1.
[0039] Among them, the default value is 20.
[0040] It can be seen that the image detail 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 histogram of the low-frequency sub-image of the input image into several block histograms according to the characteristics of the input image, 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. It can improve the output image detail presentation capability and noise resistance capability under the condition that the brightness of the input and output images are basically consistent for consumer electronic products and infrared image processing images. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. The drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 A flow chart of a method for enhancing image details by preserving brightness in a wavelet domain provided by an embodiment of the present invention;
[0043] Figure 2 A schematic diagram of the structure of a device for enhancing image details with brightness preservation in the wavelet domain provided by an embodiment of the present invention;
[0044] Figure 3 A low-contrast image provided by an embodiment of the present invention - Einstein schematic diagram;
[0045] Figure 4 A low-brightness image-landscape schematic diagram provided by an embodiment of the present invention;
[0046] Figure 5 A schematic diagram of an infrared image provided by an embodiment of the present invention;
[0047] Figure 6A schematic diagram of a plum blossom, a high-brightness image, provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0048] 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.
[0049] The image detail enhancement method and device for maintaining brightness in the wavelet domain provided by the present invention utilize the wavelet histogram automatic segmentation technology in the wavelet domain to segment the wavelet low-frequency sub-graph into a plurality of wavelet histograms for processing. The algorithm balances the contradiction between brightness maintenance and contrast enhancement to the greatest extent, minimizes the brightness error between the output image and the input image, and can achieve image contrast enhancement and clearly present image details. The method and device can be applied to consumer electronic product images and infrared image processing systems with high brightness maintenance requirements.
[0050] Figure 1 FIG. 1 is a flowchart of a method for enhancing image details by preserving brightness in a wavelet domain according to an embodiment of the present invention. Figure 1 The image detail enhancement method for maintaining brightness in the wavelet domain provided by the embodiment of the present invention comprises:
[0051] 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.
[0052] 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.
[0053] 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.
[0054] 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.
[0055] 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.
[0056] 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.
[0057] S4. Obtain the calculation formula of the wavelet histogram Calculate the probability of each wavelet coefficient in the low-frequency sub-image ca1 after rounding. Here, i is the wavelet coefficient, i = 0, 1, 2 ··· Mca, 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, and the value is set to a zero matrix.
[0058] Specifically, use the formula to calculate the probability of each wavelet coefficient in ca1, where i = 0 · 1 · 2 ··· Mca. Set the new low-frequency sub-image ca2 to have the same size as ca, and the value is set to a zero matrix.
[0059] S5. Use the first array h1 to record the wavelet histogram that meets the first rule, use the first wavelet coefficient array id1 to record the corresponding wavelet coefficients, use the second array h2 to record the wavelet histogram that meets the second rule, and use the second wavelet coefficient array id2 to record the corresponding wavelet coefficients. Here, the first rule includes 0 < p(i) <= 1 / Mca, and the second rule includes: p(i) > 1 / Mca;.
[0060] Specifically, divide the wavelet histogram with 0 < p(i) <= 1 / Mca into one category and record it with the h1 array, that is, h1(1)...h1(n1) records the statistical count, and id1(1)...id1(n1), that is, the id1 array, records the corresponding wavelet coefficients; similarly, divide the wavelet histogram with p(i) > 1 / Mca into another category and record it with the h2 array, that is, h2(1)...h2(n2) records the statistical count, and id2(1)...id2(n2), that is, the id2 array, records the corresponding wavelet coefficients.
[0061] S6. Re-divide the first array h1 and the second array h2. Use the jgh1 array to record the difference between two adjacent numbers in the first wavelet coefficient array id1, use the jg1 array to record the values where jgh1(x) >= the preset value, and the number of divided blocks is 1 + length(jg1); use the jgh2 array to record the difference between two adjacent numbers in the second wavelet coefficient array id2, use the jg2 array to record the values where jgh2(x) >= the preset value, and the number of divided blocks is 1 + length(jg2).
[0062] As an optional implementation of an embodiment of the present invention, the preset value is 20. Specifically, this step performs a re-segmentation of the wavelet histograms h1 and h2. 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 segmentation 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 segmentation blocks is 1+length(jg2).
[0063] S7, set the first public array Hx to store the block wavelet histogram, and the second public array idx to store the wavelet coefficients of the first public array Hx, wherein the method for obtaining each block wavelet histogram Hx in the first array h1 is: determine whether the jg1 array is empty, if it is empty, determine that the first array h1 cannot be divided, then set the first public array Hx=h1, the second public array idx=id1, and the length of the block wavelet histogram stored in the first public array Hx is length(Hx); if it is not empty, determine that the first array h1 can be divided again, and the number of divided blocks 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)), wherein i=1...n1-1, 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 jg2 array is empty, if it is empty, determine that the second array h2 cannot be divided, then set the first public array Hx=h2, the second public array idx=id2, and the length of the block wavelet histogram stored in the first public array Hx is length(Hx); if it is not empty, determine that the second array h2 can be split The number of divided blocks is 1+length(jg2). For any block wavelet histogram in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)) is the wavelet coefficient of the corresponding block wavelet histogram is idx=id2(T2:jg2(i)), where i=1...n2-1, when i=1, T2=1, when i=2...n2-1, T2=1+jg2(i).
[0064] Specifically, a public array Hx is set to store the block wavelet histogram, and a public array idx is set to store the wavelet coefficients of Hx. The method for obtaining each block wavelet histogram Hx in the wavelet histogram h1 is as follows: first, determine whether the array jg1 is empty (isempty(jg1) == 1). If it is empty, indicating that the wavelet histogram h1 cannot be divided, then Hx=h1, idx=id1 is assigned, and the length of block Hx is length(Hx); secondly, if the array jg1 is not empty, indicating that the wavelet histogram h1 can be divided again, 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).
[0065] 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 indicates that the wavelet histogram h2 cannot be divided, then Hx = h2, idx = id2 is assigned, and the length of the block Hx is length(Hx); secondly, if the array jg2 is not empty, it indicates 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).
[0066] S8, calculate the probability of each block wavelet histogram in the first common array Hx Cumulative probability Where i = 1...length(Hx);
[0067] S9, calculating the wavelet histogram of each block in the first public array Hx according to the following formula:
[0068]
[0069] Where i=1...length(Hx), f(i) is the new wavelet coefficient of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness and contrast.
[0070] 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.
[0071] S10, 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.
[0072] Specifically, the new low-frequency sub-image ca2 is reconstructed with ch, cv, and cd by wavelet, and the reconstructed image is I1.
[0073] S11, using formula Convert the reconstructed image I1 to the grayscale display range of [0,255] and output a new enhanced image imageout.
[0074] It can be seen that the image detail enhancement method for maintaining brightness 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 histogram of the low-frequency sub-image of the input image into a plurality of block histograms according to the characteristics of the input image, 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. It can improve the output image detail presentation capability and noise resistance capability under the condition that the brightness of the input and output images are basically consistent for consumer electronic products and infrared image processing images.
[0075] Figure 2 The structure diagram of the image detail enhancement device with brightness preservation in the wavelet domain provided by the embodiment of the present invention is shown. The image detail enhancement device with brightness preservation 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 detail enhancement device with brightness preservation in the wavelet domain. For other matters not covered, please refer to the relevant description in the above wavelet domain brightness preservation image detail enhancement method. Figure 2 The image detail enhancement device for maintaining brightness in the wavelet domain provided by the embodiment of the present invention comprises:
[0076] 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;
[0077] 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;
[0078] The first determination module is used to determine the frequency of occurrence of each wavelet coefficient of the rounded low-frequency subgraph ca1 in [0, Mca] to obtain a wavelet histogram h with a length of Mca;
[0079] 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 subgraph ca1, where i is the wavelet coefficient, i = 0, 1, 2 ··· Mca, h is the frequency of each wavelet coefficient, set the new low-frequency subgraph ca2 to be the same as the low-frequency subgraph ca, and the value is set to a zero matrix;
[0080] The recording module is used to record the wavelet histogram that conforms to the first rule using the first array h1, record the corresponding wavelet coefficients using the first wavelet coefficient array id1, record the wavelet histogram that conforms to the second rule using the second array h2, and record the corresponding wavelet coefficients using the second wavelet coefficient array id2, where the first rule includes 0 < p(i) <= 1 / Mca, and the second rule includes: p(i) > 1 / Mca;
[0081] The splitting module is used to further split the first array h1 and the second array h2, use the jgh1 array to record the difference between two adjacent numbers in the first wavelet coefficient array id1, use the jg1 array to record the values where jgh1(x) >= the preset value, and the number of splitting blocks is 1 + length(jg1); use the jgh2 array to record the difference between two adjacent numbers in the second wavelet coefficient array id2, use the jg2 array to record the values where jgh2(x) >= the preset value, and the number of splitting blocks is 1 + length(jg2);
[0082] The second determination module is used to set the first public array Hx to store the block wavelet histogram, and the second public array idx to store the wavelet coefficients of the first public array Hx, wherein the method for obtaining each block wavelet histogram Hx in the first array h1 is: determine whether the jg1 array is empty, if it is empty, determine that the first array h1 cannot be divided, then set the first public array Hx=h1, the second public array idx=id1, and the length of the block wavelet histogram stored in the first public array Hx is length(Hx); if it is not empty, determine that the first array h1 can be divided again, the number of divided blocks 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)), wherein i=1...n1-1, when i=1, T 1=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 jg2 array is empty, if it is empty, determine that the second array h2 cannot be divided, then set the first public array Hx=h2, the second public array idx=id2, and the length of the block wavelet histogram stored in the first public array Hx is length(Hx); if it is not empty, determine that the second array h2 can be Divide again, the number of divided blocks is 1+length(jg2), and the wavelet histogram of any block in 1...(1+length(jg2)) is Hx=h2(T2:jg2(i)), and the wavelet coefficient of the corresponding block wavelet histogram is idx=id2(T2:jg2(i)), where i=1...n2-1, when i=1, T2=1, when i=2...n2-1, T2=1+jg2(i);
[0083] The third calculation module is used to calculate the probability of each block wavelet histogram in the first public array Hx Cumulative probability Where i = 1...length(Hx);
[0084] The fourth calculation module is used to calculate the wavelet histogram of each block in the first public array Hx according to the following formula:
[0085]
[0086] Where i = 1...length(Hx), f(i) is the new wavelet coefficient of the new low-frequency sub-image ca2, and P1 is the adjustment parameter of image details, brightness, and contrast;
[0087] 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;
[0088] 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.
[0089] As an optional implementation of the embodiment of the present invention, P1 takes a value range of [0, 1].
[0090] As an optional implementation of the embodiment of the present invention, P1=0.1.
[0091] As an optional implementation manner of the embodiment of the present invention, the preset value is 20.
[0092] It can be seen that the image detail enhancement device for maintaining brightness 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, can automatically divide the histogram of the low-frequency sub-image of the input image into a plurality of block histograms according to the characteristics of the input image, 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. This can improve the output image detail presentation capability and noise resistance capability under the condition that the brightness of the input and output images are basically consistent for consumer electronic products and infrared image processing images.
[0093] In order to better illustrate the positive effects of the present invention, the GHE, BBHE, BHEPL, BHEMHE, MMBEBHE and other algorithms are compared with the present invention in terms of running time, average brightness error (ABME), peak signal-to-noise ratio (PSNR) and other indicators. The data is the average value of processing 20 images. The data table is shown in Table 1.
[0094] GHE BBHE BHEMHE BHEPL MMBEBHE The present invention Time(s) 0.32 0.3934 0.3948 0.4026 1.2258 0.58069 ABME 43.29 13.39 15.79 6.11 4.7129 3.4047 E(bit) 6.9949 7.0126 6.9980 7.13 7.0056 7.2325 PSNR(dB) 14.57 20.94 19.54 25.46 25.4284 27.81
[0095] Table 1
[0096] From Table 1, it can be seen that the running speed of the present invention is almost the same as that of the classic global histogram (GHE) algorithm, and the average brightness error (ABME) is the smallest, indicating that the image enhanced by the present invention is basically consistent with the input image in brightness; at the same time, the peak signal-to-noise ratio (PSNR) and information entropy values of the image processed by the present invention are the highest, indicating that the present invention is optimal in noise suppression and information detail compared with other methods.
[0097] At the same time, through Figure 3 , 4 , 5, and 6 show the images before and after being processed by the image detail enhancement method with brightness preservation in the wavelet domain provided by an embodiment of the present invention.
[0098] 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 method for enhancing image details by preserving brightness in wavelet domain, characterized in that: Including: Performing one-layer wavelet decomposition on the input image I using the db1 wavelet of the db series wavelet basis 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 the maximum value Mca of the rounded low-frequency sub-image ca1; Determining the frequency of occurrence of each wavelet coefficient of the rounded low-frequency sub-image ca1 in the range [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-image ca1, where i is the wavelet coefficient, i=0, 1, 2...Mca, 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, and set the value to a zero matrix; Using a first array h1 to record the wavelet histogram that conforms to the first rule, using a first wavelet coefficient array id1 to record the corresponding wavelet coefficients, using a second array h2 to record the wavelet histogram that conforms to the second rule, and using a second wavelet coefficient array id2 to record the corresponding wavelet coefficients, where the first rule includes 0 < p(i) <= 1 / Mca, and the second rule includes: p(i) > 1 / Mca; Re-segmenting the first array h1 and the second array h2, using a jgh1 array to record the difference between two adjacent numbers in the first wavelet coefficient array id1, using a jg1 array to record the values where jgh1(x) >= a preset value, and the number of segmentation blocks is 1 + length(jg1); using a jgh2 array to record the difference between two adjacent numbers in the second wavelet coefficient array id2, using a jg2 array to record the values where jgh2(x) >= a preset value, and the number of segmentation blocks is 1 + length(jg2); Set the first public array Hx to store the block wavelet histogram, and the second public array idx to store the wavelet coefficients of the first public array Hx, wherein the method for obtaining each block wavelet histogram Hx in the first array h1 is: determine whether the jg1 array is empty, if it is empty, determine that the first array h1 cannot be divided, then set the first public array Hx=h1, the second public array idx=id1, and the length of the block wavelet histogram stored in the first public array Hx is length(Hx); if it is not empty, determine that the first array h1 can be divided again, and the number of divided blocks 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)), wherein i=1...n1-1, 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 jg2 array is empty, if it is empty, determine that the second array h2 cannot be divided, then set the first public array Hx=h2, the second public array idx=id2, and the length of the block wavelet histogram stored in the first public array Hx is length(Hx); if it is not empty, determine that the second array h2 cannot be divided. Group h2 can be divided again, and the number of divided blocks is 1+length(jg2). For any block wavelet histogram in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), and the wavelet coefficient of the corresponding block wavelet histogram is idx=id2(T2:jg2(i)), where i=1...n2-1, when i=1, T2=1, when i=2...n2-1, T2=1+jg2(i); Calculate the probability of each block wavelet histogram in the first public array Hx Cumulative probability Where i = 1...length(Hx); The wavelet histogram of each block in the first public array Hx is calculated according to the following formula: Where i=1...length(Hx), f(i) is the new wavelet coefficient 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.
2. The method according to claim 1, characterized in that The value range of P1 is [0,1].
3. The method according to claim 2, characterized in that The P1=0.
1.
4. The method according to any one of claims 1 to 3, characterized in that: The preset value is 20.
5. A device for enhancing image details by preserving brightness 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 subgraph ca1 in [0, Mca], obtain the wavelet histogram h, and the length 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-image ca1, where i is the wavelet coefficient, i=0, 1, 2...Mca, 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, and set the value to a zero matrix; The recording module is used to record the wavelet histogram that conforms to the first rule by using the first array h1, record the corresponding wavelet coefficients by using the first wavelet coefficient array id1, record the wavelet histogram that conforms to the second rule by using the second array h2, and record the corresponding wavelet coefficients by using the second wavelet coefficient array id2, where the first rule includes 0 < p(i) <= 1 / Mca, and the second rule includes: p(i) > 1 / Mca; The splitting module is used to re-split the first array h1 and the second array h2, use the jgh1 array to record the difference between two adjacent numbers in the first wavelet coefficient array id1, use the jg1 array to record the values where jgh1(x) >= the preset value, and the number of splitting blocks is 1 + length(jg1); use the jgh2 array to record the difference between two adjacent numbers in the second wavelet coefficient array id2, use the jg2 array to record the values where jgh2(x) >= the preset value, and the number of splitting blocks is 1 + length(jg2); The second determination module is used to set the first public array Hx to store the block wavelet histogram, and the second public array idx to store the wavelet coefficients of the first public array Hx, wherein the acquisition method of each block wavelet histogram Hx in the first array h1 is: determine whether the jg1 array is empty, if it is empty, determine that the first array h1 cannot be divided, then set the first public array Hx=h1, the second public array idx=id1, and the length of the block wavelet histogram stored in the first public array Hx is length(Hx); if it is not empty, determine that the first array h1 can be divided again, the number of divided blocks 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)), wherein i=1...n1-1, 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 jg2 array is empty, if it is empty, determining that the second array h2 cannot be divided, then setting the first public array Hx=h2, the second public array idx=id2, the length of the block wavelet histogram stored in the first public array Hx is length(Hx); if it is not empty, determining the The second array h2 can be divided again, and the number of divided blocks is 1+length(jg2). For any block wavelet histogram in 1...(1+length(jg2)), Hx=h2(T2:jg2(i)), and the wavelet coefficient of the corresponding block wavelet histogram is idx=id2(T2:jg2(i)), where i=1...n2-1, when i=1, T2=1, when i=2...n2-1, T2=1+jg2(i); The third calculation module is used to calculate the probability of each block wavelet histogram in the first public array Hx Cumulative probability Where i = 1...length(Hx); The fourth calculation module is used to calculate the wavelet histogram of each block in the first public array Hx according to the following formula: Where i=1...length(Hx), f(i) is the new wavelet coefficient 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.
6. The device according to claim 5, characterized in that The value range of P1 is [0,1].
7. The device according to claim 6, characterized in that The P1=0.
1.
8. The device according to any one of claims 5 to 7, characterized in that The preset value is 20.
Citation Information
Patent Citations
Method for compensating uneven brightness of bottom view image under nighttime infrared
CN103400343A
Low-frequency wavelet coefficient interpolation image equalization enhancement method
CN108269246A