# Multi-region Nonuniform Brightness Correction Algorithm Based on L-Channel Gamma Transform

Authors: Min Qi; Shanshan Cui; Xin Chang; Yuelei Xu; Hongying Meng; Yi Wang; Ting Yin
Journal: Security and Communication Networks
 (2022)

---

## Abstract

Nonuniform brightness distribution of collimator reticle images leads to the recognition difficulty of reticle grids and coordinate scales on images and affects the digitalization of reticle coordinate system. The article proposes an image quality improvement algorithm that operates onL channel of LAB color space to perform brightness correction. It designs four typical image modules depending on representative brightness features. Corresponding brightness correction models for all typical image modules are constructed by designing the new correction functions based on nonlinear gamma transform. A concept of brightness similarity is defined for automatic matching between typical image modules and the image region to be processed. On this basis, the algorithm can automatically adjust brightness correction mode to ensure the brightness of each pixel tends to be uniform, which is reflected in a visible improvement in the color distortion of the image. The algorithm can effectively reduce the complexity of model processing and adaptively adjust brightness correction intensity according to the pixel brightness value. It enables more accurate corrections with good results.


---

## Body

## 1. Introduction

In many technologies such as image enhancement [1] and target detection, the influence of illumination [2] has always been an important concern. During the image acquisition process, due to changes in the imaging environment or uneven smoothness of the surface of the object, the brightness of the image may vary locally. Some regions may be brighter than others, while some may look dim, which makes it difficult to identify local details in the image [3]. Therefore, before applying the image, it is necessary to improve the overall quality of the brightness-distorted image, that is, to preprocess the image.Common processing methods include histogram equalization method, homomorphic filtering method based on illumination-reflection model, gradient domain transform method, and gamma transform method. Histogram equalization [4–7] has a certain practical value for images whose background and foreground are too bright or too dark, but its disadvantage is that it does not select the processed data, so it may eventually increase the contrast of the background area or decrease the contrast of useful signals; the homomorphic filtering method [8,9] based on the principle of illumination-reflection imaging can enhance the high-frequency information of the image while retaining part of the low-frequency information, achieving the effect of compressing the dynamic range of the image gray level and enhancing the contrast of the image. However, when the grayscale value of one part of the image is enhanced, it is easy to cause the grayscale value of another part of the image to be over-enhanced; the gradient domain transformation method[10,11] can better maintain the detailed information and sense of hierarchy in the original image, but it will sharpen the image to a certain extent. Gamma transform [12–16] can effectively attenuate the influence of light and improve the quality of the image under unknown lighting conditions by selecting an appropriate gamma value.The current gamma transform correction methods are divided into linear correction methods and nonlinear correction methods. The linear correction method can realize the change of the gamma transform intensity with the pixel grayscale value to a certain extent, and overcome the shortcoming of traditional gamma transform method that cannot solve the problem of grayscale correction where highlight areas and shadow areas coexist in the same image, but there are still some shortcomings. First, the linear correction methods lack the ability to effectively enhance the gamma value changing with the pixel grayscale values. Second, the selection of the gamma value has not yet solved the practical problem of the grayscale changes in the highlight, transition, and shadow areas in an image. Finally, the grayscale images are slightly distorted after gamma transform, and the phenomenon becomes obvious for color images which are converted to grayscale images before gamma transform. The nonlinear correction method uses a correction mode in which nonlinear functions are superimposed on each other, but its correction model is too complicated and computationally complex, which is not conducive to implementation.The collimator [17] is an optical tool commonly used in the calibration process. Due to the small area of the collimator reticle, the resolution of its coordinates in the display with a green background is limited. In addition, the observation is also inconvenient and human eyes are prone to fatigue. the digitalization of the collimator reticle coordinate system can address the shortcomings and provide an intelligent, convenient, and more accurate optical measurement. The first step in the process is to acquire the image of the reticle. At this point, the main problem encountered is that the color of the reticle image has distortion with two forms superimposed. One is that the colors in some areas are darker than normal color and some are lighter than normal colors. Another is that the overall color shades of some of the images taken at different moments are different. These problems pose difficulties for the subsequent recognition of reticle grids and coordinate scales on images and affect the generation of a complete digital reticle coordinate system. Thus, the image quality needs to be improved.However, the various methods referred to above do not solve this problem well. Among these methods, the performance of the traditional nonlinear gamma transform correction method is relatively good, but the results of color correction are still not satisfactory. The gamma transform is hard to obtain satisfactory parameters for a whole reticle image. The reason is that the correction model is too complex to control under the complicated color distribution as collimator reticle images which need the adjustment of an opposite trend for darker color and lighter color to get a consistent middle value.Considering the fact that the essence of visual color distortions comes from the unequal brightness on the reticle image, known as uneven brightness, unlike usual gamma transform methods that operate on grayscale images of color images, the proposed algorithm in this article transforms color images from RGB color space to LAB color space to perform correction inL channel independently. The strategy of correction aimed at brightness is directed at the intrinsic factor and enables more accurate corrections with good results. In addition, the algorithm reasonably designs four typical image modules depending on brightness features and constructs correction model for each module. The proposed models aided by auxiliary functions are based on gamma transform by studying the brightness characteristics and its variation laws in different modules, and the corresponding parameters are trained respectively. It effectively reduces the complexity of model processing. Last, a new concept of brightness similarity of two image regions is defined, which allows the algorithm to automatically identify different regions in an image according to their different brightness intensities, and adaptively adjust brightness correction mode to ensure the brightness of all pixels in an image tends to be uniform and produce an image with harmonious colors.


## 2. Methodology

The color collimator reticle image from the RGB color space is mapped to the LAB color space; theL, A, and B channel values of all pixels are then saved; and the L-channel image displayed in grayscale is extracted separately. Considering the transformation capability of gamma transform and the characteristics of the brightness distribution of reticle images, four typical image modules are designed according to their brightness distribution characteristics in L-channel image; brightness correction models are construct based on nonlinear gamma transform and designed corresponding correction functions; the correction functions are performed with different parameters on each typical image module to make reticle grids and coordinate scales clear, and the correction parameters are obtained saving as typical brightness correction parameter sets. When correcting the uneven brightness of the reticle image, the color reticle image is divided into multiple regions, and each region is matched to the most similar typical image module through a similarity measurement mechanism; the corresponding brightness correction parameter set is obtained to complete the best brightness correction; after the brightness correction of all areas, the color reticle image which has been processed is restored to the RGB color space. This is the high-quality image with uniform brightness that will be provided for subsequent recognition of reticle grids and coordinate scales. Specific steps are shown in Figure 1.Figure 1
The flowchart of the overall method.


### 2.1. Mapping the Color Collimator Reticle Image from RGB Color Space to LAB Color Space

In the RGB color space, different lighting will affect the pixel values of the R, G, and B channels, which brings difficulty to the overall lighting processing. Compared with the RGB color space, the LAB color space is a device-independent color system. TheL channel represents the brightness of the pixel, the A channel represents the range from red to green, and the B channel represents the range from yellow to blue. Different lighting that affects only the L channel value will not affect the other two channels. The image is mapped to the LAB color space, and the brightness can be independently corrected, which is helpful to solve the image quality problem caused by the light interference.


### 2.2. Defining Typical Image Modules Based on Brightness Characteristics

Due to the different parallel light intensity of the collimator tube and the influence of the surrounding environment when taking pictures of the reticle, the imaging effect of the reticle will be different, including different brightness regions in one image and different brightness levels for different images. Therefore, it is necessary to analyze and define several typical image modules for the reticle images according to the brightness distribution characteristics. They are defined as low brightness (LB) image module, high brightness (HB) image module, brightness transition (BT) image module, and normal brightness (NB) image module. The size of the four image modules is 64 × 64 with the unit pixel, and this size can be adjusted according to the actual situation. According to the existing reticle image, an area with a size of 64 × 64 in pixel is selected on the L-channel image and four typical image modules are selected and defined according to the following steps:The average brightness “g” of the area is calculated ad follows:(1)g=164×64∑i=064∑j=064Li,j,where i is the row number of the image area and j is the column number.Using the following formula, the area is binarized and the average brightness difference between the background image and the foreground image including reticle grids and coordinate scales is calculated. The range of brightness values for each pixel is [0, 100] inL channel. For the subsequent definition of typical image modules, only a rough distinction between foreground and background is needed, so here the binarization is carried out using formula (1).(2)Li,j=1,Li,j≥50,0,Li,j<50.After the binarization, the background pixel value is 1 and the foreground pixel value is 0.With the average brightnessgb of the background pixel at the corresponding position on the L-channel image and the average brightness gf of the foreground pixel at the corresponding position on the L-channel image, the average brightness difference Ñ g between the background pixel and the foreground pixel is obtained as follows:(3)∇g=|gb−gf|.When Ñg < 38, the brightness difference between the collimator reticle coordinates image and the background image is too small to be displayed clearly, and it will adversely affect the subsequent image processing.The area that meets the conditions listed in Table1 are selected and defined it as typical image modules.Table 1
Definition of four typical image modules.
Typical image moduleLBHBBTNBAverage brightnessg < 40g > 8440 ≤g ≤ 8440 ≤g ≤ 84Average brightness differenceÑg < 38Ñg < 38Ñg < 38Ñg ≥ 38


### 2.3. Constructing Brightness Correction Models for Typical Image Modules

The brightness correction models for all typical image modules are studied. New formulas of correction functions based on gamma transform are designed, and they are performed respectively on the L-channel images of the LB, HB and BT modules to make reticle grids and coordinate scales clear in order to get their typical brightness correction parameter sets.The L-channel image of the LAB color space is displayed as a grayscale image with a size of 64 pixels ×64 pixels. The basic form of gamma transform is:(4)s=crαr=cr1/γr,αr>0,where c is a normal number and the typical value is 0.5. r is the brightness value before conversion, s is the brightness value after conversion, α(r) is the power exponent related to the pixel value, γ(r) is the correction function, and α(r) is the reciprocal of each other, the typical value of γ(r) is as follows:(5)γr=1+mcosπr2r0m∈0,1,where m is the adjustment coefficient and r0 is the critical value of brightness correction. In terms of the control of the brightness correction effect, only relying on increasing m to expand the value range of γ(r) will cause the amplitude change rate of γ(r) in the value range to be too large, that is, the unit brightness change causes γ(r) amplitude to change too much, which causes the value of α(r) to change drastically, and finally causes obvious distortion of the corrected image. In order to solve this problem and improve the robustness of brightness correction, γ′(r) is put forward based on γ(r). At this time α(r) is:(6)αr=1γ′r=1γr+fr.γ′(r) is composed of γ(r) superimposed on an auxiliary function f(r), and f(r) is composed of one or several linear functions or nonlinear functions. The following discusses the brightness correction strategy of the L-channel image of the four typical image modules.The brightness correction model for LB image module. The pixel brightness value in the LB image module is low, and the brightness value needs to be increased through correction. In this case, the form of the correction function γ(r) is as follows:(7)γr=1+m1cosπr2r01m1∈0,1,where m1 is the regulation coefficient, with a typical value of 0.2. r01 is the critical value of the corrected brightness of the LB image module, and the typical value is 0.3. In this article, the brightness value in the narrow range of [0, r01] is extended to a large brightness range by gamma transform, so as to improve the image brightness, stretch the contrast at the same time, and achieve the purpose of making the dotted grid and coordinate scale clear. Since the correction range is limited to [0, r01], and the brightness is increasing, only the correction range is different, so the auxiliary function f(r) uses the following linear function form:(8)fr=nd1−rr01,r∈0,r01nd∈0,1,where nd is the regulation coefficient, with a typical value of 0.7. Thus, the brightness correction function of the LB image module is obtained as follows:(9)s=r1/1+m1cosπr/2r01+nd1−r/r01,r∈0,r01,r,r∈r01,1.The typical brightness correction parameter setPSd of this module is {m1, r01, nd }. The correction function curve is shown in Figure 2. After correction, the average grayscale value g and average brightness difference ∇ g of the image are all in the range of NB image module, and the reticle grids and coordinate scales can be clearly displayed.Figure 2
The brightness correction function of LB image module.The brightness correction model for HB image module. In the HB image module, the marking grid and coordinate scale are not clear because of the influence of the brightness value is too high, so the brightness value needs to be reduced through correction. In order to achieve this purpose, the correction function γ(r) uses the following form:(10)γr=1+m2cosπ−π1−r21−r02,m2∈0,1,where m2 is the regulation coefficient, with a typical value of 0.2. r02 is the critical value of the corrected brightness of the HB image module, and the typical value is 0.7. At this point, the auxiliary function f(r) in the HB image module uses the following linear function form:(11)fr=nhr02−r1−r02,r∈r02,1nh∈0,1,where nh is the regulation coefficient, with a typical value of 0.1.Thus, the brightness correction function of the HB image module is obtained as follows:(12)s=r,r∈0,r02,r11+m2cosπ−π1−r/21−r02+nhr02−r/1−r02,r∈r02,1.The typical brightness correction parameter setPSh of this module is {m2, r02, nh }. The correction function curve is shown in Figure 3. After correction, the average grayscale value g and average brightness difference ∇ g of the image are all in the range of NB image module, and the reticle grids and coordinate scales can be clearly displayed.Figure 3
The brightness correction function of HB image module.The brightness correction model for BT image module. Under the actual illumination conditions, there is usually a transition area between the high brightness region and low brightness region. This article adopts the adaptive strategy of different correction strength in the BT image module. For the pixels whose brightness is distributed in the middle region of the module, the intensity of brightness correction is weak. The brightness distribution is close to the pixels at both ends, and the intensity of brightness correction is strengthened. In this case, the form of correction function γ(r) is as follows:(13)γr=1+m1cosπr2r01,r∈0,r01,1,r∈r01,r02,1+m2cosπ−π1−r21−r02,r∈r02,1,where m1 and m2 are the adjustment coefficients, with typical values of 0.2. r01 and r02 are the threshold values of the corrected brightness of the LB image module and the HB image module, and the typical values are 0.3 and 0.7, respectively.The auxiliary functionf(r) is designed as the following nonlinear function:(14)fr=ρsin4πrcosθ+r−12sinθ,ρ∈0,1,where θ = arctan(−2nt), nt is the regulation coefficient, with a typical value of 0.3. The parameter ρ is introduced in order to make the correction effect of pixel brightness to be weak in the middle and strong at both ends when the auxiliary function f(r) is corrected. The typical value of ρ is 0.1.Thus, the brightness correction function of the BT image module is obtained as follows:(15)s=r11+m1cosπr/2r01+fr,r∈0,r01,r11+fr,r∈r01,r02,r11+m2cosπ−π1−r/21−r02+fr,r∈r02,1,where (16)fr=ρsin4πrcosθ+r−12sinθ,ρ∈0,1,θ=arctan−2nt.The typical brightness correction parameter setPSt of this module is {m1, m2, r01, r02, nt, ρ}. The correction function curve is shown in Figure 4. After correction, the average grayscale value g and average brightness difference ∇ g of the image are all in the range of NB image module, and the reticle grids and coordinate scales can be clearly displayed.Figure 4
The brightness correction function of BT image module.The brightness correction model for NB image module. The reticle grids and coordinate scales in the NB image module can be clearly displayed, so the brightness correction function is simplys = r.


### 2.4. Adaptive Brightness Correction

The L-channel image of the color reticle image to be processed into several regions is divided, and the optimal brightness similarity match is carried out between each region and all typical image modules. The corresponding typical brightness correction parameters are obtained to carry out brightness correction.For L-channel images, horizontal and vertical parallel lines separated by size (typical value is 64 in pixels) are used to divide them into multiple square areas. When the side length of the remaining region is less than the size near the image boundary, it still becomes an independent region. The concept of brightness similarity of two images block is defined, which is denoted bySi(U, Vi) as:(17)SiU,Vi=UTViUTU1/2⋅ViTVi1/2,i=d,h,t,n,where U is the brightness matrix of a certain region of the reticle L-channel image to be processed; Vi represents the brightness matrix of the L-channel image of a typical image module. The size of the brightness matrix is 64 × 64, and the element value in the matrix is the corresponding pixel value of the L-channel image. When subscript i is d, it stands for LB image module, h stands for HB image module, t stands for BT image module, and n stands for NB image module. The larger the Si(U, Vi), the higher the similarity between the two and the closer the brightness distribution. According to formula (17), the brightness similarity Si(U, Vi) between a certain region and the L-channel image of the four typical image modules is calculated respectively. According to the i value corresponding to the maximum brightness similarity value, the brightness correction parameter set of typical image modules is obtained. Based on this parameter, the brightness correction of the region of the L-channel image of the reticle to be processed is completed.AllN regions of the L-channel image of the reticle to be processed are traversed, and the self-adaptive brightness correction of the entire image is completed.


### 2.5. Converting the Reticle Image from LAB Color Space back to RGB Color Space

The RGB color mode was adopted by current monitors. In order to enable the corrected image to be displayed normally on the monitor, the brightness-corrected reticle image is converted from the LAB color space back to the RGB color space.At this point, a complete reticle image with uniform brightness is obtained. The reticle grids and coordinate scales of the low brightness region, high brightness region, brightness transition region, as well as the normal brightness region in the original image are all clearly displayed at the same time and provide a high-quality image.


## 2.1. Mapping the Color Collimator Reticle Image from RGB Color Space to LAB Color Space

In the RGB color space, different lighting will affect the pixel values of the R, G, and B channels, which brings difficulty to the overall lighting processing. Compared with the RGB color space, the LAB color space is a device-independent color system. TheL channel represents the brightness of the pixel, the A channel represents the range from red to green, and the B channel represents the range from yellow to blue. Different lighting that affects only the L channel value will not affect the other two channels. The image is mapped to the LAB color space, and the brightness can be independently corrected, which is helpful to solve the image quality problem caused by the light interference.


## 2.2. Defining Typical Image Modules Based on Brightness Characteristics

Due to the different parallel light intensity of the collimator tube and the influence of the surrounding environment when taking pictures of the reticle, the imaging effect of the reticle will be different, including different brightness regions in one image and different brightness levels for different images. Therefore, it is necessary to analyze and define several typical image modules for the reticle images according to the brightness distribution characteristics. They are defined as low brightness (LB) image module, high brightness (HB) image module, brightness transition (BT) image module, and normal brightness (NB) image module. The size of the four image modules is 64 × 64 with the unit pixel, and this size can be adjusted according to the actual situation. According to the existing reticle image, an area with a size of 64 × 64 in pixel is selected on the L-channel image and four typical image modules are selected and defined according to the following steps:The average brightness “g” of the area is calculated ad follows:(1)g=164×64∑i=064∑j=064Li,j,where i is the row number of the image area and j is the column number.Using the following formula, the area is binarized and the average brightness difference between the background image and the foreground image including reticle grids and coordinate scales is calculated. The range of brightness values for each pixel is [0, 100] inL channel. For the subsequent definition of typical image modules, only a rough distinction between foreground and background is needed, so here the binarization is carried out using formula (1).(2)Li,j=1,Li,j≥50,0,Li,j<50.After the binarization, the background pixel value is 1 and the foreground pixel value is 0.With the average brightnessgb of the background pixel at the corresponding position on the L-channel image and the average brightness gf of the foreground pixel at the corresponding position on the L-channel image, the average brightness difference Ñ g between the background pixel and the foreground pixel is obtained as follows:(3)∇g=|gb−gf|.When Ñg < 38, the brightness difference between the collimator reticle coordinates image and the background image is too small to be displayed clearly, and it will adversely affect the subsequent image processing.The area that meets the conditions listed in Table1 are selected and defined it as typical image modules.Table 1
Definition of four typical image modules.
Typical image moduleLBHBBTNBAverage brightnessg < 40g > 8440 ≤g ≤ 8440 ≤g ≤ 84Average brightness differenceÑg < 38Ñg < 38Ñg < 38Ñg ≥ 38


## 2.3. Constructing Brightness Correction Models for Typical Image Modules

The brightness correction models for all typical image modules are studied. New formulas of correction functions based on gamma transform are designed, and they are performed respectively on the L-channel images of the LB, HB and BT modules to make reticle grids and coordinate scales clear in order to get their typical brightness correction parameter sets.The L-channel image of the LAB color space is displayed as a grayscale image with a size of 64 pixels ×64 pixels. The basic form of gamma transform is:(4)s=crαr=cr1/γr,αr>0,where c is a normal number and the typical value is 0.5. r is the brightness value before conversion, s is the brightness value after conversion, α(r) is the power exponent related to the pixel value, γ(r) is the correction function, and α(r) is the reciprocal of each other, the typical value of γ(r) is as follows:(5)γr=1+mcosπr2r0m∈0,1,where m is the adjustment coefficient and r0 is the critical value of brightness correction. In terms of the control of the brightness correction effect, only relying on increasing m to expand the value range of γ(r) will cause the amplitude change rate of γ(r) in the value range to be too large, that is, the unit brightness change causes γ(r) amplitude to change too much, which causes the value of α(r) to change drastically, and finally causes obvious distortion of the corrected image. In order to solve this problem and improve the robustness of brightness correction, γ′(r) is put forward based on γ(r). At this time α(r) is:(6)αr=1γ′r=1γr+fr.γ′(r) is composed of γ(r) superimposed on an auxiliary function f(r), and f(r) is composed of one or several linear functions or nonlinear functions. The following discusses the brightness correction strategy of the L-channel image of the four typical image modules.The brightness correction model for LB image module. The pixel brightness value in the LB image module is low, and the brightness value needs to be increased through correction. In this case, the form of the correction function γ(r) is as follows:(7)γr=1+m1cosπr2r01m1∈0,1,where m1 is the regulation coefficient, with a typical value of 0.2. r01 is the critical value of the corrected brightness of the LB image module, and the typical value is 0.3. In this article, the brightness value in the narrow range of [0, r01] is extended to a large brightness range by gamma transform, so as to improve the image brightness, stretch the contrast at the same time, and achieve the purpose of making the dotted grid and coordinate scale clear. Since the correction range is limited to [0, r01], and the brightness is increasing, only the correction range is different, so the auxiliary function f(r) uses the following linear function form:(8)fr=nd1−rr01,r∈0,r01nd∈0,1,where nd is the regulation coefficient, with a typical value of 0.7. Thus, the brightness correction function of the LB image module is obtained as follows:(9)s=r1/1+m1cosπr/2r01+nd1−r/r01,r∈0,r01,r,r∈r01,1.The typical brightness correction parameter setPSd of this module is {m1, r01, nd }. The correction function curve is shown in Figure 2. After correction, the average grayscale value g and average brightness difference ∇ g of the image are all in the range of NB image module, and the reticle grids and coordinate scales can be clearly displayed.Figure 2
The brightness correction function of LB image module.The brightness correction model for HB image module. In the HB image module, the marking grid and coordinate scale are not clear because of the influence of the brightness value is too high, so the brightness value needs to be reduced through correction. In order to achieve this purpose, the correction function γ(r) uses the following form:(10)γr=1+m2cosπ−π1−r21−r02,m2∈0,1,where m2 is the regulation coefficient, with a typical value of 0.2. r02 is the critical value of the corrected brightness of the HB image module, and the typical value is 0.7. At this point, the auxiliary function f(r) in the HB image module uses the following linear function form:(11)fr=nhr02−r1−r02,r∈r02,1nh∈0,1,where nh is the regulation coefficient, with a typical value of 0.1.Thus, the brightness correction function of the HB image module is obtained as follows:(12)s=r,r∈0,r02,r11+m2cosπ−π1−r/21−r02+nhr02−r/1−r02,r∈r02,1.The typical brightness correction parameter setPSh of this module is {m2, r02, nh }. The correction function curve is shown in Figure 3. After correction, the average grayscale value g and average brightness difference ∇ g of the image are all in the range of NB image module, and the reticle grids and coordinate scales can be clearly displayed.Figure 3
The brightness correction function of HB image module.The brightness correction model for BT image module. Under the actual illumination conditions, there is usually a transition area between the high brightness region and low brightness region. This article adopts the adaptive strategy of different correction strength in the BT image module. For the pixels whose brightness is distributed in the middle region of the module, the intensity of brightness correction is weak. The brightness distribution is close to the pixels at both ends, and the intensity of brightness correction is strengthened. In this case, the form of correction function γ(r) is as follows:(13)γr=1+m1cosπr2r01,r∈0,r01,1,r∈r01,r02,1+m2cosπ−π1−r21−r02,r∈r02,1,where m1 and m2 are the adjustment coefficients, with typical values of 0.2. r01 and r02 are the threshold values of the corrected brightness of the LB image module and the HB image module, and the typical values are 0.3 and 0.7, respectively.The auxiliary functionf(r) is designed as the following nonlinear function:(14)fr=ρsin4πrcosθ+r−12sinθ,ρ∈0,1,where θ = arctan(−2nt), nt is the regulation coefficient, with a typical value of 0.3. The parameter ρ is introduced in order to make the correction effect of pixel brightness to be weak in the middle and strong at both ends when the auxiliary function f(r) is corrected. The typical value of ρ is 0.1.Thus, the brightness correction function of the BT image module is obtained as follows:(15)s=r11+m1cosπr/2r01+fr,r∈0,r01,r11+fr,r∈r01,r02,r11+m2cosπ−π1−r/21−r02+fr,r∈r02,1,where (16)fr=ρsin4πrcosθ+r−12sinθ,ρ∈0,1,θ=arctan−2nt.The typical brightness correction parameter setPSt of this module is {m1, m2, r01, r02, nt, ρ}. The correction function curve is shown in Figure 4. After correction, the average grayscale value g and average brightness difference ∇ g of the image are all in the range of NB image module, and the reticle grids and coordinate scales can be clearly displayed.Figure 4
The brightness correction function of BT image module.The brightness correction model for NB image module. The reticle grids and coordinate scales in the NB image module can be clearly displayed, so the brightness correction function is simplys = r.


## 2.4. Adaptive Brightness Correction

The L-channel image of the color reticle image to be processed into several regions is divided, and the optimal brightness similarity match is carried out between each region and all typical image modules. The corresponding typical brightness correction parameters are obtained to carry out brightness correction.For L-channel images, horizontal and vertical parallel lines separated by size (typical value is 64 in pixels) are used to divide them into multiple square areas. When the side length of the remaining region is less than the size near the image boundary, it still becomes an independent region. The concept of brightness similarity of two images block is defined, which is denoted bySi(U, Vi) as:(17)SiU,Vi=UTViUTU1/2⋅ViTVi1/2,i=d,h,t,n,where U is the brightness matrix of a certain region of the reticle L-channel image to be processed; Vi represents the brightness matrix of the L-channel image of a typical image module. The size of the brightness matrix is 64 × 64, and the element value in the matrix is the corresponding pixel value of the L-channel image. When subscript i is d, it stands for LB image module, h stands for HB image module, t stands for BT image module, and n stands for NB image module. The larger the Si(U, Vi), the higher the similarity between the two and the closer the brightness distribution. According to formula (17), the brightness similarity Si(U, Vi) between a certain region and the L-channel image of the four typical image modules is calculated respectively. According to the i value corresponding to the maximum brightness similarity value, the brightness correction parameter set of typical image modules is obtained. Based on this parameter, the brightness correction of the region of the L-channel image of the reticle to be processed is completed.AllN regions of the L-channel image of the reticle to be processed are traversed, and the self-adaptive brightness correction of the entire image is completed.


## 2.5. Converting the Reticle Image from LAB Color Space back to RGB Color Space

The RGB color mode was adopted by current monitors. In order to enable the corrected image to be displayed normally on the monitor, the brightness-corrected reticle image is converted from the LAB color space back to the RGB color space.At this point, a complete reticle image with uniform brightness is obtained. The reticle grids and coordinate scales of the low brightness region, high brightness region, brightness transition region, as well as the normal brightness region in the original image are all clearly displayed at the same time and provide a high-quality image.


## 3. Results and Discussion

The experiments were performed on a Windows 10 64 bit operating system. The processor is Intel Core i7-9700 K with 3.60 GHz operating frequency, and the memory is 32 GB. The vision system uses a CCD camera with a resolution of 3072 × 2048. In the following experiments, brightness correction has been completed for four kinds of regions, and good correction results have been achieved. Figure5 is a collimator reticle image with uneven brightness. It shows one example for each kind of region with different brightness features individually: area 1 is for low brightness region, area 2 is for high brightness region, area 3 is for brightness transition region, and area 4 is for normal brightness region.Figure 5
The collimator reticle image with uneven brightness.In order to implement the correction of brightness, the first step is to get the parameters of correction models for each typical brightness image module. The color collimator reticle images from RGB color space are mapped to LAB color space. According to the criteria in Table1, four representative image blocks with the size of 64 × 64 in pixel respectively in the L channel are selected and defined them as the four typical image modules. Each correction model is trained with the corresponding typical image module to make the brightness of all pixels uniform. At the same time, the green color of background becomes even and the lines are clear visually. Then the parameter sets of brightness correction models for each typical image module can be obtained. The typical values are as follows:The parameter setPSd of {m1, r01, nd } for LB image module is {0.2, 0.3, 0.7}; the parameter set PSh of {m2, r02, nh } for HB image module is {0.2, 0.7, 0.1}, the parameter set PSt of {m1, m2, r01, r02, nt, ρ} for BT image module is {0.2, 0.2, 0.3, 0.7, 0.3, 0.1}, and the NB image module needs no parameter set. The values of all the parameter sets can be fine-adjusted when required for specific different applications.For a color collimator reticle image to be processed, the image is divided into multiple square regions with a size of 64 in pixel. The brightness similaritySi (U, Vi) is calculated between each region and all typical image modules and the maximum is obtained to perform the adaptive brightness correction. The following are examples of experimental results of brightness correction for different brightness areas in the processed image. For Si (U, Vi), in the value of i, d is for LB typical image module, h is for HB typical image module, t is for BT typical image module, and n is for NB typical image module.


### 3.1. Adaptive Brightness Correction of Area 1

The brightness similaritiesSi (U, Vi) between area 1 and all typical image modules are shown in Table 2. U is the brightness matrix of area 1. Among Si(U, Vi), the Sd(U, Vd) value is the largest, indicating that the region is closest to the brightness of the LB typical image module, so the parameters of the typical brightness correction parameter set PSd of LB image module are used to perform brightness correction on area 1 and converted the transformed image to the RGB color space.Table 2
The brightness similaritySi(U, Vi) between area 1 and four typical image modules.
Sd(U, Vd)Sh(U, Vh)St(U, Vt)Sn(U, Vn)Area 10.9130.5170.8510.699Figure6(a) is the original image of area 1, Figure 6(b) shows its L-channel image, and Figure 6(c) is the corrected image. At this time, the overall brightness of the image is improved, and the grid lines are more clearly displayed.Figure 6
The results of area 1 before and after correction. (a) Original image of area 1, (b) L-channel image, and (c) corrected image.
(a)(b)(c)


### 3.2. Adaptive Brightness Correction of Area 2

The brightness similaritiesSi (U, Vi) between area 2 and all typical image modules are shown in Table 3. U is the brightness matrix of area 2. Among Si(U, Vi), the Sh(U, Vh) value is the largest, indicating that the region is closest to the brightness of the HB typical image module, so the parameters of the typical brightness correction parameter set PSh of HB image module are used to perform brightness correction on area 2 and converted the transformed image to the RGB color space.Table 3
The brightness similaritySi(U, Vi) between area 2 and four typical image modules.
Sd(U, Vd)Sh(U, Vh)St(U, Vt)Sn(U, Vn)Area 20.4940.9270.8160.711Figure7(a) is the original image of area 2, Figure 7(b) shows its L-channel image, and Figure 7(c) is the corrected image. At this time, the overall brightness of the image is reduced and tends to be uniform. The contrast is enhanced, and the grid lines that were previously unrecognizable are clearly displayed.Figure 7
The results of area 2 before and after correction. (a) Original image of area 2, (b) L-channel image, and (c) corrected image.
(a)(b)(c)


### 3.3. Adaptive Brightness Correction of Area 3

The brightness similaritiesSi (U, Vi) between area 3 and all typical image modules are shown in Table 4. U is the brightness matrix of area 3. Among Si(U, Vi), the St(U, Vt) value is the largest, indicating that the region is closest to the brightness of the BT typical image module, so the parameters of the typical brightness correction parameter set PSt of BT image module are used to perform brightness correction on area 3 and converted the transformed image to the RGB color space.Table 4
The brightness similaritySi(U, Vi) between area 3 and four typical image modules.
Sd(U, Vd)Sh(U, Vh)St(U, Vt)Sn(U, Vn)Area 30.6970.7120.9190.823Figure8(a) is the original image of area 3, Figure 8(b) shows its L-channel image, and Figure 8(c) is the corrected image. At this time, the overall brightness of the image is improved and tends to be uniform, and the contrast is enhanced. The grid lines that were previously unrecognizable are clearly displayed.Figure 8
The results of area 3 before and after correction. (a) Original image of area 3, (b) L channel image, and (c) corrected image.
(a)(b)(c)


### 3.4. Adaptive Brightness Correction of Area 4

The brightness similaritiesSi (U, Vi) between area 4 and all typical image modules are shown in Table 5. U is the brightness matrix of area 4. Among Si(U, Vi), the Sn(U,Vn) value is the largest, indicating that the region is closest to the brightness of the NB typical image module, so area 4 does not need brightness correction.Table 5
The brightness similaritySi(U, Vi) between area 4 and four typical image modules.
Sd(U, Vd)Sh(U, Vh)St(U, Vt)Sn(U, Vn)Area 40.7270.6930.7860.923


## 3.1. Adaptive Brightness Correction of Area 1

The brightness similaritiesSi (U, Vi) between area 1 and all typical image modules are shown in Table 2. U is the brightness matrix of area 1. Among Si(U, Vi), the Sd(U, Vd) value is the largest, indicating that the region is closest to the brightness of the LB typical image module, so the parameters of the typical brightness correction parameter set PSd of LB image module are used to perform brightness correction on area 1 and converted the transformed image to the RGB color space.Table 2
The brightness similaritySi(U, Vi) between area 1 and four typical image modules.
Sd(U, Vd)Sh(U, Vh)St(U, Vt)Sn(U, Vn)Area 10.9130.5170.8510.699Figure6(a) is the original image of area 1, Figure 6(b) shows its L-channel image, and Figure 6(c) is the corrected image. At this time, the overall brightness of the image is improved, and the grid lines are more clearly displayed.Figure 6
The results of area 1 before and after correction. (a) Original image of area 1, (b) L-channel image, and (c) corrected image.
(a)(b)(c)


## 3.2. Adaptive Brightness Correction of Area 2

The brightness similaritiesSi (U, Vi) between area 2 and all typical image modules are shown in Table 3. U is the brightness matrix of area 2. Among Si(U, Vi), the Sh(U, Vh) value is the largest, indicating that the region is closest to the brightness of the HB typical image module, so the parameters of the typical brightness correction parameter set PSh of HB image module are used to perform brightness correction on area 2 and converted the transformed image to the RGB color space.Table 3
The brightness similaritySi(U, Vi) between area 2 and four typical image modules.
Sd(U, Vd)Sh(U, Vh)St(U, Vt)Sn(U, Vn)Area 20.4940.9270.8160.711Figure7(a) is the original image of area 2, Figure 7(b) shows its L-channel image, and Figure 7(c) is the corrected image. At this time, the overall brightness of the image is reduced and tends to be uniform. The contrast is enhanced, and the grid lines that were previously unrecognizable are clearly displayed.Figure 7
The results of area 2 before and after correction. (a) Original image of area 2, (b) L-channel image, and (c) corrected image.
(a)(b)(c)


## 3.3. Adaptive Brightness Correction of Area 3

The brightness similaritiesSi (U, Vi) between area 3 and all typical image modules are shown in Table 4. U is the brightness matrix of area 3. Among Si(U, Vi), the St(U, Vt) value is the largest, indicating that the region is closest to the brightness of the BT typical image module, so the parameters of the typical brightness correction parameter set PSt of BT image module are used to perform brightness correction on area 3 and converted the transformed image to the RGB color space.Table 4
The brightness similaritySi(U, Vi) between area 3 and four typical image modules.
Sd(U, Vd)Sh(U, Vh)St(U, Vt)Sn(U, Vn)Area 30.6970.7120.9190.823Figure8(a) is the original image of area 3, Figure 8(b) shows its L-channel image, and Figure 8(c) is the corrected image. At this time, the overall brightness of the image is improved and tends to be uniform, and the contrast is enhanced. The grid lines that were previously unrecognizable are clearly displayed.Figure 8
The results of area 3 before and after correction. (a) Original image of area 3, (b) L channel image, and (c) corrected image.
(a)(b)(c)


## 3.4. Adaptive Brightness Correction of Area 4

The brightness similaritiesSi (U, Vi) between area 4 and all typical image modules are shown in Table 5. U is the brightness matrix of area 4. Among Si(U, Vi), the Sn(U,Vn) value is the largest, indicating that the region is closest to the brightness of the NB typical image module, so area 4 does not need brightness correction.Table 5
The brightness similaritySi(U, Vi) between area 4 and four typical image modules.
Sd(U, Vd)Sh(U, Vh)St(U, Vt)Sn(U, Vn)Area 40.7270.6930.7860.923


## 4. Conclusion

Uneven brightness on collimator reticle images has adverse effects on the digitalization of reticle coordinate system. The effective multi-region nonuniform brightness correction algorithm is proposed to adjust the image brightness so that they converge to the same value, and the color distortion is improved at the same time. The algorithm converts the image to the LAB color space and corrects the image brightness inL channel. This measure makes the correction effect easier to be controlled and more accurate. The idea of four typical image modules is proposed and their brightness correction models are reasonably constructed based on nonlinear gamma transform. Corresponding correction functions aided by auxiliary functions are designed with parameters trained respectively according to different brightness features. It effectively reduces the complexity of correction models and lays the foundation for adaptive brightness correction. The presented concept of brightness similarity allows every region on an image to be matched to one of typical image modules with closest brightness characteristics and to obtain the optimal correction parameters for them. The algorithm effectively achieves adaptive brightness correcting for the type of image which is of discrepancy in brightness as high brightness and low brightness coexisting in one image and needs to be adjusted for an opposite trend to get a consistent value in the middle region. The algorithm can obviously be used to solve color distortion problems, when the distortion is caused by uneven illumination.



---

*Source: 2675950-2022-04-23.xml*