Underwater image enhancement method based on multi-interval sub-histogram equalization
Through the multi-interval sub-histogram equalization method and sub-interval linear transformation and variational model color correction, combined with multi-scale fusion technology, the low contrast and color cast problems of underwater images are solved, significantly improving image quality and improving dark areas. Detail and contrast.
Patent Information
- Application Number
- CN202111574984.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-21
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-12-21
AI Technical Summary
The attenuation and scattering effects of light in underwater images lead to low contrast, blur, reduced true color of objects, bright artifacts, and non-uniform illumination, making it difficult to recover information and making it difficult for existing technologies to effectively improve image quality.
Using a method based on multi-interval sub-histogram equalization, combined with the color correction method of sub-interval linear transformation and variational model, through multi-scale linear weighted fusion, the RGB channel image is decomposed, preprocessed and threshold selected, and sub-histograms are divided. Perform equalization processing to finally achieve the defogging effect.
It effectively solves the color cast and saturation degradation problems of underwater images, improves dark and bright details, significantly improves image contrast and color uniformity, and enhances the overall quality of underwater images.
Smart Images

Figure CN114240793B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an underwater image enhancement method based on multi-interval sub-histogram equalization. Background Art
[0002] The physical properties of underwater media prevent the degradation of normal images taken in the air. When light propagates in water, the intensity of light decays exponentially according to the wavelength of the color spectrum. The attenuation of light makes underwater objects less visible. In addition, light decays exponentially with distance and depth, which is mainly due to absorption and scattering effects. In summary, the low quality of underwater images is mainly caused by the following factors: low contrast, blur, reduced true color of objects, bright artifacts, floating particles, and non-uniform illumination. These factors lead to unbalanced illumination. Therefore, severe deterioration makes it difficult to restore underwater image information. So finding an effective solution to restore underwater image information is an urgent and challenging task.
[0003] According to research, various underwater imaging technologies and methods have been introduced into the field of underwater image processing. Underwater enhancement technology has been proposed to solve such problems. Underwater enhancement technology is a simple and fast method, but it plays a great role in improving the quality of underwater images. This method can improve image quality by processing the intensity values of the red, green and blue channels through specific rules. Summary of the invention
[0004] According to the technical problems raised above, an underwater image enhancement method based on multi-interval sub-histogram equalization is provided. The present invention mainly realizes effective defogging of dense fog images based on a multi-interval sub-histogram equalization method, a color correction method based on sub-interval linear transformation and variational model, and a multi-scale linear weighted fusion method.
[0005] The technical means adopted by the present invention are as follows:
[0006] The underwater image enhancement method based on multi-interval sub-histogram equalization includes the following steps:
[0007] Step S01: obtaining an original RGB dense fog image; performing color correction on the original RGB dense fog image by using a color correction algorithm based on subinterval linear transformation and variational model to obtain an enhanced image after color correction;
[0008] Step S02: decomposing the original RGB dense fog image into R, G, and B channel images;
[0009] Step S03: preprocessing the pixels of the R, G, and B channel images respectively, stretching the pixels of the R, G, and B channels to the range of [0, 255], and obtaining the stretched single channel images respectively;
[0010] Step S04: Calculate the number of occurrences and frequency of each gray value of the R, G, and B channel images respectively, set an index for selecting a threshold, and obtain the center point of the threshold by the lower lateral quantile method;
[0011] According to the number of sub-histograms required, the threshold selection method is divided into three cases:
[0012] When the number of intervals is 2, the center point of the threshold is the required threshold;
[0013] When the number of intervals is an even number and the number of intervals is not 2, the number of executions of the threshold selection operation is calculated, and the left threshold of the threshold center point is obtained by subtracting the product of k times the number of executions of the threshold selection operation and the variance of the pixel from the center point of the threshold; then the storage position of the center point of the threshold is calculated, and the center point is stored in the threshold array; and then the right threshold of the center point is obtained by adding the product of k times the number of executions of the threshold selection operation and the pixel variance to the center point of the threshold;
[0014] When the number of intervals is an odd number, the number of executions of the threshold selection operation is calculated, and the left threshold of the threshold center point is obtained by subtracting the product of k times the number of executions of the threshold selection operation and the variance of the pixel from the center point of the threshold; then the storage position of the threshold center point is calculated, the threshold center point is not stored in the threshold array, and the right threshold of the threshold center point is directly stored; then the right threshold of the threshold center point is obtained by adding the product of k times the number of executions of the threshold selection operation and the variance of the pixel to the center point of the threshold; the required threshold is calculated through the above operations, and then the entire single-channel histogram is divided into multiple sub-histograms;
[0015] Step S05: performing equalization processing on each of the sub-histograms to obtain a single-channel equalized image;
[0016] Step S06: multi-scale fusion of the R, G, B channel color-corrected images and the R, G, B channel images after multi-interval sub-histogram equalization to obtain a final defogging image.
[0017] Compared with the prior art, the present invention has the following advantages:
[0018] 1. The present invention adopts a color correction method based on subinterval linear transformation and variational model, which achieves good color correction effect, makes the histogram distribution of red, green and blue channels more uniform, and improves the saturation of image color while correcting the color, solves the color cast and saturation degradation problems of underwater images, and improves the dark details of underwater images.
[0019] 2. The present invention adopts a multi-interval sub-histogram equalization method, which effectively solves the low contrast problem of the image, achieves good results in enhancing the bright details of the image, and completes the effective adjustment of the image histogram, so that the image contrast and details are effectively enhanced.
[0020] 3. The present invention fuses the color-corrected image with the contrast-enhanced image through multi-scale linear fusion, thereby achieving effective enhancement of the underwater image.
[0021] Based on the above reasons, the present invention can be widely promoted in the fields of image processing and the like. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0023] Figure 1 It is a schematic diagram of the process of the present invention.
[0024] Figure 2 This is a comparison of the enhancement effects of the present invention and other algorithms on underwater scene images. Figure 2-1 -1. Figure 2-2 -1. Figure 2 -3-1, Figure 2 -4-1 is the result diagram after being processed by the IBLA algorithm; Figure 2-1 -2. Figure 2-2 -2. Figure 2 -3-2, Figure 2 -4-2 is the result diagram after being processed by the ICM algorithm; Figure 2-1 -3. Figure 2-2 -3. Figure 2 -3-3, Figure 2 -4-3 is the result diagram after being processed by RGHS algorithm; Figure 2-1 -4. Figure 2-2 -4. Figure 2 -3-4, Figure 2 -4-4 is the result image after being processed by the UWCNN algorithm; Figure 2-1 -5. Figure 2-2 -5. Figure 2 -3-5, Figure 2 -4-5 is the result diagram after being processed by the algorithm proposed in this article. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] like Figure 1-2 As shown, the present invention provides an underwater image enhancement method based on multi-interval sub-histogram equalization, comprising the following steps:
[0028] Step S01: obtaining an original RGB dense fog image; performing color correction on the original RGB dense fog image by using a color correction algorithm based on subinterval linear transformation and variational model to obtain an enhanced image after color correction;
[0029] Step S02: decomposing the original RGB dense fog image into R, G, and B channel images;
[0030] Step S03: preprocessing the pixels of the R, G, and B channel images respectively, stretching the pixels of the R, G, and B channels to the range of [0, 255], and obtaining the stretched single channel images respectively;
[0031] Step S04: Calculate the number of occurrences and frequency of each gray value of the R, G, and B channel images respectively, set an index for selecting a threshold, and obtain the center point of the threshold by the lower lateral quantile method.
[0032] As a preferred implementation, in this application, the threshold selection method is divided into three cases according to the number of sub-histograms required for division:
[0033] When the number of intervals is 2, the center point of the threshold is the required threshold;
[0034] When the number of intervals is an even number and the number of intervals is not 2, the number of executions of the threshold selection operation (setting the selection of a threshold value greater than the center point of the threshold and a value less than the center point of the threshold as one threshold selection operation) is calculated, and the left threshold of the center point of the threshold is obtained by subtracting the product of the number of executions of the threshold selection operation k times and the variance of the pixel from the center point of the threshold; then the storage position of the center point of the threshold is calculated, and the center point is stored in the threshold array; and then the right threshold of the center point is obtained by adding the product of the number of executions of the threshold selection operation k times and the variance of the pixel to the center point of the threshold;
[0035] When the number of intervals is an odd number, the number of executions of the threshold selection operation is calculated, and the left threshold of the threshold center point is obtained by subtracting the product of k times the number of executions of the threshold selection operation and the variance of the pixel from the center point of the threshold; then the storage position of the threshold center point is calculated, the threshold center point is not stored in the threshold array, and the right threshold of the threshold center point is directly stored; then the right threshold of the threshold center point is obtained by adding the product of k times the number of executions of the threshold selection operation and the variance of the pixel to the center point of the threshold; the required threshold is calculated through the above operations, and then the entire single-channel histogram is divided into multiple sub-histograms;
[0036] Step S05: performing equalization processing on each of the sub-histograms to obtain a single-channel equalized image;
[0037] Step S06: multi-scale fusion of the R, G, B channel color-corrected images and the R, G, B channel images after multi-interval sub-histogram equalization to obtain a final defogging image.
[0038] In this application, the main steps of the color correction method based on subinterval linear transformation and variational model are as follows:
[0039] Step S021: The total pixel value calculation formula of the R, G, and B channels in the color correction method based on sub-interval linear transformation and variational model is as follows:
[0040]
[0041]
[0042]
[0043] Among them, P and Q represent the number of rows and columns of the matrix converted from the input image, respectively. c (t) represents the pixel value of a pixel in the input image, S c Represents the total pixel value of a single-channel image, c∈{R,G,B}, i represents the loop variable used for accumulation calculation, that is, each time pixel addition is performed, i increases by 1, and the accumulation calculation is P×Q times;
[0044] Step S022: The ratio of the maximum single-channel total pixel value to the total pixel value of each channel is calculated as:
[0045]
[0046]
[0047]
[0048] Wherein, Max represents a maximum value function, and the maximum value of the total pixel value of the R, G, and B channels is obtained by the Max function; R R ,R G ,R B Respectively represent the ratio of the total pixel value of the R, G, and B channels to the maximum total pixel value;
[0049] Step S023: In order to divide each channel into three intervals, two cutoff ratios are defined and It is expressed as follows:
[0050]
[0051]
[0052] Among them, c represents any channel of R, G, B, θ1 and θ2 are constants between 0 and 1, R c Indicates the ratio of the pixel sum of any one channel of R, G, B to the maximum pixel sum;
[0053] Cutoff threshold and Corresponding to the cutoff ratio, it is determined according to the lower quantile function:
[0054]
[0055]
[0056] in, and represents the cut-off threshold, F represents the lower quantile function, I c (t) represents the pixel value of a point in one of the three channels: R, G, or B;
[0057] Step S024: In order to effectively suppress shadow and highlight values, the following operations are performed on each color channel:
[0058]
[0059] in, Represents the processed pixel value of a certain point in any channel of R, G, or B;
[0060] Then the following linear transformation operation is performed on the pixels in the middle area:
[0061]
[0062] in, represents the image after color correction;
[0063] Step S025: The calculation formula of the variational model with data term and regularization term is described as the following formula (13):
[0064]
[0065] Among them, μ c represents an enhanced image, c represents a three-dimensional space of three channels of a color image, including R, G and B channels; α represents a positive parameter for controlling the regular term;
[0066] Step S026: The Euler-Lagrange derivative of the variational model with data terms and regularization terms is calculated by deduction to obtain the following formula (14):
[0067]
[0068] in, represents the image after color correction;
[0069] Step S027: Solve the variational model by gradient descent method, and obtain the partial derivative of the Euler-Lagrange derivative of the variational model to obtain formula (15):
[0070]
[0071] Where m represents the timeline of iterative calculation;
[0072] Step S028: discretize and rewrite formula (15) to express it in an explicit way as the following formula (16):
[0073]
[0074] Where k represents the number of iterative calculations;
[0075] Step S029: After performing left-right identity transformation on the above formula (16), the iteration rule shown in the following formula (17) is obtained:
[0076]
[0077] where μ crepresents the enhanced image, c represents the three-dimensional space of the three channels of the color image, including R, G and B channels; when c=1, it represents the R channel, when c=2, it represents the G channel, and when c=3, it represents the B channel; α represents the positive parameter for controlling the regularization term, m represents the timeline of iterative calculation, k represents the number of iterative calculations, represents the color-corrected image,
[0078] In this application, the expression for linear stretching is defined as:
[0079]
[0080] Among them, H c (t) represents the pixel value after correction of any channel of R, G, or B; I c (t) represents the pixel value of any channel of R, G, or B; mi c Indicates the minimum pixel value of any channel of R, G, or B; ma c Indicates the maximum pixel value of any one of the R, G, and B channels.
[0081] As a preferred implementation, the threshold selection and multi-interval division in step S04 further include the following steps:
[0082] Step S041: Calculate the number and frequency of occurrence of each pixel in the original RGB dense fog image:
[0083] N = imhist(H c (t)) (19);
[0084]
[0085] Among them, H c (t) represents the linearly stretched image, imhist represents a function for calculating the number of pixel occurrences, N represents the number of occurrences of each pixel in the input image, P and Q represent the number of rows and columns of the matrix converted from the original RGB dense fog image, and h represents the frequency of occurrence of each pixel in the input image;
[0086] Step S042: Calculate the number of rows of the matrix formed by the occurrence frequency of the pixels, and the calculation formula is as follows:
[0087] [R,C] = size(h) (21);
[0088] Wherein, size(h) represents a function for finding the number of rows and columns of a matrix, R represents the number of rows of the matrix formed by the frequency of occurrence of pixels, and C represents the number of columns of the matrix formed by the frequency of occurrence of pixels;
[0089] Step S043: Accumulate the occurrence frequency of the pixel until the sum of the frequencies exceeds the set lower quantile; the calculation formula is as follows:
[0090] Fs = Fs + h(Cp) (22);
[0091] Cp=Cp+1 (23);
[0092] Among them, Fs represents the sum of pixel occurrence frequencies, h(Cp) represents the pixel occurrence frequency, and Cp represents the threshold center point;
[0093] Step S044: The pixel variance of the original RGB dense fog image is calculated by the pixel sum and the average value of the image pixels, and the calculation formula is as follows:
[0094]
[0095] Where i represents the i-th pixel, S represents the total number of pixels in the input image, represents the average pixel value of the input image, and σ represents the pixel variance of the input image;
[0096] Step S045: According to the number of the intervals:
[0097] (1) When the number of intervals is 2, the center point of the threshold is used as the segmentation threshold, and the calculation formula is as follows:
[0098] d = Cp (25);
[0099] Where d represents the selected threshold;
[0100] (2) When the number of intervals is an even number and not 2, first set the first element of the threshold array to 0, and then calculate the number of threshold selection operations required:
[0101] d(0) = 0 (26);
[0102]
[0103] Among them, ce represents the number of threshold selection operations that need to be performed, fix represents the floor rounding function, and n represents the number of interval divisions;
[0104] Calculate the threshold number to the left of the center point, and the calculation formula (28) is as follows:
[0105]
[0106] Among them, ce represents the number of thresholds to the left of the threshold center point, and fix represents the upward rounding function;
[0107] The threshold to the left of the threshold center point is obtained by subtracting the product of k times the pixel variance and the number of threshold selection operations from the threshold center point; the number of threshold selection operations is cyclically decreased, and formulas (29) and (30) are as follows:
[0108] d(i)=Cp-k×ce×σ i∈{2,ie} (29);
[0109] ce=ce-1 (30);
[0110] Where d(i) represents the i-th threshold stored in the threshold array, and k represents the positive parameter used to calculate the threshold;
[0111] Calculate the position of the threshold center point in the threshold array and store the threshold center point in the threshold array. Formulas (31) and (32) are as follows:
[0112] te = ie + 1 (31);
[0113] d(te) = Cp (32);
[0114] Among them, te represents the position of the threshold center point in the threshold array;
[0115] The threshold to the right of the threshold center point is calculated by adding the product of the threshold center point plus k times the pixel variance and the number of threshold selection operations. Formulas (33) and (34) are as follows:
[0116] je=je+1 je∈{1,ce} (33);
[0117] d(i)=Cp+k×je×σ i∈{te+1,n} (34);
[0118] Among them, je represents the number of threshold selection operations;
[0119] And set the last element of the threshold array to 256:
[0120] d(n+1)=256 (35);
[0121] (3) When the number of interval divisions is an odd number, the first element of the threshold array should also be set to 0 first, and then the number of threshold selection operations is calculated. Formulas (36) and (37) are as follows:
[0122] d(0)=0 (36);
[0123]
[0124] Where co represents the number of threshold selection operations required; the number of thresholds to the left of the center point is calculated, formula (38) is as follows:
[0125]
[0126] Wherein, io represents the number of thresholds to the left of the threshold center point; the threshold to the left of the threshold center point is calculated by subtracting the product of the pixel variance k times the threshold center point and the number of threshold selection operations; the number of threshold selection operations increases with the loop calculation, and formulas (39) and (40) are as follows:
[0127] d(i)=Cp-k×co×σ i∈{2,io} (39);
[0128] co = co-1 (40);
[0129] The storage position of the threshold center point in the threshold array is calculated but not used as the storage position of the threshold center point. It is only used for the subsequent calculation of other thresholds. Formula (41) is as follows:
[0130] to=io+1(41);
[0131] Where to represents the normal storage position of the threshold center point in the threshold array. The threshold to the right of the threshold center point is calculated by adding the product of the pixel variance k times the threshold selection operation number to the threshold center point. Formulas (42) and (43) are as follows:
[0132] jo=jo+1 jo∈{1,co} (42);
[0133] d(i)=Cp+k×jo×σ i∈{to+1,n} (43);
[0134] Among them, jo represents the number of threshold selection operations that need to be performed and sets the last element of the threshold array to 256:
[0135] d(n+1)=256 (44);
[0136] When the number of intervals is an odd number, the threshold is selected successfully and stored in the threshold array.
[0137] Preferably, the step S05 divides the image histogram according to the threshold value selected in step S04, and uses the histogram between two adjacent threshold values as a sub-histogram, thereby obtaining a plurality of sub-interval histograms X n , and use the cumulative density function CDF(a, t) of each sub-histogram to calculate the pixel value after multi-interval sub-histogram equalization transformation. Formula (45) is as follows:
[0138]
[0139] Among them, y(a,t) represents the pixel value in the ath interval after histogram equalization, a represents the ath interval, and t represents the pixel value of the tth grayscale level of the image in the interval.
[0140] Preferably, the multi-scale fusion comprises the following steps:
[0141] Step S061: defining a weight map and obtaining an aggregate weight map; the aggregate weight map is determined by three measurement weights, including: a contrast weight, a saturation weight, and an exposure weight map;
[0142] The contrast weight is a contrast weight map:
[0143] F C =|L*I| (46);
[0144] Among them, F C represents contrast weight map, L represents Laplacian operator, * represents convolution, and I represents input image;
[0145] The saturation weighting makes the image more saturated by adapting the fusion algorithm to the chromaticity information of the input image:
[0146]
[0147] Among them, F S represents the saturated weight map, I c (x) represents the pixel value of the input image;
[0148] The purpose of the exposure weight map is to extract better exposure features of each part of the input image:
[0149]
[0150] Among them, F E (x) represents the exposure weight map, represents the average pixel value, σ represents the pixel variance;
[0151] In multi-scale fusion, the three feature weight maps are multiplied to obtain the aggregate weight map; and the aggregate weight is normalized by dividing the weight of each pixel in each image by the sum of the weights of the same pixel in all images. Formulas (49) and (50) are as follows:
[0152] W t =F C ×F S ×F E (49);
[0153]
[0154] Among them, W trepresents the aggregation weight map, t represents the t-th input image, Normalized aggregation weight map, k represents the number of input images;
[0155] Step S062: Fusing the input image and the aggregation weight map; the input image is decomposed by the Laplacian pyramid, the aggregation weight map is decomposed by the Gaussian pyramid, and then the decomposed input image and the aggregation weight map are fused pixel by pixel:
[0156]
[0157] Among them, R l (x) represents the reconstructed image, represents the weight graph decomposed by Gaussian pyramid, L l {I} represents the input image decomposed by the Laplacian pyramid.
[0158] Example 1
[0159] like Figure 2 As shown, the first foggy image is first processed by a variety of algorithms; Figure 2-1 -1 is the result image after being processed by the IBLA algorithm. It can be seen that the result image is still foggy and the details are slightly blurred, which does not achieve the expected effect. Figure 2-1 -2 is the result image after being processed by the ICM algorithm. It can be seen that the contrast of the result image has been improved, but the details are not clear and the effect needs to be improved. Figure 2-1 -3 is the result image after being processed by the RGHS algorithm. It can be seen that the dehazing effect of the result image is good and the details are partially improved, but the image still has a color cast problem and does not achieve the expected effect. Figure 2-1 -4 is the result image after being processed by the UWCNN algorithm. It can be seen that the result image has a serious color cast problem, detailed information cannot be obtained, and the processing result is very poor. Figure 2-1 -5 is the result after being processed by the algorithm in this paper. It can be found that the color cast problem has been solved, the details have been significantly improved, the contrast has been effectively enhanced, and the image enhancement is relatively successful. Then the second blue image is processed. Figure 2-2 -1 is the result image after being processed by the IBLA algorithm. It can be seen that the problem of the blue bias in the result image has not been solved, the details are slightly blurred, and the effect is not good. Figure 2-2 -2 is the result image after being processed by the ICM algorithm. It can be seen that the result image is still blue as a whole, the details are not clear, and the expected effect is not achieved. Figure 2-2 -3 is the result image after being processed by the RGHS algorithm. It can be seen that the color cast problem of the result image has been partially improved, but the color cast problem still exists. The details and contrast have been partially improved, but the expected effect has not been achieved. Figure 2-2-4 is the result image after being processed by the UWCNN algorithm. It can be seen that the result image has a serious color cast problem, detailed information cannot be obtained, and the processing result is difficult to be satisfactory. Figure 2-2 -5 is the result image after being processed by the algorithm in this paper. It can be found that the color cast problem has been solved, the details have been significantly improved, the contrast has been effectively enhanced, and the image enhancement is relatively successful.
[0160] Then process the third greenish image. Figure 2 -3-1 is the result image after being processed by the IBLA algorithm. It can be seen that the green problem of the result image has not been solved, the details are slightly blurred, and the effect is not good. Figure 2 -3-2 is the result image after being processed by the ICM algorithm. It can be seen that the result image is still green as a whole, the details are not clear, and the expected effect is not achieved. Figure 2 -3-3 is the result image after being processed by the RGHS algorithm. It can be seen that the color cast problem of the result image has been partially improved, but the color cast problem still exists. The details and contrast have been partially improved, but the expected effect has not been achieved. Figure 2 -3-4 is the result image after being processed by the UWCNN algorithm. It can be seen that the result image has a serious color cast problem, detailed information cannot be obtained, and the processing result is difficult to be satisfactory. Figure 2 -3-5 is the result image after being processed by the algorithm in this paper. It can be found that the color cast problem has been solved, the details have been significantly improved, the contrast has been effectively enhanced, and the image enhancement is relatively successful. Then the fourth greenish image is processed. Figure 2 -4-1 is the result image after being processed by the IBLA algorithm. It can be seen that the green problem of the result image is still serious, the details are blurred, and the processing effect is poor. Figure 2 -4-2 is the result image after being processed by the ICM algorithm. It can be seen that the result image is still greenish, the details are not clear, and the expected effect is not achieved. Figure 2 -4-3 is the result image after being processed by the RGHS algorithm. It can be seen that the color cast problem of the result image has been partially improved, but the color cast problem still exists. The details and contrast have been partially improved, but the expected effect has not been achieved. Figure 2 -4-4 is the result image after being processed by the UWCNN algorithm. It can be seen that the result image has a serious color cast problem, detailed information cannot be obtained, and the processing result is difficult to be satisfactory. Figure 2 -4-5 is the result after the algorithm in this paper processes the image. It can be seen that the color cast problem has been solved, the details have been significantly improved, the contrast has been effectively enhanced, and the image enhancement is relatively successful. It can be observed that the first three algorithms are insufficient in color correction, contrast and details, while the algorithm proposed in this paper effectively processes the color cast, low contrast and blurred details of underwater images, corrects the image color, improves the contrast and highlights the details; it reflects that the color of the degraded image has been well corrected.
[0161] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0162] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0163] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. An underwater image enhancement method based on multi-interval sub-histogram equalization, characterized in that: The following steps are involved: Step S01: obtaining an original RGB dense fog image; performing color correction on the original RGB dense fog image by using a color correction algorithm based on subinterval linear transformation and variational model to obtain an enhanced image after color correction; Step S02: decomposing the original RGB dense fog image into R, G, and B channel images; Step S03: preprocessing the pixels of the R, G, and B channel images respectively, stretching the pixels of the R, G, and B channels to the range of [0, 255], and obtaining the stretched single channel images respectively; Step S04: Calculate the number of occurrences and frequency of each gray value of the R, G, and B channel images respectively, set an index for selecting a threshold, and obtain the center point of the threshold by the lower lateral quantile method; According to the number of sub-histograms required, the threshold selection method is divided into three cases: When the number of intervals is 2, the center point of the threshold is the required threshold; When the number of intervals is an even number and the number of intervals is not 2, the number of executions of the threshold selection operation is calculated, and the left threshold of the threshold center point is obtained by subtracting the product of k times the number of executions of the threshold selection operation and the variance of the pixel from the center point of the threshold; then the storage position of the center point of the threshold is calculated, and the center point is stored in the threshold array; and then the right threshold of the center point is obtained by adding the product of k times the number of executions of the threshold selection operation and the pixel variance to the center point of the threshold; When the number of intervals is an odd number, the number of executions of the threshold selection operation is calculated, and the left threshold of the threshold center point is obtained by subtracting the product of k times the number of executions of the threshold selection operation and the variance of the pixel from the center point of the threshold; then the storage position of the threshold center point is calculated, the threshold center point is not stored in the threshold array, and the right threshold of the threshold center point is directly stored; then the right threshold of the threshold center point is obtained by adding the product of k times the number of executions of the threshold selection operation and the variance of the pixel to the center point of the threshold; the required threshold is calculated through the above operations, and then the entire single-channel histogram is divided into multiple sub-histograms; Step S05: performing equalization processing on each of the sub-histograms to obtain a single-channel equalized image; Step S06: multi-scale fusion of the R, G, B channel color-corrected images and the R, G, B channel images after multi-interval sub-histogram equalization to obtain a final defogging image.
2. The underwater image enhancement method based on multi-interval sub-histogram equalization according to claim 1 is characterized in that The color correction method based on subinterval linear transformation and variational model comprises the following steps: Step S021: The total pixel value calculation formula of the R, G, and B channels in the color correction method based on sub-interval linear transformation and variational model is as follows: Among them, P and Q represent the number of rows and columns of the matrix converted from the input image, respectively. c (t) represents the pixel value of a pixel in the input image, S c Represents the total pixel value of a single-channel image, c∈{R,G,B}, i represents the loop variable used for accumulation calculation, that is, each time pixel addition is performed, i increases by 1, and the accumulation calculation is P×Q times; Step S022: The ratio of the maximum single-channel total pixel value to the total pixel value of each channel is calculated as: Wherein, Max represents a maximum value function, and the maximum value of the total pixel value of the R, G, and B channels is obtained by the Max function; R R ,R G ,R B Respectively represent the ratio of the total pixel value of the R, G, and B channels to the maximum total pixel value; Step S023: In order to divide each channel into three intervals, two cutoff ratios are defined and It is expressed as follows: Among them, c represents any channel of R, G, B, θ1 and θ2 are constants between 0 and 1, R c Indicates the ratio of the pixel sum of any one channel of R, G, B to the maximum pixel sum; Cutoff threshold and Corresponding to the cutoff ratio, it is determined according to the lower quantile function: in, and represents the cut-off threshold, F represents the lower quantile function, I c (t) represents the pixel value of a point in one of the three channels: R, G, or B; Step S024: In order to effectively suppress shadow and highlight values, the following operations are performed on each color channel: in, Represents the processed pixel value of a certain point in any channel of R, G, or B; Then the following linear transformation operation is performed on the pixels in the middle area: in, represents the image after color correction; Step S025: The calculation formula of the variational model with data term and regularization term is described as the following formula (13): Among them, μ c represents an enhanced image, c represents a three-dimensional space of three channels of a color image, including R, G and B channels; α represents a positive parameter for controlling the regular term; Step S026: The Euler-Lagrange derivative of the variational model with data terms and regularization terms is calculated by deduction to obtain the following formula (14): in, represents the image after color correction; Step S027: Solve the variational model by gradient descent method, and obtain the partial derivative of the Euler-Lagrange derivative of the variational model to obtain formula (15): Where m represents the timeline of iterative calculation; Step S028: discretize and rewrite formula (15) to express it in an explicit way as the following formula (16): Where k represents the number of iterative calculations; Step S029: After performing left-right identity transformation on the above formula (16), the iteration rule shown in the following formula (17) is obtained: where μ c represents the enhanced image, c represents the three-dimensional space of the three channels of the color image, including R, G and B channels; when c=1, it represents the R channel, when c=2, it represents the G channel, and when c=3, it represents the B channel; α represents the positive parameter for controlling the regularization term, m represents the timeline of iterative calculation, k represents the number of iterative calculations, represents the color-corrected image, 3. The underwater image enhancement method based on multi-interval sub-histogram equalization according to claim 1, characterized in that: The linear stretching expression is defined as: Among them, H c (t) represents the pixel value after correction of any channel of R, G, or B; I c (t) represents the pixel value of any channel of R, G, or B; mi c Indicates the minimum pixel value of any channel of R, G, or B; ma c Indicates the maximum pixel value of any one of the R, G, and B channels.
4. The underwater image enhancement method based on multi-interval sub-histogram equalization according to claim 1, characterized in that: The threshold selection and multi-interval division in step S04 further include the following steps: Step S041: Calculate the number and frequency of occurrence of each pixel in the original RGB dense fog image: N=imhist(H c (t))(19); Among them, H c (t) represents the linearly stretched image, imhist represents a function for calculating the number of pixel occurrences, N represents the number of occurrences of each pixel in the input image, P and Q represent the number of rows and columns of the matrix converted from the original RGB dense fog image, and h represents the frequency of occurrence of each pixel in the input image; Step S042: Calculate the number of rows of the matrix formed by the occurrence frequency of the pixels, and the calculation formula is as follows: [R,C] = size(h)(21); Wherein, size(h) represents a function for finding the number of rows and columns of a matrix, R represents the number of rows of the matrix formed by the frequency of occurrence of pixels, and C represents the number of columns of the matrix formed by the frequency of occurrence of pixels; Step S043: Accumulate the occurrence frequency of the pixel until the sum of the frequencies exceeds the set lower quantile; the calculation formula is as follows: Fs = Fs + h(Cp) (22); Cp=Cp+1(23); Among them, Fs represents the sum of pixel occurrence frequencies, h(Cp) represents the pixel occurrence frequency, and Cp represents the threshold center point; Step S044: The pixel variance of the original RGB dense fog image is calculated by the pixel sum and the average value of the image pixels, and the calculation formula is as follows: Where i represents the i-th pixel, S represents the total number of pixels in the input image, represents the average pixel value of the input image, and σ represents the pixel variance of the input image; Step S045: According to the number of the intervals: (1) When the number of intervals is 2, the center point of the threshold is used as the segmentation threshold, and the calculation formula is as follows: d = Cp(25); Where d represents the selected threshold; (2) When the number of intervals is an even number and not 2, first set the first element of the threshold array to 0, and then calculate the number of threshold selection operations required: d(0)=0(26); Among them, ce represents the number of threshold selection operations that need to be performed, fix represents the floor rounding function, and n represents the number of interval divisions; Calculate the threshold number to the left of the center point, and the calculation formula (28) is as follows: Among them, ce represents the number of thresholds to the left of the threshold center point, and fix represents the upward rounding function; The threshold to the left of the threshold center point is obtained by subtracting the product of k times the pixel variance and the number of threshold selection operations from the threshold center point; the number of threshold selection operations is cyclically decreased, and formulas (29) and (30) are as follows: d(i)=Cp-k×ce×σ i∈{2,ie}(29); ce=ce-1(30); Where d(i) represents the i-th threshold stored in the threshold array, and k represents the positive parameter used to calculate the threshold; Calculate the position of the threshold center point in the threshold array and store the threshold center point in the threshold array. Formulas (31) and (32) are as follows: te = ie + 1 (31); d(te)=Cp(32); Among them, te represents the position of the threshold center point in the threshold array; The threshold to the right of the threshold center point is calculated by adding the product of the threshold center point plus k times the pixel variance and the number of threshold selection operations. Formulas (33) and (34) are as follows: je=je+1 je∈{1,ce}(33); d(i)=Cp+k×je×σ i∈{te+1,n}(34); Among them, je represents the number of threshold selection operations; And set the last element of the threshold array to 256: d(n+1)=256(35); (3) When the number of interval divisions is an odd number, the first element of the threshold array should also be set to 0 first, and then the number of threshold selection operations is calculated. Formulas (36) and (37) are as follows: d(0)=0(36); Where co represents the number of threshold selection operations required; the number of thresholds to the left of the center point is calculated, formula (38) is as follows: Wherein, io represents the number of thresholds to the left of the threshold center point; the threshold to the left of the threshold center point is calculated by subtracting the product of the pixel variance k times the threshold center point and the number of threshold selection operations; the number of threshold selection operations increases with the loop calculation, and formulas (39) and (40) are as follows: d(i)=Cp-k×co×σ i∈{2,io}(39); co = co-1(40); The storage position of the threshold center point in the threshold array is calculated but not used as the storage position of the threshold center point. It is only used for the subsequent calculation of other thresholds. Formula (41) is as follows: to=io+1(41); Where to represents the normal storage position of the threshold center point in the threshold array. The threshold to the right of the threshold center point is calculated by adding the product of the pixel variance k times the threshold selection operation number to the threshold center point. Formulas (42) and (43) are as follows: jo=jo+1 jo∈{1,co}(42); d(i)=Cp+k×jo×σ i∈{to+1,n}(43); Among them, jo represents the number of threshold selection operations that need to be performed and sets the last element of the threshold array to 256: d(n+1)=256(44); When the number of intervals is an odd number, the threshold is selected successfully and stored in the threshold array.
5. The underwater image enhancement method based on multi-interval sub-histogram equalization according to claim 1, characterized in that: The step S05 divides the image histogram according to the threshold value selected in step S04, and uses the histogram between two adjacent threshold values as a sub-histogram, thereby obtaining a plurality of sub-interval histograms X n , and use the cumulative density function CDF(a, t) of each sub-histogram to calculate the pixel value after multi-interval sub-histogram equalization transformation. Formula (45) is as follows: Among them, y(a,t) represents the pixel value in the ath interval after histogram equalization, a represents the ath interval, and t represents the pixel value of the tth grayscale level of the image in the interval.
6. The underwater image enhancement method based on multi-interval sub-histogram equalization according to claim 1, characterized in that: The multi-scale fusion comprises the following steps: Step S061: defining a weight map and obtaining an aggregate weight map; the aggregate weight map is determined by three measurement weights, including: a contrast weight, a saturation weight, and an exposure weight map; The contrast weight is a contrast weight map: F C =|L*I|(46); Among them, F C represents contrast weight map, L represents Laplacian operator, * represents convolution, and I represents input image; The saturation weighting makes the image more saturated by adapting the fusion algorithm to the chromaticity information of the input image: Among them, F S represents the saturated weight map, I c (x) represents the pixel value of the input image; The purpose of the exposure weight map is to extract better exposure features of each part of the input image: Among them, F E (x) represents the exposure weight map, represents the average pixel value, σ represents the pixel variance; In multi-scale fusion, the three feature weight maps are multiplied to obtain the aggregate weight map; and the aggregate weight is normalized by dividing the weight of each pixel in each image by the sum of the weights of the same pixel in all images. Formulas (49) and (50) are as follows: W t =F C ×F S ×F E (49); Among them, W t represents the aggregation weight map, t represents the t-th input image, Normalized aggregation weight map, k represents the number of input images; Step S062: Fusing the input image and the aggregation weight map; the input image is decomposed by the Laplacian pyramid, the aggregation weight map is decomposed by the Gaussian pyramid, and then the decomposed input image and the aggregation weight map are fused pixel by pixel: Among them, R l (x) represents the reconstructed image, represents the weight graph decomposed by Gaussian pyramid, L l {I} represents the input image decomposed by the Laplacian pyramid.
Citation Information
Patent Citations
Real-time water-surface fog scene image enhancement method based on FPGA
CN107895357A
MSRCR image defogging method based on multi-channel convolution
CN109816605A
