Image enhancement method, apparatus, storage medium, and computer program product

By performing color equalization, contrast optimization, and grayscale adjustment on underwater images, the problems of speed, consistency of effect, noise sensitivity, and robustness of existing underwater image enhancement methods are solved, achieving high-quality visual effects and color reproduction of the images.

CN119090977BActive Publication Date: 2026-06-23CHINA TELECOM CORP LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CORP LTD
Filing Date
2024-08-14
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Existing underwater image enhancement methods have shortcomings in processing speed, consistency of results, noise sensitivity, robustness, and parameter adjustment, resulting in poor underwater image quality and visual effects.

Method used

By performing color equalization, contrast optimization, and grayscale adjustment on the original image, including RGB color decomposition, adaptive color equalization, adaptive histogram equalization, and histogram stretching algorithms, the color distribution, contrast, and grayscale adjustment of the image are improved.

Benefits of technology

It significantly improves the visual quality and color reproduction of underwater images, enhances image clarity and detail, and improves overall image brightness and dynamic range.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119090977B_ABST
    Figure CN119090977B_ABST
Patent Text Reader

Abstract

The application discloses an image enhancement method and device, a storage medium and a computer program product. The method comprises the following steps: obtaining an original image, wherein the original image comprises a plurality of pixel points with a first pixel value; performing color balance processing on the first pixel value of each pixel point in the original image to obtain a first intermediate image, wherein the first intermediate image comprises a plurality of pixel points with a second pixel value, and the second pixel value is obtained by performing color balance processing on the first pixel value of the corresponding pixel point; performing contrast optimization on the second pixel value of each pixel point in the first intermediate image to obtain a second intermediate image, wherein the second intermediate image comprises a plurality of pixel points with a third pixel value; and performing gray scale adjustment on the third pixel value of each pixel point in the second intermediate image to obtain an enhanced target image. The application solves the technical problem that the visual quality and color restoration of an image after being enhanced by a related algorithm are poor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image enhancement technology, and more specifically, to an image enhancement method, apparatus, storage medium, and computer program product. Background Technology

[0002] Underwater activities such as underwater archaeology, underwater environmental protection, underwater topographic scanning, and autonomous underwater navigation all rely heavily on underwater vision technology. Therefore, obtaining clear underwater images plays a crucial role in ocean exploration. The imaging process for underwater images differs significantly from that for outdoor images. Due to the selective attenuation of light wavelengths in water, light scattering in the complex underwater environment, and artificial light sources, underwater images often exhibit color casts, blurriness, and low visibility. Therefore, underwater image enhancement technology has become a key method for improving the quality and visualization of underwater images.

[0003] However, most existing image enhancement methods still have the following problems when processing underwater images: (1) They have problems with processing speed and are slow when processing images; (2) They work well for certain types of images, but may not work well for other types of images; (3) They are sensitive to noise, which leads to noise or artifacts in the enhanced image; (4) They are not robust enough for complex lighting conditions or irregular lighting distributions; (5) When processing images, multiple parameters need to be adjusted or set, which may require users to do some trial and error or optimization.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] This application provides an image enhancement method, apparatus, storage medium, and computer program product to at least solve the technical problem of poor visual quality and color reproduction of images after enhancement by related algorithms.

[0006] According to one aspect of the embodiments of this application, an image enhancement method is provided, comprising: acquiring an original image to be processed, wherein the original image includes a plurality of pixels with a first pixel value; performing color equalization processing on the first pixel value of each pixel in the original image to obtain a first intermediate image, wherein the first intermediate image includes a plurality of pixels with a second pixel value, and the second pixel value is obtained by performing color equalization processing on the first pixel value of the corresponding pixel; performing contrast optimization on the second pixel value of each pixel in the first intermediate image to obtain a second intermediate image, wherein the second intermediate image includes a plurality of pixels with a third pixel value; and performing grayscale adjustment on the third pixel value of each pixel in the second intermediate image to obtain an enhanced target image.

[0007] Optionally, color equalization processing is performed on the first pixel value of each pixel in the original image to obtain a first intermediate image, including: determining the first pixel value of multiple pixels in the original image, wherein the first pixel value is an RGB color value; performing RGB color decomposition on the first pixel value of multiple pixels in the original image to obtain three first color component values ​​of each pixel in the RGB three color channels; performing color equalization processing on the three first color component values ​​of each pixel in the RGB three color channels to obtain three second color component values ​​of each pixel in the RGB three color channels, wherein the color equalization processing includes at least: enhancement processing and normalization processing; determining the second pixel value of each pixel based on the three second color component values ​​of each pixel in the RGB three color channels, and obtaining the first intermediate image based on the second pixel value of each pixel.

[0008] Optionally, color equalization processing is performed on the three first color component values ​​of each pixel in the RGB color channels to obtain the three second color component values ​​of each pixel in the RGB color channels. This includes: for each pixel, enhancing the three first color component values ​​of the pixel in the RGB color channels to obtain the corresponding three third color component values; and standardizing the three third color component values ​​of the pixel in the RGB color channels to obtain the corresponding three second color component values.

[0009] Optionally, the three first color component values ​​of the pixel in the three RGB color channels are enhanced to obtain the corresponding three third color component values, including: normalizing the first color component values ​​of the pixel in each color channel; traversing each pixel using a preset sliding window, and determining the third color component values ​​of each pixel based on a preset enhancement ratio, a preset window step size, the position coordinates of the pixel in the original image, and the normalized first color component values.

[0010] Optionally, the three third color component values ​​of a pixel in the RGB three color channels are standardized to obtain the corresponding three second color component values. This includes: determining three first color histograms corresponding to the RGB three color channels based on the third color component values ​​of multiple pixels in each color channel in the original image; determining the maximum non-zero color component value and the minimum non-zero color component value in each first color histogram; and adjusting the third color component value of a pixel in each color channel based on the maximum non-zero color component value and the minimum non-zero color component value in the first color histogram corresponding to the color channel to obtain the corresponding second color component value.

[0011] Optionally, the contrast optimization of the second pixel values ​​of each pixel in the first intermediate image to obtain the second intermediate image includes: dividing the first intermediate image into multiple non-overlapping sub-blocks and determining the second pixel value of each pixel in each sub-block, wherein the second pixel value is determined by the three second color component values ​​of the pixel in the RGB color channels; for each sub-block, determining three second color histograms of the sub-block in the RGB color channels based on the second pixel values ​​of each pixel in the sub-block; determining the cumulative distribution function of the sub-block in the RGB color channels based on the three second color histograms, wherein the cumulative distribution function is used to characterize the cumulative probability density of the color component values ​​of each pixel in the sub-block being the second color component values; for the second color component values ​​of the sub-block in each color channel, determining a mapping function based on the cumulative distribution function, and mapping the second color component values ​​according to the mapping function to obtain the corresponding fourth color component values; determining the third pixel value of each pixel based on the three fourth color component values ​​of each pixel in the RGB color channels, and obtaining the second intermediate image based on the third pixel values ​​of each pixel.

[0012] Optionally, the third pixel value of each pixel in the second intermediate image is adjusted to grayscale to obtain the enhanced target image. This includes: determining the third pixel value of multiple pixels in the second intermediate image, wherein the third pixel value is a grayscale value, and the grayscale value is determined by the three fourth color components of the pixel in the RGB color channels; determining the pixel histogram of the second intermediate image based on the third pixel value of each pixel, and determining the maximum non-zero pixel value and the minimum non-zero pixel value based on the pixel histogram; for each third pixel value, adjusting the third pixel value based on the maximum non-zero pixel value, the minimum non-zero pixel value, and a preset control parameter to obtain the corresponding fourth pixel value, and using the fourth pixel value as the pixel value of the corresponding pixel in the second intermediate image, wherein the control parameter is used to control the adjustment range, and the larger the control parameter, the smaller the adjustment range, and vice versa; and obtaining the enhanced target image based on the fourth pixel value of each pixel.

[0013] According to another aspect of the embodiments of this application, an image enhancement apparatus is also provided, comprising: an acquisition module for acquiring an original image to be processed, wherein the original image includes a plurality of pixels with pixel values ​​of a first pixel value; a first processing module for performing color equalization processing on the first pixel values ​​of each pixel in the original image to obtain a first intermediate image, wherein the first intermediate image includes a plurality of pixels with pixel values ​​of a second pixel value, and the second pixel value is obtained by performing color equalization processing on the first pixel values ​​of the corresponding pixels; a second processing module for performing contrast optimization on the second pixel values ​​of each pixel in the first intermediate image to obtain a second intermediate image, wherein the second intermediate image includes a plurality of pixels with pixel values ​​of a third pixel value; and a third processing module for performing grayscale adjustment on the third pixel values ​​of each pixel in the second intermediate image to obtain an enhanced target image.

[0014] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-described image enhancement method by running the computer program.

[0015] According to another aspect of the embodiments of this application, a computer program product is also provided, the computer program product including a stored computer program, wherein the computer program implements the above-described image enhancement method when executed by a processor.

[0016] In this embodiment, an original image to be processed is obtained, wherein the original image includes multiple pixels with a first pixel value; color equalization processing is performed on the first pixel value of each pixel in the original image to obtain a first intermediate image, wherein the first intermediate image has a more uniform color distribution and is closer to the color of the real image than the original image; contrast optimization is performed on the second pixel value of each pixel in the first intermediate image to obtain a second intermediate image, wherein the second intermediate image has significantly enhanced image details and contrast compared to the first intermediate image, making the image clearer and more visually impactful; grayscale adjustment is performed on the third pixel value of each pixel in the second intermediate image to obtain an enhanced target image, wherein the target image has a wider grayscale value distribution range compared to the second intermediate image, thereby improving the overall brightness and dynamic range of the image, thus solving the technical problem of poor visual quality and color reproduction after image enhancement by related algorithms. Attached Figure Description

[0017] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0018] Figure 1 This is a hardware structure block diagram of an optional computer terminal (or mobile device) for implementing an image enhancement method according to an embodiment of this application;

[0019] Figure 2 This is a flowchart illustrating an optional image enhancement method according to an embodiment of this application;

[0020] Figure 3 This is a visual analysis comparison diagram of an optional multi-type image enhancement method according to an embodiment of this application;

[0021] Figure 4 This is a schematic diagram of an optional image enhancement device according to an embodiment of this application;

[0022] Figure 5 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of this application. Detailed Implementation

[0023] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0025] Furthermore, all information and data (including but not limited to user device information, user personal information, etc.) involved in this application are information and data authorized by the user or fully authorized by all parties. For example, this system has an interface with the relevant user or organization. Before obtaining relevant information, it needs to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving consent from the aforementioned user or organization.

[0026] To better understand the embodiments of this application, the technical terms involved in the embodiments of this application are explained below:

[0027] A pixel is the smallest controllable unit in a digital image, that is, the basic element that makes up a digital image. Each pixel contains information about the color and brightness of the image, and by combining pixels of different colors, rich image content can be presented. In digital image processing and computer graphics, the pixel is the basic unit of image processing and display.

[0028] Pixel value: This refers to the grayscale value or color component value of each pixel in a digital image. In digital image processing, pixel values ​​are typically used to represent information such as brightness and color in an image. Common pixel value ranges from 0 to 255, representing different grayscale levels from black to white. In color images, each pixel is usually composed of pixel values ​​from three channels (red, green, and blue) to represent different colors.

[0029] Contrast ratio: refers to the degree of difference in brightness or color between adjacent pixels in a digital image. The higher the contrast ratio, the more obvious the differences between different areas in the image, thus making the image clearer and more vivid.

[0030] Automatic Color Equalization (ACE) is an image processing technique used to adjust the color distribution of an image, making its color histogram more uniform. Therefore, this algorithm can improve the visual quality of an image, especially in cases of uneven color distribution or where certain color channels are too bright or too dark.

[0031] Fast Automatic Color Equalization (Fast ACE) is a technique for image color equalization, designed to improve the visual quality of images by making the brightness and color distribution more uniform. Its core idea is to adjust the image's histogram to achieve a more even distribution of brightness.

[0032] Adaptive Histogram Equalization (AHE) is a technique for enhancing image contrast, particularly suitable for enhancing contrast in local regions. Its basic idea is to divide the image into multiple small regions and perform histogram equalization on each region separately.

[0033] Peak Signal-to-Noise Ratio (PSNR): This refers to the level of distortion produced by image enhancement operations compared to the original ideally lit image. An increase in PSNR indicates less distortion and represents an improvement in image quality.

[0034] Structural Similarity Index (SSIM): This refers to the degree of structural similarity between the enhanced image and the original image. An increase in the SSIM value indicates that the structures of the two images are more similar.

[0035] Tone Mapping Quality Index (TMQI): Based on the principle of SSIM, it is used to evaluate whether the color of the enhanced image maintains consistency with the original image, and the higher the TMQI value, the higher the color consistency of the image.

[0036] The Natural Image Quality Evaluator (NIQE) is a model built on the statistical characteristics of natural scenes. It evaluates images using a set of statistical characteristics of quality perception. The lower the NIQE value, the closer the image quality is to human visual preferences.

[0037] Perceptual Contrast Quality Index (PCQI): Used to evaluate the contrast of local areas, and the higher the PCQI value, the better the contrast is achieved during image enhancement.

[0038] Luminance Order Error (LOE): It is based on the relative order of the luminance sequence to determine the naturalness of an image. The lower the LOE value, the smaller the luminance error and the better the naturalness of the image.

[0039] Example 1

[0040] According to an embodiment of this application, an embodiment of an image enhancement method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0041] The method provided in this application relates to the field of artificial intelligence technology. The image enhancement method provided in this application can be applied to a terminal, a server, or software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application implementing the image enhancement method, but is not limited to the above forms.

[0042] Figure 1 A hardware block diagram of a computer terminal (or mobile device) for implementing an image enhancement method is shown. Figure 1 As shown, the computer terminal 10 (or mobile device 10) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0043] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0044] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the image enhancement method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the image enhancement method of the application described above. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0045] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0046] The display can be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).

[0047] Under the above operating environment, Figure 2 This is a flowchart illustrating an optional image enhancement method according to an embodiment of this application, such as... Figure 2 As shown, the method includes at least steps S202-S208, wherein:

[0048] Step S202: Obtain the original image to be processed.

[0049] In the technical solution provided in step S202, the original image can be understood as the image to be enhanced, such as an underwater image. Due to the absorption and scattering characteristics of water, light is greatly attenuated when it propagates in water. Problems such as light attenuation, background light scattering, and scattering of light by plankton and suspended particles in the underwater environment lead to noise and distortion in the image, resulting in poor image quality. Therefore, the first pixel value of multiple pixels in the original image is generally low.

[0050] Step S204: Perform color equalization processing on the first pixel value of each pixel in the original image to obtain the first intermediate image.

[0051] In the technical solution provided in step S204, the first pixel value of each pixel in the original image is processed by color equalization to obtain the second pixel value of each pixel, and the first intermediate image is composed of the pixels with the second pixel value. Compared with the original image, the color distribution is more balanced and the color bars are more uniform, so the image quality is initially improved.

[0052] Step S206: Perform contrast optimization on the second pixel values ​​of each pixel in the first intermediate image to obtain the second intermediate image.

[0053] In the technical solution provided in step S206, by optimizing the color contrast of the second pixel value of each pixel in the first intermediate image, the third pixel value of each pixel is obtained, and the second intermediate image is composed of the pixels with the third pixel value. Compared with the first intermediate image, the visibility and clarity of local details of the image are improved. For example, the brighter or darker areas are equalized, making the image clearer, fuller, and more prominent, thus further improving the image quality.

[0054] Step S208: Adjust the grayscale value of the third pixel of each pixel in the second intermediate image to obtain the enhanced target image.

[0055] In the technical solution provided in step S208, by adjusting the grayscale value of the third pixel of each pixel in the second intermediate image, the final enhanced target image is obtained. Compared with the second intermediate image, the grayscale difference between different regions in the image is more obvious, which enhances the contrast of the image and makes the visual effect of the image more outstanding.

[0056] The method described in this embodiment will be further described below.

[0057] As an optional implementation, in the technical solution provided in step S202 above, the original image can be acquired in the following ways, including: acquiring the original image by equipping the robot with a high-definition camera, acquiring the original image by using a camera, etc.

[0058] As an optional implementation, in the technical solution provided in step S204 above, the original image can be color balanced using an automatic color balance algorithm, following the steps below:

[0059] Step S2041: Determine the first pixel value of multiple pixels in the original image.

[0060] The pixel value of a pixel usually refers to the RGB color value or grayscale value of the pixel. Since step S204 is to perform color equalization processing on the image, only the RGB color value of the pixel is considered in the entire processing. Therefore, the first pixel value mentioned above is the RGB color value (with a value range of 0 to 255).

[0061] Step S2042: Perform RGB color decomposition on the first pixel values ​​of multiple pixels in the original image to obtain the three first color component values ​​of each pixel in the RGB three color channels.

[0062] Specifically, step S2042 decomposes the RGB color values ​​of multiple pixels in the original image into three RGB color channels, resulting in three first color component values ​​for each pixel in each of the three RGB color channels. That is, for each pixel, there is one first color component value in each of the three RGB color channels: the first color component value corresponding to the red channel, the first color component value corresponding to the green channel, and the first color component value corresponding to the blue channel. Each color channel includes the color component values ​​of multiple pixels in the original image for the corresponding color.

[0063] For example, if the RGB color value of a pixel is (255,0,0), then the first color component value corresponding to its red channel is 255, and the first color component values ​​corresponding to its green and blue channels are both 0.

[0064] Step S2043: Perform color equalization processing on the three first color component values ​​of each pixel in the three RGB color channels to obtain the three second color component values ​​of each pixel in the three RGB color channels.

[0065] Specifically, step S2043 involves performing color equalization processing on the first color component values ​​of each pixel in the three RGB color channels to obtain three second color component values ​​of each pixel in the three RGB color channels. The second color component values ​​of each pixel in each RGB color channel have a more balanced color component distribution compared to the first color component values ​​of each pixel in each RGB color channel.

[0066] Step S2044: Determine the second pixel value of each pixel based on the three second color component values ​​in the RGB three color channels, and obtain the first intermediate image based on the second pixel value of each pixel.

[0067] Specifically, step S2044 involves combining the second color component values ​​of each pixel in the RGB three color channels to obtain the second pixel value of each pixel, i.e., the RGB color value; then, the newly determined RGB color value is applied to each pixel to generate the first intermediate image.

[0068] Optionally, in the technical solution provided in step S2043 above, color equalization processing includes at least: enhancement processing and normalization processing. Therefore, for each pixel in the image, color equalization processing can be implemented according to the following method:

[0069] Step S1: Enhance the three first color component values ​​of the pixel in the three RGB color channels respectively to obtain the corresponding three third color component values.

[0070] Specifically, the first color component value of a pixel in the R, G, and B color channels can be enhanced in the following way:

[0071] Step 1: Normalize the first color component value.

[0072] The normalization process described above can be achieved by dividing the first color component value of a pixel in the corresponding color channel by 255, thereby limiting the range of the first color component value to between 0 and 1.

[0073] Step 2: Use a preset sliding window to traverse each pixel, and determine the third color component value of each pixel based on the preset enhancement ratio, preset window step size, the position coordinates of the pixel in the original image, and the normalized first color component value.

[0074] First, the entire image is divided into multiple sub-blocks, and the local enhancement parameter matrix P corresponding to each sub-block is obtained using the following formula, which can be written as:

[0075]

[0076] Where (x,y) represents the pixel within the sub-block with x-coordinate and y-coordinate, P x,y This represents an element within the local enhancement parameter matrix P corresponding to the sub-block. Therefore, when (x,y) = (0,0), it indicates that the element is the center of the matrix.

[0077] Then, the local enhancement parameter matrix P is normalized according to the following formula, so that the sum of all elements in the local enhancement parameter matrix P is 1:

[0078]

[0079] Where, sum(P) n,m ) represents all elements P in the local enhancement parameter matrix P corresponding to the sub-block. x,y The sum of x and y, where x takes values ​​in the range of (-n, n) and y takes values ​​in the range of (-m, m).

[0080] Finally, for each sub-block, a preset local sliding window is used to traverse all pixels in the sub-block in turn with a certain step size, and the third color component value corresponding to each pixel is obtained by the following formula.

[0081]

[0082] Where r represents the radius of the local sliding window, C represents the enhancement ratio (also known as the magnification ratio), and I x,y The second color component value, I, represents the pixel at position coordinates (x, y). x+i,y+j P represents the first color component value (i.e., the color component value between 0 and 1) of the pixel at position coordinates (x+i, y+i) in the corresponding color channel. i+r,j+r This represents the local enhancement parameters for the pixel with position coordinates (x+i, y+i).

[0083] Step 3: Obtain the enhanced color channel based on the third color component value of each pixel.

[0084] Step S2: Standardize the three third color component values ​​of the pixel in the three RGB color channels to obtain the corresponding three second color component values.

[0085] Step 1: Determine the three first color histograms corresponding to the RGB three color channels based on the third color component values ​​of multiple pixels in each color channel of the original image.

[0086] In other words, the third color component values ​​of multiple pixels in the original image on the R, G, and B color channels are summarized to obtain three first color histograms for each of the RGB color channels. These first color histograms are used to visually display the distribution of the third color components of all pixels in the original image in each color channel.

[0087] Step 2: Determine the maximum and minimum non-zero color component values ​​within each first color histogram.

[0088] Among them, the maximum non-zero color component value and the minimum non-zero color component value are the non-zero color component values ​​with the largest and smallest values ​​in the color histogram.

[0089] Step 3: For the third color component value of a pixel in each color channel, adjust the third color component value based on the maximum and minimum non-zero color component values ​​in the first color histogram corresponding to the color channel to obtain the corresponding second color component value.

[0090] Specifically, the second color component mentioned above can be obtained by the following formula:

[0091]

[0092] Among them, the above I x,y This represents the second color component value of the pixel at position (x,y) in the corresponding color channel of the original image. min(I) and max(I) represent the minimum and maximum non-zero color component values ​​in the corresponding color channels of the original image, respectively. x,y The second color component value represents the pixel at position (x,y) in the original image, which is normalized to the range [0,1].

[0093] It should be noted that the above method yields second color component values ​​for each pixel in the R, G, and B color channels, all of which are decimals between 0 and 1. Therefore, it is necessary to convert the second color component values ​​to integers between 0 and 255, which can be done by multiplying the second color component value by 255.

[0094] Therefore, by performing color equalization processing on the first pixel value (i.e., RGB color value) of each pixel in the original image using the automatic color equalization algorithm provided in steps S2041-S2044 above, the following effects can be achieved:

[0095] (1) Enhance the color distribution of the image to improve the visual effect, making the colors of the image more vivid and the contrast stronger;

[0096] (2) Eliminate color deviations in the image caused by factors such as lighting conditions and camera equipment, so that all details in the image have a consistent tone and visual effect;

[0097] (3) Enhance the details and contrast of the image, reduce problems such as underexposure or overexposure, and make the image clearer and more vivid.

[0098] Furthermore, in order to make the detail contrast within the first intermediate image after color equalization more balanced, this application embodiment also proposes to adjust and improve the contrast level of the image by means of an adaptive histogram equalization algorithm.

[0099] As an optional implementation, in the technical solution provided in step S206 above, the first intermediate image can be contrast optimized using an adaptive histogram equalization algorithm, following the steps below:

[0100] Step S2061: Divide the first intermediate image into multiple non-overlapping sub-blocks and determine the second pixel value of each pixel point in each sub-block.

[0101] The first intermediate image is divided into multiple non-overlapping sub-blocks of equal size, denoted as W(x,y), and each sub-block includes at least one pixel (x,y), and the second pixel value of the pixel is determined by the three second color component values ​​of the pixel in the RGB three color channels.

[0102] Step S2062: For each sub-block, determine three second color histograms of the sub-block on the three RGB color channels based on the second pixel value of each pixel point in the sub-block.

[0103] In other words, the values ​​of the three second color components of each pixel in the R, G, and B color channels are statistically analyzed to obtain three second color histograms for the RGB color channels. Each second color histogram is used to visually display the distribution of the second color components of all pixels in each color channel within the sub-block.

[0104] Step S2063: Determine the cumulative distribution function of the sub-block in the three RGB color channels based on the three second color histograms, and determine the mapping function based on the cumulative distribution function.

[0105] For each color channel, let P(x,y,z) represent the probability density that the second color component value of a pixel (x,y) in the sub-block W(x,y) is equal to z in that color channel. Then the cumulative distribution function CDF(x,y,z) of the sub-block in that color channel can be expressed as: Where CDF(x,y,z) represents the cumulative probability density of pixel values ​​less than or equal to z in region W(x,y). Therefore, the cumulative distribution function is used to characterize the cumulative probability density of each pixel within a sub-block having a color component value equal to the second color component value. Then, the mapping function is determined by the following formula: T(z) = CDF -1 (z), where the above mapping function can map the second color component value to a new color component value.

[0106] Step S2064: For the second color component value of the sub-block in each color channel, the second color component value is mapped according to the mapping function to obtain the corresponding fourth color component value.

[0107] Specifically, the mapping function of the sub-block on each color channel is applied to map the second color component value of each pixel in the corresponding color channel to obtain the fourth color component value.

[0108] Step S2065: Determine the third pixel value of each pixel based on the three fourth color component values ​​in the RGB three color channels, and obtain the second intermediate image based on the third pixel value of each pixel.

[0109] Specifically, step S2065 involves combining the fourth color component values ​​of each pixel in the RGB three color channels to obtain the third pixel value, i.e., the RGB color value, of each pixel; then, the newly determined RGB color value is applied to each pixel to generate the second intermediate image.

[0110] Therefore, by using the adaptive histogram equalization provided in steps S2061-S2065 to optimize the contrast of the second pixel values ​​(i.e., RGB color values) of each pixel in the first intermediate image, the following effects can be achieved:

[0111] (1) By equalizing the histogram of local regions, the details in the image can be significantly enhanced, especially the darker or brighter areas will be equalized, making the details more obvious;

[0112] (2) Adjust the contrast of different areas in the image to make the bright and dark parts of the image more clearly visible.

[0113] Furthermore, in order to make the contrast-optimized second intermediate image clearer, this application embodiment also proposes to adjust and improve the grayscale of the image by using a histogram stretching algorithm.

[0114] As an optional implementation, in the technical solution provided in step S208 above, the grayscale of the second intermediate image can be adjusted using a histogram stretching algorithm, following the steps below:

[0115] Step S2081: Determine the third pixel value of multiple pixels in the second intermediate image.

[0116] Since this step adjusts the image grayscale, only the grayscale value of each pixel is considered in the entire processing. Therefore, the third pixel value mentioned above is a grayscale value (ranging from 0 to 255, where 0 represents black and 255 represents white). The grayscale value of each pixel can be determined based on the three fourth color components of the pixel in the RGB color channels using the following formula: Grayscale value = A1 * the fourth color component value corresponding to the red channel + A2 * the fourth color component value corresponding to the green channel + A3 * the fourth color component value corresponding to the blue channel. Here, A1, A2, and A3 are weights, which can be set according to the actual application scenario.

[0117] Step S2082: Determine the pixel histogram of the second intermediate image based on the third pixel value of each pixel, and determine the maximum zero pixel value and the minimum non-zero pixel value within the grayscale histogram.

[0118] In other words, the pixel (grayscale) histogram corresponding to the second intermediate image is obtained by statistically analyzing the third pixel (grayscale) values ​​of each pixel, and this pixel histogram is used to intuitively reflect the distribution of the third pixel values ​​of each pixel in the image.

[0119] Step S2083: For each third pixel value, the third pixel value is adjusted based on the maximum non-zero pixel value, the minimum non-zero pixel value, and the preset control parameters to obtain the corresponding fourth pixel value, and the fourth pixel value is used as the pixel value of the corresponding pixel point in the second intermediate image.

[0120] The fourth pixel value mentioned above can be obtained using the following method:

[0121]

[0122] Where max(g) represents the maximum non-zero pixel (grayscale) value, min(g) represents the minimum non-zero pixel (grayscale) value, g represents the third pixel (grayscale) value, g′ represents the fourth pixel (grayscale) value, and C represents the control parameter. The control parameter C is used to control the adjustment range. The larger the control parameter C is, the smaller the adjustment range, and vice versa.

[0123] It should be noted that the value of the control parameter C can be determined by balancing the relationship between contrast enhancement and detail preservation as needed. Generally, a larger C value can be used to control detail preservation during the contrast enhancement process, which may be more suitable for images with rich details in both light and dark areas; while a smaller C value can be used to obtain a stronger contrast enhancement effect, which may be more suitable for images that need to enhance overall contrast. Generally, its value can be between 0.1 and 10.

[0124] Step S2084: Obtain the enhanced target image based on the fourth pixel value of each pixel.

[0125] In other words, the grayscale value of each pixel in the image is replaced with the grayscale value of the fourth pixel determined above to obtain the enhanced target image.

[0126] Therefore, by adjusting the third pixel value (i.e., grayscale value) of each pixel in the second intermediate image using the histogram stretching algorithm provided in steps S2081-S2084 above, the following effects can be achieved:

[0127] (1) By linearly mapping the gray values ​​between the minimum non-zero gray value and the maximum non-zero gray value, the gray value range of the image is expanded. This allows the gray values ​​that were originally similar in the image to have a large difference after stretching, thereby enhancing the contrast of the image and making the boundaries between objects in the image clearer.

[0128] (2) The grayscale range of the entire image is remapped to between 0 and 255, thereby expanding the grayscale range of the image. This means that the originally dark areas will become brighter and the originally bright areas will become darker, thus making the image have richer information at different grayscale values.

[0129] Based on the scheme defined in steps S202 to S208 above, it can be understood that in the embodiment, an original image to be processed is obtained, wherein the original image includes multiple pixels with a first pixel value; color equalization processing is performed on the first pixel value of each pixel in the original image to obtain a first intermediate image, wherein the first intermediate image has a more uniform color distribution and is closer to the color of the real image than the original image; contrast optimization is performed on the second pixel value of each pixel in the first intermediate image to obtain a second intermediate image, wherein the second intermediate image has significantly enhanced image details and contrast compared to the first intermediate image, making the image clearer and more visually impactful; grayscale adjustment is performed on the third pixel value of each pixel in the second intermediate image to obtain an enhanced target image, wherein the target image has a wider grayscale value distribution range compared to the second intermediate image, thereby improving the overall brightness and dynamic range of the image, and thus solving the technical problem of poor visual quality and color reproduction after image enhancement by related algorithms.

[0130] Furthermore, to verify the effectiveness of the above-mentioned scheme, this application uses underwater images from a classic underwater image processing dataset as the original images to be processed. Specifically, six types of underwater images—human figures, schools of fish, and corals—were selected for visual effect analysis. The image enhancement and enrichment of this application are compared with current mainstream machine learning image enhancement algorithms, including the MSR algorithm, the MSRCP algorithm, and the LIME algorithm, yielding the following results: Figure 3The visual effect comparison diagram is shown.

[0131] As can be seen from the visual effect comparison, various underwater image enhancement methods can improve the image quality of underwater images with poor shooting effects and blurry image quality. Among them, the MSR (Minimum Set Ratio) algorithm greatly preserves the color of the original image, but the image is still relatively blurry, and the enhancement effect is not good for images with foreground objects; the MSRCR (Minimum Set Ratio with Contrast Preservation) algorithm can highlight foreground objects and improve the enhancement effect, but it affects the color of the original image, resulting in color difference, and it does not enhance static objects such as corals; the LIME (Locally Interpretable Model-agnostic Explanations) algorithm highlights dynamic objects while preserving the original color of the image during image enhancement, and improves the contrast of the image to a certain extent, but the effect is not obvious and there is a slight halo phenomenon, and the contrast of dark areas of static images is not obvious and the brightness is low; the solution of this application, while preserving the original color of the image, performs specific enhancement on the foreground and dynamic objects, improves the contrast and brightness, avoids overexposure, and achieves the effect of underwater image enhancement. In summary, the image enhancement algorithm proposed in this application makes the enhanced underwater images appear clearer and more natural to the human eye.

[0132] In addition, this application also evaluates each enhancement method from an objective perspective, namely customer evaluation indicators, such as peak signal-to-noise ratio (PSNR), structural similarity index (SSIM), tone mapping image quality index (TMQI), no-reference image quality evaluation index (NIQE), block contrast quality index (PCQI), and luminance sorting error (LOE), and obtains the comparison results shown in Table 1 below.

[0133] Table 1

[0134] Evaluation indicators MSR algorithm MSRCR algorithm LIME algorithm This application proposal PSNR 14.5147 14.9573 12.0149 15.0702 SSIM 0.8864 0.9129 0.7351 0.9803 PCQI 1.1248 1.1683 0.8319 1.2016 TMQI 0.8512 0.9209 0.6284 0.9674 NIQE 2.4012 2.4694 2.0843 2.5318 LOE 21.6384 16.0711 40.1502 12.0539

[0135] As can be seen from Table 1 above, the proposed solution performs better in all indicators compared to other solutions. Furthermore, it should be noted that the proposed solution is not only applicable to underwater image capture but can also be widely used in fields such as environmental monitoring and marine engineering.

[0136] Example 2

[0137] Based on Embodiment 1 of this application, an embodiment of an image enhancement apparatus is also provided, which executes the image enhancement method described in the above embodiment when running. Wherein, Figure 4 This is a schematic diagram of an optional image enhancement device according to an embodiment of this application, such as... Figure 4 As shown, the image enhancement device includes at least an acquisition module 42, a first processing module 44, a second processing module 46, and a third processing module 48, wherein:

[0138] The acquisition module 42 is used to acquire the original image to be processed, wherein the original image includes multiple pixels with a pixel value of the first pixel value;

[0139] The first processing module 44 is used to perform color equalization processing on the first pixel value of each pixel in the original image to obtain a first intermediate image. The first intermediate image includes multiple pixels with second pixel values, and the second pixel values ​​are obtained by performing color equalization processing on the first pixel values ​​of the corresponding pixels.

[0140] The second processing module 46 is used to perform contrast optimization on the second pixel value of each pixel in the first intermediate image to obtain a second intermediate image, wherein the second intermediate image includes multiple pixels with a third pixel value.

[0141] The third processing module 48 is used to adjust the grayscale value of the third pixel of each pixel in the second intermediate image to obtain the enhanced target image.

[0142] It should be noted that each module in the above-mentioned image enhancement device can be a program module (e.g., a set of program instructions to implement a certain function) or a hardware module. For the latter, it can be manifested in the following forms, but is not limited to them: each of the above modules is manifested as a processor, or the functions of each of the above modules are implemented by a processor.

[0143] Example 3

[0144] According to an embodiment of this application, a non-volatile storage medium is also provided, which stores a program, wherein the program controls the device where the non-volatile storage medium is located to execute the image enhancement method in embodiment 1 when it runs.

[0145] Optionally, the device containing the non-volatile storage medium executes the following steps by running the program: acquiring an original image to be processed, wherein the original image includes multiple pixels with a first pixel value; performing color equalization processing on the first pixel value of each pixel in the original image to obtain a first intermediate image, wherein the first intermediate image includes multiple pixels with a second pixel value, and the second pixel value is obtained by performing color equalization processing on the first pixel value of the corresponding pixel; performing contrast optimization on the second pixel value of each pixel in the first intermediate image to obtain a second intermediate image, wherein the second intermediate image includes multiple pixels with a third pixel value; and adjusting the grayscale of the third pixel value of each pixel in the second intermediate image to obtain an enhanced target image.

[0146] According to an embodiment of this application, a computer program product is also provided, which includes a stored computer program, wherein the computer program implements the image enhancement method in embodiment 1 when executed by a processor.

[0147] Optionally, the computer program performs the following steps: acquiring an original image to be processed, wherein the original image includes multiple pixels with a first pixel value; performing color equalization processing on the first pixel value of each pixel in the original image to obtain a first intermediate image, wherein the first intermediate image includes multiple pixels with a second pixel value, and the second pixel value is obtained by performing color equalization processing on the first pixel value of the corresponding pixel; performing contrast optimization on the second pixel value of each pixel in the first intermediate image to obtain a second intermediate image, wherein the second intermediate image includes multiple pixels with a third pixel value; and adjusting the grayscale of the third pixel value of each pixel in the second intermediate image to obtain an enhanced target image.

[0148] According to an embodiment of this application, a processor is also provided for running a program, wherein the program executes the image enhancement method in embodiment 1 during runtime.

[0149] Optionally, the program executes the following steps during runtime: acquiring the original image to be processed, wherein the original image includes multiple pixels with a first pixel value; performing color equalization processing on the first pixel value of each pixel in the original image to obtain a first intermediate image, wherein the first intermediate image includes multiple pixels with a second pixel value, and the second pixel value is obtained by performing color equalization processing on the first pixel value of the corresponding pixel; performing contrast optimization on the second pixel value of each pixel in the first intermediate image to obtain a second intermediate image, wherein the second intermediate image includes multiple pixels with a third pixel value; and adjusting the grayscale of the third pixel value of each pixel in the second intermediate image to obtain the enhanced target image.

[0150] According to an embodiment of this application, an electronic device is also provided, wherein, Figure 5 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of this application, such as... Figure 5 As shown, the electronic device includes one or more processors; a memory for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to run the programs, wherein the programs are configured to execute the image enhancement method in Embodiment 1 above during runtime.

[0151] Optionally, the processor is configured to execute the following steps via a computer program: acquiring an original image to be processed, wherein the original image includes multiple pixels with a first pixel value; performing color equalization processing on the first pixel value of each pixel in the original image to obtain a first intermediate image, wherein the first intermediate image includes multiple pixels with a second pixel value, and the second pixel value is obtained by performing color equalization processing on the first pixel value of the corresponding pixel; performing contrast optimization on the second pixel value of each pixel in the first intermediate image to obtain a second intermediate image, wherein the second intermediate image includes multiple pixels with a third pixel value; and performing grayscale adjustment on the third pixel value of each pixel in the second intermediate image to obtain an enhanced target image.

[0152] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0153] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0154] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.

[0155] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0156] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0157] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to related technologies, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0158] The above are merely preferred embodiments of this application. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. An image enhancement method, characterized in that, include: Obtain the original image to be processed, wherein the original image includes multiple pixels with a first pixel value; A first intermediate image is obtained by performing color equalization processing on the first pixel value of each pixel in the original image. The first intermediate image includes multiple pixels with second pixel values, and the second pixel values ​​are obtained by performing color equalization processing on the first pixel values ​​of the corresponding pixels. The contrast of the second pixel value of each pixel in the first intermediate image is optimized to obtain the second intermediate image, wherein the second intermediate image includes multiple pixels with a third pixel value. Adjusting the grayscale value of the third pixel of each pixel in the second intermediate image to obtain the enhanced target image includes: determining the third pixel value of multiple pixels in the second intermediate image, wherein the third pixel value is a grayscale value, and the grayscale value is determined by the three fourth color components of the pixel in the RGB color channels; determining the pixel histogram of the second intermediate image based on the third pixel value of each pixel, and determining the maximum non-zero pixel value and the minimum non-zero pixel value based on the pixel histogram; for each third pixel value, adjusting the third pixel value based on the maximum non-zero pixel value, the minimum non-zero pixel value, and preset control parameters to obtain the corresponding fourth pixel value, and using the fourth pixel value as the pixel value of the corresponding pixel in the second intermediate image, wherein the expression of the fourth pixel value is written as: In the formula, This represents the value of the fourth pixel. This represents the maximum non-zero pixel value. The smallest non-zero pixel value is represented by g, the third pixel value is represented by C, and the control parameter is represented by C. The control parameter is used to control the adjustment range. The larger the control parameter is, the smaller the corresponding adjustment range is, and the smaller the control parameter is, the larger the corresponding adjustment range is. The enhanced target image is obtained based on the fourth pixel value of each pixel.

2. The method according to claim 1, characterized in that, The first intermediate image is obtained by performing color equalization processing on the first pixel value of each pixel in the original image, including: Determine the first pixel value of a plurality of pixels in the original image, wherein the first pixel value is an RGB color value; The first pixel values ​​of multiple pixels in the original image are decomposed into RGB colors to obtain the three first color component values ​​of each pixel in the three RGB color channels. Color equalization processing is performed on the three first color component values ​​of each pixel in the three RGB color channels to obtain the three second color component values ​​of each pixel in the three RGB color channels. The color equalization processing includes at least: enhancement processing and normalization processing. The second pixel value of each pixel is determined based on the three second color component values ​​in the three color channels of RGB, and the first intermediate image is obtained based on the second pixel value of each pixel.

3. The method according to claim 2, characterized in that, Color equalization processing is performed on the three first color component values ​​of each pixel in the RGB three color channels to obtain the three second color component values ​​of each pixel in the RGB three color channels, including: For each pixel, the three first color component values ​​of the pixel in the three RGB color channels are enhanced to obtain the corresponding three third color component values. The three third color component values ​​of the pixel in the three RGB color channels are standardized to obtain the corresponding three second color component values.

4. The method according to claim 3, characterized in that, The three first color component values ​​of the pixel in the RGB three color channels are enhanced respectively to obtain the corresponding three third color component values, including: For the first color component value of the pixel in each color channel, the first color component value is normalized. The third color component value of each pixel is determined by traversing each pixel using a preset sliding window, based on a preset enhancement ratio, a preset window step size, the position coordinates of the pixel in the original image, and the normalized first color component value.

5. The method according to claim 3, characterized in that, The three third color component values ​​of the pixel in the RGB three color channels are standardized to obtain the corresponding three second color component values, including: Based on the third color component values ​​of multiple pixels in each color channel of the original image, three first color histograms corresponding to the three RGB color channels are determined; Determine the maximum and minimum non-zero color component values ​​within each of the first color histograms; For the third color component value of the pixel in each color channel, the third color component value is adjusted based on the maximum non-zero color component value and the minimum non-zero color component value in the first color histogram corresponding to the color channel to obtain the corresponding second color component value.

6. The method according to claim 1, characterized in that, The contrast of the second pixel value of each pixel in the first intermediate image is optimized to obtain the second intermediate image, including: The first intermediate image is divided into multiple non-overlapping sub-blocks, and the second pixel value of each pixel in each sub-block is determined, wherein the second pixel value is determined by the three second color component values ​​of the pixel in the RGB three color channels; For each sub-block, three second color histograms of the sub-block are determined on the three RGB color channels based on the second pixel value of each pixel point in the sub-block; The cumulative distribution function of the sub-block in the three RGB color channels is determined based on the three second color histograms, wherein the cumulative distribution function is used to characterize the cumulative probability density of the color component value of each pixel in the sub-block being the second color component value; For the second color component value of the sub-block in each color channel, a mapping function is determined according to the cumulative distribution function, and the second color component value is mapped according to the mapping function to obtain the corresponding fourth color component value; The third pixel value of each pixel is determined based on the three fourth color component values ​​in the three color channels of RGB, and the second intermediate image is obtained based on the third pixel value of each pixel.

7. An image enhancement device, characterized in that, include: An acquisition module is used to acquire the original image to be processed, wherein the original image includes multiple pixels with a first pixel value; The first processing module is used to perform color equalization processing on the first pixel value of each pixel in the original image to obtain a first intermediate image. The first intermediate image includes multiple pixels with second pixel values, and the second pixel values ​​are obtained by performing color equalization processing on the first pixel values ​​of the corresponding pixels. The second processing module is used to perform contrast optimization on the second pixel value of each pixel in the first intermediate image to obtain a second intermediate image, wherein the second intermediate image includes multiple pixels with a third pixel value. The third processing module is used to adjust the grayscale of the third pixel value of each pixel in the second intermediate image to obtain an enhanced target image. This includes: determining the third pixel value of multiple pixels in the second intermediate image, wherein the third pixel value is a grayscale value, and the grayscale value is determined by three fourth color components in the RGB color channels of the pixel; determining the pixel histogram of the second intermediate image based on the third pixel value of each pixel, and determining the maximum non-zero pixel value and the minimum non-zero pixel value based on the pixel histogram; for each third pixel value, adjusting the third pixel value based on the maximum non-zero pixel value, the minimum non-zero pixel value, and preset control parameters to obtain a corresponding fourth pixel value, and using the fourth pixel value as the pixel value of the corresponding pixel in the second intermediate image, wherein the expression for the fourth pixel value is written as: In the formula, This represents the value of the fourth pixel. This represents the maximum non-zero pixel value. The smallest non-zero pixel value is represented by g, the third pixel value is represented by C, and the control parameter is represented by C. The control parameter is used to control the adjustment range. The larger the control parameter is, the smaller the corresponding adjustment range is, and the smaller the control parameter is, the larger the corresponding adjustment range is. The enhanced target image is obtained based on the fourth pixel value of each pixel.

8. A non-volatile storage medium, characterized in that, The non-volatile storage medium stores a computer program, wherein the device containing the non-volatile storage medium executes the image enhancement method according to any one of claims 1 to 6 by running the computer program.

9. A computer program product, characterized in that, include: A computer program, wherein when executed by a processor, the computer program implements the image enhancement method according to any one of claims 1 to 6.