Uneven illumination image correction method

By combining OTSU and Sauvola algorithms and realizing image correction on the FPGA platform, the problem of missing image details caused by uneven lighting is solved, and the image is efficient, real-time correction and noise reduction is achieved, which is suitable for high-demand application scenarios.

CN117115035BActive Publication Date: 2024-11-05CHANGCHUN UP OPTOTECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311133170.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-04
Publication Date
2024-11-05
Estimated Expiration
2043-09-04

AI Technical Summary

Technical Problem

The prior art is difficult to effectively solve the problems of missing image details and poor visibility caused by uneven lighting, especially in image processing and computer vision technology. The existing algorithms are prone to over-enhancement or under-enhancement, and have high complexity and cannot At the same time, reduce noise and ensure image quality.

Method used

Combining the OTSU algorithm and the Sauvola algorithm, the uneven illuminated image is corrected, and the image correction algorithm is combined with FPGA, and the noise is denoised through median filtering and low-pass filtering. The global and local thresholds are calculated using OTSU and Sauvola algorithms to achieve the accuracy of the image. Segmentation and brightness adjustment reduce noise and improve real-time and efficiency of image processing.

Benefits of technology

It realizes accurate correction of images under different lighting conditions, eliminates image problems caused by lighting differences, improves the speed and throughput of image processing, and is suitable for application scenarios with high real-time requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117115035B_ABST
    Figure CN117115035B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and in particular to an FPGA-based uneven illumination image correction method, which mainly includes reading and storing uneven illumination images; image conversion and denoising; using OTSU to obtain the maximum inter-class variance g and threshold T1, and segmenting the background C0 and foreground C1; performing Sauvola algorithm operation on the foreground C1, calculating the threshold T2 in a local window, and performing image segmentation to obtain local details; merging the background C0 and the foreground C1 to obtain an enhanced image after brightness adjustment, converting the enhanced image back to an RGB color image, and sending it to an output interface to realize image output. The combination of the OTSU algorithm and the Sauvola algorithm can respectively accurately correct the overall and foreground, and eliminate image problems caused by illumination differences; implementation on FPGA can greatly improve the speed and throughput of image processing, and is suitable for application scenarios with high real-time requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method for correcting an image with uneven illumination. Background Art

[0002] With the widespread application of various photographic devices, the phenomenon of missing image details and poor visibility due to uneven lighting, underexposure and other reasons is very common, which directly affects the development of computer vision technology, such as image feature extraction, target recognition, monitoring systems, etc. Therefore, it is very important to improve the contrast of images with uneven lighting, the brightness of dark areas, maintain the brightness information of other areas, and make the enhanced image have a high structural similarity with the original image.

[0003] In the field of image processing, due to the unevenness of lighting conditions, there are often obvious brightness differences and background noise in the image. In order to improve the image quality and the accuracy of subsequent processing, it is necessary to correct the uneven lighting image.

[0004] Existing gamma correction algorithms increase the contrast between high-frequency and low-frequency parts of an image by adjusting the ratio of the two, which can easily lead to over-enhancement and under-enhancement. Wavelet transform algorithms can highlight details at different scales, but they cannot simultaneously reduce noise while keeping the algorithm complexity low. Summary of the invention

[0005] In order to solve the above problems, the present invention provides a method for correcting uneven illumination images. By combining the OTSU algorithm and the Sauvola algorithm, the present invention can correct images under different illumination conditions, and combine the image correction algorithm with FPGA, thereby achieving real-time and high efficiency of image processing.

[0006] The uneven illumination image correction method provided by the present invention mainly comprises the following steps:

[0007] S1, read the uneven illumination image;

[0008] S2, converting the uneven illumination image into a grayscale image, and performing median filtering and low-pass filtering to remove noise to obtain a denoised image;

[0009] S3, using OTSU algorithm to calculate the global threshold T1 of the denoised image;

[0010] S4, performing preliminary binarization on the filtered image according to the global threshold T1 to obtain the background C0 and foreground C1 of the denoised image;

[0011] S5, using the Sauvola algorithm to calculate the threshold T2 of the foreground C1 in the local window;

[0012] S6, performing image segmentation on the foreground C1 according to the global threshold T1 and the threshold T2;

[0013] S7, merging the background C0 with the foreground C1 after image segmentation to obtain an enhanced image after brightness adjustment, and converting the enhanced image back into an RGB color image.

[0014] Further, step S3 specifically includes the following steps:

[0015] S31, calculate the overall average grayscale μ of the denoised image T ;

[0016] S32, performing grayscale statistics on the denoised image to obtain a grayscale histogram;

[0017] S33, according to the grayscale histogram, take the grayscale levels k∈[0,255] one by one as the segmentation threshold of the denoised image, and divide the denoised image into background C0 and foreground C1, and obtain the probability w0 and average grayscale μ0 of the background C0, and the probability w1 and average grayscale μ1 of the foreground C1 under different segmentation thresholds;

[0018] S34. Calculate the inter-class variance g according to the following formula:

[0019] g=w0(μ0-μ T ) 2 +w1(μ1-μ T ) 2 (1);

[0020] The gray level k that maximizes the inter-class variance g is selected as the threshold T1.

[0021] Furthermore, step S5 specifically includes the following steps:

[0022] S51, in the extracted foreground C1, calculate the local average grayscale μ in the w×w local window of each pixel T2 ;

[0023] S52, according to the local average gray level μ T2 , calculate the standard deviation s within the local window;

[0024] S53, according to the dependence degree m, the positive bias C and the sensitivity R, the threshold T2 is calculated by the following formula:

[0025] T2=m×(sR)+C (2);

[0026] Among them, the degree of dependence m represents the degree of dependence of the threshold T2 on the standard deviation s, and its value range is [0.1, 0.5]; the value range of the positive bias C is a positive integer of [0, 50]; and the value range of the sensitivity R is [0, 1].

[0027] Furthermore, the value range of the dependence degree m is limited to [0.3, 0.4]; the value range of the positive bias C is limited to a positive integer of [15, 25].

[0028] Furthermore, in step S6, the threshold T2 is used to perform image segmentation on the foreground C1 to obtain local details; for the transition area between the background C0 and the foreground C1, the threshold that makes the transition area more natural and smooth is selected by comparing the global threshold T1 and the threshold T2; the preliminary binarization is updated according to the selected threshold, and the transition area is obtained in combination with the denoised image.

[0029] Furthermore, the proposed uneven illumination image correction method is implemented on FPGA, including OTSU module and Sauvola module, where: the OTSU module calls 4 RAMs inside FPGA to store probability w0, average grayscale μ0, probability w1 and average grayscale μ1 respectively; 256 8-bit counters are used to realize grayscale statistics; in the process of traversing grayscale k, the multiplexing counter is used to calculate the inter-class variance g, and the register is used to store the global threshold T1; the Sauvola module calls the divider, multiplier and adder inside FPGA to calculate the local average grayscale μ T2 and standard deviation s, and are stored in two RAMs inside the FPGA respectively; finally, the threshold T2 is calculated using a multiplier in combination with the external input dependence m, positive bias C and sensitivity R.

[0030] Compared with the prior art, the present invention can achieve the following beneficial effects:

[0031] 1) By combining the OTSU algorithm and the Sauvola algorithm, the present invention can accurately correct the whole image and the foreground, respectively, and eliminate image problems caused by illumination differences;

[0032] 2) By implementing image correction on FPGA, the speed and throughput of image processing can be greatly improved, which is suitable for application scenarios with high real-time requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 is a flow chart of a method for correcting an uneven illumination image according to an embodiment of the present invention;

[0034] Figure 2 is a flow chart of an OTSU algorithm provided according to an embodiment of the present invention;

[0035] Figure 3 4 is a flow chart of the Sauvola algorithm provided according to an embodiment of the present invention. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and do not constitute a limitation of the present invention.

[0037] The uneven illumination image correction method based on the FPGA platform provided by the present invention can perform targeted correction on images under different illumination conditions by combining the OTSU algorithm and the Sauvola algorithm. At the same time, the image correction is implemented on the FPGA by utilizing the high parallelism and programmable characteristics of the FPGA platform, thereby achieving real-time and high efficiency of image processing.

[0038] Figure 1 The flowchart of the uneven illumination image correction method provided by the embodiment of the present invention is shown.

[0039] like Figure 1 As shown, the uneven illumination image correction method provided by the embodiment of the present invention specifically includes the following steps:

[0040] S1, read the uneven illumination image;

[0041] S2, converting the uneven illumination image into a grayscale image, and performing median filtering and low-pass filtering to remove noise to obtain a denoised image;

[0042] S3, using OTSU algorithm to calculate the global threshold T1 of the denoised image;

[0043] S4, performing preliminary binarization on the filtered image according to the global threshold T1 to obtain the background C0 and foreground C1 of the denoised image;

[0044] S5, using the Sauvola algorithm to calculate the threshold T2 of the foreground C1 in the local window;

[0045] S6. Perform image segmentation on the foreground C1 according to the global threshold T1 and threshold T2:

[0046] S7, merging the background C0 and the foreground C1 after image segmentation to obtain an enhanced image after brightness adjustment, and converting the enhanced image back into an RGB color image.

[0047] Figure 2 The flowchart of the OTSU algorithm provided by the embodiment of the present invention is shown.

[0048] like Figure 2 As shown, step S3 specifically includes the following steps:

[0049] S31, calculate the overall average grayscale μ of the denoised image T ;

[0050] S32, performing grayscale statistics on the denoised image to obtain a grayscale histogram;

[0051] S33, according to the grayscale histogram, take the grayscale levels k∈[0,255] one by one as the segmentation threshold of the denoised image, and divide the denoised image into background C0 and foreground C1, and obtain the probability w0 and average grayscale μ0 of the background C0, and the probability w1 and average grayscale μ1 of the foreground C1 under different segmentation thresholds;

[0052] S34. Calculate the inter-class variance g according to the following formula:

[0053] g=w0(μ0-μ T ) 2 +w1(μ1-μ T ) 2 (1);

[0054] The gray level k that maximizes the inter-class variance g is selected as the threshold T1.

[0055] Figure 3 The flowchart of the Sauvola algorithm provided by the embodiment of the present invention is shown.

[0056] like Figure 3 As shown, step S5 specifically includes the following steps:

[0057] S51, in the extracted foreground C1, calculate the local average grayscale μ in the w×w local window of each pixel T2 ;

[0058] S52, according to the local average gray level μ T2 , calculate the standard deviation s within the local window;

[0059] S53, according to the dependence degree m, the positive bias C and the sensitivity R, the threshold T2 is calculated by the following formula:

[0060] T2=m×(sR)+C (2);

[0061] Among them, the degree of dependence m represents the degree of dependence of the threshold T2 on the standard deviation s, and the value range is [0.1, 0.5]. The larger the value of the parameter m, the less sensitive it is to the standard deviation s. Therefore, in the embodiment of the present invention, the value range is limited to [0.3, 0.4]; the value range of the positive bias C is a positive integer of [0, 50]. If the value of the positive bias C is too large, the threshold T2 will be too high, and if it is too small, it cannot effectively prevent the negative threshold. Therefore, in the embodiment of the present invention, the value range is limited to [15, 25]; the value range of the sensitivity R is [0, 1]. When the standard deviation s is higher than half of the overall image, the threshold T2 will be significantly raised. Therefore, in the embodiment of the present invention, the sensitivity R is 0.5.

[0062] In step S6, the threshold T2 is used to segment the foreground C1 to obtain local details; for the transition area between the background C0 and the foreground C1, the threshold that makes the transition area more natural and smooth is selected by comparing the global threshold T1 and the threshold T2; the preliminary binarization is updated according to the selected threshold, and the transition area is obtained in combination with the denoised image;

[0063] The method for realizing uneven illumination images provided in the embodiment of the present invention is implemented on an FPGA, including an OTSU module and a Sauvola module, wherein:

[0064] In the OTSU module, the 4 RAMs inside the FPGA are called to store the probability w0, the average gray level μ0, the probability w1 and the average gray level μ1 respectively; 256 8-bit counters are used to implement gray level statistics; in the process of traversing the gray level k, the multiplexed counter is used to calculate the inter-class variance g, and the register is used to store the global threshold T1;

[0065] The Sauvola module uses the divider, multiplier, and adder inside the FPGA to calculate the local average grayscale μ T2 and standard deviation s, and are stored in two RAMs inside the FPGA respectively; finally, the threshold T2 is calculated using a multiplier in combination with the external input dependence m, positive bias C and sensitivity R.

[0066] In the embodiment of the present invention, FPGA is used as the top-level controller, which mainly includes:

[0067] A state machine is used for timing control, that is, to manage the start and stop of the two modules. According to the state of the state machine, the OTSU and Sauvola modules are started sequentially, and the image data is controlled when it enters the OTSU module and the Sauvola module.

[0068] Use multiplexers and access controllers to control data paths, i.e. use multiplexers to select image data to be input to the OTSU module or the Sauvola module, and use access controllers to coordinate the order in which different modules access the memory;

[0069] Perform clock management, that is, generate different clock frequencies for different algorithm modules and manage clock domain synchronization between modules.

[0070] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the disclosure of the present invention can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in the present invention can be achieved, and this document does not limit this.

[0071] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for correcting an image with uneven illumination, characterized in that: The specific steps include: S1, read uneven illumination image; S2, converting the uneven illumination image into a grayscale image, and performing median filtering and low-pass filtering to remove noise to obtain a denoised image; S3, using OTSU algorithm to calculate the global threshold of the denoised image ; S4. According to the global threshold The filtered image is preliminarily binarized to obtain the background of the denoised image. and prospects ; S5, using the Sauvola algorithm to calculate the foreground in the local window Threshold ; S6. According to the global threshold and the threshold , for the prospects Perform image segmentation; in step S6, according to the threshold Regarding the prospects Perform image segmentation to obtain local details; for the background and the prospects The transition region is then compared to the global threshold and the threshold , selecting a threshold value that makes the transition region more natural and smooth; updating the preliminary binarization according to the selected threshold value, and obtaining the transition region in combination with the denoised image; S7, the background Foreground after image segmentation The images are merged to obtain an enhanced image after brightness adjustment, and the enhanced image is converted back into an RGB color image.

2. The uneven illumination image correction method according to claim 1, characterized in that: The step S3 specifically includes the following steps: S31, calculating the overall average grayscale of the denoised image ; S32, performing grayscale statistics on the denoised image to obtain a grayscale histogram; S33, according to the gray level histogram, take the gray level As the segmentation threshold of the denoised image, the denoised image is divided into the background and the prospects , get the background under different segmentation thresholds Probability and average grayscale , and prospects Probability and average grayscale ; S34, calculate the inter-class variance according to the following formula : Select the between-class variance Maximum gray level As the threshold .

3. The uneven illumination image correction method according to claim 2, characterized in that: The step S5 specifically includes the following steps: S51, in the extracted foreground In each pixel Calculate the local average grayscale in the local window ; S52, according to the local average grayscale , calculate the standard deviation within the local window s ; S53. According to the degree of dependence m , positive bias C and sensitivity R , the threshold is calculated by the following formula : Among them, the degree of dependence m Represents the threshold The standard deviation s The degree of dependence is in the range of [0.1,0.5]; the positive bias C The value range is a positive integer in [0,50]; the sensitivity R The value range is [0,1].

4. The uneven illumination image correction method according to claim 3, characterized in that: The degree of reliance m The value range of is limited to [0.3,0.4]; the positive bias C The value range of is limited to positive integers in [15,25].

5. The uneven illumination image correction method according to claim 4, characterized in that: The uneven illumination image correction implementation method is implemented on an FPGA, and the FPGA includes an OTSU module and a Sauvola module, wherein: The OTSU module calls the 4 RAMs inside the FPGA to respectively , the average grayscale The probability and the average grayscale Storage; using 256 8-bit counters to achieve grayscale statistics; in the grayscale During the traversal process, the multiplexing counter is used to perform the inter-class variance The global threshold is calculated and stored in a register ; The Sauvola module calls the divider, multiplier and adder inside the FPGA to calculate the local average grayscale and the standard deviation s , and are stored in two RAMs inside the FPGA; finally, combined with the degree of dependence of the external input m , positive bias C and sensitivity R , the threshold is calculated using the multiplier .