Está en la página 1de 8

Tan and Triggs Illumination Normalization

Pi19404
January 23, 2014

Contents

Contents
Tan and Triggs Illumination Normalization
Introduction . . . . . . . . . . . . . . . . . . . . . 0.1.1 Illumination and Reflectance . . . . 0.1.2 Gamma Correction . . . . . . . . . . 0.1.3 Difference of Gaussian Filtering 0.1.4 Contrast Equalization . . . . . . . . 0.1.5 code . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . 0.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3
3 3 4 5 6 8 8

2 | 8

Tan and Triggs Illumination Normalization

Tan and Triggs Illumination Normalization


0.1 Introduction
In this article we will look at Tan and Triggs Illumination Normalization method . The purpose is to preprocess images so as to make them robust/invariant to illumination changes by employing a preprocessing step.

  

The present algorithm uses a series of step to counter the effects of illumination variation,local shadowing and highlights. Preprocessing algorithms typicall introduce distortion in the image,however the aim is to presever the disticntive features of the image. The preprocessing chain consists of following steps : Gamma Correction -> Difference of Gaussian Filtering ->Masking >Contrast Equalization

0.1.1 Illumination and Reflectance

    

The intensity of light reflected from a object is production of illumination and sufrace reflectance components f (x; y ) = I (x; y ) R(x; y ) Illumination I is ammount of light indident on the scene and is dependent on external conditions. Reflectance is ammount of light reflected by the object,and arises from property of object themselves. To compensate for non uniform illumination the aim is to remove the illumination component which is dependent on lighting condition during image capture so that only reflectance component that truly is a object property remains. Illumination varies slowly across the image as compared to reflectance.

3 | 8

Tan and Triggs Illumination Normalization

 

Illumination can be considered as low frequency,while reflectance is a high frequency component present in the image. the product can be expressed as a sum by taking log log (I (x; y )) + log (R(x; y ))

0.1.2 Gamma Correction

      

Gamma Correction is a non linear gray level transformation that replaces each pixel with intensity I in the image with I for 0   1 or log (I ) if = 0. Thus a gamma correction increases the dynamic range of the image. The scale of the output image be from 0 to 255 Gamma=1,is a identity transformation,where every pixel is mapped to itself. Gamma=0.5 we can see that pixels from 0-50 are mapped to larger range of 0-115 while pixels in the range 200-255 are mapped to a smaller range of 230-255. Thus gamma correction has the effect of enhancing the dynamic range of image in the dark regions while compressing it in the bright regions. Therby improving the visibility can the contrast of the image.

Figure 1: Gamma Correction Curvers

Mat gammaCorrection(Mat image,float gamma) { Mat tmp; image.convertTo(tmp, CV_32FC1,1.0/255.0,0); pow(tmp, gamma, tmp); tmp.convertTo(tmp,CV_8UC1,255.0,0); return tmp; }

4 | 8

Tan and Triggs Illumination Normalization

Increasing the gamma ,increases dynamic range in darker regions while compresses it in the brighter regions further

Figure 2: Gamma Correction Images

0.1.3 Difference of Gaussian Filtering


Gamma correction or any other form of contrast normalization algorithm does no remove the overall effects of intensity gradients such as shading effects.

        

Shading effects are considered to be predominantly low frequency phenemenon. It is not possible to distinguish between a illumination gradient and one caused by shading effects of surface structure Since illumination is also modelled as low frequency phenomenon. A high pass filtering operations can be performed to remove these components. DoG filter is a way to perform bandpass filtering operations which remove shading and illumination components in the image ,and also reduces the noise. Dog Filter consists of 2 DoG filter approximates a laplacian of gaussian filter,which is used for edge detection The output of DoG Filter is a edge intensity image. Gaussians are charactesize by mean and variance/std deviation(sigma). A large sigma will blur out the fine details/edges while low pass filtering, hence a small sigma is used which will only eliminate the noise.

5 | 8

Tan and Triggs Illumination Normalization

  

The second gaussian has a large sigma,which removes high frequency details in the image and retains only low frequency components of the image . Now from we subtract this low frequency image from the original low pass filtered image,therby obtaining a high frequency edge image. Typically 1:2 ratio between the two gaussians provides good result. In present implementation the sigma is chosen as 3 and 7 for the gaussians

0.1.4 Contrast Equalization

 

The final step of our preprocessing chain is contrast equalization which globally rescales the image intensities to standardize a robust measure of overall contrast or intensity varia- tion. Since DOG approximate gradient,there are bound to be extreme value produced by highlights,shadows and noise etc

I I
=

I I

(mean(I )) alpha
1

(1)

(mean(min(; I ))) alpha

(2)

I tanh(  )

(3) (4)

 

The output of above steps is a image with pixel intensity in the ranges (;  ) To get a integer output ,we normalize the values between 0 to 255

Mat illumNorm(Mat image,float sigma0,float sigma1, float alpha=0.1,float tau=10)

6 | 8

Tan and Triggs Illumination Normalization

Mat tmp; image.convertTo(tmp,CV_32FC1,1.0/255.0,0); Mat gaussian0, gaussian1; int kernel_sz0 = (sigma0); int kernel_sz1 = (sigma1); kernel_sz0 += ((kernel_sz0 % 2) == 0) ? 1 : 0; kernel_sz1 += ((kernel_sz1 % 2) == 0) ? 1 : 0; GaussianBlur(tmp, gaussian0, Size(kernel_sz0,kernel_sz0), sigma0, sigma0, BORD GaussianBlur(tmp, gaussian1, Size(kernel_sz1,kernel_sz1), sigma1, sigma1, BORD //difference of gaussian cv::subtract(gaussian0,gaussian1,tmp); Mat tmp1; //contrast streching double meanI = 0.0; cv::pow(abs(tmp),alpha,tmp1); meanI = mean(tmp1).val[0]; tmp = tmp / pow(meanI, 1.0f/alpha); pow(min(abs(tmp), tau), alpha, tmp1); meanI = mean(tmp1).val[0]; tmp = tmp / pow(meanI, 1.0f/alpha);

//tanh normalization for(int r = 0; r < tmp.rows; r++) { for(int c = 0; c < tmp.cols; c++) { tmp.at<float>(r,c) = tanh(tmp.at<float>(r,c) / tau); } } tmp = tau * tmp; tmp=tmp+tau; //integer value normalization cv::normalize(tmp,tmp,0,255,CV_MINMAX); tmp.convertTo(tmp,CV_8UC1,1.0,0); return tmp; }

7 | 8

Tan and Triggs Illumination Normalization

0.1.5 code

The code for this can be found in git repo /media/UBUNTU/repository/ OpenVisionLibrary/OpenVision in ImgProc/preprocess.hpp and ImgProc/preprocess.cpp files

8 | 8

También podría gustarte