A brightness compensation method for tobacco leaf images with uneven illumination

Through dark channel a priori algorithm and automatic background contrast adjustment method, the brightness compensation problem of uneven light tobacco leaves is solved, light correction and image quality improvement are achieved, and the accuracy and detection efficiency of tobacco leaves maturity recognition are ensured.

CN112330568BActive Publication Date: 2024-12-03YUNNAN ACAD OF TOBACCO AGRI SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011352803.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-27
Publication Date
2024-12-03
Estimated Expiration
2040-11-27

AI Technical Summary

Technical Problem

Uneven light causes light differences in tobacco leaf image shooting, affecting the aesthetic effect of the picture and the accuracy of tobacco leaf maturity recognition. Especially when shooting in different environments, the image quality decreases, making it difficult to achieve brightness compensation.

Method used

Use dark channel a priori algorithm to remove fog, and use an image enhancement algorithm that automatically adjusts background contrast, combined with two-dimensional second-order polynomial fitting to achieve brightness difference compensation, cut the image to reduce external ambient light spurs, highlight the target object, and adjust the contrast Factor to restore image lighting characteristics.

Benefits of technology

Effectively eliminates light inhomogeneity, improves image quality, ensures the accuracy and detection efficiency of tobacco leaf maturity recognition, avoids misjudgment caused by angle differences, and is suitable for different weather and light conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112330568B_ABST
    Figure CN112330568B_ABST
Patent Text Reader

Abstract

The present invention discloses a brightness compensation method for an unevenly illuminated tobacco leaf image, which includes inputting a tobacco leaf image into a network database, defogging the image using a dark channel prior algorithm, and then implementing image brightness difference compensation processing using an image enhancement algorithm that automatically adjusts the background contrast to obtain a tobacco leaf image after illumination correction. The present invention is based on an image enhancement and stray light removal algorithm that automatically adjusts the background contrast of an image. The algorithm is based on defogging using a dark channel prior method, obtains the distribution characteristics of the background illumination through polynomial fitting, and achieves the purpose of restoring and enhancing the image by adjusting the contrast factor. The present invention can effectively restore uneven illumination background, provides effective pre-processing for actual image applications, and ensures the original quality of the image, laying a good foundation for accurately identifying the maturity of tobacco leaves under different environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image processing, and in particular relates to a brightness compensation method for a tobacco leaf image with uneven illumination. Background Art

[0002] When taking photos with a mobile phone or camera during actual field harvesting and capturing tobacco leaf images, factors such as changes in lighting (changes in shooting angle), shadows, and differences in the reflective properties of the object surface often affect the image. This causes uneven lighting on the surface of the imaged tobacco leaves, resulting in some areas of the acquired tobacco leaf images having too strong lighting while others have weak lighting. This not only seriously affects the aesthetics of the image, but also misleads the results of tobacco leaf maturity recognition, and especially brings certain difficulties to the processing of tobacco leaf images (such as background removal and feature value extraction).

[0003] Therefore, it is extremely necessary to study a real-time brightness compensation method for tobacco leaf images with uneven illumination that can correct image brightness differences. Summary of the invention

[0004] The object of the present invention is to provide a brightness compensation method for a tobacco leaf image with uneven illumination.

[0005] The objective of the present invention is achieved in this way. A brightness compensation method for a tobacco leaf image with uneven illumination is provided, which is to input the tobacco leaf image into a network database, use a dark channel prior algorithm to defog the image, and then use an image enhancement algorithm that automatically adjusts the background contrast to achieve image brightness difference compensation processing to obtain a tobacco leaf image after illumination correction.

[0006] The beneficial effects of the present invention are:

[0007] 1) The method of the present invention is based on the dark channel prior and adds an image enhancement algorithm that automatically adjusts the background contrast. The dark channel of the image is calculated in sequence, the refractive index is calculated using the dark channel, the atmospheric light is evaluated, and the haze map is obtained. Then, the background contrast is adjusted by deducting the haze map from the image to obtain a picture after brightness difference compensation.

[0008] 2) This method uses image cropping in sequence to limit a small area on the tobacco leaf image, eliminate the influence of external ambient light stray as much as possible, highlight the target, and automatically adjust the background contrast to achieve the purpose of brightness compensation. This method fully considers the limitations of shooting conditions in different environments (bad weather, shooting angle, indoor and outdoor light, etc.), resulting in image quality degradation or unclear, color difference, blur, etc., and effectively realizes accurate compensation of brightness differences, providing favorable support for accurate identification of tobacco leaf maturity.

[0009] 3) The method of the present invention is based on an image enhancement and de-stray light algorithm that automatically adjusts the background contrast of the image. The algorithm is based on the dark channel prior method for defogging, obtains the distribution characteristics of the background illumination through polynomial fitting, and achieves the purpose of restoring and enhancing the image by adjusting the contrast factor. The present invention can effectively restore the uneven illumination background, provide effective pre-processing for actual image applications, and ensure the original quality (fidelity) of the image. It lays a good foundation for accurately identifying the maturity of tobacco leaves based on images under different environments, and ensures accurate qualitative grading of tobacco leaves.

[0010] 4) The method of the present invention is not affected by usage scenarios under different weather conditions and shooting angles under different brightness, and can effectively avoid misjudgment of results due to color differences caused by angle differences.

[0011] 5) The present invention can process both single images and image backgrounds in batches, greatly improving detection efficiency and ensuring the reliability of analysis results. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 is a tobacco leaf image of Example 1 of the present invention, wherein a is a tobacco leaf image taken on a rainy day, and b is a tobacco leaf image after brightness compensation;

[0013] Figure 2 is a tobacco leaf image of Example 2 of the present invention, wherein a is a tobacco leaf image taken on a hazy day, and b is a tobacco leaf image after brightness compensation;

[0014] Figure 3 is a tobacco leaf image of Example 3 of the present invention, wherein a is a tobacco leaf image taken on a rainy day, and b is a tobacco leaf image after brightness compensation;

[0015] Figure 4 is a tobacco leaf image of Example 4 of the present invention, wherein a is a tobacco leaf image taken in a floodlight environment, and b is a tobacco leaf image after brightness compensation;

[0016] Figure 5 is a tobacco leaf image of Example 5 of the present invention, wherein a is a tobacco leaf image taken under greenhouse light, and b is a tobacco leaf image after brightness compensation;

[0017] Figure 6 is a tobacco leaf image of Example 6 of the present invention, wherein a is a tobacco leaf image taken indoors, and b is a tobacco leaf image after brightness compensation;

[0018] Figure 7 : is the tobacco leaf image of Example 7 of the present invention, wherein a is the tobacco leaf image taken under strong light, and b is the tobacco leaf image after brightness compensation. DETAILED DESCRIPTION

[0019] The present invention is further described below in conjunction with the embodiments, but the present invention is not limited in any way. Any changes or improvements made based on the teachings of the present invention belong to the protection scope of the present invention.

[0020] The invention discloses a brightness compensation method for a tobacco leaf image with uneven illumination. The method comprises the following steps: inputting the tobacco leaf image into a network database, using a dark channel priori algorithm to perform defogging on the image, and then using an image enhancement algorithm that automatically adjusts the background contrast to achieve image brightness difference compensation processing, thereby obtaining a tobacco leaf image after illumination correction.

[0021] The specific steps include:

[0022] S1: Dark channel prior

[0023] 1) Input foggy tobacco leaf image I,

[0024] 2) Calculate the transmittance estimate based on the defogging model

[0025] The dehazing model

[0026] (x)—input image, i.e., the photographed tobacco leaf image; J(x)—image with stray light removed;

[0027] A—ambient atmospheric light component; t(x)—transmission image (or refractive index (atmospheric transmission coefficient)). Assuming that the transmittance t(x) is a constant in each window, it is defined as , and the value of A is given, then the minimum operation is performed twice on both sides to obtain the following formula:

[0028]

[0029] J is the desired fog-free image. According to the aforementioned dark color prior theory:

[0030]

[0031] get:

[0032]

[0033] Recalculate the estimated refractive index

[0034]

[0035] In real life, even in a blue sky with white clouds, there are still some particles in the air. Therefore, the influence of fog can still be felt when looking at distant objects. In addition, the presence of fog makes humans feel the existence of depth of field. It is necessary to retain a certain degree of fog when defogging. The present invention introduces a factor between [0,1] as a correction (weighted value ω correction) in the above formula:

[0036]

[0037] Among them, ω is a weighted value between [0,1]; Jc represents each channel of the color image, Ω(x) represents a window centered on pixel X, first find the minimum value of the RGB component of each pixel, store it in a grayscale image of the same size as the original image, and then perform minimum filtering on the grayscale image. The radius of the filter is determined by the window size, and the window width = 2*Radius+1; Ac is the atmospheric light value of the c channel;

[0038] 3) Estimation of atmospheric light A: Select the brightest 0.1% pixels in the dark channel of the dark channel image, and take the brightest pixel among the pixels corresponding to these pixels in the input image as the atmospheric light A;

[0039] 4) Defogging image I according to the defogging model to obtain the haze-free image J corresponding to I:

[0040] exist In the formula, the data of each channel needs to be divided by the corresponding A value, that is, normalized, so that a good defogging high-contrast image can be obtained for a low-contrast image. However, the / A operation may cause t<0. In this case, the value of t can be directly set to 0 to solve the problem. Using the previous dark channel image / A for operation is simple and efficient, and the haze-free image can be restored. And J=(IA) / t+A, now I, A, t have all been calculated, so J can be calculated completely.

[0041] When the value of the projection image t is very small, the value of J will be too large, causing the image to transition to the white field as a whole. Therefore, a threshold t is set. 0 , when t <t 0 When t=t 0 All the effect diagrams in this invention are based on t 0 =0.1 is the standard calculation.

[0042] Therefore, the final formula is as follows:

[0043]

[0044] S2: Adjust the image contrast to obtain the tobacco leaf image after illumination correction:

[0045] 1) Obtain the contrast ratio u(x) between the foggy image I(x) and the fog-free image J(x):

[0046]

[0047] 2) Based on the two-dimensional second-order polynomial F(x,y)=c0+c1x+c2y+c3xy+c4x 2 +c5y 2 ;Fit the threshold surface and determine a threshold surface that can change appropriately with the change of the image area, but the average brightness of the background remains almost unchanged. Use this surface to segment the background and tobacco leaf image;

[0048] 3) Perform contrast adjustment on the segmented tobacco leaf image.

[0049] The two-dimensional second-order polynomial fits a subset of the brightness values ​​of the pixels of a given image through the minimum mean square error of the brightness function in the sense of minimum mean square error MSE;

[0050]

[0051] Where num is the number of image pixels;

[0052] Uneven illumination conditions may cause the background brightness function to present a plane or quadratic surface form. Therefore, the present invention adopts a two-dimensional second-order polynomial to fit the threshold surface to approximate the interface between the object and the background image, and further remove the uneven background to completely extract the target from the background. The method fits a subset of the brightness values ​​of the pixels of a given image through the minimum mean square error MSE of the brightness function, and determines a threshold surface that can change appropriately with the change of the image area for the average brightness Bave of the fitted background surface (Formula 1), but the average brightness of the background is almost unchanged, so the average brightness can better separate the background and the target. For pixels belonging to the background, u(x) is close to 1, and the corrected tobacco leaf image takes the average brightness of the fitted background; for pixels with smaller u(x), the probability of belonging to the object is greater, and its brightness is appropriately amplified by the adjustment factor S (Formula 2); the restored image obtained by different contrast adjustment factors, in addition, as the adjustment factor S increases, the contrast of the restored image also increases, while keeping the background brightness uniform; the adjusted image is output to obtain the tobacco leaf image after illumination correction.

[0053] Bave=[I(x,y)-J(x,y)]*x 3 +[I(x,y)-J(x,y)]*x 2 +[I(x,y)-J(x,y)]*x+U(x) (Formula 1);

[0054] S=Bave / MSE (Equation 2)

[0055] This method crops the image background frame before dark channel prior dehazing to reduce the background clutter.

[0056] The tobacco leaf image is the clearest target object that can be photographed in severe weather conditions, thereby improving the contrast between the target object and the stray light background.

[0057] The present invention is further described below with reference to the embodiments.

[0058] Embodiments 1-7 use the method of the present invention to perform illumination compensation processing on tobacco leaf images collected under different illumination environments. Figure 1-7 They are the original tobacco leaf image and the tobacco leaf image after brightness compensation in Examples 1-7.

[0059] The following is a detailed description of the steps of the method of the present invention by taking Example 2 as an example.

[0060] Jiuxi Town, Jiangchuan District, Yuxi, in haze weather, use a mobile phone to take photos of tobacco leaves in the field, capture the clearest possible image of the tobacco leaves and crop the background of the image to remove the cluttered background, such as Figure 2 As shown in a, add basic information about tobacco leaves, such as variety, part, harvest time, etc. Then open the mobile network, log in to the IP, and upload the tobacco leaf image to the network database.

[0061] Will Figure 2 After the background is removed by cropping in the middle, the image contrast is adjusted line by line based on the dark channel prior defogging and the minimum pixel brightness to obtain the tobacco leaf image after illumination correction. Figure 2 Middle b.

[0062] Comparative Example

[0063] Image recognition was performed on the original tobacco leaf images and the tobacco leaf images after brightness compensation in Examples 1-7 to determine the maturity. The results are shown in Table 1.

[0064] Table 1 Maturity discrimination results before and after brightness compensation

[0065]

[0066] It can be seen from Table 1 that the tobacco leaf images processed by the brightness compensation method of the present invention in Examples 1-7 are more conducive to the identification of tobacco leaf maturity based on image processing.

Claims

1. A brightness compensation method for an unevenly illuminated tobacco leaf image, characterized in that: The tobacco leaf image is input into the network database, the dark channel prior algorithm is used to defog the image, and then the image brightness difference compensation processing is realized by the image enhancement algorithm which automatically adjusts the background contrast, so as to obtain the tobacco leaf image after illumination correction; The specific steps include: S1. Dark channel prior 1) Input foggy tobacco leaf image I , 2) Calculate the transmittance estimate in, ω is a weighted value between [0,1]; I c (y) is a channel of a point y in the RGB image, A c is the atmospheric light value of the c channel, C is the c channel, Ω(x) Represents a window centered on pixel X; first find the minimum value of the RGB components of each pixel and store it in a grayscale image of the same size as the original image, then perform minimum filtering on the grayscale image. The radius of the filter is determined by the window size, and the window width = 2*Radius+1; 3) Estimation of atmospheric light A: Select the brightest 0.1% pixels in the dark channel of the dark channel image, and take the brightest pixel among the pixels corresponding to these pixels in the input image as the atmospheric light A; 4) Based on the dehazing model For images I After defogging, we get I The corresponding haze-free image J : in, J(x) To eliminate the image affected by stray light, I(x) The input is the tobacco leaf image taken. A is the ambient atmospheric light component, t(x) is the medium transmittance, t 0 is the transmittance obtained from the prior information, and its value is 0.1; S2. Adjust the image contrast to obtain the tobacco leaf image after illumination correction: a. Obtaining a foggy image I(x) With fog-free image J(x) Contrast ratio U(x) : b. Based on two-dimensional second-order polynomial F(x,y)=c0+c1x+c2y+c3xy+c4x 2 +c5y 2 Fitting a threshold surface to determine a threshold surface that can change appropriately with the change of the image area, but the average brightness of the background remains almost unchanged, and using this surface to segment the background and tobacco leaves; the two-dimensional second-order polynomial is a subset of the brightness values ​​of the given image pixels fitted by the minimum mean square error of the brightness function in the sense of minimum mean square error (MSE); in, x, y are the horizontal and vertical coordinates of the image area; c is the generated fitting threshold surface, where c0, c1, c2, c3, c4, c5 are the polynomial coefficients; num is the number of image pixels, zi, xi , yi are the grayscale values ​​of the vertical line, horizontal coordinate, and vertical coordinate corresponding to the i-th pixel point, respectively. F(xi,yi) Based on xi,yi A two-dimensional second-order polynomial of ; c. Adjust the contrast of the segmented tobacco leaf image. The specific method is as follows: for pixels belonging to the background, U(x) Close to 1, the corrected tobacco leaf image takes the average brightness Bave of the fitted background, as shown in Formula 1; U(x) The brightness of the smaller pixel is appropriately amplified by the adjustment factor S as shown in formula 2; the restored image is obtained by different contrast adjustment factors. In addition, as the adjustment factor S increases, the contrast of the restored image also increases, while keeping the background brightness uniform; the adjusted image is output to obtain the tobacco leaf image after illumination correction; Bave= [I(x,y)-J(x,y)]*x 3 +[I(x,y)-J(x,y)]*x 2 +[I(x,y)-J(x,y)]*x+U(x) Formula 1; S=Bave / MSE Formula 2; in, I(x,y) are the horizontal and vertical coordinate values ​​corresponding to the existing foggy image, J(x,y) To output the horizontal and vertical coordinate values ​​corresponding to the tobacco leaf image after illumination correction.

2. The brightness compensation method for unevenly illuminated tobacco leaf images according to claim 1, characterized in that: Before dark channel prior dehazing, the image background frame is cropped to reduce the background noise.

3. The brightness compensation method for unevenly illuminated tobacco leaf images according to claim 1, characterized in that: The tobacco leaf image is a target object that is photographed as clearly as possible under bad weather.