A low-light video image enhancement method based on an adaptive cropping coefficient
By introducing adaptive cropping coefficients and GAMMA transform preprocessing in the CLAHE algorithm, the problems of excessive enhancement and ring artifacts in video image processing are solved, and better contrast and detail improvement are achieved.
Patent Information
- Application Number
- CN202211153061.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-21
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2042-09-21
AI Technical Summary
Existing CLAHE algorithms have excessive enhancement and annular artifacts when processing video images, especially in complex texture areas and homogeneous areas.
Using an adaptive cropping coefficient method, GAMMA transform preprocessing of the video image and dividing the image into 16×16 image blocks, the mean value and standard deviation of each image block are calculated, the cropping coefficient is calculated based on the coefficient of variation, and each image block is cropped and histogram processed, and finally a new brightness component is obtained through linear interpolation.
It effectively overcomes the problems of excessive enhancement and ring artifacts in video image processing, improves the contrast and details of the image, and achieves a good enhancement effect.
Smart Images

Figure CN115546055B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of image processing, and in particular relates to the design of a low-illumination video image enhancement method based on an adaptive cropping coefficient. Background Art
[0002] Under conditions such as low illumination and shooting scene restrictions, the obtained image is blurred, making it difficult for observers to grasp the accurate information of the image, so it is necessary to enhance the image. At present, the most representative image enhancement algorithms are the dark color prior algorithm, the Retinex algorithm and the histogram equalization algorithm. These three algorithms belong to the spatial domain image enhancement method. Since the histogram equalization algorithm was proposed, it has undergone many improvements: the earliest HE algorithm can only be used for contrast enhancement of the entire image. In order to overcome the problem that the HE algorithm has poor enhancement effect on overly bright or overly dark areas, some scholars proposed the AHE algorithm; the AHE algorithm processes the local area of the image. The smaller the rectangular area block, the better the local contrast enhancement effect, and the larger the rectangular area block, the weaker the local contrast enhancement effect. At the same time, there is a problem of excessively amplifying noise in low-texture areas; so some scholars proposed the CLAHE algorithm, which uses global clipping coefficients and linear interpolation to suppress the problem of noise amplification based on the AHE algorithm.
[0003] The CLAHE algorithm is widely used in image enhancement, defogging, and brightness channel enhancement. Its advantages are good enhancement effects, improved image quality, and highlighted image details, especially in contrast enhancement of low-light images. However, since there may be complex texture areas or homogeneous areas in video images, if the global cropping coefficient is too low, the CLAHE algorithm will not have a significant effect on contrast enhancement of the entire image; if the global cropping coefficient is too high, the CLAHE algorithm will over-enhance when processing complex texture areas; at the same time, a global cropping coefficient that is too high for processing homogeneous areas will cause ring artifact distortion. Summary of the invention
[0004] The purpose of the present invention is to solve the problems of over-enhancement and ring artifacts when the existing CLAHE algorithm processes video images, and proposes a low-illumination video image enhancement method based on an adaptive cropping coefficient.
[0005] The technical solution of the present invention is: a low-light video image enhancement method based on an adaptive cropping coefficient, comprising the following steps:
[0006] S1. Obtain a video under low illumination and shooting scene restriction conditions, convert each frame image in the video from the RGB color space to the HSV color space, and extract the brightness component of the image.
[0007] S2. Perform GAMMA transformation preprocessing on the brightness component of the image to obtain a preprocessed image.
[0008] S3. Divide the preprocessed image into 16×16 image blocks and calculate the mean and standard deviation of each image block.
[0009] S4. Calculate the coefficient of variation of each image block according to the average value and standard deviation of each image block, and calculate the cropping coefficient of the image block according to the coefficient of variation.
[0010] S5. Calculate the histogram of the image block.
[0011] S6. Use the cropping coefficient to crop each image block, and evenly distribute the cropped amount to each histogram column in the histogram to obtain a new histogram.
[0012] S7. Calculate the cumulative distribution function of each image block according to the new histogram.
[0013] S8. Perform linear interpolation on the cumulative distribution function of each image block to obtain a new brightness component.
[0014] S9. Convert each frame of image from the HSV color space back to the RGB color space according to the new brightness component to obtain a video image enhancement result.
[0015] Furthermore, the GAMMA correction coefficient of the GAMMA transformation preprocessing in step S2 is 0.6.
[0016] Furthermore, the calculation formula of the clipping coefficient in step S4 is:
[0017]
[0018] in represents the cropping factor of the image block, represents the standard deviation of the image block, represents the average value of the image block, is a small constant, represents the cropping factor, is the coefficient of variation of the image block, and its value range is [0,1].
[0019] Furthermore, in step S5, the voting principle is used to count the histogram of each image block: a 256-bit array is constructed, and each position of the array is initialized to 0, and the brightness value of each image block is read in a loop. Each time a brightness value is read, 1 is added to the corresponding array position, and the histogram of the image block is obtained by counting.
[0020] Furthermore, step S6 is specifically as follows: subtract the value of each position in the array from the clipping coefficient to obtain a new brightness value, and add up the new brightness values and put them in the variable bonus, and divide the variable bonus by 256 and assign it to each histogram in the histogram to obtain a new histogram.
[0021] Furthermore, in step S7, each histogram bin in the new histogram is accumulated to obtain a cumulative distribution function of each image block.
[0022] Furthermore, step S8 is specifically as follows: for the image blocks at the four corners of the image, their brightness values are directly obtained by multiplying the cumulative distribution function of the image block by 255; for the image blocks on the four sides of the image, their brightness values are obtained by linearly interpolating the cumulative distribution functions of two adjacent image blocks; for the image blocks in the middle area of the image, their brightness values are obtained by bilinearly interpolating the cumulative distribution functions of four adjacent image blocks; and the new brightness component of the image is obtained by the brightness value of each image block after linear interpolation.
[0023] The beneficial effects of the present invention are:
[0024] (1) The present invention combines GAMMA correction with the CLAHE algorithm and selects different cropping coefficients according to different image blocks in each frame of the video, thereby overcoming the over-enhancement and ring artifact phenomena existing in the existing CLAHE algorithm when processing video images, effectively improving the contrast and details of each frame of the image, and achieving a good enhancement effect.
[0025] (2) The present invention can improve the contrast of the image by processing the brightness component of the video image.
[0026] (3) The present invention first performs GAMMA transform preprocessing before enhancing the image, which can effectively compensate for the over-enhancement and ring artifact phenomena caused by the CLAHE algorithm and make the brightness value of the corrected image more uniform and moderate.
[0027] (4) By introducing the coefficient of variation, the present invention can use different cropping coefficients for different image blocks. The adaptive cropping coefficient can effectively improve the contrast and details of each frame of the image. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 The figure shows a flow chart of a low illumination video image enhancement method based on an adaptive cropping coefficient provided by an embodiment of the present invention.
[0029] Figure 2 The figure is a schematic diagram of histogram statistics provided by an embodiment of the present invention.
[0030] Figure 3 FIG. 4 is a schematic diagram of linear interpolation provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0031] Now, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings. It should be understood that the embodiments shown and described in the accompanying drawings are only exemplary and are intended to explain the principles and spirit of the present invention, rather than to limit the scope of the present invention.
[0032] The embodiment of the present invention provides a low illumination video image enhancement method based on an adaptive cropping coefficient, such as Figure 1 As shown, the following steps S1 to S9 are included:
[0033] S1. Obtain a video under low illumination and shooting scene restriction conditions, convert each frame image in the video from the RGB color space to the HSV color space, and extract the brightness component of the image.
[0034] In an embodiment of the present invention, the OpenCV library function is used to obtain basic information of a video image, including the width, height, frame rate, number of frames, pixels and other information of the video. The video initially read in is in RGB color space, and the color space conversion formula is used to convert the RGB image to HSV color space to obtain the brightness component of the image, i.e., the V component.
[0035] S2. Perform GAMMA transformation preprocessing on the brightness component of the image to obtain a preprocessed image.
[0036] In the embodiment of the present invention, the GAMMA correction coefficient selected through experimental comparison is 0.6, so that the brightness value of the corrected image is more uniform and moderate.
[0037] S3. Divide the preprocessed image into 16×16 image blocks and calculate the mean and standard deviation of each image block.
[0038] In the embodiment of the present invention, the image can be divided into blocks by using a pointer (*input_data[ ]) to point to different positions of the preprocessed image, and the brightness value information of each image block is stored in the pointer.
[0039] S4. Calculate the coefficient of variation of each image block according to the average value and standard deviation of each image block, and calculate the cropping coefficient of the image block according to the coefficient of variation.
[0040] In the CLAHE algorithm, the formula for the clipping coefficient is:
[0041]
[0042] in represents the cropping factor of the image block, M represents the width of the image block, N Represents the height of the image block, Represents the cropping factor. Since different cropping factors need to be selected for different image blocks, the cropping factor is modified to:
[0043]
[0044] in represents the standard deviation of the image block, represents the average value of the image block, is a very small constant. , so the clipping factor formula can be simplified to:
[0045]
[0046] Among them will is called the coefficient of variation, because is a very small constant, so the coefficient of variation can be approximated as , the value range is [0,1]. If the image block area is a homogeneous area, that is, the smaller the degree of deviation of the brightness value from the mean, the smaller the coefficient of variation, and the smaller the cropping factor used; similarly, if the texture features of the image block area are more obvious, the greater the degree of deviation of the brightness value from the mean, the greater the coefficient of variation, and the larger the cropping factor used. Multiplying the coefficient of variation beforehand can achieve adaptive adjustment of the cropping factor.
[0047] S5. Calculate the histogram of the image block.
[0048] In the embodiment of the present invention, the voting principle is used to count the histogram of each image block: a 256-bit array is constructed, and each position of the array is initialized to 0, and the brightness value of each image block is read in a loop. Every time a brightness value is read, 1 is added to the corresponding array position, and the histogram of the image block is obtained by counting.
[0049] like Figure 2 As shown, for example, there are 5 image blocks with a brightness value of 1, so the value of the array "1" position is 5; there is 1 image block with a brightness value of 80, so the value of the array "80" position is 1.
[0050] S6. Use the cropping coefficient to crop each image block, and evenly distribute the cropped amount to each histogram column in the histogram to obtain a new histogram.
[0051] In the embodiment of the present invention, the value of each position in the array is subtracted from the clipping coefficient to obtain a new brightness value, and the new brightness values are accumulated and placed in a variable bonus. The variable bonus is divided by 256 and assigned to each histogram column in the histogram to obtain a new histogram.
[0052] S7. Calculate the cumulative distribution function of each image block according to the new histogram.
[0053] In the embodiment of the present invention, the cumulative distribution function of each image block is obtained by accumulating each histogram bar in the new histogram. The specific accumulation method is as follows:
[0054] The cumulative distribution function at the "0" position is itself.
[0055] The cumulative distribution function at the "1" position is the value at the "0" position plus the value at the "1" position.
[0056] The cumulative distribution function at the "2" position is the value at the "0" position plus the value at the "1" position plus the value at the "2" position.
[0057] The cumulative distribution function at the "3" position is the value at the "0" position plus the value at the "1" position plus the value at the "2" position plus the value at the "3" position.
[0058] And so on, the cumulative distribution function at each position of the array can be obtained, and further the cumulative distribution function corresponding to each image block can be obtained.
[0059] S8. Perform linear interpolation on the cumulative distribution function of each image block to obtain a new luminance component.
[0060] In the embodiment of the present invention, different interpolation methods are adopted for different image blocks. For example, Figure 3 As shown, for the image blocks at the four top corners of the image, their luminance values are directly obtained by multiplying the cumulative distribution function of the image block by 255.
[0061] For the image blocks on the four sides of the image, their luminance values are obtained by linearly interpolating the cumulative distribution functions of two adjacent image blocks.
[0062] For the image blocks in the middle area of the image, their luminance values are obtained by bilinearly interpolating the cumulative distribution functions of four adjacent image blocks.
[0063] The new luminance component of the image is obtained through the luminance values of each image block after linear interpolation.
[0064] S9. Convert each frame of the image back to the RGB color space according to the new luminance component to obtain the video image enhancement result.
[0065] The H component, S component, and the new V component are converted back to the RGB color space through the HSV to RGB formula for display output. By repeatedly reading in each frame and repeating the above steps, the video image enhancement result can be obtained.
[0066] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and should be understood that the protection scope of the present invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific variations and combinations that do not deviate from the essence of the present invention based on the technical revelations disclosed by the present invention, and these variations and combinations are still within the protection scope of the present invention.
Claims
1. A low-light video image enhancement method based on an adaptive cropping coefficient, characterized in that, it includes the following steps: S1. Obtain a video under low-light and shooting scene limitation conditions, convert each frame of the image in the video from the RGB color space to the HSV color space, and extract the luminance component of the image; S2. Perform GAMMA transformation preprocessing on the luminance component of the image to obtain a preprocessed image; S3. Divide the preprocessed image into 16×16 image blocks, and calculate the average value and standard deviation of each image block; S4. Calculate the coefficient of variation of each image block based on the average value and standard deviation of each image block, and calculate the cropping coefficient of the image block according to the coefficient of variation; S5. Statistically analyze the histogram of the image blocks; S6. Crop each image block using the cropping coefficient, and evenly distribute the cropped amount to each histogram bin in the histogram to obtain a new histogram; S7. Calculate the cumulative distribution function of each image block according to the new histogram; S8. Perform linear interpolation on the cumulative distribution function of each image block to obtain a new luminance component; S9. Convert each frame of the image back from the HSV color space to the RGB color space according to the new luminance component to obtain the video image enhancement result; The calculation formula for the cropping coefficient in step S4 is: wherein represents the cropping coefficient of the image block, represents the standard deviation of the image block, represents the average value of the image block, is a very small constant, represents the cropping factor, is the coefficient of variation of the image block, and its value range is [0, 1].
2. The low-light video image enhancement method according to claim 1, characterized in that, the GAMMA correction coefficient for performing GAMMA transformation preprocessing in step S2 is 0.
6.
3. The low-light video image enhancement method according to claim 1, characterized in that, in step S5, the histogram of each image block is statistically analyzed using the voting principle: construct a 256-bit array, assign an initial value of 0 to each position of the array, loop through and read the luminance value of each image block, and add 1 to the corresponding array position every time a luminance value is read to statistically obtain the histogram of the image block.
4. The low-light video image enhancement method according to claim 3, characterized in that, step S6 is specifically: subtract the value of each position in the array from the cropping coefficient to obtain a new luminance value, accumulate the new luminance values and place them in the variable bonus, divide the variable bonus by 256 and distribute it to each histogram bin in the histogram to obtain a new histogram.
5. The low-light video image enhancement method according to claim 1, characterized in that, in step S7, the cumulative distribution function of each image block is obtained by accumulating each histogram bin in the new histogram.
6. The low-light video image enhancement method according to claim 1, characterized in that, The specific steps of step S8 are as follows: for the image blocks at the four top corners of the image, their brightness values are directly obtained by multiplying the cumulative distribution function of the image block by 255; for the image blocks on the four sides of the image, their brightness values are obtained by linearly interpolating the cumulative distribution functions of two adjacent image blocks; for the image blocks in the middle region of the image, their brightness values are obtained by bilinearly interpolating the cumulative distribution functions of four adjacent image blocks; the new brightness component of the image is obtained through the brightness values of each image block after linear interpolation.
Citation Information
Patent Citations
Image local contrast enhancement method for optimizing CLAHE
CN114092361A
Underground drill rod counting method and device based on visual tracking algorithm
CN114693739A