## 2 Method
### Previous Works
#### 2.1.4 Adaptive Histogram Equalization  
To explain self-adaptive histogram equilibrium, the central idea of histogram equilibrium processing is to change the original image of the grayscale histogram from an interval in the comparative set to a uniform distribution within the full grayscale range. Histogram equalization is the nonlinear extension of the image, by redistributing the image's pixel values to ensure the number of pixels at a certain grayscale level is at about the same range. In some cases, however, the results of uniform distribution may not be suitable.  
Figure 5: The balanced pixels after flat-field correction.  
An example of the distribution of pixel values after the flat-field correction process is illustrated in Figure 6.  
Figure 6 shows that after the flat-field correction, the pixel values are centralized in the same area of the histogram. In this case, using global histogram equilibrium will cover the flat-field results, and the correction will be achieved. Therefore, it is necessary to fix the equilibrium part to a certain range, which only requires these points to be distributed uniformly to the other points of the image. The contrast-limited adaptive histogram equalization (CLAHE) method turns a global histogram equalization operation into a local equalization. The principle is that the picture is first divided into several area blocks. Second, each region of a certain output histogram's distribution undergoes individual equalization processing. Finally, adjacent areas are merged by linear interpolation, which reduces the boundary artifacts effectively. CLAHE suppresses the noise effectively and also enhances the local image's contrast. Its concept action is shown in Figure 7: limiting the contrast, in fact, limits the slope of the cumulative distribution function (CDF). However, because the cumulative distribution histogram of the CDF is the integration of the grayscale histogram Hist, the limit of the slope of the CDF is equivalent to the limit of the amplitude of Hist. Therefore, the histogram must be cropped statistically in the sub-block to lower the amplitude below a certain upper limit. Of course, the cropped part cannot be deleted. Moreover, the cropped portion must be distributed uniformly across the entire grayscale range to ensure that the total area of the histogram remains the same, as shown in Figure 7.  
As shown, the histogram will rise by a certain level, which seems to exceed the established upper limit. In fact, many solutions exist for specific implementations. The cropping process is repeated several more times to make the rising parts insignificant, or, in another common way, the following steps are performed:  
The crop value ClipLimit (CL) is set, and then the value above this limit is found in the histogram, called TotalExcess (TE). At this time, assuming that the TE is divided among all grayscale levels, the height of the overall rise of the histogram is estimated as L = TE/N, with upper = CL - L as the boundary for the histogram to deal with the following:  
(1) If the amplitude is higher than CL, it is used directly as CL;  
Figure 6: Flat-field correction histogram image.  
If the amplitude is between Upper and CL, fill it to CL;  
If the amplitude is lower than Upper, fill L pixels directly.  
After the above operation, the number of pixels used to fill is usually slightly smaller than TE. That is, some remaining pixels are not divided out, specifically those remaining from step (1) and (2) with two places. At this point, these points are distributed to the grayscale levels that are still smaller than the CL.  
Based on the above concept, the CL value in the correspondence was set to 0.02. The type selected was distribution, and the function was set as the basis for creating a contrast transformation and uniform distribution. The distribution should depend on the type of input image. The actual operation after the process is illustrated in Figure 8.