ON THE IMPROVED IMAGE DODGING ALGORITHM BASED ON MASK TECHNIQUE

The remote sensing image dodging algorithm based on Mask technique is a good method for removing the uneven lightness within a single image. However, there are some problems with this algorithm, such as how to set an appropriate filter size, for which there is no good solution. In order to solve these problems, an improved algorithm is proposed. In this improved algorithm, the original image is divided into blocks, and then the image blocks with different definitions are smoothed using the low-pass filters with different cut-off frequencies to get the background image; for the image after subtraction, the regions with different lightness are processed using different linear transformation models. The improved algorithm can get a better dodging result than the original one, and can make the contrast of the whole image more consistent.


INTRODUCTION
In the process of acquiring remote sensing images, the effect of internal and external factors will lead to the differences of hue, lightness, contrast, etc. inside a single image.The differences are mainly caused by imaging non-uniformity of optical lens, atmospheric attenuation, clouds, smog, different light conditions due to sun/shade conditions, and so on, which directly degrades remote sensing images and affects their subsequent applications and post-processing(such as feature extraction, target recognition, classification, interpretation, etc.) (Li et al., 2006).Thus, dodging (removing the differences of hue, lightness and contrast) has become an important issue in remote sensing application.
At present the algorithms of image dodging mainly focus on how to acquire the trend of lightness in an image to compensate for the lightness of different regions.According to the different methods of how to get the lightness trend in an image, the dodging algorithms can be divided into the following categories (Russ, 1999): (1) Background fitting: select some background points automatically or by human-machine interaction, then utilize a mathematical model to fit the gray values to a function of x and y, B(x, y) as the estimate of the background image, and finally subtract the background image from the original image (Blohm, 1997;Jin et al., 2000).The adaptive dodging method Zhang et al.(2003) and Li (2005) proposed also belongs to this category.However, because the reasons for causing the uneven distribution of lightness are varied and the distribution of ground objects themselves is irregular, it is difficult to choose the most appropriate model using this method.Chandelier (2009) proposed a parametric, semiempirical radiometric model, and its principle is quite similar to the standard aerial triangulation.The results are satisfactory when atmospheric conditions are favorable and stable.
(2) Sorting correction: Assuming that the background is always darker than the target in any region of an image, substitute the minimum gray value in the neighborhood for the gray value of the pixel.Repeat the above-mentioned process several times to obtain the background image, and then subtract the background image from the original image (Zhen et al., 2003).This method can correct the image with the quite uneven lightness, but the computing speed is slow.In order to get a good result, it is necessary to smooth the complicated background image.However, the process is cumbersome (Li, 1995).
(3) Filtering in frequency domain: Assuming that the lightness values of the background image are a series of lowfrequency signals, adopt a low pass filtering method to get the background image.Wang et al. (2004) proposed a dodging algorithm based on MASK technique.They utilized the Gaussian low pass filter to acquire the background image, then subtracted the background image from the original image, and finally stretch the result image to increase the contrast.The dodging algorithm Hu et al. (2004) proposed is also based on Mask technology, and only the methods of producing the background image and increasing the contrast are different from Wang et al. (2004).Sun (2008) divided the background image by the original image after obtaining the lightness distribution of the background image.This can decrease the contrast of the brighter regions and increase the contrast of the darker regions, and finally get a relatively even contrast.
Because the background image only reflects the lightness distribution of the original image, rather than the detailed information, the detailed information must be remove from the background image as much as possible.Considering that ground objects and image definitions are different in different regions of an image, the background image should be acquired using different parameters.Currently, most researchers implement dodging processing for different regions within an image using the same method with the same parameters.Aiming at the problem above, this paper puts forward an improved image dodging algorithm based on Mask technique.

THE PRINCIPLE OF MASK DODGING
The Mask dodging technique originated from the photoprint International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XXXIX-B3, 2012 XXII ISPRS Congress, 25 August -01 September 2012, Melbourne, Australia method.In this technique we use a blurred transparent positive as the mask, and overlay the positive with the negative by outlines to get a photo with low contrast and even optical density.We then print on the rigid printing paper to enhance the overall contrast and finally obtain the optical photo (Li et al., 2006).
According to the Mask dodging principle, we use the following mathematical model to depict an optical image with uneven lightness(Sun, 2008): (1) Where denotes the original image, that is, the image with uneven lightness, denotes the image with even lightness in the ideal conditions, and denotes the background image.According to the formula above, the image with uneven lightness can be regarded as the result of overlapping the ideal image with the background image, so the reason for uneven lightness of the image is that the lightness of the background image is uneven.Therefore, we can process the original image using the low-pass filter to get the background image, and then the image with even lightness can be obtained by subtracting the background image from the original one.

THE IMPROVED IMAGE DODGING ALGORITHM BASED ON MASK TECHNIQUE
In the process of image dodging with the algorithm based on Mask technique, there are some defects and problems.First, it smoothes the whole image using the same filter.
Theoretically, the degree of smoothing should depend on the definition of image, so we should process the image regions with different lightness and contrast using different filters.Second, the algorithm doesn't overcome the uneven contrast phenomenon.The contrast of the regions which are darker in the original image is still lower, and vice versa.
The following will elaborate the improved algorithm from four parts: producing the background image, subtraction, removing the border lines between image blocks, and processing the contrast.

Producing the Background Image
Producing the background image is a very critical step, because its quality will directly affect the final dodging effect.Due to the irregular distribution of uneven lightness and contrast in an image, which is difficult to be depicted by a simple mathematical model, we usually produce the background image with a low-pass filter to reflect the background lightness variation.By comparison, the Gaussian low-pass filter in frequency domain can get a satisfactory background image.
We first divide the original image into blocks, and make sure there are overlapped pixels between adjacent blocks, which can avoid the obvious border lines between adjacent blocks and can make these border lines be removed simply after dodging.According to the Mask dodging algorithm, the selection of the smoothing operator should depend on the definitions of regions with different lightness and contrast.
The regions with higher definition should be smoothed to a greater degree, and the regions with lower definition to a less degree.
In the object field, the straight edges of ground objects will be blurred after being imaged by a degrading system, as showed in Figure1 (Hu, et al.,2004).
Figure 1.Edge curve of the object with straight edge The slope of edge curve reflects the blurriness of the edge, so we can measure the definitions of image regions by the slope of the edge curve.This paper adopted the calculation method of the definition of image regions which Hu et al. (2004) proposed.
Based on the general shape of the edge curve, we adopt the following cosine function to simulate the edge curve (Zhou, 1999). ( Where x is the pixel coordinate, is the gray value of the pixel, and A, B and C are the three parameters.In order to solve out for A, B, and C, at least three pairs of data (f(x), x) are needed.Edge is reflected in the digital image to be a series of pixels whose gray values are in increasing or decreasing order.Therefore, we can extract some feature edge values in the image blocks to simulate the edge curve.
Then we differentiate the function of the edge curve to get the definition.
(3) Use the mid-point of the edge curve to calculate F(x), let , so .
Set the cut-off frequency of the low-pass filter according to the definition of each image block.If the definition of an image block is lower, the image block should be smoothed with the Gaussian low-pass filter with the higher cut-off frequency, and inversely so.The calculation steps of the cutoff frequency of the Gaussian filter are as follows: (1) Calculate the definition of each image block, .The value range of i is [1,n], where n is the number of image blocks.
(2) Acquire the maximum and minimum definitions, and .
(3) According to the size of the image block, set the maximum and minimum cut-off frequency of the Gaussian low-pass filter, and , to get the cut-off frequency of Gaussian filter of each image block.
(4) At last, the Gaussian filter with different cut-off frequencies is applied to each image block to get their background image.

Subtraction
To subtract the background image from the original image, use the following formula: (5) In the formula above, is the i-th resulting image block, is the i-th original image block, is the i-th background image block, and is the offset of gray level of the i-th image block.In order to keep the original image's average lightness, should be calculated as follows: (6) where is the average gray value of the i-th original image block, is the average gray value of the i-th background image block, and is the average gray value of the whole original image.

Removing the Border Lines between Image Blocks
After the subtraction of the image blocks, the hues of the image blocks are approximately the same, but there are obvious differences in grayscale between adjacent blocks, and the obvious border lines exist.Thus, the image needs to be further processed to remove the border lines.
(1) Process each image block using linear stretch based on the overlapped area.
(a) Adjust the gray value of each image block horizontally.Based on the first image block in each row, construct the appropriate linear transformation models, which are acquired by least-square calculation for the gray values of the overlapped pixels between the adjacent image blocks, to adjust the gray values of the other image blocks in the row.
(b)Adjust the gray value of each image block vertically using the same method.
(2) Process the gray values of the pixels in the overlapped areas by weight.Through the process above, although the differences of grayscale between each block reduce significantly and even some blocks even merge well, there is still a discontinuance of grayscale between some adjacent blocks and the border lines can be easily seen.Therefore, we construct weighted coefficients based on the distance from the pixels in the overlapped area to the border line, and then use the data in the overlapped area to finish a gradient mosaic so as to eliminate visual fragmentation in the mosaic image.
Take one-dimensional overlap for example to briefly illuminate the weighted coefficient (Figure 2).It is assumed that X and Y are the adjacent image blocks, and Z is the mosaic image.The pixel i in the overlapped area is in the column of d in Y, and L is the column width of the overlapped area.Then the grayscale value after applying the gradient mosaic according to weighted coefficients is where is the grayscale value of the pixel i in the mosaic image, is the grayscale value of the pixel i in the image block X, and is the grayscale value of the pixel i in the image block Y.

Stretching
After subtraction, the contrast of the image will become low, so in order to increase the adjacent fine contrast and the overall contrast, it is necessary to stretch the image (Gasparini et al.,2004).
In addition, for remote sensing images, the contrast of the region with higher lightness usually is higher, and the contrast of the region with lower lightness is lower.Even after dodging, this phenomenon still exists.
Therefore, when stretching the image after subtraction, we should take the uneven distribution of contrast into consideration.For the region which is brighter in the original image, the degree of stretching should be less, while the darker region in the original image should be stretched to a greater degree.In this way, we can obtain a satisfactory resulting image with even lightness and contrast.The concrete steps of stretching are as follows: (1)Producing the background image Smooth the original image using the Gaussian low-pass filter to get the background image.Here we only need to get the approximate lightness trend of the original image, so it can be directly processed as a whole and it is not necessary to divide it into blocks.
(2)Stretching the resulting image after removing the border lines Design an appropriate linear transformation model, and stretch the regions with different lightness in the original image at different degrees by adjusting the parameters.The linear transformation model is as follows: (8) where is the gray value of the pixel in the i-th row and Through computation, the definition of the lower right block is the maximum, so the cut-off frequency should be set to be minimum.In this way the region around the ground objects will not be blurred.The definition of the lower left block is the minimum, so the cut-off frequency should be set maximum.Through this we can reach a more satisfactory dodging effect.
In order to reflect the experiment result more accurately, we use some objective indicators to assess the original and resulting images.At present, a common assessment method is to first select five regions from the image, the upper left, the lower left, the upper right, the lower right and the center, then compare their mean and variance.However, there may be differences between different regions in an image itself.For example, if the upper left area of an image is forest and the lower left area is houses, there should be different lightness and contrast in an image.The approximately same mean and variance of the two regions doesn't indicate a good dodging effect.
Therefore, this paper adopts a new assessment method: select several same ground objects from the different image regions manually as shown in Figure 6, and calculate their mean and variance(Table 1).If these values are approximately the same, that means a satisfactory dodging effect was achieved.It can be seen that the means of the same kind of ground objects are approximately the same after dodging, in addition, the uneven contrast of the whole image is greatly improved.

CONCLUSION
This paper puts forward an improved image dodging algorithm based on Mask technique.The background image is obtained based on the definitions of different image regions.In this way, it can reflect the lightness trend of the image more accurately.In addition, stretching the image after subtraction with different linear transformation models improves the uneven contrast phenomenon in the original image.
Through the experiment, the correctness and validity of this algorithm are proved, but this algorithm still needs to be improved in the following aspects: (1)How to set the size of the image blocks more appropriately is a difficulty.If the size is too big, the filtering method based on the definition can't achieve the expected effect.If the size is too small, this will make the lightness of the different image regions be approximately the same, which means dodging is excessive.
(2)How should we set the values of some parameters, such as the maximum and minimum cut-off frequency automatically?
The selection of these parameters will directly influence the final dodging effect.
(3)In order to remove more detailed information from the background image, we can obtain the background image using the filters with different cut-off frequencies based on classification of ground objects.This is a recommended topic for a proposed follow-on study.

Figure 2 .
Figure 2. The sketch map of one-dimensional overlap

Figure 5 .
Figure 5.The resulting image when is different

Figure 6 .
Figure 6.The original image and the image after dodging

Table 1 .
The image information before and after dodging