Retinex Dr. Praveen Sankaran Department of ECE NIT Calicut February 18, 2013 Winter 2013 February 18, 2013 1 / 23
Outline 1 Basic Model/ Homomorphic Filtering 2 Retinex Algorithm - Surround-Center Version Winter 2013 February 18, 2013 2 / 23
Basic Model/ Homomorphic Filtering Digital Image Acquisition Revisited Winter 2013 February 18, 2013 3 / 23
Basic Model/ Homomorphic Filtering Image Components At the scene side 1 Amount of source illumination incident on the scene. 2 Amount of illumination reected by the objects in the scene. f (x, y) = i (x, y)r (x, y) (1) Illumination and Reectance 0 < i (x, y) < (2) 0 < r (x, y) < 1 (3) r. Praveen Sankaran (Department of ECE NIT Calicut DIP) Winter 2013 February 18, 2013 4 / 23
Basic Model/ Homomorphic Filtering Signicance? Why are we doing this? Illumination component slow spatial variations. Reectance component abrupt variations, particularly at junctions of dissimilar objects. Association Low frequencies Illumination High frequencies Reectance Winter 2013 February 18, 2013 5 / 23
Basic Model/ Homomorphic Filtering Using Frequency Components? Can we use the frequency components as such? I[f [x, y]] I[i [x, y]]i[r [x, y]] (4) Note the square brackets to indicate operations are discrete. We cannot use frequency components and expect to separate luminance and reectance. Of use here is the log function, since this now enables us to separate out the two separate components in the frequency domain. z [x, y] = ln f [x, y] = ln i [x, y] + ln r [x, y] (5) I{z [x, y]} = I{ln f [x, y]} = I{ln i [x, y]} + I{ln r [x, y]} (6) Winter 2013 February 18, 2013 6 / 23
Basic Model/ Homomorphic Filtering Homomorphic Filtering Note: direct from the text, we are using digital images. Winter 2013 February 18, 2013 7 / 23
Basic Model/ Homomorphic Filtering Example [ H [u, v] = (γ H γ L ) 1 e c[d2 [u,v]/d 0] ] 2 + γ L (7) c controls slope of curve between γ H and γ L. γ H > 1 and γ L < 1 attenuate low frequencies (luminance), amplify high frequencies (reectance). Dynamic range compression what and why here? Contrast enhancement. Winter 2013 February 18, 2013 8 / 23
Basic Model/ Homomorphic Filtering What are we looking for? Simultaneously achieve: dynamic range compression, contrast enhancement and true color rendition (?). Retinex can help us achieve all these three properties simultaneously. Dynamic range compression Color independence from the spectral distribution of the scene illumination Color and lightness rendition. Winter 2013 February 18, 2013 9 / 23
Naming?, Color constancy? Aim Human Visual System(HVS) can perceive the correct color of the objects in varying illumination conditions. Similarly HVS can also adapt itself to dierent dynamic ranges and perceive all the details of the scene clearly. But digital cameras are limited by the dynamic range and also the color of the images captured depends on the illumination conditions. To enhance the quality of the recorded image as to how a human being would have perceived the scene. Retinex (Retina+Cortex) Winter 2013 February 18, 2013 10 / 23
Dynamic range compression and Color independence Familiar territory Dynamic range compression can be achieved by applying logarithmic transformations on the image. Color independence can be achieved by eliminating the luminance component in the image. Why? Remember from equation 5,z [x, y] = ln f [x, y] = ln i [x, y] + ln r [x, y]. We have then, ln r [x, y] = ln f [x, y] ln i [x, y] (8) So now what we have is a problem of nding I [.]. Winter 2013 February 18, 2013 11 / 23
Finding Luminance Again our background tells us we need to nd the slow varying (low frequency component). For this we apply a low pass lter to the input image. What this lter is has an eect on the output. (Again our background tells us why this is so). Land's proposal: Moore's proposal: H [s, t] = 1 s 2 + t 2 = 1 H [s, t] = e r /c r 2 (9) (10) Hurlbert's Proposal: H [s, t] = e r2 /c 2 (11) Winter 2013 February 18, 2013 12 / 23
Filter Illustration Figure: a. Hurlbert b. Land c. Moore Winter 2013 February 18, 2013 13 / 23
Inferences The inverse square rolls rapidly but at distant pixels it has higher response than the other two forms. Similarly at distant pixels exponential function has a higher response than Gaussian function. Gaussian function acts more locally, Exponential function is less local and the inverse square function is global in nature Winter 2013 February 18, 2013 14 / 23
Retinex on Color Image R i [x, y] = ln{f i [x, y]} ln {F i [x, y] H [s, t]} (12) where, F i [x, y] is the image distribution in the i th color spectral band, ` ' denotes the convolution operation, H [s, t] is the surround function and R i [x, y] is the associated retinex output. Winter 2013 February 18, 2013 15 / 23
Surround/ Variance constant - `c' Output varies with variation of this constant. Figure: Output for varying `c'. a. c=15 b. c=80 c. c=250
Dynamic range compression vs Improved rendition when the surround constant is varied from a small value to a large value, dynamic range compression is sacriced for improved rendition Compromise: middle of the range(50 < c < 100) represents a reasonable compromise, where shadows are fairly compensated and rendition achieves acceptable levels of image quality. Winter 2013 February 18, 2013 17 / 23
Multi Scale Retinex (MSR) we nd the retinex output according for various values of surround constants and add all the retinex outputs by giving them equal weight. MSR equation: R MSRi = N n=1 w n R ni (13) w n is an optional weight value you can use to weigh contribution from each `c'. N is the number of scales. Key dierence is for the lter: H n [.] = ke r2 /c 2 n (14) Winter 2013 February 18, 2013 18 / 23
Output Image Display Range Figure: Histogram of a single scale retinex enhanced image Winter 2013 February 18, 2013 19 / 23
Multi Scale Retinex with Color Restoration (MSRCR) grey- world assumption: reectance of the image in all the three color bands are same on an average. grey-world violation: greying out of the image, either globally or in specic regions. R MSRCRi [.] = G {C i [.] R MSRi + b} (15) Color restoration function: C i [.] = β ln {αf i [.]} β ln { N i=1 F i [.] } (16) β is a gain constant, α controls the strength of the non linearity, G and b are nal gain and oset values. Typical values: β = 46, α = 125, b = =30, G = 192. Winter 2013 February 18, 2013 20 / 23
Multi Scale Retinex with Color Restoration (MSRCR) grey- world assumption: reectance of the image in all the three color bands are same on an average. grey-world violation: greying out of the image, either globally or in specic regions. R MSRCRi [.] = G {C i [.] R MSRi + b} (15) Color restoration function: C i [.] = β ln {αf i [.]} β ln { N i=1 F i [.] } (16) β is a gain constant, α controls the strength of the non linearity, G and b are nal gain and oset values. Typical values: β = 46, α = 125, b = =30, G = 192. Winter 2013 February 18, 2013 20 / 23
Luma based MSR There are many color models apart from HSI which gives us a good separation of luma-chroma space. Some examples are YCbCr, YUV, YIQ, YPbPr, HSV. Again villain here: violation of the grey-world assumption even under MSRCR! New solution: Applying MSRCR algorithm on the luminance (luma) component of the image. Best: Outputs obtained after applying MSRCR on the luma components of YUV and Lab transforms. Time is reduced approximately to one-thirds of the time it took for the original MSRCR since here the RETINEX algorithm is applied only on the luma component. Winter 2013 February 18, 2013 21 / 23
Luma based MSR There are many color models apart from HSI which gives us a good separation of luma-chroma space. Some examples are YCbCr, YUV, YIQ, YPbPr, HSV. Again villain here: violation of the grey-world assumption even under MSRCR! New solution: Applying MSRCR algorithm on the luminance (luma) component of the image. Best: Outputs obtained after applying MSRCR on the luma components of YUV and Lab transforms. Time is reduced approximately to one-thirds of the time it took for the original MSRCR since here the RETINEX algorithm is applied only on the luma component. Winter 2013 February 18, 2013 21 / 23
Luma based MSR There are many color models apart from HSI which gives us a good separation of luma-chroma space. Some examples are YCbCr, YUV, YIQ, YPbPr, HSV. Again villain here: violation of the grey-world assumption even under MSRCR! New solution: Applying MSRCR algorithm on the luminance (luma) component of the image. Best: Outputs obtained after applying MSRCR on the luma components of YUV and Lab transforms. Time is reduced approximately to one-thirds of the time it took for the original MSRCR since here the RETINEX algorithm is applied only on the luma component. Winter 2013 February 18, 2013 21 / 23
Luma based MSR There are many color models apart from HSI which gives us a good separation of luma-chroma space. Some examples are YCbCr, YUV, YIQ, YPbPr, HSV. Again villain here: violation of the grey-world assumption even under MSRCR! New solution: Applying MSRCR algorithm on the luminance (luma) component of the image. Best: Outputs obtained after applying MSRCR on the luma components of YUV and Lab transforms. Time is reduced approximately to one-thirds of the time it took for the original MSRCR since here the RETINEX algorithm is applied only on the luma component. Winter 2013 February 18, 2013 21 / 23
Luma MSRCR Illustration
YUV Transformation Y.289.587.114 R U =.147.289.436 G (17) V.615.515.100 B R 1 0 1.14 Y G = 1.395.581 U (18) B 1 2.032 0 V Winter 2013 February 18, 2013 23 / 23