Underwater image vision enhancement method and device based on gray space prior
Through a method based on grayscale space priors, pixel update and defogging are performed on underwater images, which solves the problems of color shift and blur in the existing technology of underwater images, and achieves a better visual enhancement effect.
Patent Information
- Application Number
- CN202411683410.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-02-18
AI Technical Summary
Existing underwater image enhancement technologies are prone to color shift problems and visual blur, resulting in poor visual enhancement effects of underwater images.
Using a method based on grayscale space prior, pixel updates are performed on the enhanced underwater image, and the image transmittance and ambient light value of the image are calculated. The enhanced image is obtained through the defogging process of the grayscale clear image and the grayscale mist image. .
It effectively solves the color shift problem of underwater images, improves the visual clarity and contrast of the image, and enhances the detailed performance and depth perception effect of the image.
Smart Images

Figure CN119477753A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a method and device for underwater image visual enhancement based on grayscale space prior. Background Art
[0002] With the rapid development of information technology, the application demand of computer vision in many fields is growing, and underwater image processing has gradually become an important research direction in this field. The underwater environment is more complex than the terrestrial environment, with characteristics such as insufficient light, strong scattering, and many suspended particles. These factors often cause underwater images to appear blurred, low contrast, and severe color distortion. Therefore, the research on underwater image visual enhancement is of great significance. It not only provides technical support for applications such as underwater robots, ocean exploration, and resource exploration, but also provides effective solutions for emerging needs such as ecological environment protection and underwater security monitoring.
[0003] The quality of underwater images is affected by multiple factors related to water characteristics. First, the scattering and absorption of light in water will significantly reduce the image quality. Light of different wavelengths attenuates differently in water. The red light component is absorbed in shallower waters, while blue-green light can propagate deeper. This causes underwater images to often show a blue or green color shift. Secondly, the presence of suspended particles will further increase the light scattering effect, making underwater images appear foggy and blurred. At the same time, the uneven fluidity of the water body will also cause distortion and blurring of image details, posing great challenges to visual recognition. These problems not only affect human eye observation, but also place higher requirements on the performance of automated visual algorithms, such as the accuracy and reliability of target detection, image segmentation, and target recognition in underwater environments.
[0004] At present, the existing underwater image enhancement technology is prone to problems such as color shift and visual blur, and the visual enhancement effect on underwater images is poor. Summary of the invention
[0005] In order to overcome the above-mentioned defects of the prior art, the present invention provides a method and device for underwater image visual enhancement based on grayscale space prior, which can improve the visual enhancement effect of underwater images.
[0006] An embodiment of the present invention provides a method for underwater image visual enhancement based on grayscale space prior, comprising the following steps:
[0007] Perform pixel update on the underwater image to be enhanced to obtain a balanced image;
[0008] Calculating the image transmittance and the ambient light value of the equalized image, and restoring the grayscale clear image according to the image transmittance and the ambient light value of the equalized image;
[0009] A grayscale foggy image is obtained according to the mapping of the underwater image to be enhanced, and defogging is performed on the underwater image to be enhanced according to the grayscale foggy image and the grayscale clear image to obtain an enhanced image.
[0010] Furthermore, the pixel updating of the underwater image to be enhanced to obtain a balanced image specifically includes:
[0011] Performing normalization processing on the underwater image to be enhanced to obtain a normalized image;
[0012] Calculating a channel extension coefficient according to the pixel value of the normalized image;
[0013] According to the channel stretch coefficient, pixels of the normalized image are updated to obtain the balanced image.
[0014] Furthermore, the channel extension coefficient is calculated according to the pixel value of the normalized image, specifically including:
[0015] Respectively calculating the mean values of the first a% pixel values and the last a% pixel values corresponding to the three channels R, G, and B of the normalized image; wherein a is a first preset ratio value;
[0016] The channel extension coefficient is calculated according to the mean of the first a% pixel values and the mean of the last a% pixel values under the three channels of R, G, and B of the normalized image; wherein the calculation formula of the channel extension coefficient is specifically as follows:
[0017]
[0018] Where λ is the channel extension coefficient, I′ a%max is the mean value of the first a% pixels, I′ a%min is the mean value of the latter a% pixels.
[0019] Further, updating the pixels of the normalized image according to the channel stretch coefficient to obtain the balanced image specifically includes:
[0020] Calculate the pixel mean and pixel variance corresponding to the three channels R, G, and B of the normalized image respectively;
[0021] According to the pixel means and pixel variances corresponding to the three channels and the channel extension coefficients, the pixels in the normalized image are updated to obtain the balanced image; wherein the calculation formula for pixel update is specifically:
[0022]
[0023]
[0024]
[0025]
[0026] in, is the equalized image, I′ C is the normalized image, θ is the preset brightness coefficient, σ R , σ G , σ B are the pixel variances corresponding to the three channels of the normalized image R, G, and B, μ R , μ G , μ B are respectively the pixel means corresponding to the three channels R, G, and B of the normalized image.
[0027] Furthermore, the calculating of the image transmittance and the ambient light value of the balanced image specifically includes:
[0028] Mapping the equalized image to a grayscale space to obtain a grayscale image;
[0029] From the first b‰ pixels of the brightness of the dark channel of the grayscale image, determine the pixel value of the pixel with the largest corresponding brightness value as the ambient light value; wherein b is a second preset ratio value;
[0030] The image transmittance is calculated according to the ambient light value and a preset atmospheric scattering model; wherein the calculation formula of the image transmittance is specifically as follows:
[0031]
[0032] Wherein, t(x) is the image transmittance, A is the ambient light value, I g (y) = J g (y)t(x)+A[1-t(x)] is the preset atmospheric scattering model, and Ω(x) is a preset square area centered on the pixel point x in the grayscale image.
[0033] Furthermore, the grayscale clear image is restored according to the image projection rate and the ambient light value of the equalized image, specifically including:
[0034] According to the image transmittance and the ambient light value, the balanced image is restored by a preset inversion model to obtain the grayscale clear image; wherein the inversion model is specifically:
[0035]
[0036] Among them, α is the preset stability coefficient.
[0037] Further, the defogging process is performed on the underwater image to be enhanced according to the grayscale foggy image and the grayscale clear image to obtain an enhanced image, which specifically includes:
[0038] Linearly fusion is performed on the grayscale foggy image and the grayscale clear image, and grayscale feature distribution is calculated;
[0039] According to the grayscale feature distribution, a linear defogging calculation is performed on the underwater image to be enhanced to obtain the enhanced image.
[0040] Furthermore, the linear defogging calculation is specifically as follows:
[0041] J C =I C +ρ|I g -J g |
[0042] Among them, J C is the enhanced image, I C is the underwater image to be enhanced, I g is the grayscale foggy image, J g is the grayscale clear image, and ρ is the preset fusion coefficient.
[0043] Another embodiment of the present invention provides an underwater image visual enhancement device based on grayscale space prior, comprising: an equalization module, a restoration module and an enhancement module;
[0044] The equalization module is used to update the pixels of the underwater image to be enhanced to obtain a balanced image;
[0045] The restoration module is used to calculate the image transmittance and ambient light value of the equalized image, and restore the grayscale clear image according to the image transmittance and ambient light value of the equalized image;
[0046] The enhancement module is used to map the underwater image to be enhanced to obtain a grayscale foggy image, and to defog the underwater image to be enhanced according to the grayscale foggy image and the grayscale clear image to obtain an enhanced image.
[0047] Furthermore, the equalization module is used to update the pixels of the underwater image to be enhanced to obtain an equalized image, which specifically includes:
[0048] Normalizing the RGB three channels of the underwater image to be enhanced to obtain a normalized image;
[0049] Calculating a channel extension coefficient according to the pixel value of the normalized image;
[0050] According to the channel stretch coefficient, pixels of the normalized image are updated to obtain the balanced image.
[0051] Compared with the prior art, the present invention has the following beneficial effects:
[0052] After processing by the equalization method, the color offset problem of underwater images is effectively solved, and the corresponding color channel feature distribution curves tend to be consistent. At the same time, by establishing the feature association between color space and gray space, the gray dark channel theory is used to eliminate the visual blur problem caused by dust in the color space, better maintain the original information of the image, and improve the visual enhancement effect of underwater images. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 A flowchart of a method for underwater image visual enhancement based on grayscale spatial prior is provided in accordance with an embodiment of the present invention.
[0054] Figure 2 A schematic diagram of a flow chart of an underwater grayscale space prior theory provided by an embodiment of the present invention.
[0055] Figure 3 Degraded images obtained in different types of underwater scenes and their corresponding RGB channel distribution histograms provided by an embodiment of the present invention.
[0056] Figure 4 A flowchart of a preferred embodiment of a method for underwater image visual enhancement based on grayscale spatial prior provided by an embodiment of the present invention.
[0057] Figure 5 An example diagram of visual comparison and corresponding channel histogram changes of an underwater image before and after being processed by the proposed color equalization algorithm provided in an embodiment of the present invention.
[0058] Figure 6 A comparison diagram of subjective processing effects of different methods on underwater images with different color cast types provided by an embodiment of the present invention.
[0059] Figure 7 A comparison diagram of subjective processing effects of different methods on underwater images with different turbidities provided by an embodiment of the present invention.
[0060] Figure 8 A schematic structural diagram of an underwater image vision enhancement device based on grayscale space prior is provided in another embodiment of the present invention. DETAILED DESCRIPTION
[0061] The drawings are for illustrative purposes only and should not be construed as limiting the present patent;
[0062] It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0063] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0064] Reference Figure 1 , is a flow chart of a method for underwater image visual enhancement based on grayscale space prior provided by an embodiment of the present invention, comprising the following steps:
[0065] S1: Update the pixels of the underwater image to be enhanced to obtain a balanced image;
[0066] S2: Calculate the image transmittance and the ambient light value of the equalized image, and restore the grayscale clear image according to the image transmittance and the ambient light value of the equalized image;
[0067] S3: mapping the underwater image to be enhanced to obtain a grayscale foggy image, and defogging the underwater image to be enhanced according to the grayscale foggy image and the grayscale clear image to obtain an enhanced image.
[0068] In a preferred embodiment, referring to Figure 2 , which is a flow chart of an underwater grayscale space prior theory provided by an embodiment of the present invention. Due to the achromatic nature of foggy images, the pixel distribution curves of such foggy hazy features in the RGB space and the grayscale space are almost the same. Under the ideal premise of ignoring the fluctuation of pixel values caused by content differences, the distribution of foggy features in the color space and the grayscale space should remain completely consistent.
[0069] Reference Figure 3 , are degraded images obtained in different types of underwater scenes and their corresponding RGB channel distribution histograms provided by an embodiment of the present invention. Figure 3 It can be seen that the underwater image channel histogram has the following degradation characteristics:
[0070] 1) Concentration: The main pixels of the RGB channels of underwater images are concentrated in a certain interval, while the proportion of pixels outside the interval is relatively small. This feature is the main reason for the low contrast of underwater images.
[0071] 2) Sequentiality: Underwater images have obvious color shift characteristics in visual perception. For a single underwater image, its RGB color channels are usually arranged in the order of red, green, blue or red, blue, green.
[0072] 3) Offset: There is an obvious positional deviation in the pixel distribution in the corresponding RGB channels of the underwater image, and the greater the deviation, the higher the degree of color distortion.
[0073] Aiming at the degradation characteristics of underwater images, the embodiment of the present invention provides a method for underwater image visual enhancement based on grayscale space prior theory based on experimental analysis of underwater grayscale space prior theory. The corresponding process is as follows: Figure 4 As shown in the figure. The main principle is to build an underwater image enhancement algorithm architecture based on grayscale space priors, and to explore and utilize the common features of dust haze in grayscale space and color space to build a visual enhancement link suitable for underwater environments. By establishing feature association mapping between grayscale space and color space, the visual perception quality of underwater images in terms of color restoration, clarity and contrast is improved, thereby improving the image's detail performance and depth perception effect.
[0074] For step S1, specifically, updating pixels of the underwater image to be enhanced to obtain a balanced image specifically includes:
[0075] Performing normalization processing on the underwater image to be enhanced to obtain a normalized image;
[0076] Calculating a channel extension coefficient according to the pixel value of the normalized image;
[0077] According to the channel stretch coefficient, pixels of the normalized image are updated to obtain the balanced image.
[0078] Furthermore, the channel extension coefficient is calculated according to the pixel value of the normalized image, specifically including:
[0079] Respectively calculating the mean values of the first a% pixel values and the last a% pixel values corresponding to the three channels R, G, and B of the normalized image; wherein a is a first preset ratio value;
[0080] The channel extension coefficient is calculated according to the mean of the first a% pixel values and the mean of the last a% pixel values under the three channels of R, G, and B of the normalized image; wherein the calculation formula of the channel extension coefficient is specifically as follows:
[0081]
[0082] Where λ is the channel extension coefficient, I′ a%max is the mean value of the first a% pixels, I′ a%min is the mean value of the latter a% pixels.
[0083] Further, updating the pixels of the normalized image according to the channel stretch coefficient to obtain the balanced image specifically includes:
[0084] Calculate the pixel mean and pixel variance corresponding to the three channels R, G, and B of the normalized image respectively;
[0085] According to the pixel means and pixel variances corresponding to the three channels and the channel extension coefficients, the pixels in the normalized image are updated to obtain the balanced image; wherein the calculation formula for pixel update is specifically:
[0086]
[0087]
[0088]
[0089]
[0090] in, is the equalized image, I′ C is the normalized image, θ is the preset brightness coefficient, σ R , σ G , σ B are the pixel variances corresponding to the three channels of the normalized image R, G, and B, μ R , μ G , μ B are respectively the pixel means corresponding to the three channels R, G, and B of the normalized image.
[0091] In a preferred embodiment, after acquiring the underwater image to be enhanced, it is necessary to first perform pixel reorganization on the feature distribution of the image through a color equalization algorithm to equalize the color shift problem caused by channel deviation, specifically including:
[0092] 1) The input image I is calculated by the following formula C The R, G, and B channels of the image to be enhanced are normalized to balance the brightness and contrast of each channel, so as to more clearly extract and enhance the image details. The normalization process first calculates the pixel mean μ of each channel. C and pixel variance σ C , which is used to adjust the dynamic range and brightness distribution of the image, thereby optimizing the visual perception of the image:
[0093]
[0094] 2) Calculate the channel stretch coefficient λ to adapt the dynamic range of each channel and evenly stretch it within a preset range to enhance the contrast and details of the image. The channel stretch coefficient λ can be determined by the statistical information of the image pixel value, usually based on the brightness distribution of the channel, and appropriately adjust the mapping of the dark and bright areas to achieve a better visual effect. In addition, in this preferred embodiment, the value range of the first preset ratio value a can be 3-8, and a=5 is preferably selected.
[0095]
[0096] Among them, I′ 5%max and I′ 5%min They represent the average values of the first 5% and last 5% of the pixels in the RGB channel of the normalized image, respectively, and are used to control the upper and lower limits of the brightness, respectively, to ensure that the brightness and contrast of the channel are more in line with visual requirements. Specifically, I′ 5%max It represents the average value of the first 5% of the pixel values in each RGB channel of the normalized image, that is, the representative average value of the brighter area; and I′ 5%min It represents the average value of the last 5% of the pixel values of each channel, representing the average value of the darker area in the image. This method can effectively reduce the impact of extreme pixel values on the overall image brightness adjustment. By introducing percentage pixel values in the normalization calculation, it is possible to avoid local brightness distortion while ensuring the overall image brightness and contrast, thereby enhancing the visual consistency and color expression of the image.
[0097] 3) Update the pixel values in the image and output a color-balanced image
[0098]
[0099]
[0100]
[0101]
[0102] Among them, θ represents the brightness reference coefficient, which is used to fix the center position of the RGB channel distribution to minimize the numerical overflow problem caused by the large dynamic range of pixels; μ avg and σ avg They represent the average size of the channel mean and variance, respectively, and can reflect the perceptual quality and pixel distribution concentration of the image to a certain extent.
[0103] Reference Figure 5 , which is an example diagram of visual comparison and corresponding channel histogram changes of underwater images before and after the proposed color equalization algorithm is processed, provided by an embodiment of the present invention. The first and third rows are examples of subjective visual changes of underwater images before and after color equalization, and the second and fourth rows are the channel histogram distributions of the images before and after the algorithm is processed. Figure 5 It can be seen that after being processed by the proposed equalization method, the color shift problem of underwater images is effectively solved, and the corresponding color channel feature distribution curves tend to be consistent.
[0104] For step S2, specifically, calculating the image transmittance and the ambient light value of the balanced image specifically includes:
[0105] Mapping the equalized image to a grayscale space to obtain a grayscale image;
[0106] From the first b‰ pixels of the brightness of the dark channel of the grayscale image, determine the pixel value of the pixel with the largest corresponding brightness value as the ambient light value; wherein b is a second preset ratio value;
[0107] The image transmittance is calculated according to the ambient light value and a preset atmospheric scattering model; wherein the calculation formula of the image transmittance is specifically as follows:
[0108]
[0109] Wherein, t(x) is the image transmittance, A is the ambient light value, I g (y) = J g (y)t(x)+A[1-t(x)] is the preset atmospheric scattering model, and Ω(x) is a preset square area centered on the pixel point x in the grayscale image.
[0110] Furthermore, the grayscale clear image is restored according to the image projection rate and the ambient light value of the equalized image, specifically including:
[0111] According to the image transmittance and the ambient light value, the balanced image is restored by a preset inversion model to obtain the grayscale clear image; wherein the inversion model is specifically:
[0112]
[0113] Among them, α is the preset stability coefficient.
[0114] In a preferred embodiment, the balanced image is mapped to the grayscale space, the image transmittance and the ambient light value are estimated using the grayscale dark channel prior algorithm, and the clear image in the grayscale space is restored in combination with the imaging inversion model. The specific calculation process is as follows:
[0115] 1) Assuming that the ambient light value A is a fixed constant, the atmospheric scattering model is used:
[0116] I g (y) = J g (y)t(x)+A[1-t(x)]
[0117] Perform minimization on the left and right ends of the model, that is, take the minimum value on a given set of pixels, and you can get the following formula:
[0118]
[0119] Mathematically transform the above minimization processing form:
[0120]
[0121] Combined with the dark channel prior theory, we know that under the minimized state, J g The value of (y) tends to 0. This feature simplifies the transformation form of the atmospheric scattering model. Therefore, the scene transmittance can be calculated based on the above transformation form:
[0122]
[0123] 2) In this preferred embodiment, the second preset ratio value b is 1, that is, the first 1‰ pixels of the dark channel brightness are selected. Among the selected pixels, the pixels with the highest brightness value are extracted according to their corresponding positions in the original image, and this value is used as the ambient light value A.
[0124] 3) Reverse the original atmospheric scattering model to obtain a clear image in grayscale space. At the same time, a stability factor α is introduced in the calculation process to solve the problem of image overexposure caused by too low transmittance. Through this stability factor, a lower limit of transmittance can be set to ensure that the calculation of the model in the low transmittance area is more stable, thereby effectively preventing the image brightness from being over-enhanced under conditions of heavy dust or strong light, and maintaining the visual balance of the restoration result. The inversion model is shown as follows:
[0125]
[0126] For step S3, specifically, the defogging process is performed on the underwater image to be enhanced according to the grayscale foggy image and the grayscale clear image to obtain the enhanced image, specifically including:
[0127] Linearly fusion is performed on the grayscale foggy image and the grayscale clear image, and grayscale feature distribution is calculated;
[0128] According to the grayscale feature distribution, a linear defogging calculation is performed on the underwater image to be enhanced to obtain the enhanced image.
[0129] Furthermore, the linear defogging calculation is specifically as follows:
[0130] J c =I C +ρ|I g -J g |
[0131] Among them, J C is the enhanced image, I C is the underwater image to be enhanced, I g is the grayscale foggy image, J gis the grayscale clear image, and ρ is the preset fusion coefficient.
[0132] In a preferred embodiment, the grayscale haze image and the grayscale clear image are linearly fused to calculate the characteristic distribution of the haze in the grayscale space, which serves as a priori reference for subsequent image defogging and visual clarity restoration.
[0133] Guided by the grayscale space prior theory, a fine feature association is established between the color space and the grayscale space to effectively suppress and eliminate the visual blur caused by the dust and haze effect in the color space. This processing step takes advantage of the grayscale space prior theory and gradually corrects the color restoration and detail enhancement effects of the image for the noise and contrast loss problems introduced in the color channel.
[0134] Through this association modeling, clear information in the grayscale space can be effectively transferred to the color space, thereby improving the clarity and color reproduction of the image in complex environments.
[0135] The above process can be described by the following mathematical expression:
[0136] J C =I C +ρ|I g -J g |
[0137] Among them, ρ is the fusion coefficient, which is used to control the local dehazing intensity.
[0138] In summary, the implementation process of the present invention can be summarized by Table 1:
[0139] Table 1 Implementation process of the present invention
[0140]
[0141] To verify the effectiveness of the present invention, an experimental comparison and analysis is conducted on the basis of the underwater image dataset UIEB with the current mainstream underwater image enhancement methods. The comparison methods include: DCP, ROP, ROP+, HFM, MPF and MSPE. The experimental hardware platform is Intel(R) Core(TM) i5-9400 CPU@2.90GHz, 16GB memory. The software platform is Win10 operating system, and the algorithm runs on Matlab2021a.
[0142] The subjective processing effects of the contrast method on underwater images with different color cast types and different turbidity are shown in the figure below. Figure 6 and Figure 7 As shown. Figure 6It can be seen from the figure that DCP cannot balance the color shift problem in underwater images, and after being processed by the DCP algorithm, the brightness information of the image is lost, and it appears too dim visually. Figure 7 It can be observed that although the ROP and ROP+ algorithms can improve the visual clarity of underwater images to a certain extent, due to the lack of comprehensive consideration of the underwater image degradation process, the two are only applicable to specific foggy underwater scenes with low color deviation; the HFM algorithm can balance the color distribution of underwater images to a certain extent, but due to the excessive enhancement of the red channel, the enhanced results of the algorithm visually show a yellowish red perception effect, such as Figure 6 As shown in the second and fifth rows of Figure 6 and Figure 7 It can be seen from the results that the content features of the image processed by the MPF algorithm have been weakened to a certain extent, which is reflected in a slightly dim visual appearance; the results of the MSPE algorithm have obvious color distortion problems, and the processed image is still relatively blurred visually. Compared with the above algorithms, the present invention comprehensively considers the color shift and foggy hazy features of underwater images, and shows better generalization performance in enhancing the perceived quality of images and improving the visual clarity of images.
[0143] In order to quantitatively analyze the performance of the comparison algorithms, the current mainstream Peak Signal-to-Noise Ratio (PSNR), Structural Similarity Index Measure (SSIM) and Underwater Image Quality Measure (UIQM) are used as objective evaluation indicators.
[0144] Table 2 Comparison results of objective indicators
[0145]
[0146] The objective index results of the comparison algorithms are shown in Table 2. Due to the loss of more brightness features, the DCP algorithm shows large errors in image pixels and structures; the ROP and ROP+ algorithms have weak generalization capabilities, resulting in large pixel errors in the enhancement results; the MPF and MSPE algorithms have obvious color degradation and color distortion problems in the enhancement results, which leads to low UIQM indicators. The present invention can perform adaptive pixel adjustment for different underwater scenes, and has better performance in color balance and fog elimination. Compared with the suboptimal algorithm HFM, it has performance advantages of 1.63dB, 1.32% and 0.0937 in PSNR, SSIM and UIQM indicators respectively. The objective indicators are basically consistent with subjective perception, which verifies the effectiveness of the method proposed in the underwater image visual enhancement task.
[0147] Reference Figure 8 , is a schematic structural diagram of an underwater image visual enhancement device based on grayscale space prior provided by another embodiment of the present invention, comprising: an equalization module 101, a restoration module 102 and an enhancement module 103;
[0148] The equalization module 101 is used to update the pixels of the underwater image to be enhanced to obtain an equalized image;
[0149] The restoration module 102 is used to calculate the image transmittance and the ambient light value of the equalized image, and restore the grayscale clear image according to the image transmittance and the ambient light value of the equalized image;
[0150] The enhancement module 103 is used to map the underwater image to be enhanced to obtain a grayscale foggy image, and to defog the underwater image to be enhanced according to the grayscale foggy image and the grayscale clear image to obtain an enhanced image.
[0151] Furthermore, the equalization module 101 is used to update the pixels of the underwater image to be enhanced to obtain an equalized image, which specifically includes:
[0152] Normalizing the RGB three channels of the underwater image to be enhanced to obtain a normalized image;
[0153] Calculating a channel extension coefficient according to the pixel value of the normalized image;
[0154] According to the channel stretch coefficient, pixels of the normalized image are updated to obtain the balanced image.
[0155] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A method for underwater image visual enhancement based on grayscale spatial prior, characterized in that: The steps include: Perform pixel update on the underwater image to be enhanced to obtain a balanced image; Calculating the image transmittance and the ambient light value of the equalized image, and restoring the grayscale clear image according to the image transmittance and the ambient light value of the equalized image; A grayscale foggy image is obtained according to the mapping of the underwater image to be enhanced, and defogging is performed on the underwater image to be enhanced according to the grayscale foggy image and the grayscale clear image to obtain an enhanced image.
2. The underwater image visual enhancement method based on grayscale space prior according to claim 1, characterized in that: The pixel updating of the underwater image to be enhanced to obtain a balanced image specifically includes: Performing normalization processing on the underwater image to be enhanced to obtain a normalized image; Calculating a channel extension coefficient according to the pixel value of the normalized image; According to the channel stretch coefficient, pixels of the normalized image are updated to obtain the balanced image.
3. The underwater image visual enhancement method based on grayscale space prior according to claim 2, characterized in that: The calculating the channel extension coefficient according to the pixel value of the normalized image specifically includes: Respectively calculating the mean values of the first a% pixel values and the last a% pixel values corresponding to the three channels R, G, and B of the normalized image; wherein a is a first preset ratio value; The channel extension coefficient is calculated according to the mean of the first a% pixel values and the mean of the last a% pixel values under the three channels of R, G, and B of the normalized image; wherein the calculation formula of the channel extension coefficient is specifically as follows: Wherein, λ is the channel extension coefficient, I ′ a%max is the mean value of the first a% pixels, I ′ a%min is the mean value of the latter a% pixels.
4. The underwater image visual enhancement method based on grayscale spatial prior according to claim 3, characterized in that: The step of updating pixels of the normalized image according to the channel stretch coefficient to obtain the balanced image specifically includes: Calculate the pixel mean and pixel variance corresponding to the three channels R, G, and B of the normalized image respectively; According to the pixel means and pixel variances corresponding to the three channels and the channel extension coefficients, the pixels in the normalized image are updated to obtain the balanced image; wherein the calculation formula for pixel update is specifically: in, is the equalized image, I ′ C is the normalized image, θ is the preset brightness coefficient, σ R , σ G , σ B are the pixel variances corresponding to the three channels of the normalized image R, G, and B, μ R , μ G , μ B are respectively the pixel means corresponding to the three channels R, G, and B of the normalized image.
5. The method for underwater image visual enhancement based on grayscale spatial prior according to claim 1, characterized in that: The calculating the image transmittance and the ambient light value of the balanced image specifically includes: Mapping the equalized image to a grayscale space to obtain a grayscale image; From the first b‰ pixels of the brightness of the dark channel of the grayscale image, determine the pixel value of the pixel with the largest corresponding brightness value as the ambient light value; wherein b is a second preset ratio value; The image transmittance is calculated according to the ambient light value and a preset atmospheric scattering model; wherein the calculation formula of the image transmittance is specifically as follows: Wherein, t(x) is the image transmittance, A is the ambient light value, I g (y) = J g (y)t(x)+A[1-t(x)] is the preset atmospheric scattering model, and Ω(x) is a preset square area centered on the pixel point x in the grayscale image.
6. The underwater image visual enhancement method based on grayscale spatial prior according to claim 5, characterized in that: The restoring of the image projection rate and the ambient light value of the equalized image to obtain a grayscale clear image specifically includes: According to the image transmittance and the ambient light value, the balanced image is restored by a preset inversion model to obtain the grayscale clear image; wherein the inversion model is specifically: Among them, α is the preset stability coefficient.
7. The method for underwater image visual enhancement based on grayscale spatial prior according to claim 1, characterized in that: The defogging process is performed on the underwater image to be enhanced according to the grayscale foggy image and the grayscale clear image to obtain an enhanced image, specifically comprising: Linearly fusion is performed on the grayscale foggy image and the grayscale clear image, and grayscale feature distribution is calculated; According to the grayscale feature distribution, a linear defogging calculation is performed on the underwater image to be enhanced to obtain the enhanced image.
8. The method for underwater image visual enhancement based on grayscale spatial prior according to claim 7, characterized in that: The linear defogging calculation is specifically as follows: J C =I C +ρ|I g -J g | Among them, J C is the enhanced image, I C is the underwater image to be enhanced, I g is the grayscale foggy image, J g is the grayscale clear image, and ρ is the preset fusion coefficient.
9. An underwater image visual enhancement device based on grayscale spatial prior, characterized in that: include: Equalization module, restoration module and enhancement module; The equalization module is used to update the pixels of the underwater image to be enhanced to obtain a balanced image; The restoration module is used to calculate the image transmittance and ambient light value of the equalized image, and restore the grayscale clear image according to the image transmittance and ambient light value of the equalized image; The enhancement module is used to map the underwater image to be enhanced to obtain a grayscale foggy image, and to defog the underwater image to be enhanced according to the grayscale foggy image and the grayscale clear image to obtain an enhanced image.
10. The underwater image visual enhancement device based on grayscale spatial prior according to claim 9, characterized in that: The equalization module is used to update the pixels of the underwater image to be enhanced to obtain an equalized image, which specifically includes: Normalizing the RGB three channels of the underwater image to be enhanced to obtain a normalized image; Calculating a channel extension coefficient according to the pixel value of the normalized image; According to the channel stretch coefficient, pixels of the normalized image are updated to obtain the balanced image.