A low-illumination image enhancement method based on HSV color space
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-12
- Publication Date
- 2026-08-11
AI Technical Summary
[0004]为了克服现有技术的不足,本发明的目的是提供一种基于HSV色彩空间的低照度图像增强方法,解决传统方法噪声较大、细节丢失、会带来色彩偏差的问题
[0044]本发明提供了一种基于HSV色彩空间的低照度图像增强方法,通过融合像素截断线性拉伸、伽马校正处理、对比度增强处理以及饱和度优化,解决了传统方法噪声较大、细节丢失、会带来色彩偏差的问题,实现了亮度和对比度的提升以及在增强色彩鲜艳度的同时保持图像的自然度。
Smart Images

Figure CN121169780B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a low-light image enhancement method based on the HSV color space. Background Technology
[0002] In the iterative evolution of intelligent sensing systems, visual information acquisition, as the foundational layer of environmental semantic understanding, directly determines the accuracy and reliability of higher-level decision-making modules. According to Shannon's information theory, the integrity and signal-to-noise ratio (SNR) of image data are key indicators for measuring visual information quality. However, the interference posed by low-light scenes at night to visual information acquisition has become one of the core contradictions restricting the performance improvement of intelligent sensing systems. From the perspective of physical optics and sensor principles, the photoelectric conversion efficiency of imaging sensors drops sharply in low-light environments. According to the Lambert-Beer law, insufficient photon reception leads to an image SNR below 10dB. When the light intensity is below the minimum response threshold of the imaging device, the charge accumulation of pixels cannot form an effective signal, resulting in large areas of dark noise in the image, obscuring the texture features of the target object. Furthermore, traditional CMOS sensors suffer from severe readout noise and dark current noise in low light, further deteriorating image quality, causing loss of image details and blurred edge features. The degradation of visual information caused by low light significantly impacts the core algorithm modules of intelligent sensing systems. In the field of object detection, the average accuracy of the YOLOv5 algorithm based on deep learning drops from 82.3% in low-light environments to 51.7% in normal lighting conditions. In the feature extraction stage, the SIFT algorithm's accuracy in feature point detection in low-light images decreases by 38%, leading to a 2.3-fold increase in drift error for subsequent object tracking algorithms. This cumulative error effect can ultimately lead to misjudgments in intelligent system decisions. In autonomous driving scenarios, incorrect object recognition results can delay vehicle obstacle avoidance decisions by up to 0.8 seconds, seriously threatening driving safety. According to statistics, the effective recognition rate of current traffic monitoring systems in low-light environments is less than 65%, becoming a technical bottleneck restricting the deployment and application of intelligent transportation systems.
[0003] Currently, existing low-light image enhancement methods still have many shortcomings in addressing the aforementioned challenges. Traditional methods mainly focus on adjusting the image's grayscale distribution and pixel values. Histogram equalization, as a global enhancement algorithm, remaps image grayscale values by optimizing pixel intensity distribution characteristics, but it easily leads to over-enhancement and noise amplification. While subsequent adaptive histogram cropping strategies have controlled the enhancement rate to some extent, they still suffer from detail loss when handling complex lighting scenes. Methods based on Retinex theory decompose the image into illumination and reflection components and recombine them to enhance image contrast and color vibrancy, but they have high computational complexity and are prone to introducing color bias. In recent years, deep learning-based methods have shown great potential, but their dependence on large amounts of labeled data, overfitting during model training, and black-box characteristics limit their widespread application in real-world scenarios. Summary of the Invention
[0004] In order to overcome the shortcomings of the prior art, the purpose of this invention is to provide a low-light image enhancement method based on the HSV color space, which solves the problems of large noise, loss of detail and color deviation caused by traditional methods.
[0005] To achieve the above objectives, the present invention provides the following solution:
[0006] A low-light image enhancement method based on the HSV color space includes:
[0007] The input image is preprocessed using a homomorphic filter to obtain a preprocessed image;
[0008] The preprocessed image is converted to HSV space to obtain the original three-channel components; the original three-channel components include: the original H component, the original S component, and the original V component.
[0009] Perform pixel truncation and linear stretching on the original V component to obtain a first-stage V component.
[0010] The first-stage V component is gamma-corrected using the Sigmoid transition function to obtain the second-stage V component.
[0011] The contrast enhancement process of the two-stage V component is performed using the CLAHE algorithm with K-means clustering constraints to obtain the three-stage V component.
[0012] The original S-component is optimized for saturation using a saturation stretching algorithm to obtain the optimized S-component.
[0013] The original H component, the three-stage V component, and the optimized S component are fused to obtain an optimized three-channel component, and the optimized three-channel component is converted to RGB space to obtain an optimized image;
[0014] The optimized image is then subjected to color balance processing to obtain an illumination-enhanced image.
[0015] Preferably, the input image is preprocessed using a homomorphic filter to obtain a preprocessed image, including:
[0016] The reflectance and grayscale value of the input image are separated to obtain the data to be processed;
[0017] The preprocessed image is obtained by using a homomorphic filtering algorithm to perform differential frequency domain modulation on the data to be processed.
[0018] Preferably, the original V component is subjected to pixel truncation and linear stretching to obtain a first-stage V component, including:
[0019] Construct a truncated linear tensile formula; the expression of the truncated linear tensile formula is: Where, enhance is the result of truncating linear stretching; image is the original V component; trunup and trundown are the upper and lower breakpoints of the original V component, respectively; minout and maxout are the minimum and maximum values of the preset grayscale range of the first-stage V component, respectively.
[0020] The original V component is optimized using the truncated linear stretching formula to obtain the first-stage V component.
[0021] Preferably, the first-stage V component is subjected to gamma correction using the Sigmoid transition function to obtain the second-stage V component, including:
[0022] Construct the original gamma transform formula;
[0023] The original gamma transform formula is optimized to obtain the Sigmoid transition function; the expression of the Sigmoid transition function is: s = cr γ ;in, k = 0.1 × (T) high -T low ); s is the two-stage V component; c is the linear gain adjustment factor; γ is the dynamic gamma correction factor; γ low γ high These represent the gamma setting values for the low-brightness range and the high-brightness range, respectively; k is the slope parameter; μ is the current area brightness; T mid The midpoint of the brightness threshold; T high T low These are the maximum and minimum brightness values, respectively.
[0024] The first-stage V component is optimized using the Sigmoid transition function to obtain the second-stage V component.
[0025] Preferably, the CLAHE algorithm, which incorporates K-means clustering constraints, is used to perform contrast enhancement processing on the two-stage V component to obtain the three-stage V component, including:
[0026] The cliplimit parameter is obtained by using the K-Means clustering algorithm to obtain the limiting parameters of the CLAHE algorithm;
[0027] The cliplimit parameter is updated in the CLAHE algorithm, and the CLAHE algorithm is used to optimize the two-stage V component to obtain the three-stage V component.
[0028] Preferably, the cliplimit parameter is obtained by using the K-Means clustering algorithm to obtain the limiting parameters of the CLAHE algorithm, including:
[0029] Preset the number of clusters;
[0030] Construct a parameter calculation formula; the expression of the parameter calculation formula is:
[0031]
[0032] Where `min_center` and `max_center` are the minimum and maximum values of all cluster centers, respectively; `cluster_center.min()` and `cluster_center.max()` extract the minimum and maximum values of all cluster centers, respectively; `cliplimit`... factor The empirical distribution factor is defined as `cliplimit`, which is the `cliplimit` parameter.
[0033] Based on the number of clusters, the two-stage V components are clustered into regions using the K-Means clustering algorithm to obtain the clustering results;
[0034] The cliplimit parameter is obtained by calculating the clustering results using the parameter calculation formula.
[0035] Preferably, the original S-component is saturated using a saturation stretching algorithm to obtain an optimized S-component, including:
[0036] Construct a saturation stretching formula; the expression of the saturation stretching formula is: Where output is the optimized S component; clip(x,a,b) represents restricting x to the interval [a,b]; input is the original S component; k0 is a statistical property; S max S min S mean These are the maximum, minimum, and average values of the original S-component, respectively.
[0037] The optimized S-component is obtained by calculating the original S-component using the saturation stretching formula.
[0038] Preferably, the optimized image undergoes color balance processing to obtain an illumination-enhanced image, including:
[0039] Preset K value;
[0040] The gain of the optimized image is calculated based on the K value to obtain the gain coefficient;
[0041] The optimized image is color-corrected using the gain coefficient to obtain a temporary image;
[0042] When the pixel value of the temporary image exceeds 255, it is truncated to obtain the illumination-enhanced image.
[0043] The present invention discloses the following technical effects:
[0044] This invention provides a low-light image enhancement method based on the HSV color space. By fusing pixel truncation linear stretching, gamma correction, contrast enhancement, and saturation optimization, it solves the problems of high noise, loss of detail, and color deviation caused by traditional methods, and achieves the improvement of brightness and contrast while maintaining the naturalness of the image. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 A schematic diagram of a low-light image enhancement process based on the HSV color space provided in an embodiment of the present invention;
[0047] Figure 2 This is a schematic diagram of the overall network structure provided in an embodiment of the present invention;
[0048] Figure 3 A flowchart of homomorphic filtering provided for embodiments of the present invention;
[0049] Figure 4 A schematic diagram of a filter provided in an embodiment of the present invention;
[0050] Figure 5 Images and histograms before and after truncated linear stretching provided for embodiments of the present invention;
[0051] Figure 6 This is a cosine distance measurement diagram provided in an embodiment of the present invention;
[0052] Figure 7 The flowchart of the CLAHE algorithm provided in this embodiment of the invention;
[0053] Figure 8 The CLAHE algorithm flow for integrating K-Means clustering is provided in the embodiments of the present invention;
[0054] Figure 9 This is a comparison of the effects of low-light image enhancement before and after, provided in an embodiment of the present invention.
[0055] Figure 10 This is a three-dimensional pixel surface diagram of the image before and after enhancement provided in an embodiment of the present invention;
[0056] Figure 11 The saturation stretching effect provided in the embodiments of the present invention;
[0057] Figure 12 The implementation flow of the grayscale world algorithm provided in the embodiments of the present invention. Detailed Implementation
[0058] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0059] The purpose of this invention is to provide a low-light image enhancement method based on the HSV color space, which solves the problems of high noise, loss of detail, and color deviation caused by traditional methods.
[0060] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0061] Figure 1 This is a schematic diagram of a low-light image enhancement process based on the HSV color space provided in an embodiment of the present invention, as shown below. Figure 1As shown, this invention provides a low-light image enhancement method based on the HSV color space, comprising:
[0062] Step 100: Preprocess the input image using a homomorphic filter to obtain a preprocessed image;
[0063] Step 200: Convert the preprocessed image to HSV space to obtain the original three-channel components; the original three-channel components include: the original H component, the original S component, and the original V component;
[0064] Step 300: Perform pixel truncation and linear stretching on the original V component to obtain a first-stage V component;
[0065] Step 400: Perform gamma correction on the first-stage V component using the Sigmoid transition function to obtain the second-stage V component;
[0066] Step 500: Use the CLAHE algorithm with K-means clustering constraints to perform contrast enhancement processing on the second-stage V component to obtain the third-stage V component;
[0067] Step 600: Optimize the saturation of the original S-component using a saturation stretching algorithm to obtain the optimized S-component;
[0068] Step 700: Fuse the original H component, the three-stage V component, and the optimized S component to obtain optimized three-channel components, and convert the optimized three-channel components to RGB space to obtain an optimized image;
[0069] Step 800: Perform color balance processing on the optimized image to obtain an illumination-enhanced image.
[0070] Furthermore, the input image is preprocessed using a homomorphic filter to obtain a preprocessed image, including:
[0071] The reflectance and grayscale value of the input image are separated to obtain the data to be processed;
[0072] The preprocessed image is obtained by using a homomorphic filtering algorithm to perform differential frequency domain modulation on the data to be processed.
[0073] Specifically, the original V component is subjected to pixel truncation and linear stretching to obtain a first-stage V component, including:
[0074] Construct a truncated linear tensile formula; the expression of the truncated linear tensile formula is: Where, enhance is the result of truncating linear stretching; image is the original V component; trunup and trundown are the upper and lower breakpoints of the original V component, respectively; minout and maxout are the minimum and maximum values of the preset grayscale range of the first-stage V component, respectively.
[0075] The original V component is optimized using the truncated linear stretching formula to obtain the first-stage V component.
[0076] Furthermore, the first-stage V component is subjected to gamma correction using the Sigmoid transition function to obtain the second-stage V component, including:
[0077] Construct the original gamma transform formula;
[0078] The original gamma transform formula is optimized to obtain the Sigmoid transition function; the expression of the Sigmoid transition function is: s = cr γ ;in, k = 0.1 × (T) high -T low ); s is the two-stage V component; c is the linear gain adjustment factor; γ is the dynamic gamma correction factor; γ low γ high These represent the gamma setting values for the low-brightness range and the high-brightness range, respectively; k is the slope parameter; μ is the current area brightness; T mid The midpoint of the brightness threshold; T high T low These are the maximum and minimum brightness values, respectively.
[0079] The first-stage V component is optimized using the Sigmoid transition function to obtain the second-stage V component.
[0080] Specifically, the CLAHE algorithm, which incorporates K-means clustering constraints, is used to perform contrast enhancement processing on the second-stage V component to obtain the third-stage V component, including:
[0081] The cliplimit parameter is obtained by using the K-Means clustering algorithm to obtain the limiting parameters of the CLAHE algorithm;
[0082] The cliplimit parameter is updated in the CLAHE algorithm, and the CLAHE algorithm is used to optimize the two-stage V component to obtain the three-stage V component.
[0083] Furthermore, the K-Means clustering algorithm is used to obtain the limiting parameters of the CLAHE algorithm, resulting in the cliplimit parameter, which includes:
[0084] Preset the number of clusters;
[0085] Construct a parameter calculation formula; the expression of the parameter calculation formula is:
[0086]
[0087] Where `min_center` and `max_center` are the minimum and maximum values of all cluster centers, respectively; `cluster_center.min()` and `cluster_center.max()` extract the minimum and maximum values of all cluster centers, respectively; `cliplimit`... factor The empirical distribution factor is defined as `cliplimit`, which is the `cliplimit` parameter.
[0088] Based on the number of clusters, the two-stage V components are clustered into regions using the K-Means clustering algorithm to obtain the clustering results;
[0089] The cliplimit parameter is obtained by calculating the clustering results using the parameter calculation formula.
[0090] Specifically, the original S-component is optimized for saturation using a saturation stretching algorithm to obtain an optimized S-component, including:
[0091] Construct a saturation stretching formula; the expression of the saturation stretching formula is: Where output is the optimized S component; clip(x,a,b) represents restricting x to the interval [a,b]; input is the original S component; k0 is a statistical property; S max S min S mean These are the maximum, minimum, and average values of the original S-component, respectively.
[0092] The optimized S-component is obtained by calculating the original S-component using the saturation stretching formula.
[0093] Further, the optimized image undergoes color balance processing to obtain an illumination-enhanced image, including:
[0094] Preset K value;
[0095] The gain of the optimized image is calculated based on the K value to obtain the gain coefficient;
[0096] The optimized image is color-corrected using the gain coefficient to obtain a temporary image;
[0097] When the pixel value of the temporary image exceeds 255, it is truncated to obtain the illumination-enhanced image.
[0098] refer to Figure 2 The overall network structure is shown in the figure. First, the input image is preprocessed using a homomorphic filter to convert the color space from RGB to HSV. For the V (luminance) component, pixel value truncation and linear stretching are performed first. Then, the luminance is enhanced by combining gamma correction based on the Sigmoid transition function with the CLAHE algorithm that incorporates K-means clustering constraints. For the S component, the saturation enhancement algorithm is used for optimization. Finally, color gamut conversion and color balancing operations are performed to retain more image information.
[0099] Furthermore, image preprocessing is based on homomorphic filtering. Homomorphic filtering is based on the distribution characteristics of image gray values under different lighting conditions, and processes the image through frequency domain filtering. This method, by separating reflectivity and gray values, can better control the brightness and smoothness of the image, and uses mathematical transformations to convert the complex light-reflection interaction into a frequency-domain operable linear problem. The basic steps of homomorphic filtering are as follows: Figure 3 As shown. The homomorphic filtering algorithm differentially modulates the illumination component and reflection characteristics of an image in the frequency domain. By processing these two parts separately, it effectively enhances high-frequency details while preserving low-frequency information. It suppresses low-frequency information, thereby reducing the dynamic range of the image; at the same time, it enhances the high-frequency components, thereby improving the image contrast. The filter selected in this embodiment is as follows. Figure 4 As shown, the horizontal axis D(u,v) measures the distance between different frequency components and the origin, while H(u,v), as the filter's transfer function, is also called the filter's frequency response or filtering function, used to characterize the filter's processing of different frequency components. This processing mechanism compresses the image's dynamic range by suppressing low-frequency information response, while simultaneously amplifying high-frequency signal strength to improve local contrast. Thus, while maintaining natural lighting perception, the enhanced image better conforms to the perceptual characteristics of the human visual system in terms of texture rendering and edge sharpness.
[0100] Furthermore, Figure 3 In the diagram, f(x,y) is the input original image; Ln is the natural logarithmic transform; DFT is the discrete Fourier transform; H(u,v) is the homomorphic filter function; IDFT is the inverse discrete Fourier transform; exp represents the exponential function; and g(x,y) is the output image obtained after homomorphic filtering. Figure 4 In this context, D(u,v) represents the frequency distance; Y(L) represents the low-frequency gain; and Y(H) represents the high-frequency gain.
[0101] Specifically, a multi-strategy brightness enhancement algorithm is proposed. After preprocessing the original low-light image, relevant algorithms from the OpenCV library are used to perform color space conversion operations on the image. First, the input RGB image is converted to the HSV color space, and the luminance component of the V channel is separated. Because the luminance variation in the V component of a low-light image is not significant, its pixel value distribution range is narrow, resulting in low contrast. Simultaneously, because the V component in a low-light image is less sensitive to changes in brightness, details in the image are often affected and lost. Considering these reasons, this embodiment proposes a multi-strategy brightness enhancement algorithm based on the principle of linear transformation. First, a truncation and linear stretching operation is performed on the image to remove parts with excessively low or high pixel values. Since the image still lacks in brightness and contrast, the CLAHE algorithm, which combines a gamma transform based on the Sigmoid transition function and K-Means clustering, is used to process the image, enhancing pixel values within a certain range and improving the brightness and contrast of the low-light image.
[0102] Furthermore, a truncated linear stretching algorithm is proposed. Conventional grayscale images, due to their wide grayscale distribution range and clustered intensity values, have limited dynamic range, resulting in insufficient image contrast and poor visual perception. To address this issue, the original image needs to be stretched to increase contrast and adapt to human visual perception. Truncated linear stretching, as an image enhancement method, constructs an adaptive threshold range based on the image intensity histogram distribution characteristics. It then linearly maps pixel values, truncating intensity values exceeding the preset range, thereby enhancing image contrast by expanding the effective intensity variation range. The equation is as follows:
[0103]
[0104] In the formula, enhance represents the enhanced image, image is the original image, trunup and trundown refer to the upper and lower breakpoints of the original image, which are usually the minimum and maximum gray values of a certain percentage removed from the original image. maxout and minout represent the maximum and minimum gray values of the enhanced image's gray range. In this embodiment, these two values are set to 220 and 15, respectively.
[0105] Preferably, for the optimization problem of insufficient local contrast in images, the truncated linear transform method based on dynamic range adjustment of grayscale values shows significant improvement. By setting reasonable threshold parameters and performing nonlinear mapping on the pixel distribution, the visual features of the target region can be effectively enhanced, and the recognition of target features in the image can be improved. Figure 5 The processing results show that the truncated linear stretching algorithm is highly effective in enhancing the gray-level ranges of interest in the image and suppressing the gray-levels of little interest.
[0106] Specifically, this involves Gamma correction based on the Sigmoid transition function. The gamma transform optimizes the grayscale distribution of an image through non-linear adjustments, enhancing the brightness of darker areas while appropriately suppressing excessively high grayscale values. After the transformation, the image's detail is significantly improved. The mathematical formula for the gamma transform is as follows:
[0107] s = cr γ
[0108] Where r represents the grayscale input intensity of the original image, that is, the pixel value before correction, and its value range is [0,1]. The output intensity value after gamma correction is denoted as s, and the grayscale scaling factor c is used as a linear gain adjustment factor, usually set to 1. γ is the gamma correction factor, which controls the intensity gain amplitude of the entire nonlinear mapping process.
[0109] In traditional gamma correction, changes in the γ value are typically adjusted piecewise using a hard threshold. This can lead to significant discontinuities in brightness adjustment, especially in regions where brightness approaches the threshold, potentially resulting in abrupt changes in visual gamma. To avoid this, this embodiment proposes a gamma value continuity optimization method based on the Sigmoid transition function. The Sigmoid transition function replaces the hard threshold to smooth changes in the γ value, thereby improving the continuity and stability of image brightness correction. The optimized formula is as follows:
[0110]
[0111] Where, γ low and γ high Based on the gamma values of low-brightness and high-brightness areas, μ represents the brightness of the current area. The slope parameter of the transition smoothness is controlled by the k value, which is calculated as follows:
[0112] k = 0.1 × (T) high -T low )
[0113] T mid The midpoint of the brightness threshold is calculated as shown in the formula:
[0114]
[0115] By introducing the Sigmoid transition function, the γ value can exhibit a smooth S-shaped curve when brightness changes, rather than an abrupt change, thus enhancing the natural transition effect in image processing. Furthermore, the smoothness of the Sigmoid transition can be adjusted to suit a wider range of application scenarios.
[0116] Preferably, the CLAHE algorithm, which incorporates K-Means clustering constraints, is used. K-Means clustering, a classic unsupervised learning technique, divides observed samples into K mutually exclusive subsets through an iterative optimization strategy. Its optimization objective is to minimize the sum of squared Euclidean distances from each sample to the corresponding cluster center. The execution process includes the following steps:
[0117] 1) Selecting K initial cluster centers: Before starting the algorithm, K data points need to be randomly selected as initial cluster centers. In practical applications, heuristic methods are often used to select higher-quality initial cluster centers in order to improve algorithm efficiency and clustering results.
[0118] 2) Assigning data points to the nearest cluster centers: During cluster analysis, it is necessary to determine the affiliation of each sample in the dataset. This is done by calculating the feature space distance between the sample and all cluster centroids, and assigning it to the corresponding cluster unit based on the minimum distance criterion. There are several common distance metrics; for example, the cosine distance metric is illustrated in the diagram below. Figure 6 . Figure 6 In the three-dimensional space R 3 The diagram shows three coordinate axes labeled "hello," "hi," and "world," representing a three-dimensional space. Each axis corresponds to a feature or dimension, used to represent the value of a data point in that dimension. Vector representation: The arrows in the diagram represent vectors, each pointing from the origin to a specific point, indicating the position of a data point in three-dimensional space. For example, "hi,world!" and "hello,world!" correspond to two different vectors.
[0119] 3) Recalculate cluster centers: During the iterative optimization of clustering, a centroid update operation needs to be performed on each cluster unit. The spatial location of the new centroid is determined by calculating the feature mean vector of all data samples within that cluster unit, using the following formula:
[0120]
[0121] Among them, S i Let |S| represent the set of data points in the i-th cluster. i | represents the number of data points within the set.
[0122] 4) Repeatedly assign and update steps until the termination condition is met: During the iteration process, the algorithm will continuously optimize, making the objects within the cluster more compact and the objects between different clusters more dispersed. To avoid the algorithm from getting into an infinite loop, a maximum number of iterations is usually set as the termination condition. Once the maximum number of iterations is reached, the algorithm stops executing the data point assignment and cluster center update steps.
[0123] Furthermore, while traditional histogram equalization can effectively improve image contrast and highlight details, it often leads to local over-enhancement and noise amplification in images with complex lighting conditions or significant brightness variations, affecting the visual effect and subsequent processing. To overcome this limitation, researchers invented the CLAHE (Contrast Limited Adaptive Histogram Equalization) algorithm. This algorithm employs a block-based processing strategy, establishing local feature analysis units by constructing overlapping rectangular sub-regions, and performing dynamic histogram redistribution within each limited neighborhood. In addition, the CLAHE algorithm sets a contrast cap when equalizing the histogram of each local region to prevent noise amplification caused by over-enhancement. This constraint ensures that the image maintains good smoothness and naturalness while being enhanced, avoiding the "blocking" effect or noise pollution that may occur with traditional HE algorithms. The main steps of the algorithm are as follows: Figure 7 As shown: First, the input image is divided into multiple sub-blocks of the same size. Then, a histogram is calculated for each sub-block and equalization is performed. During equalization, the cliplimit parameter is used to limit the contrast of the sub-blocks to prevent excessive local contrast. Finally, interpolation methods such as bilinear interpolation are used to process the sub-block boundaries, and all sub-blocks are stitched together to obtain the final enhanced image. These steps work together to ensure that the image maintains good visual quality while enhancing contrast.
[0124] Furthermore, based on the above research, this embodiment proposes a CLAHE algorithm that integrates K-Means clustering. This algorithm combines the two methods mentioned above, using K-Means clustering to dynamically adjust the cliplimit parameter in CLAHE (Contrast Limit Adaptive Histogram Equalization). The cliplimit parameter controls the degree of contrast enhancement during histogram equalization, avoiding excessive noise amplification. The specific implementation details of the algorithm are as follows: After reading the image, the V component values of the image are expanded into a one-dimensional array, and then clustered into several different regions using the K-Means clustering algorithm. In this embodiment, the pixel values are clustered into 5 regions. Based on the clustering results, the center value of each cluster region, cluster_center, is output, which is the average brightness value of each region. The implementation process is as follows:
[0125]
[0126] Where `cluster_center` represents the center of each cluster in the five regions, `min_center` is the minimum value of all cluster centers, representing the brightness of the darkest region in the image, and `max_center` is the maximum value of all cluster centers, representing the brightness of the brightest region in the image. The `cliplimit` in the formula... factorThis is an empirical distribution factor used to control the scaling ratio of cliplimit; in this embodiment, it is set to 0.03. After the above steps, the final histogram clipping threshold used in the CLAHE algorithm is obtained. Using the adjusted CLAHE parameters, a local contrast enhancement operation is then performed on the original image. The degree of contrast enhancement can be dynamically adjusted according to the image's brightness distribution, avoiding excessive contrast enhancement in images with a small brightness range, thereby reducing noise amplification and artifacts. The specific implementation process is as follows... Figure 8 As shown. Figure 8 In this context, V component represents the luminance component in the HSV color space, area1, area2, ..., area5 represent different regions after clustering, min-center represents the minimum value among all cluster centers, max-center represents the maximum value among all cluster centers, cliplimit represents the contrast limit parameter of the CLAHE algorithm, and tileGridSize represents the grid size of the CLAHE algorithm.
[0127] Specifically, the results of low-light image enhancement using this improved algorithm are as follows: Figure 9 As shown in the comparison, the CLAHE algorithm, which incorporates K-Means clustering, effectively controls the contrast enhancement of the image after histogram equalization. While enhancing image details, it avoids image noise problems caused by over-enhancement. (The last sentence appears to be incomplete and possibly refers to a specific algorithm or approach.) Figure 9 The results, using Python's OpenCV and Matplotlib libraries, analyzed the pixel intensity differences in 3D images before and after applying the CLAHE algorithm with K-Means clustering. The results are as follows: Figure 10 As shown. In Figure 10 In the 3D visualization image shown, the coordinate system constructs an intuitive framework for displaying the pixel features of the image. The x-axis and y-axis represent the horizontal column index and vertical row index, respectively, indicating the width and height of the image. The z-axis represents the pixel grayscale distribution. The undulations and color changes of the surface correspond to the bright and dark areas of the image; the more yellowish the color in the image, the higher the brightness value of the corresponding area. It can be observed that the original image is generally dark and low in brightness, with dark areas dominating. The image processed using the improved CLAHE algorithm exhibits a more balanced pixel distribution, with the grayscale values of pixels concentrated in the dark areas being effectively stretched and expanded, thus achieving better results than the unprocessed image.
[0128] Specifically, a saturation enhancement algorithm based on nonlinear stretching is used. After performing the above enhancement operation on the V component of the image in the HSV color space, the brightness and contrast of the image are significantly improved. However, considering that the algorithm used in adjusting the V component may over-enhance or weaken the image's colors, resulting in insufficient color saturation or distortion, further adjustment of the S component, i.e., the saturation component, is needed to obtain better visual effects. Given the significant differences in illumination distribution in low-light nighttime images acquired under different imaging environments, their color saturation characteristics exhibit non-uniform variations. Therefore, this embodiment designs an adaptive nonlinear mapping algorithm based on the HSV color space saturation channel, implemented as follows:
[0129]
[0130] In the formula, input represents the S-component of the input image, output represents the S-component of the output image, and k0 is based on the statistical characteristics of the S-component pixels, i.e., the average value S. mean Minimum value S min and maximum value S max The dynamic range is calculated using adaptive parameters. The function clip(x,a,b) restricts x to the interval [a,b], and in this embodiment, the pixel value is restricted to between 0 and 255. Unlike fixed stretching parameters, this saturation stretching algorithm can adaptively adjust according to the actual situation of the image. Therefore, it can better adapt to the characteristics of different images, enhancing color vibrancy while maintaining the naturalness of the image and avoiding color distortion.
[0131] Furthermore, Figure 11 The image shows the images before and after processing, along with their respective saturation spatial distribution maps, or heatmaps. These heatmaps visually demonstrate the saturation changes in different regions of the image. The "hot" colors map the distribution of saturation intensity, and the color bar on the right quantifies the range of saturation values. It can be seen that the original image's saturation heatmap exhibits a relatively concentrated and dark color distribution, indicating low saturation in these areas. In contrast, the processed image's saturation heatmap displays a more balanced and richer color distribution, with the yellow tones in the highlight areas expanding and becoming brighter, emphasizing the details in the highly saturated areas. Therefore, the processed image is visually more vivid and vibrant, significantly improving its expressiveness and visual effect.
[0132] Specifically, color restoration. During the color space conversion of an image, color deviations or imbalances may occur due to the series of enhancement algorithms applied to the image. Therefore, this embodiment performs a color balance operation on the image, improving the overall color quality by adjusting the color distribution. Color balance algorithms typically calculate the color temperature of the scene based on the grayscale balance point of the image, i.e., gray objects or regions, and adjust the color distribution accordingly. This embodiment uses a gray-world hypothesis model based on colorimetry theory for white balance optimization. By dynamically adjusting the gain coefficients of multispectral channels, automatic correction of scene colors is achieved. The specific implementation process of the algorithm is as follows: Figure 12 As shown, applying this algorithm to the image to be processed as a post-processing step after converting the image from the HSV color gamut to the RGB color gamut can quickly and effectively balance the color distribution in the image, making the overall color tone of the image more consistent, improving the visual quality of the image and the accuracy of subsequent processing, and helping to restore the original scene image.
[0133] Further, algorithm performance analysis. To thoroughly verify the performance advantages and generalization ability of the algorithm proposed in this embodiment, the processing effect of the proposed algorithm was systematically compared with that of current mainstream low-light enhancement methods on the LOL low-light image benchmark set. The comparison results of objective evaluation indicators are detailed in Table 1.
[0134] Table 1
[0135]
[0136] Experimental data show that the algorithm in this embodiment achieves an average improvement of 20.05% in Peak Signal-to-Noise Ratio (PSNR) and 21.76% in Structural Similarity Index (SSIM) compared to similar algorithms. It outperforms SSR, MSR, and MSRCR algorithms in throughput (i.e., the number of images processed per unit time), although its throughput is slightly lower than other algorithms. While not the highest throughput, quantitative results demonstrate that in image restoration tasks under complex lighting conditions, the enhancement model proposed in this embodiment can effectively improve the visual quality of low-light images, exhibiting superior adaptability in brightness correction and detail preservation, and achieving a better balance between speed and performance.
[0137] Furthermore, in comparison experiments with low-light images, this embodiment further verifies the generalization ability of the algorithm in this chapter on the Exdark dataset for real nighttime scenes. The experimental results are shown in Table 2.
[0138] Table 2
[0139]
[0140] The results in the table show that the algorithm in this embodiment achieves an average speedup of 21.25% in NIQE compared to mainstream algorithms and an average speedup of 24.85% in CEIQ compared to existing algorithms. Although slightly lower than the MSRCR algorithm, it has the best overall performance. The throughput of this embodiment is 10.65 images / second, which is above average among the compared algorithms. Due to the high resolution of images in the ExDark dataset, the algorithm takes a long time to process, and its average processing speed is lower than that of low-light datasets compared to low-light images. While maintaining the natural characteristics of images, the algorithm in this embodiment significantly improves color performance and detail visibility in real-world low-light night scenes, demonstrating superior generalization performance in night scene enhancement tasks under complex lighting conditions.
[0141] The beneficial effects of this invention are as follows:
[0142] This invention combines pixel truncation linear stretching, gamma correction, and contrast enhancement to eliminate extreme pixel value distributions, thereby enhancing pixel values within the target range and improving the brightness and contrast of low-light images. Through saturation optimization, it enhances color vibrancy while maintaining image naturalness, avoiding color distortion.
[0143] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0144] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A low-illumination image enhancement method based on HSV color space, characterized in that, include: The input image is preprocessed using a homomorphic filter to obtain a preprocessed image; The preprocessed image is converted to HSV space to obtain the original three-channel components; The original three-channel components include: the original H component, the original S component, and the original V component; Perform pixel truncation and linear stretching on the original V component to obtain a first-stage V component. The first-stage V component is gamma-corrected using the Sigmoid transition function to obtain the second-stage V component. The contrast enhancement process of the two-stage V component is performed using the CLAHE algorithm with K-means clustering constraints to obtain the three-stage V component. The original S-component is optimized for saturation using a saturation stretching algorithm to obtain the optimized S-component. The original H component, the three-stage V component, and the optimized S component are fused to obtain an optimized three-channel component, and the optimized three-channel component is converted to RGB space to obtain an optimized image; The optimized image is then subjected to color balance processing to obtain an illumination-enhanced image; The input image is preprocessed using a homomorphic filter to obtain a preprocessed image, including: The reflectance and grayscale value of the input image are separated to obtain the data to be processed; The preprocessed image is obtained by using a homomorphic filtering algorithm to perform differential frequency domain modulation on the data to be processed. Perform pixel-truncation and linear stretching operations on the original V component to obtain a first-stage V component, including: Construct a truncated linear tensile formula; the expression of the truncated linear tensile formula is: ;in, To truncate the linear stretching results; The original V component; These are the upper and lower breakpoints of the original V component, respectively; These are the minimum and maximum values of the preset grayscale range for the V component in the first stage, respectively; The original V component is optimized using the truncated linear stretching formula to obtain the first-stage V component; The first-stage V component is gamma-corrected using the Sigmoid transition function to obtain the second-stage V component, including: constructing the original gamma-transform formula; The original gamma transform formula is optimized to obtain the Sigmoid transition function; the expression of the Sigmoid transition function is: ;in, ; s is the two-stage V component; c is the linear gain adjustment factor; This is the dynamic gamma correction factor; These are the gamma setting values for the low-brightness range and the high-brightness range, respectively; k is the slope parameter. The current area brightness; The midpoint of the brightness threshold; These represent the maximum and minimum brightness values, respectively; r is the pixel value without gamma correction. The first-stage V component is optimized using the Sigmoid transition function to obtain the second-stage V component.
2. The low-light image enhancement method based on the HSV color space according to claim 1, characterized in that, The CLAHE algorithm, which incorporates K-means clustering constraints, is used to enhance the contrast of the two-stage V components, resulting in the three-stage V components, including: The K-Means clustering algorithm is used to obtain the limiting parameters of the CLAHE algorithm, and thus the results are obtained. parameter; The The parameters are updated in the CLAHE algorithm, and the two-stage V component is optimized using the CLAHE algorithm to obtain the three-stage V component.
3. The low-light image enhancement method based on the HSV color space according to claim 2, characterized in that, The K-Means clustering algorithm is used to obtain the limiting parameters of the CLAHE algorithm, and thus the results are obtained. Parameters, including: Preset the number of clusters; Construct a parameter calculation formula; the expression of the parameter calculation formula is: ; in, These are the minimum and maximum values of all cluster centers, respectively; These represent the minimum and maximum values extracted from all cluster centers, respectively. It is the empirical distribution factor; For the parameter; Based on the number of clusters, the two-stage V components are clustered into regions using the K-Means clustering algorithm to obtain the clustering results; The clustering results are calculated using the parameter calculation formula to obtain the... parameter.
4. The low-light image enhancement method based on the HSV color space according to claim 3, characterized in that, The original S-component is optimized for saturation using a saturation stretching algorithm to obtain the optimized S-component, including: Construct a saturation stretching formula; the expression of the saturation stretching formula is: ;in, For the optimized S component; This means restricting x to the interval Inside; The original S component; Statistical characteristics; These are the maximum, minimum, and average values of the original S-component, respectively. The optimized S-component is obtained by calculating the original S-component using the saturation stretching formula.
5. The low-light image enhancement method based on the HSV color space according to claim 4, characterized in that, The optimized image is subjected to color balance processing to obtain an illumination-enhanced image, including: Preset K value; The gain of the optimized image is calculated based on the K value to obtain the gain coefficient; The optimized image is color-corrected using the gain coefficient to obtain a temporary image; When the pixel value of the temporary image exceeds 255, it is truncated to obtain the illumination-enhanced image.
Citation Information
Patent Citations
An image enhancement algorithm based on multi-algorithm fusion of different color spaces
CN109191390A
Enhancement method for low-illumination image
CN115937031A
Hydrophobicity grade determination method and system
CN116879112A
Improved U-net network training method and defect identification method
CN118314325A
Low-illumination image enhancement method
CN120525780A