An Edge-preserving Filtering Framework for Visibility Restoration Linchao Bao, Yibing Song, Qingxiong Yang (City University of Hong Kong) and Narendra Ahuja (University of Illinois at Urbana-Champaign) Contents • Proposed Edge-preserving Filtering Framework • Application on Dehazing From Gaussian to Bilateral • Gaussian filtering • p, q: pixel location • Ω: the neighborhood of pixel p • Gσ: Gaussian function p q From Gaussian to Bilateral • Bilateral filtering • Gσ_s ,Gσ_r : Gaussian function • Wp: Weight normalization factor p q [Tomasi and Manduchi ICCV’98] Edge-preserving Filtering Applications • • • • • • • • Detail enhancement [Farbman et al. 08] HDR tone mapping [Durand and Dorsey 02] Image abstraction/stylization [Winnemoller et al. 06] Joint filtering (upsampling, colorization) [Kopf et al. 07] Photo-look transferring [Bae et al. 06] Video enhancement [Bennett and McMillan 05] Haze removal (Dehazing) [Tarel and Hautiere 09] Shadow Removal [Yang et al. 12] Bilateral Filtering σr 0.1 0.01 σs 0.05 0.1 0.2 0.4 Input image Input image (color visualized) σs 0.01 0.05 0.1 σr 0.1 0.2 0.4 Bilateral Filtering Smaller σr Larger σr Edge blurred Not smoothed Bilateral filtered Our Filtering Framework Our bilateral filtered Idea Find the optimal filtered value for each pixel, such that Weighting function Cost function • Ω: The neighboring pixels of p • Perform aggregations on costs of neighboring pixels w.r.t. different x values, and then select the optimal x* as the output filtered value! • Reminder: Gaussian and bilateral filter are just aggregations using different weighting functions! First example Neighborhood of p p Where is x* ? q First example Neighborhood of p p Where is x* ? q First example Neighborhood of p x* q α = 2.0 First example Neighborhood of p x* x* q α = 2.0 α = 1.0 First example Neighborhood of p x* x* α = 2.0 α = 1.0 α = 0.5 20 15 x* q 10 5 0 =0.5 0 100 200 300 First example α = 2.0 Box filter (Mean filter) α = 1.0 Median filter α = 0.5 ? Our Framework Find the optimal filtered value for each pixel, such that Weighting function ( Cost function can be any local-neighborhood-aggregation-based filter) Specific Form (power cost function) can be • • • • • Box filter Gaussian filter Bilateral filter Guided filter … α < 2.0 Edge-preserving α = 2.0 Original filter Examples Gaussian Input filtered Examples Ƒ is Gaussian Input filter, α = 0.5 Examples Bilateral Inputfiltered Examples Ƒ is bilateral Inputfilter, α = 0.5 Examples Ƒ is bilateral filter, α = 0.5 Edge-preserving Filtering Applications • • • • • • • • Detail enhancement [Farbman et al. 08] HDR tone mapping [Durand and Dorsey 02] Image abstraction/stylization [Winnemoller et al. 06] Joint filtering (upsampling, colorization) [Kopf et al. 07] Photo-look transferring [Bae et al. 06] Video enhancement [Bennett and McMillan 05] Haze removal (Dehazing) [Tarel and Hautiere 09] Shadow Removal [Yang et al. 12] Haze Removal (Dehazing) The widely adopted model [Narasimhan and Nayar 02] Atmospheric light (global constant) Haze image (input) Dehazed image (desired result) Transmission map (haze attenuation) Haze Removal (Dehazing) The widely adopted model [Narasimhan and Nayar 02] • First estimate A and transmission map t • Ill-posed – additional assumption/prior needed Dark channel prior [He et al. 09] => Rough estimate of Smoothness [Fattal 08] [Tan et al. 08] White balanced input image [Tarel and Hautiere 09] => A = (1, 1, 1) • We prefer fast filtering-based method [Tarel and Hautiere 09] Filtering-based Method [Tarel and Hautiere 09] Haze image I (input) Filtering-based Method [Tarel and Hautiere 09] 1) W Filtering-based Method [Tarel and Hautiere 09] 1) 2) A Filtering-based Method [Tarel and Hautiere 09] 1) 2) B Filtering-based Method [Tarel and Hautiere 09] 1) 2) 3) Filtering-based Method [Tarel and Hautiere 09] 1) 2) 3) 4) J Filtering-based Method [Tarel and Hautiere 09] 1) 2) 3) 4) Edge-preserving Filtering W Median filtered (Tarel’s method) Bilateral filtered Edge-preserving Filtering W Median filtered (Tarel’s method) Ours (F is BLF, α=1) Bilateral filtered Replace the filtering step 1) 2) 3) 4) Replace the filtering step 1) 2) 3) 4) Result Input Tarel’s method Our result (0.35 sec 1-megapixel@CPU) (0.78 sec 1-megapixel@CPU) Thank you! Presented by Linchao Bao (@ City University of Hong Kong) Implementation • Straightforward implementation: FUNCTION J = OurFilteringFramework(I, F, α) init output image J; init image MinMap with maximum cost value; FOREACH output candidate value x, calculate intermediate image Ȋ=|x-I|^α; obtain M by filtering Ȋ using F; FOREACH pixel p, if M(p)<MinMap(p) then MinMap(p)=M(p), J(p)=x; ENDFOR ENDFOR ENDFUNC Fast Algorithm • Fast approximation algorithm: (see paper for details) • Do not filter for each candidate x value • Sampling and interpolation: • Assume local pixels are similar, then for each pixel p, filtered follows curve , and • Filter at N sampling intensity levels, then use three x values and their costs to calculate x* using the above curve (choose three points near the bottom of the curve) • Experiments show that can usually generate good results • N>=16 can generally produce high-quality results (PSNR>40dB)