Night image color correction method and device

By grouping and calculating local contrast information in nighttime images and selecting bright areas and low gray index areas, the problem of inaccurate light source estimation in nighttime images is solved, and efficient color cast correction is achieved.

CN117274075BActive Publication Date: 2025-09-16YANGTZE DELTA REGION INST OF UNIV OF ELECTRONICS SCI & TECH OF CHINE (HUZHOU)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311077931.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-25
Publication Date
2025-09-16
Estimated Expiration
2043-08-25

AI Technical Summary

Technical Problem

Existing color correction methods for nighttime color images suffer from decreased accuracy in detecting gray points under noise interference, resulting in inaccurate light source estimation, affecting image quality and subsequent visual tasks.

Method used

By extracting image brightness information, grouping areas within the neighborhood, calculating local contrast information and gray index, selecting bright areas and low gray index areas as gray areas, and obtaining light source information based on these areas to perform color deviation correction.

Benefits of technology

It effectively suppresses noise interference, improves the accuracy of night scene light source estimation, enhances image quality, and has simple calculation and good effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117274075B_ABST
    Figure CN117274075B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for nighttime image color correction. The method comprises the following steps: firstly, dividing an image into three components: red, green, and blue; grouping pixel values ​​within the neighborhood of each pixel based on brightness information and calculating the average value thereof; then, for each pixel point in each channel, taking the logarithm of the average value of the corresponding high-value group and the average value of the corresponding low-value group and performing a subtraction to obtain a local contrast value of each pixel point; calculating the gray index at each pixel position based on the local contrast values ​​in the three color channels, and obtaining a gray index distribution map; selecting some bright pixels as initial bright pixels based on brightness information; and simultaneously performing uniform grid division on the image space; selecting a bright area by calculating the ratio of bright pixels in each grid area; selecting a candidate gray point falling into the bright area as the final extracted gray point, estimating the light source of the image, and performing color correction on the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of computer vision and image processing, and particularly relates to a method and device for nighttime image color correction. Background Art

[0002] In natural scenes, color images often provide richer visual information than grayscale images. When acquiring images using imaging devices, the colors of objects in the captured color images often deviate from their true colors due to varying lighting conditions. For example, the same white object will exhibit different color casts in the images captured by a camera under different lighting conditions. This color cast not only directly impacts image quality but also interferes with subsequent visual tasks that utilize color information. Therefore, color correction of the acquired raw color signals is a necessary step in various imaging systems. In particular, color correction of nighttime color images is particularly challenging due to factors such as low scene illumination, uneven illumination distribution, and high imaging noise. Currently, there is limited research on color correction methods for nighttime color images, making the development of color correction methods for nighttime color images of great significance.

[0003] Existing color correction algorithms include the gray-world algorithm and the gray point detection algorithm. The gray-world algorithm assumes that the average grayscale values ​​of the three color channels of a color image acquired under white illumination are equal. This method is computationally simple, but performs poorly in some scenes. In recent years, a typical image color correction method is the gray point detection algorithm, as described in the paper: KF Yang, SB Gao, and YJ Li. Efficient Illuminant Estimation for Color Constancy Using Grey Pixels. CVPR, 2015. This method assumes that some detectable gray pixels exist in color images under normal illumination. It estimates the locations of gray pixels in the scene and uses these pixels as much as possible to estimate the image's illuminant. This method has the advantages of few parameters, simple computation, and good performance. However, in nighttime color correction tasks, noise interference reduces the accuracy of gray point detection, resulting in poor performance. Summary of the Invention

[0004] To address the shortcomings of the existing technology and improve the accuracy of gray point detection, thereby correcting image color based on gray points and improving the accuracy of night scene light source estimation, the present invention adopts the following technical solutions:

[0005] A method for nighttime image color correction comprises the following steps:

[0006] Step S1: extracting brightness information corresponding to the image color;

[0007] Step S2: Determine the region in the image, and group the regions within its neighborhood according to the brightness information corresponding to the color of the region, so that each region obtains multiple groups of brightness information corresponding to its color;

[0008] Step S3: Calculating local contrast information of the regional color based on each set of brightness information corresponding to the regional color;

[0009] Step S4: Calculate the gray index of the region based on the local contrast information of the region color to obtain the gray index distribution of the image;

[0010] Step S5: Select the bright area according to the brightness information, and take the area falling into the bright area and with a small gray index as the gray area;

[0011] Step S6: Based on the gray area corresponding to the image color, obtain the light source information corresponding to the image color, and perform color deviation correction on the image using the image and its light source information.

[0012] Furthermore, the region is a pixel point, and the region color is a color channel of the pixel point;

[0013] In step S1, the average of the pixel values ​​of each pixel in several color channels is calculated to obtain the brightness value of each pixel;

[0014] In step S2, the brightness values ​​of the pixels in the color channel within a certain range of each pixel are grouped according to the neighborhood range of each pixel; the neighborhood range is 9 pixels × 9 pixels;

[0015] In step S3, in each color channel, the grouping value corresponding to each pixel is compared to obtain a local contrast value of the pixel.

[0016] Furthermore, the color channels include red, green and blue.

[0017] Furthermore, in step S2, the regions are grouped by calculating the median of the regional brightness values ​​within the domain range, so that the regions obtain the average value of the high value group and the average value of the low value group under each color;

[0018] In step S3, in each color, the logarithm operation is performed on the average value of the high value group and the average value of the low value group corresponding to each area to obtain the high value group logarithm value and the low value group logarithm value, and then the low value group logarithm value is subtracted from the high value group logarithm value to obtain the local contrast value of the area.

[0019] Furthermore, in step S4, the standard deviation and mean of the local contrast value of each region in each color are calculated, and then the standard deviation is divided by the mean to obtain the gray index of the region.

[0020] Furthermore, in step S4, the gray index at each region position in the image is calculated in sequence to obtain a gray index distribution map; in step S5, based on the gray index distribution map, the region with a small gray index is extracted as the gray region.

[0021] Furthermore, in step S5, based on the brightness information in step S1, bright areas are proportionally selected, and the image space is gridded. The final bright area is determined based on the proportion of bright areas in the grid area. A portion of bright pixels is selected at a ratio of 20% as initial bright pixels; the grid size is 20 pixels × 20 pixels.

[0022] Furthermore, in step S5, based on the gray index in step S4, regions with smaller gray indexes are extracted as candidate gray regions, and the candidate gray regions falling within the bright region are used as the final extracted gray regions. The gray value of the pixels with smaller gray values ​​ranges from one pixel to 0.1% of the number of pixels in the image.

[0023] Furthermore, in step S6, the sum of the pixel values ​​of the gray areas in each color channel of the image is used as the light source information of the color, and the image pixel value of each color is divided by the light source information of the corresponding color to correct the color deviation of the image.

[0024] A nighttime image color correction device includes a memory and one or more processors. The memory stores executable code. When the one or more processors execute the executable code, they are used to implement a nighttime image color correction method.

[0025] The advantages and beneficial effects of the present invention are:

[0026] The present invention provides a method and device for nighttime image color correction. Based on brightness information, pixel values ​​within the neighborhood of each pixel are grouped and their average values ​​are calculated. This effectively suppresses noise interference and improves local contrast. By selecting gray points in bright areas, the impact of insufficient nighttime illumination on gray point detection is reduced, and the accuracy of nighttime scene light source estimation is improved, thereby resolving problems such as high noise and low brightness in nighttime scenes. The method and device have the characteristics of simple calculation and good effect, and are very suitable for color correction of images in nighttime scenes. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 This is a flow chart of a nighttime image color correction method according to an embodiment of the present invention.

[0028] Figure 2ais the original nighttime color cast image in the embodiment of the present invention.

[0029] Figure 2b This is a color-bias-free image obtained by the nighttime image color correction method in an embodiment of the present invention.

[0030] Figure 2c It is a standard color-free image calculated from a real light source in an embodiment of the present invention.

[0031] Figure 3 2 is a schematic structural diagram of a nighttime image color correction device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0032] The following describes the specific embodiments of the present invention in detail with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only used to illustrate and explain the present invention and are not intended to limit the present invention.

[0033] like Figure 1 As shown in the figure, a nighttime image color correction method uses a Nikon D750 camera to shoot test images outdoors at night. A standard color plate is placed during the shooting process to obtain the scene's actual light source information. The acquired image size is 3016×2016×3, in 14-bit TIF format. The standard image without color cast is obtained after correction of the scene's actual light source. The specific steps include:

[0034] Step S1: extracting brightness information corresponding to the image color;

[0035] Decompose the input color image into three color channel images: red, green, and blue; calculate the mean of the pixel values ​​of each pixel in several color channels (such as red, green, and blue) to obtain the brightness value of each pixel.

[0036] In the embodiment of the present invention, taking the pixel point (200, 200) as an example, the pixel values ​​of the red, green, and blue channels of the pixel point are 3242, 2614, and 896, respectively; the average pixel value of the red, green, and blue channels at the pixel point (200, 200) is 2250.7; according to this method, the brightness value of each pixel point is calculated in sequence.

[0037] Step S2: Determine the region in the image, and group the regions within its neighborhood according to the brightness information corresponding to the color of the region, so that each region obtains multiple groups of brightness information corresponding to its color;

[0038] According to the neighborhood range of each pixel point, the brightness values ​​of the pixels within a certain range in the color channel are grouped; by calculating the median of the brightness values ​​of the pixels within the range, the pixels are grouped so that the pixels obtain the average value of the high value group and the average value of the low value group under each color channel.

[0039] Specifically, based on the brightness value of each pixel point obtained in step S1, the pixels within a certain neighborhood range of each pixel in each color channel are grouped; specifically, for each pixel point, the median of the brightness values ​​of the pixels within its certain neighborhood range is calculated, and then the pixels with brightness values ​​greater than the median value are divided into a high-value group, and the pixels with brightness values ​​less than or equal to the median value are divided into a low-value group; the average values ​​of the high-value group and the low-value group pixels in the red, green and blue color channels are calculated respectively, and recorded as the high-value group average value and the low-value group average value of the corresponding pixels in the corresponding channels; finally, for each pixel in each color channel, the corresponding high-value group average value and the low-value group average value are obtained.

[0040] In this embodiment of the present invention, taking the pixel point (200, 200) as an example, the median of the brightness value of the pixel point within a 9×9 neighborhood in the red channel is calculated to be 2155.3. Pixels with brightness values ​​greater than the median are then divided into a high-value group, and pixels with brightness values ​​less than or equal to the median are divided into a low-value group. The average values ​​of the high-value group in the red, green, and blue color channels are calculated to be 3092.9, 2905.4, and 888.8, respectively, and the average values ​​of the low-value group are calculated to be 2711.9, 2543.8, and 760.2, respectively. Finally, for each pixel in each color channel, the corresponding average values ​​of the high-value group and the low-value group are obtained.

[0041] Step S3: Calculating local contrast information of the regional color based on each set of brightness information corresponding to the regional color;

[0042] In each color channel, the logarithm operation is performed on the average value of the high-value group and the average value of the low-value group corresponding to each pixel point to obtain the logarithmic value of the high-value group and the logarithmic value of the low-value group. Then, the logarithmic value of the high-value group is subtracted from the logarithmic value of the low-value group to obtain the local contrast value of the pixel point. Each pixel point in the three channels is traversed in turn, and the corresponding local contrast value is obtained for each pixel in each color channel.

[0043] In the embodiment of the present invention, taking the pixel point (200, 200) as an example, in the three color channels, for each pixel point, the logarithm operation is performed on the corresponding high-value group average and low-value group average, respectively. The logarithmic values ​​of the high-value group average are: 8.0369, 7.9743, and 6.7899, respectively, and the logarithmic values ​​of the low-value group average are: 7.9054, 7.8414, and 6.6336, respectively. Then, in each color channel, the logarithmic value of the corresponding low-value group average is subtracted from the logarithmic value of the high-value group average, and the local contrast values ​​of the pixel point in the three color channels are obtained as: 0.1315, 0.1329, and 0.1562, respectively. Each pixel point in the three color channels is traversed in sequence, and the corresponding local contrast value of each pixel in each color channel is obtained.

[0044] Step S4: Calculate the gray index of the region based on the local contrast information of the region color to obtain the gray index distribution of the image;

[0045] Calculate the standard deviation and mean of the local contrast value of each pixel in each color channel, divide the standard deviation by the mean to obtain the gray index of the pixel position, and calculate the gray index of each pixel position in the image in turn to obtain the gray index distribution map.

[0046] In the embodiment of the present invention, taking the pixel point (200, 200) as an example, the standard deviation of the local contrast values ​​of the pixel point in the red, green, and blue color channels of 0.1315, 0.1329, and 0.1562 is calculated to be 0.0139, which is then divided by the mean of the local contrast values ​​of the pixel point in the red, green, and blue color channels of 0.1402 to obtain a gray index at the pixel position of 0.0990. The gray index at each pixel position in the image is calculated sequentially to obtain a gray index distribution graph.

[0047] Step S5: Select the bright area according to the brightness information, and take the area falling into the bright area and with a small gray index as the gray area;

[0048] According to the brightness information in step S1, bright pixels are selected proportionally, and the image space is gridded at the same time. The bright area is determined according to the proportion of bright pixels in the grid area; according to the gray index distribution map in step S4, pixels with small gray values ​​are extracted as candidate gray points, and the candidate gray points falling into the bright area are used as the final extracted gray points.

[0049] In an embodiment of the present invention, first, based on the brightness information calculated in step S1, 20% of pixels with the largest brightness values ​​are proportionally selected as initial bright pixels; at the same time, the image space is evenly divided, and each grid size is 20 pixels × 20 pixels; the proportion of bright pixels in each grid area is calculated, and the grid area with more than half of the bright pixels is extracted as the final selected bright area; in addition, from the gray index distribution map calculated in step S4, this embodiment extracts 0.1% of pixels with the smallest grayscale value as candidate gray points, and the candidate gray points falling into the bright area are used as the final extracted gray points, obtaining a total of 1520 pixels as gray points.

[0050] Step S6: Based on the gray area corresponding to the image color, obtain the light source information corresponding to the image color, and perform color deviation correction on the image using the image and its light source information.

[0051] The sum of the pixel values ​​of the gray points in each color channel of the image is used as the light source information of the color channel. The image pixel value of each color channel is divided by the light source information of the corresponding channel to correct the color deviation of the image.

[0052] In an embodiment of the present invention, the sum of the pixel values ​​corresponding to the gray points in the red, green, and blue channel images of each original image is calculated as the light source information of each channel, which are 5343202, 4794584, and 1243016, respectively. The images of the three color channels of the original image are divided by the light source information of the corresponding channels to correct the color shift of the image. Taking the pixel point (200, 200) as an example, the pixel values ​​of the three color channels of this pixel point in the original image are 3242, 2614, and 896, respectively. The pixel values ​​after division by the light source information of the corresponding channels are 0.00060675, 0.00054520, and 0.00072083, respectively. Finally, the pixels of the entire image are linearly normalized to obtain the corrected image.

[0053] The test results are as follows Figures 2a to 2c As shown, the present invention performs color correction on a color-biased image, which can achieve an effect equivalent to that of a standard image without color bias, and the calculation is simple and flexible.

[0054] Corresponding to the aforementioned embodiment of a method for nighttime image color correction, the present invention also provides an embodiment of a device for nighttime image color correction.

[0055] See also Figure 3 An embodiment of the present invention provides a nighttime image color correction device, comprising a memory and one or more processors. The memory stores executable code. When the one or more processors execute the executable code, they are used to implement a nighttime image color correction method in the above embodiment.

[0056] An embodiment of a night image color correction device of the present invention can be applied to any device with data processing capabilities, and the device with data processing capabilities can be a device or apparatus such as a computer. The device embodiment can be implemented through software, or through hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of any device with data processing capabilities in which it is located reading the corresponding computer program instructions in the non-volatile memory into the memory for execution. From the hardware level, if Figure 3 The figure shows a hardware structure diagram of a night image color correction device of the present invention, in which any device with data processing capability is located. Figure 3 In addition to the processor, memory, network interface, and non-volatile memory shown, any device with data processing capabilities in which the apparatus in the embodiment is located may also include other hardware, generally based on the actual functions of the device with data processing capabilities, which will not be described in detail.

[0057] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0058] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial description of the method embodiments. The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and 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 network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present invention. A person of ordinary skill in the art can understand and implement the present invention without inventive work.

[0059] An embodiment of the present invention further provides a computer-readable storage medium having a program stored thereon. When the program is executed by a processor, the method for nighttime image color correction in the above embodiment is implemented.

[0060] The computer-readable storage medium may be an internal storage unit of any device with data processing capabilities described in any of the aforementioned embodiments, such as a hard disk or memory. The computer-readable storage medium may also be an external storage device of any device with data processing capabilities, such as a plug-in hard disk, a smart media card (SMC), an SD card, a flash card, etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit and an external storage device of any device with data processing capabilities. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capabilities, and may also be used to temporarily store data that has been output or is to be output.

[0061] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A nighttime image color correction method, characterized in that The steps include: Step S1: extracting brightness information corresponding to the image color; Step S2: Determine the region in the image, and group the regions within its neighborhood according to the brightness information corresponding to the color of the region, so that each region obtains multiple groups of brightness information corresponding to its color; Step S3: Calculating local contrast information of the regional color based on each set of brightness information corresponding to the regional color; Step S4: Calculate the gray index of the region based on the local contrast information of the region color; Step S5: Selecting a bright area based on the brightness information, and defining the area within the bright area with a small gray index as a gray area; the area with a small gray index refers to a group of pixels with the smallest gray value in the gray index distribution diagram, and the number of pixels in this group ranges from one pixel to 0.1% of the number of pixels in the image; Step S6: Based on the gray area corresponding to the image color, obtain the light source information corresponding to the image color, and perform color deviation correction on the image using the image and its light source information.

2. The method for nighttime image color correction according to claim 1, wherein: The region is a pixel point, and the region color is a color channel of the pixel point; In step S1, the average of the pixel values ​​of the pixel in several color channels is calculated to obtain the brightness value of the pixel; In step S2, the brightness values ​​of the pixels in the neighborhood of the pixel points in the color channel are grouped according to the neighborhood of the pixel points; In step S3, the grouping values ​​corresponding to the pixels in each color channel are compared to obtain the local contrast value of the pixel.

3. The method for nighttime image color correction according to claim 2, wherein: The color channels include red, green, and blue.

4. The method for nighttime image color correction according to claim 1, wherein: In step S2, the regions are grouped by calculating the median of the brightness values ​​of the regions within the neighborhood, so that the regions obtain the average value of the high value group and the average value of the low value group under each color; In step S3, for each color, logarithmic operations are performed on the average values ​​of the high-value group and the low-value group corresponding to the region to obtain the high-value group logarithm value and the low-value group logarithm value, and then the high-value group logarithm value is subtracted from the low-value group logarithm value to obtain the local contrast value of the region.

5. The method for nighttime image color correction according to claim 1, wherein: In step S4, the standard deviation and mean of the local contrast value of the region in each color are calculated, and then the standard deviation is divided by the mean to obtain the gray index of the region.

6. The method for nighttime image color correction according to claim 5, characterized in that: In step S4, the gray index at each region position in the image is calculated in sequence to obtain a gray index distribution map; In step S5, based on the gray index distribution diagram, the area with a small gray index is extracted as the gray area.

7. The method for nighttime image color correction according to claim 1, characterized in that: In step S5, a bright area is selected according to the brightness information in step S1, and the image space is gridded. The final bright area is determined according to the proportion of the bright area in the grid area.

8. The method for nighttime image color correction according to claim 1, characterized in that: In step S5, based on the gray index in step S4, regions with small gray index are extracted as candidate gray regions, and candidate gray regions falling into the bright region are taken as the final extracted gray regions.

9. The method for nighttime image color correction according to claim 1, characterized in that: In step S6, the sum of the pixel values ​​of the gray areas in each color channel of the image is used as the light source information of the color, and the image pixel value of each color is divided by the light source information of the corresponding color to correct the color deviation of the image.

10. A nighttime image color correction device, characterized in that: The invention comprises a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement a nighttime image color correction method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Method for correcting image colors through gray points

    CN104504722A

  • Super night scene image color correction method and device and electronic device

    CN110958401A