Underwater image processing method and system
By combining frequency domain and airspace processing methods in underwater image processing, and using homomorphic filtering and color correction technology, the problem that contrast and color cannot be improved simultaneously in the existing methods is solved, and high-quality underwater image processing is achieved.
Patent Information
- Application Number
- CN202211661043.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-23
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2042-12-23
AI Technical Summary
When the existing underwater image processing methods enhance image contrast and improve color, they easily enhance background noise, and cannot improve contrast and color at the same time, limiting the improvement of image quality.
A method combining frequency domain and airspace processing is adopted to convert the image to the frequency domain through Fourier transform for homomorphic filtering to enhance contrast, and color correction is performed in the airspace, and finally channel fusion is performed in the Lab color gamut space to obtain the final output image.
It effectively avoids the enhancement of background noise, significantly improves the contrast and color of the image, and improves the overall quality of the underwater image.
Smart Images

Figure CN116320344B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an underwater image processing method and system. Background Art
[0002] Underwater optical imaging technology is an important part of underwater detection technology. It is a universal requirement in many underwater fields such as underwater national defense, underwater detection, underwater aquaculture, underwater rescue, and underwater archaeology. It has important application value and scientific significance.
[0003] When shooting underwater, the image quality will be affected by various factors in the water. There are two main aspects: on the one hand, organic matter in the water and various particles and microorganisms suspended in the water will scatter visible light, including forward scattering and backward scattering, making the captured target object blurred, the signal-to-noise ratio reduced, details lost, imaging contrast reduced, and the viewing experience reduced. On the other hand, water has a strong absorption effect on visible light, and the absorption degree of light of different wavelengths is inconsistent, causing color distortion of underwater images. This greatly limits the application of underwater images in ocean observation and detection, so it is very important to improve the quality of underwater images.
[0004] At present, the methods for underwater image restoration mainly include physical model-based restoration methods, non-physical model-based restoration methods and deep learning-based methods. The physical model-based methods need to assume or estimate some parameters in the model, and use the degradation mechanism of underwater images to restore clear underwater images; the image restoration based on non-physical models is not affected by model estimation, and directly processes the image to improve the visual quality of underwater images; the deep learning-based methods establish an underwater image degradation training library through supervised or unsupervised learning, extract the feature vector of the degraded image, and thus perform new underwater degraded image restoration. However, the restoration method based on physical models needs to assume or estimate some parameters in the model, which greatly limits the robustness of image restoration; the deep learning method lacks a large number of training data sets in real underwater environments, and the models trained with artificially synthesized data sets have limited generalization ability and are time-consuming to train; the method based on non-physical models can directly process data to improve the visual quality of images, and is simple to implement, but the existing non-physical model restoration method does not select data during image processing, which may enhance the background noise in the image and cannot improve the contrast and color at the same time. Therefore, improving the existing non-physical model restoration method so that it only enhances the useful information of the image and improves the image color during data processing is of great significance in practical applications. Summary of the invention
[0005] In view of the technical problems that the above-mentioned existing image processing methods have the problem of enhancing background noise and failing to improve contrast and color at the same time, the present invention proposes an underwater image processing method and system.
[0006] In a first aspect, an embodiment of the present application provides an underwater image processing method, comprising:
[0007] Image acquisition step: acquiring underwater images;
[0008] Contrast enhancement step: performing contrast enhancement on the underwater image in the frequency domain;
[0009] Color correction step: performing color correction on the underwater image in the air domain;
[0010] Image fusion step: The contrast-enhanced underwater image and the color-corrected underwater image are fused in the Lab color space to obtain the final output image.
[0011] In the above underwater image processing method, the contrast enhancement step comprises:
[0012] Grayscale image conversion step: converting the underwater image into a grayscale image;
[0013] Image filtering step: converting the grayscale image into a frequency domain space using Fourier transform to obtain a frequency image, and filtering the frequency image using a homomorphic filter;
[0014] Histogram equalization step: converting the filtered frequency image into the spatial domain and performing contrast-limited adaptive histogram equalization to obtain the contrast-enhanced underwater image.
[0015] In the above underwater image processing method, the color correction step comprises:
[0016] The best background area search step: using a quadtree search method to search for the best background area of the underwater image;
[0017] Image color cast determination step: performing channel separation on the optimal background area, calculating the pixel mean of each channel, and determining whether the underwater image has color cast and the type of color cast according to the pixel mean;
[0018] Color cast correction step: performing color correction on underwater images of different color cast types using different color correction algorithms to obtain the color-corrected underwater images.
[0019] In the above underwater image processing method, the optimal background area search step comprises:
[0020] Region division step: evenly dividing the underwater image into four regions;
[0021] Variance calculation step: Calculate the variance of each region and determine whether the size of the region with the lowest score is less than the set size threshold;
[0022] Loop step: If yes, the area with the lowest score is taken as the best background area; if not, four areas are evenly divided based on the area with the lowest score, and the variance calculation step is recursively executed until the size of the area with the lowest score is smaller than the set size threshold, and the area is taken as the best background area.
[0023] In the above underwater image processing method, the image color cast determination step comprises:
[0024] Channel separation step: separating the red, green and blue channels of the optimal background area, and calculating the pixel means of the red, green and blue channels respectively;
[0025] Color cast type judgment step: judging whether the underwater image has color cast and the type of color cast according to the maximum value of the pixel means of the red, green and blue channels.
[0026] In the above underwater image processing method, the color cast type determination step comprises:
[0027] If the maximum value is the pixel mean of the green channel, the underwater image is a green-leaning underwater image;
[0028] If the maximum value is the pixel mean of the blue channel, the underwater image is a blue underwater image;
[0029] If the maximum value is the pixel mean of the red channel, the underwater image is a yellowish underwater image;
[0030] If the pixel means of the green, blue and red channels are all equal, then there is no color cast in the underwater image.
[0031] In the above underwater image processing method, the image fusion step comprises:
[0032] Channel fusion step: replacing the brightness channel of the underwater image after color correction with the brightness channel of the underwater image after contrast enhancement in the Lab color space to obtain a Lab color map;
[0033] Output image acquisition step: converting the Lab color gamut image into RGB space to obtain the final output image.
[0034] In a second aspect, an embodiment of the present application provides an underwater image processing system, which is used to implement the underwater image processing method described in the first aspect, including:
[0035] Image acquisition unit: acquire underwater images;
[0036] Contrast enhancement unit: performing contrast enhancement on the underwater image in the frequency domain;
[0037] Color correction unit: performing color correction on the underwater image in the airspace;
[0038] Image fusion unit: The underwater image after contrast enhancement and the underwater image after color correction are fused in the Lab color space to obtain the final output image.
[0039] The above underwater image processing system, wherein the contrast enhancement unit comprises:
[0040] Grayscale image conversion module: converting the underwater image into a grayscale image;
[0041] Image filtering module: converting the grayscale image into frequency domain space by Fourier transform to obtain a frequency image, and filtering the frequency image by homomorphic filter;
[0042] Histogram equalization module: converts the filtered frequency image into the spatial domain and performs contrast-limited adaptive histogram equalization to obtain the contrast-enhanced underwater image.
[0043] The above underwater image processing system, wherein the color correction unit comprises:
[0044] The best background area search module uses a quadtree search method to search for the best background area of the underwater image;
[0045] Image color cast discrimination module: performing channel separation on the optimal background area, calculating the pixel mean of each channel, and judging whether the underwater image has color cast and the type of color cast according to the pixel mean;
[0046] Color cast correction module: performs color correction on underwater images of different color cast types using different color correction algorithms to obtain the color-corrected underwater images.
[0047] Compared with the prior art, the advantages and positive effects of the present invention are:
[0048] 1. The present invention discloses a method for judging color cast of underwater images, which uses a quadtree search method and obtains the best background area by calculating the minimum variance of the area, and judges the type of image color cast according to the channel pixel mean value of the best background area, thereby avoiding errors in image color cast judgment caused by interference from bright spots or targets in the image;
[0049] 2. The present invention uses a homomorphic filter to filter the image, enhances the high-frequency information of the image, that is, enhances the image details, and weakens the low-frequency information of the image, that is, weakens the background noise part of the image, thereby obtaining a high-contrast image and avoiding the enhancement of background noise during the image processing process; and converts the homomorphically filtered image to the spatial domain, and uses limited contrast adaptive histogram equalization to further improve the overall brightness of the image and further enhance the details;
[0050] 3. The present invention combines spatial domain and frequency domain image processing, improves image contrast in the frequency domain, and corrects image color in the spatial domain; at the same time, in the lab color space, the brightness channel for contrast enhancement in the frequency domain and the color channel for color correction in the spatial domain are merged to achieve simultaneous improvement of underwater image contrast and color. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A schematic diagram of the steps of the underwater image processing method provided by the present invention;
[0052] Figure 2 The present invention provides Figure 1 Schematic diagram of the process of step S2;
[0053] Figure 3 The present invention provides Figure 1 Schematic diagram of the process of step S3;
[0054] Figure 4 The present invention provides Figure 1 Schematic diagram of the process of step S4;
[0055] Figure 5 A schematic diagram of a flow chart of an embodiment of an underwater image processing method provided by the present invention;
[0056] Figure 6 A schematic diagram of the optimal background area search method provided by the present invention;
[0057] Figure 7 The experimental result diagram provided by the present invention;
[0058] Figure 8 A framework diagram of the underwater image processing system provided by the present invention;
[0059] Fig. 9 This is a comparison chart of the processing effects of the present invention and other algorithms on different underwater scene images. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0061] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.
[0062] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0063] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0064] The present invention is described in detail below in conjunction with the various embodiments shown in the accompanying drawings, but it should be noted that these embodiments are not limitations of the present invention, and any equivalent transformations or substitutions in functions, methods, or structures made by ordinary technicians in the field based on these embodiments are all within the scope of protection of the present invention.
[0065] Before elaborating on each embodiment of the present invention in detail, the core inventive concept of the present invention is summarized and elaborated in detail through the following several embodiments.
[0066] First, the underwater image is read and converted into a grayscale image; the grayscale image is Fourier transformed and transferred to the frequency domain; the homomorphic filtering is used to filter it to enhance the high-frequency information of the image details and reduce the low-frequency information of the image background; the filtered image is subjected to the contrast-limited adaptive histogram equalization (CLAHE) to further enhance the overall brightness and details of the image; then the read underwater original image is searched for the best background area of the image using the quadtree search method; the image channels of the best background area are separated, the mean of each channel is calculated, and the color cast type of the underwater image is determined according to the mean of each channel; color correction is performed according to the color cast type to obtain a color-free underwater image; the color-corrected image is transferred to the Lab color space; finally, the contrast-enhanced grayscale image and the color-corrected image are fused to obtain the contrast- and color-corrected underwater image. This method combines frequency domain and spatial domain image processing to obtain the best results of the two methods, and at the same time significantly improves the contrast and color of the underwater image.
[0067] Embodiment 1:
[0068] Figure 1 Schematic diagram of the steps of the underwater image processing method provided by the present invention. Figure 1 As shown, in order to solve the problems of low contrast, color distortion, blurred details, etc. of underwater images, this embodiment discloses a specific implementation method of an underwater image processing method (hereinafter referred to as "method").
[0069] Specifically, the method disclosed in this embodiment mainly includes the following steps:
[0070] Step S1: Acquire underwater images;
[0071] Step S2: performing contrast enhancement on the underwater image in the frequency domain;
[0072] Specifically, refer to Figure 2 As shown, step S2 includes:
[0073] Step S21: converting the underwater image into a grayscale image;
[0074] The original underwater image is an RGB image. The RGB value is converted to a grayscale value by calculating the weighted sum of the R, G, and B components. gray , the specific formula is as follows:
[0075] I gray =0.299*R+0.578*G+0.114*B.
[0076] Step S22: converting the grayscale image into a frequency domain space by Fourier transform to obtain a frequency image, and filtering the frequency image by a homomorphic filter;
[0077] Among them, the characteristics of the homomorphic filter are used to enhance the high-frequency information of the image, that is, to enhance the image details; the low-frequency information of the image is weakened, that is, to weaken the background noise part of the image, so as to obtain a high-contrast image;
[0078] Step S23: converting the filtered frequency image into the spatial domain and performing contrast-limited adaptive histogram equalization to obtain the contrast-enhanced underwater image.
[0079] Specifically, the homomorphically filtered image is converted to the spatial domain, and the contrast-limited adaptive histogram equalization (CLAHE) is used to improve the overall brightness of the image and further enhance the details to obtain a contrast-enhanced image I en .
[0080] Step S3: performing color correction on the underwater image in the airspace;
[0081] Reference Figure 3 As shown, step S3 specifically includes:
[0082] Step S31: searching for the best background area of the underwater image using a quadtree search method;
[0083] Specifically, step S31 includes:
[0084] Step S311: evenly divide the underwater image into four areas;
[0085] Step S312: Calculate the variance of each region and determine whether the size of the region with the lowest score is smaller than a set size threshold;
[0086] Among them, the best background area scoring formula is as follows:
[0087]
[0088] Among them, Q k represents the score of the kth region, n represents the number of pixels in the region, c∈{r,g,b} represents the red, green and blue color channels of the image, and x represents the pixel coordinates. represents the mean value of image pixels in the kth region, represents the image pixel value of the kth region, represents the red pixel value of the kth region, represents the green pixel value of the kth region, Represents the blue pixel value of the kth region.
[0089] Step S313: If yes, the area with the lowest score is taken as the best background area; if not, four areas are evenly divided based on the area with the lowest score, and the variance calculation step is recursively executed until the size of the area with the lowest score is smaller than the set size threshold, and the area is taken as the best background area.
[0090] Step S32: performing channel separation on the optimal background area, calculating the pixel mean of each channel, and judging whether the underwater image has color cast and the type of color cast according to the pixel mean;
[0091] Specifically, step S32 includes:
[0092] Step S321: separating the red, green and blue channels of the optimal background area, and calculating the pixel means of the red, green and blue channels respectively;
[0093] Step S322: judging whether the underwater image has color cast and the type of color cast according to the maximum value of the pixel means of the red, green and blue channels.
[0094] If the maximum value is the pixel mean of the green channel, the underwater image is a green-leaning underwater image; if the maximum value is the pixel mean of the blue channel, the underwater image is a blue-leaning underwater image; if the maximum value is the pixel mean of the red channel, the underwater image is a yellow-leaning underwater image;
[0095] If the pixel means of the green, blue and red channels are all equal, then there is no color cast in the underwater image.
[0096] Step S33: performing color correction on underwater images of different color cast types using different color correction algorithms to obtain the color-corrected underwater images.
[0097] Specifically, if the underwater image is greenish:
[0098] Then, histogram equalization is performed on each channel of the underwater image, and the histogram of each channel is drawn respectively. The number of occurrences of each gray level in the histogram is counted, the cumulative histogram distribution is calculated, the cumulative distribution is positive, and finally normalized.
[0099] If the underwater image is a blue underwater image, the following formula is used for color correction, where the red channel I after color correction is rc (x) is:
[0100]
[0101] Among them, I rc (x) represents the red channel after color correction, x represents the image pixel position, The pixel mean of the green channel representing the best background area, The pixel mean of the red channel representing the optimal background area. r (x) is the red channel of the original underwater image, I g (x) is the green channel of the original underwater image; α is a constant that affects the color correction result. In this embodiment, the value of α is set to 1.6.
[0102] If the underwater image is yellowish, the following formula is used for color correction, where the green channel I after color correction is gc (x), blue channel I bc (x) is:
[0103]
[0104]
[0105] Among them, I gc (x) is the green channel after color correction, I bc (x) are the blue channels after color correction, The pixel mean of the green channel representing the best background area, The pixel mean of the red channel representing the best background area, The pixel mean of the green channel representing the best background area; I r (x) is the red channel of the original underwater image, I g (x) is the green channel of the original underwater image, I b (x) is the blue channel of the original underwater image; α represents a constant that affects the color correction result. In this embodiment, the value of α is set to 1.6.
[0106] Step S4: performing channel fusion on the underwater image after contrast enhancement and the underwater image after color correction in the Lab color space to obtain a final output image.
[0107] Reference Figure 4 As shown, step S4 specifically includes:
[0108] Step S41: replacing the brightness channel of the underwater image after color correction with the brightness channel of the underwater image after contrast enhancement in the Lab color gamut space to obtain a Lab color gamut map;
[0109] Specifically, L represents the brightness channel, and a channel and b channel represent the color channels. In the Lab color space, the brightness channel L of the color-corrected image is replaced by I en ; Because the value range of the brightness channel L in the Lab space is L∈[0,100], it needs to be normalized. After normalization, it is
[0110] in, For I en Normalized brightness channel matrix.
[0111] The brightness channel of the contrast-enhanced underwater image is fused with the color channel of the color-corrected underwater image. The fusion formula is:
[0112]
[0113] in, For I en Normalized brightness channel matrix, I rLab is the final image fused in the Lab color space, α is the fusion coefficient, Lab(:,:,a) and Lab(:,:,b) are the color channels after color correction and transfer to the Lab color space.
[0114] Step S42: convert the Lab color gamut image into RGB space to obtain the final output image.
[0115] Please refer to the following Figure 5 . Figure 5 A schematic diagram of an embodiment of an underwater image processing method provided by the present invention; Figure 5 The specific application process of this method is as follows:
[0116] Step 1: First, convert the original underwater color RGB image into a grayscale image. gray , the RGB value is converted to grayscale value by calculating the weighted sum of each component of R, G, and B. The specific formula is as follows;
[0117] I gray =0.299*R+0.578*G+0.114*B;
[0118] Step 2: Convert the grayscale image to the frequency domain for homomorphic filtering. Use the homomorphic filter to filter the frequency image, and use the characteristics of the homomorphic filter to enhance the high-frequency information of the image, that is, the image details; and weaken the low-frequency information of the image, that is, the background noise part of the image, so as to obtain a high-contrast image;
[0119] Step 2.1: The specific frequency domain conversion method is to regard an image f(x, y) as an incident component i(x, y) and a reflected component r(x, y), that is,
[0120] f(x,y)=i(x,y)r(x,y);
[0121] Because the incident component and the reflected component model are multiplicative, the Fourier transform cannot be used directly to control the incident component and the reflected component. Therefore, the logarithm of f(x, y) is first taken to separate i(x, y) and r(x, y);
[0122] lnf(x,y)=lni(x,y)+lnr(x,y)
[0123] Perform Fourier transform on the above equation to obtain the frequency domain FFT (ln (f (x, y)) of the linear combination:
[0124] FFT(ln(f(x,y))=FFT(ln(i(x,y))+FFT(lnr(x,y))
[0125] Simplified to:
[0126] F(u,v)=I(u,v)+R(u,v)
[0127] Step 2.2: Perform homomorphic filtering on the separated reflection component and incident component in the frequency domain, and use a frequency domain function H(u,v) to filter F(u,v) to obtain S(u,v):
[0128] S(u,v)=H(u,v)F(u,v)=H(u,v)I(u,v)+H(u,v)R(u,v)
[0129] After filtering, perform inverse Fourier transform to get s(x,y),
[0130] s(x,y)=IDFT(S(u,v))
[0131] Finally, take the antilogarithm to get the filtered spatial image g(x,y),
[0132] g(x,y)=e s(x,y) =i 0 (x,y)+r 0 (x,y)
[0133] In the above formula, H(u,v) is the transfer function of the homomorphic filter:
[0134]
[0135] where r H represents the high frequency gain, r L Indicates the low frequency gain, D 0 Indicates the cutoff frequency.
[0136] Step 3: Perform contrast-limited histogram equalization (CLAHE) processing on the filtered image to improve the overall brightness of the image and further enhance the details to obtain a contrast-enhanced image I en.
[0137] Step 4: Use the quadtree search method to search for the best background area of the original underwater image, divide the underwater image evenly into four areas, calculate the variance of the background area, select the area with the lowest score as the best background area, and then divide the best background area into four sub-areas, and recursively repeat the above steps until the size of the best area is less than the set threshold, so as to obtain the best background area. Figure 6 As shown, the optimal background area scoring formula is as follows:
[0138]
[0139] Among them, Q k represents the score of the kth region, n represents the number of pixels in the region, c∈{r,g,b} represents the red, green and blue color channels of the image, and x represents the pixel coordinates. represents the mean value of image pixels in the kth region, represents the image pixel value of the kth region, represents the red pixel value of the kth region, represents the green pixel value of the kth region, Represents the blue pixel value of the kth region.
[0140] Step 5: Based on the best background area searched in step 4, perform channel separation on the image of the area, separate the red, green, and blue color channels of the best background area, and calculate the pixel mean of each channel
[0141] Step 6: Determine the color of the image. According to the mean value of each channel pixel calculated in step 5, determine the type of image color cast. The color channel with the larger mean value of the pixel determines the type of image color cast.
[0142] Step 7: Use different color correction algorithms to correct the color of underwater images with different color cast types to obtain the color-corrected image I cor ;
[0143] 7.1 For greenish underwater images:
[0144] Histogram equalization is performed on each channel of the original underwater image. First, the histogram of each channel is drawn separately, the number of occurrences of each gray level in the histogram is counted, and then the cumulative histogram distribution is calculated, the cumulative distribution is positive, and finally normalized.
[0145] The histogram distribution of the statistical image is normalized to [0,1]:
[0146]
[0147] Calculate the mapping function sk ,
[0148]
[0149] Among them, p r (r k ) indicates the gray level is r k The probability of H and W are the height and width of the original underwater image, n k Indicates the gray level is r k The number of pixels, J represents the maximum gray level of the image, s k represents the mapping function, r j Indicates gray level (j=0~k).
[0150] 7.2 For bluish underwater images:
[0151]
[0152] Among them, I rc (x) represents the red channel after color correction, x represents the image pixel position, The pixel mean of the green channel representing the best background area, Represents the pixel mean of the red channel of the best background area found. r (x) is the red channel of the original underwater image, I g (x) is the green channel of the original underwater image; α is a constant that affects the color correction result. In this embodiment, the value of α is set to 1.6.
[0153] 7.3 For yellowish underwater images:
[0154]
[0155]
[0156] Among them, I gc (x) is the green channel after color correction, I bc (x) are the blue channels after color correction, The pixel mean of the green channel representing the best background area, The pixel mean of the red channel representing the best background area, The pixel mean of the blue channel representing the best background area; I r (x) is the red channel of the original underwater image, I g (x) is the green channel of the original underwater image, I b (x) is the blue channel of the original underwater image; α represents a constant that affects the color correction result. In this embodiment, the value of α is set to 1.6.
[0157] 7.4. For images without color cast Skip directly to step 8.
[0158] Step 8: Color corrected image I cor Convert to Lab color space; L represents the brightness channel, and a channel and b channel represent the color channels.
[0159] Step 9: Channel fusion: fuse the image enhancement image in the frequency domain with the color correction image in the spatial domain to obtain a contrast and color corrected image. The specific fusion process is to replace the color corrected image brightness channel L with I in the Lab space. en ; Because the value range of brightness L in Lab space is L∈[0,100], it is necessary to en After normalization,
[0160] The fusion formula is:
[0161]
[0162] in, For I en Normalized brightness channel matrix, I rLab is the final image fused in the Lab color space, α is the fusion coefficient, Lab: , : , a, Lab: , : , b are the color channels after color correction and transfer to the Lab color space.
[0163] Step 10: Lab color gamut image I after contrast enhancement and color correction rRGB Then convert back to RGB space to get the final output image.
[0164] Figure 7 The experimental results of the green, blue and yellow images proposed by the present invention are shown in the figure, where column a is the original underwater image, column b is the underwater image after contrast enhancement, column c is the underwater image after color correction, and column d is the final output image. The present invention combines spatial domain and frequency domain image processing, improves the image contrast in the frequency domain, and corrects the image color in the spatial domain; at the same time, in the Lab color space, the brightness channel of the contrast map in the frequency domain is integrated with the color channel of the color correction in the spatial domain, so as to achieve simultaneous improvement of the underwater image contrast map and color, and solve the problems of low contrast, color distortion, and blurred details of underwater images.
[0165] Embodiment 2:
[0166] In combination with the underwater image processing method disclosed in the first embodiment, this embodiment discloses a specific implementation example of an underwater image processing system (hereinafter referred to as “system”).
[0167] Reference Figure 8 As shown, the system comprises:
[0168] Image acquisition unit 1: acquire underwater images;
[0169] Contrast enhancement unit 2: performing contrast enhancement on the underwater image in the frequency domain;
[0170] Specifically, the contrast enhancement unit 2 includes:
[0171] Grayscale image conversion module 21: converts the underwater image into a grayscale image;
[0172] Image filtering module 22: converting the grayscale image into a frequency domain space by Fourier transform to obtain a frequency image, and filtering the frequency image by a homomorphic filter;
[0173] The histogram equalization module 23 converts the filtered frequency image into the spatial domain and performs contrast-limited adaptive histogram equalization to obtain the contrast-enhanced underwater image.
[0174] Color correction unit 3: performs color correction on the underwater image in the air domain;
[0175] Specifically, the color correction unit 3 includes:
[0176] The best background area search module 31 searches for the best background area of the underwater image using a quadtree search method;
[0177] Furthermore, the optimal background area search module 31 includes:
[0178] Region division module 311: divides the underwater image evenly into four regions;
[0179] Variance calculation module 312: calculates the variance of each region and determines whether the size of the region with the lowest score is less than a set size threshold;
[0180] Loop module 313: If yes, the area with the lowest score is taken as the best background area; if not, four areas are evenly divided based on the area with the lowest score, and the variance calculation step is recursively executed until the size of the area with the lowest score is smaller than the set size threshold, and the area is taken as the best background area.
[0181] Image color cast determination module 32: performing channel separation on the optimal background area, calculating the pixel mean of each channel, and determining whether the underwater image has color cast and the type of color cast according to the pixel mean;
[0182] Furthermore, the image color cast determination module 32 includes:
[0183] Channel separation module 321: separates the red, green and blue channels of the optimal background area, and calculates the pixel means of the red, green and blue channels respectively;
[0184] The color cast type determination module 322 determines whether the underwater image has color cast and the type of color cast according to the maximum value of the pixel means of the red, green and blue channels.
[0185] If the maximum value is the pixel mean of the green channel, the underwater image is a green-leaning underwater image; if the maximum value is the pixel mean of the blue channel, the underwater image is a blue-leaning underwater image; if the maximum value is the pixel mean of the red channel, the underwater image is a yellow-leaning underwater image;
[0186] If the pixel means of the green, blue and red channels are all equal, then there is no color cast in the underwater image.
[0187] The color cast correction module 33 performs color correction on underwater images of different color cast types by using different color correction algorithms to obtain the color-corrected underwater images.
[0188] Image fusion unit 4: performs channel fusion of the contrast-enhanced underwater image and the color-corrected underwater image in the Lab color space to obtain a final output image.
[0189] Specifically, the image fusion unit 4 includes:
[0190] Channel fusion module 41: replaces the brightness channel of the underwater image after color correction with the brightness channel of the underwater image after contrast enhancement in Lab color space to obtain a Lab color map;
[0191] Output image acquisition module 42: converts the Lab color gamut image into RGB space to obtain the final output image.
[0192] like Figure 7 As shown, it is a diagram showing the effect of the present invention on each step of image processing in different scenes. It can be seen that the contrast and color cast correction of the final fused image are significantly improved.
[0193] like Fig. 9 As shown in the figure, it is an experimental effect diagram of the present invention and other algorithms in different scenes. It can be seen from the effect diagram that the SSR algorithm and the MSR algorithm can enhance the contrast of the image, but have almost no effect on the color correction of the image; the DCP has little effect on the contrast and color correction of green and blue images, and is effective in improving the contrast of yellowish images, but has no color correction; the method proposed in the present invention can improve the image contrast in different scenes and remove the image color cast.
[0194] Table 1 shows an objective evaluation of various algorithms using the no-reference underwater color image quality evaluation standard UCIQE. This standard uses a linear combination of chroma, saturation and contrast for quantitative evaluation. The larger the value of this evaluation index, the better the color and contrast of the color image. From the data in the table, it can be seen that the mean value of the algorithm of the present invention is higher than that of other methods, indicating that the processing effect of this method is better than that of other algorithms.
[0195] Table 1 Comparison of UCIQE of the processing results of the algorithm of the present invention and other algorithms
[0196] Serial number Original image SSR MSR DCP Algorithm of the present invention Figure 7 a 0.328 0.375 0.304 0.330 0.457 Figure 7 b 0.340 0.396 0.398 0.405 0.413 Figure 7 c 0.333 0.387 0.412 0.384 0.406 Ave 0.334 0.386 0.371 0.373 0.425
[0197] For the technical solutions of the underwater image processing system disclosed in this embodiment and the underwater image processing method disclosed in the first embodiment, please refer to the description of the first embodiment, which will not be repeated here.
[0198] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0199] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. An underwater image processing method, characterized in that: include: Image acquisition step: acquiring underwater images; Contrast enhancement step: performing contrast enhancement on the underwater image in the frequency domain; Color correction step: performing color correction on the underwater image in the air domain; Image fusion step: The contrast-enhanced underwater image and the color-corrected underwater image are fused in the Lab color space to obtain the final output image. The color correction step comprises: The best background area search step: using a quadtree search method to search for the best background area of the underwater image; Image color cast determination step: performing channel separation on the optimal background area, calculating the pixel mean of each channel, and determining whether the underwater image has color cast and the type of color cast according to the pixel mean; Color cast correction step: performing color correction on underwater images of different color cast types using different color correction algorithms to obtain the color-corrected underwater images. The optimal background area search step comprises: Region division step: evenly dividing the underwater image into four regions; Variance calculation step: Calculate the variance of each region and determine whether the size of the region with the lowest score is less than the set size threshold; Loop step: If yes, the area with the lowest score is taken as the best background area; if not, four areas are evenly divided based on the area with the lowest score, and the variance calculation step is recursively executed until the size of the area with the lowest score is less than the set size threshold, and the area is taken as the best background area. The best background area scoring formula is expressed as: in, represents the score of the kth region, n represents the number of pixels in the region, c∈{r, g, b} represents the red, green and blue color channels of the image, x represents the pixel coordinates, represents the mean value of image pixels in the kth region, represents the image pixel value of the kth region, represents the red pixel value of the kth region, represents the green pixel value of the kth region, Represents the blue pixel value of the kth region.
2. The underwater image processing method according to claim 1, characterized in that: The contrast enhancement step comprises: Grayscale image conversion step: converting the underwater image into a grayscale image; Image filtering step: converting the grayscale image into a frequency domain space using Fourier transform to obtain a frequency image, and filtering the frequency image using a homomorphic filter; Histogram equalization step: converting the filtered frequency image into the spatial domain and performing contrast-limited adaptive histogram equalization to obtain the contrast-enhanced underwater image.
3. The underwater image processing method according to claim 1, characterized in that: The image color cast determination step comprises: Channel separation step: separating the red, green and blue channels of the optimal background area, and calculating the pixel means of the red, green and blue channels respectively; Color cast type judgment step: judging whether the underwater image has color cast and the type of color cast according to the maximum value of the pixel means of the red, green and blue channels.
4. The underwater image processing method according to claim 3, characterized in that: The color cast type determination step comprises: If the maximum value is the pixel mean of the green channel, the underwater image is a green-leaning underwater image; If the maximum value is the pixel mean of the blue channel, the underwater image is a blue underwater image; If the maximum value is the pixel mean of the red channel, the underwater image is a yellowish underwater image; If the pixel means of the green, blue and red channels are all equal, then there is no color cast in the underwater image.
5. The underwater image processing method according to claim 1, characterized in that: The image fusion step comprises: Channel fusion step: replacing the brightness channel of the underwater image after color correction with the brightness channel of the underwater image after contrast enhancement in the Lab color space to obtain a Lab color map; Output image acquisition step: converting the Lab color gamut image into RGB space to obtain the final output image.
6. An underwater image processing system, used to implement the underwater image processing method according to any one of claims 1 to 5, characterized in that: include: Image acquisition unit: acquire underwater images; Contrast enhancement unit: performing contrast enhancement on the underwater image in the frequency domain; Color correction unit: performing color correction on the underwater image in the airspace; Image fusion unit: The underwater image after contrast enhancement and the underwater image after color correction are fused in the Lab color space to obtain the final output image.
7. The underwater image processing system according to claim 6, characterized in that: The contrast enhancement unit comprises: Grayscale image conversion module: converting the underwater image into a grayscale image; Image filtering module: converting the grayscale image into frequency domain space by Fourier transform to obtain a frequency image, and filtering the frequency image by homomorphic filter; Histogram equalization module: converts the filtered frequency image into the spatial domain and performs contrast-limited adaptive histogram equalization to obtain the contrast-enhanced underwater image.
8. The underwater image processing system according to claim 6, characterized in that: The color correction unit comprises: The best background area search module uses a quadtree search method to search for the best background area of the underwater image; Image color cast discrimination module: performing channel separation on the optimal background area, calculating the pixel mean of each channel, and judging whether the underwater image has color cast and the type of color cast according to the pixel mean; Color cast correction module: performs color correction on underwater images of different color cast types using different color correction algorithms to obtain the color-corrected underwater images.
Citation Information
Patent Citations
Underwater image enhancement method based on color correction and detail enhancement
CN110689587A
Image enhancement algorithm based on wavelet transform and fusing high-frequency and low-frequency information
CN111583123A