Fast Adaptive Bilateral Filtering of Color Images Ruturaj G. - - PowerPoint PPT Presentation

fast adaptive bilateral filtering of color images
SMART_READER_LITE
LIVE PREVIEW

Fast Adaptive Bilateral Filtering of Color Images Ruturaj G. - - PowerPoint PPT Presentation

Fast Adaptive Bilateral Filtering of Color Images Ruturaj G. Gavaskar and Kunal N. Chaudhury Department of Electrical Engineering, Indian Institute of Science IEEE International Conference on Image Processing, Taipei (2019) Classical bilateral


slide-1
SLIDE 1

Fast Adaptive Bilateral Filtering of Color Images

Ruturaj G. Gavaskar and Kunal N. Chaudhury

Department of Electrical Engineering, Indian Institute of Science

IEEE International Conference on Image Processing, Taipei (2019)

slide-2
SLIDE 2

Classical bilateral filter Nonlinear edge-preserving smoothing1: g(i) = η(i)−1

j∈Ω

ω(j)φ

  • f (i − j) − f (i)
  • f (i − j),

η(i) =

  • j∈Ω

ω(j)φ

  • f (i − j) − f (i)
  • ,

where ◮ f and g are the input and output RGB images. ◮ f (i) and g(i) are vectors. ◮ ω and φ = Gaussian kernels with variance ρ2 and σ2. ◮ Ω = Neighborhood for averaging.

1Tomasi and Manduchi, 1998 1

slide-3
SLIDE 3

Role of σ

Input. Output, σ = 30. Output, σ = 200. Weights Weights

2

slide-4
SLIDE 4

Adaptation of σ ◮ σ (width of range kernel) controls the extent of blurring. ◮ A fixed σ either over or under smooths. ◮ Useful for controlling the blur in different regions, e.g., more blur to remove coarse textures in images. ◮ σ is allowed to change at each pixel (a rule is required). ◮ Proposed for a couple of applications (for grayscale images):

◮ Image sharpening2. ◮ JPEG deblocking3.

2Zhang and Allebach, 2008. 3Zhang and Gunturk, 2009. 3

slide-5
SLIDE 5

Adaptive bilateral filter (ABF) ◮ Make the width of the range kernel a function of i. ◮ Moreover, allow center4 to be different from f (i). g(i) = η(i)−1

j∈Ω

ω(j) φi

  • f (i − j) − θ(i)
  • f (i − j),

η(i) =

  • j∈Ω

ω(j) φi

  • f (i − j) − θ(i)
  • f (i − j).

◮ However, a fixed spatial kernel is used.

4Zhang and Allebach, 2008. 4

slide-6
SLIDE 6

Computation cost ◮ O(ρ2) computations per pixel. ◮ Higher ρ (window size) is used for higher-resolution images. ◮ e.g. 60 seconds for a 2 megapixel image on a CPU. ◮ Real-time implementation is challenging. ◮ Fast approximation: Approximate the original formula and hope to speed it up, without appreciable loss of visual information.

5

slide-7
SLIDE 7

Fast bilateral filtering ◮ Several fast algorithms for classical bilateral filtering (gray/color). ◮ Complexity does not scale with filter width (O(1) implementation). ◮ Almost all fundamentally require the range kernel to be fixed. ◮ Filtering reduced to fast convolutions by approximating the range kernel. ◮ Rules out extension to ABF (range kernel is changing).

6

slide-8
SLIDE 8

Our contribution ◮ Novel O(1) algorithm for fast ABF of color images. ◮ Builds on a recently proposed algorithm for gray images5. ◮ Trivial channel-by-channel extension to color images (3X cost). ◮ Filtering in RGB space? ◮ As explained later, this poses technical challenges. ◮ Core idea: Express filtering using local (weighted) histograms6.

5Gavaskar and Chaudhury, 2019. 6Mozerov and van de Weijer, 2015. 7

slide-9
SLIDE 9

Local weighted histogram ◮ Local histogram at pixel i: hi(t) =

  • j∈Ω

δ

  • f (i − j) − t
  • ,

t ∈ {0, . . . , 255}3. ◮ t = (tr, tg, tb) and δ(t) = δ(tr) δ(tg) δ(tb). ◮ Local weighted histogram at pixel i: hi(t) =

  • j∈Ω

ω(j) δ

  • f (i − j) − t
  • ,

t ∈ {0, . . . , 255}3. ◮ Interpretation: Spatially-weighted frequency of RGB value t.

8

slide-10
SLIDE 10

Reformulation of ABF ABF in terms of local weighted histograms: g(i) = η(i)−1

t

thi(t)φi

  • t − θ(i)
  • ,

and η(i) =

  • t

hi(t)φi

  • t − θ(i)
  • ,

where sum is over RGB values in the neighborhood of i.

9

slide-11
SLIDE 11

Background ◮ ABF for grayscale images can be similarly reformulated. ◮ In grayscale, hi(t) is a function of a scalar variable. ◮ For fast algorithm, hi(t) is approximated using polynomials7. ◮ This gave closed-form Gaussian integrals. ◮ Histogram approximation using fast convolutions (moment matching). ◮ For color images, hi(t) is a function of a vector variable. ◮ Polynomial approximation is bad due to sparse data.

7Gavaskar and Chaudhury, 2019. 10

slide-12
SLIDE 12

Background ◮ Motivated by the approach in Mozerov and van de Weijer8:

◮ hi(t) is constant over an interval [ai, bi] (in R3). ◮ hi(t) is zero elsewhere. ◮ Summations are replaced by line integrals: ˆ g(i) = ˆ η(i)−1

  • [ai ,bi ]

t φi

  • t − θ(i)
  • dt,

ˆ η(i) =

  • [ai ,bi ]

φi

  • t − θ(i)
  • dt.

◮ The integrals, and hence the filter, have a closed-form expression. ◮ By clever choice of the interval, the computation becomes O(1).

8Mozerov and van de Weijer, 2015. 11

slide-13
SLIDE 13

Novelty of our proposal ◮ In Mozerov and van de Weijer, the interval was chosen to be

◮ passing through f (i). ◮ having direction ¯ f (i) − f (i), where ¯ f (i) = mean value.

◮ This makes the algorithm O(1), but is an ad-hoc choice. ◮ We choose the interval such that it captures linear trend of data. ◮ To do this, we use the covariance of the local weighted histogram. ◮ Our proposed algorithm is also O(1).

12

slide-14
SLIDE 14

Choice of interval ◮ Covariance matrix: Ci =

  • j∈Ω

ω(j)

  • f (i − j) − ¯

f (i)

  • f (i − j) − ¯

f (i) ⊤. ◮ Direction of [ai, bi] = Largest eigenvector of the covariance matrix. ◮ This should give “best” linear approximation of the set of data points. ◮ Proposal: [ai, bi] =

  • ¯

f (i) − c

  • λi qi, ¯

f (i) + c

  • λi qi
  • ;

(λi, qi) = Top eigenpair of Ci, c = Positive constant, decides length of the interval.

13

slide-15
SLIDE 15

14

slide-16
SLIDE 16

Fast computation of interval endpoints ◮ Recall: ai = ¯ f (i) − c√λi qi, bi = ¯ f (i) + c√λi qi. ◮ We must find a fast method to compute the end points. ◮ O(1) Gaussian convolutions come to our rescue. ◮ ¯ f (i) = ω ∗ f (i) → 3 Gaussian convolutions. ◮ (p, q)th entry of Ci = ω ∗ (fpfq)(i) −

  • ω ∗ fp(i)

ω ∗ fq(i)

  • .

◮ 6 additional Gaussian convolutions to compute Ci’s.

15

slide-17
SLIDE 17

Fast computation of interval endpoints ◮ (λi, qi) computed using power iterations method. ◮ Power iterations:

◮ Initialize qi as unit vector along ¯ f (i) − f (i).9 ◮ Iterate: qi ← Ciqi/qi.

◮ In practice, just one iteration is enough. ◮ λi = q⊤

i Ciqi.

◮ Overall, computation of ai, bi requires O(1) operations.

9Direction used in Mozerov and van de Weijer, 2015. 16

slide-18
SLIDE 18

Filter approximation ◮ Recall: ˆ g(i) = ˆ η(i)−1

  • [ai ,bi ]

t φi

  • t − θ(i)
  • dt,

ˆ η(i) =

  • [ai ,bi ]

φi

  • t − θ(i)
  • dt.

◮ The integrals have closed-form expressions in terms of ai, bi. ◮ This was made possible due to the nature of the approximation. ◮ As computation of ai, bi is O(1), computation of ˆ g(i) becomes O(1).

17

slide-19
SLIDE 19

Filter approximation ◮ Closed-form expression (mean + first-order correction): ˆ g(i) = ¯ f (i) +

  • 2
  • β − αe1e−1

2

  • − 1
  • c
  • λiqi,

where α = σ(i)/c

  • 2πλi,

β = 1 2c√λi q⊤

i

  • θ(i) − ¯

f (i) + c

  • λiqi
  • ,

e1 = exp

  • −(1 − β)2

πα2

  • − exp
  • − β2

πα2

  • ,

e2 = erf 1 − β √πα

  • − erf

β √πα

  • .

◮ Main point: All computations are O(1).

18

slide-20
SLIDE 20

Summary of the algorithm

  • 1. Compute ω ∗ (fpfq), ω ∗ fp for p, q = 1, 2, 3 using O(1)

convolutions.

  • 2. For each pixel i,

2.1 Populate Ci using the above convolved quantities. 2.2 Estimate dominant eigenpair (λi, qi) by power iterations method. 2.3 Compute α, β, e1, e2 in the previous slide. 2.4 Compute ˆ g(i) using the formula in the previous slide.

Dominant cost = 9 Gaussian convolutions.

19

slide-21
SLIDE 21

Application: Adaptive detail enhancement Brief overview: ◮ Objective: Enhance details, but not to the same extent everywhere. ◮ More enhancement in regions which are more visually salient. ◮ Can be accomplished using the ABF10. ◮ σ(i) is decided using a saliency map. ◮ θ(i) = f (i). ◮ We use our proposed algorithm for color filtering.

10Ghosh et al., 2019. 20

slide-22
SLIDE 22

Input (640 × 960). Enhanced, ρ = 5. Saliency map.

10 20 30 40 50 60 70

σ map.

Timings: Brute-force = 27 sec., Proposed = 1.4 sec.

21

slide-23
SLIDE 23

Application: JPEG deblocking Brief overview: ◮ Objective: Smooth out blocking artifacts in JPEG-compressed images. ◮ For grayscale images, can be accomplished using ABF1112. ◮ We extend the same idea to color images. ◮ σ(i) is decided using a technique proposed previously 11. ◮ θ(i) = f (i). ◮ We use our proposed algorithm for filtering.

11 Zhang and Gunturk, 2009. 12Gavaskar and Chaudhury, 2019. 22

slide-24
SLIDE 24

Input (512 × 512). Deblocked, ρ = 4.

40 60 80 100 120 140 160

σ map. Original.

Timings: Brute-force = 8.4 sec., Proposed = 0.6 sec.

23

slide-25
SLIDE 25

Application: Sharpening Brief overview: ◮ Objective: Sharpen a blurred image containing fine noise grains. ◮ For grayscale images, can be accomplished using ABF13. ◮ We extend the idea to color images. ◮ Both σ(i) and θ(i) are decided using previously proposed techniques. ◮ We use our proposed algorithm for filtering.

13Zhang and Allebach, 2008. 24

slide-26
SLIDE 26

Input (1600 × 1200). Sharpened, ρ = 4.

23 24 25 26 27 28 29 30 31 32 33

σ map.

Timings: Brute-force = 62 sec., Proposed = 4.4 sec.

25

slide-27
SLIDE 27

Conclusion ◮ Proposed O(1) algorithm for adaptive bilateral filtering of color images. ◮ First such algorithm to the best of our knowledge. ◮ Core idea: Approximate local histogram as uniform along direction of maximum variance. ◮ Achieves about 15× speedup with reasonable accuracy. ◮ Useful for detail enhancement, sharpening, and deblocking. ◮ Better accuracy and extension to non-Gaussian kernels?

Research supported by EMR grant SERB/F/6047/2016-2017 from DST-SERB, Government of India.

26

slide-28
SLIDE 28

References I

  • C. Tomasi and R. Manduchi, “Bilateral filtering for gray and color images,”
  • Proc. IEEE International Conference on Computer Vision, pp. 839–846,

1998.

  • B. Zhang and J. P. Allebach, “Adaptive bilateral filter for sharpness

enhancement and noise removal,” IEEE Transactions on Image Processing,

  • vol. 17, no. 5, pp. 664–678, 2008.
  • K. Sugimoto and S.-I. Kamata, “Compressive bilateral filtering,” IEEE

Transactions on Image Processing, vol. 24, no. 11, pp. 3357–3369, 2015.

  • M. G. Mozerov and J. van de Weijer, “Global color sparseness and a local

statistics prior for fast bilateral filtering,” IEEE Transactions on Image Processing, vol. 24, no. 12, pp. 5842–5853, 2015.

  • R. Deriche, “Recursively implementing the Gaussian and its derivatives,”

Research Report RR-1893, INRIA, 1993.

27

slide-29
SLIDE 29

References II

  • I. T. Young and L. J. van Vliet, “Recursive implementation of the Gaussian

filter,” Signal Processing, vol. 44, pp. 139–151, 1995.

  • S. Ghosh, R. G. Gavaskar, and K. N. Chaudhury, “Saliency guided image

detail enhancement,” Proc. National Conference on Communications, pp. 1–6, 2019.

  • M. Zhang and B. K. Gunturk, “Compression artifact reduction with

adaptive bilateral filtering,” Proc. SPIE Visual Communications and Image Processing, vol. 7257, 2009.

  • R. G. Gavaskar and K. N. Chaudhury, “Fast adaptive bilateral filtering,”

IEEE Transactions on Image Processing, vol. 28, no. 2, pp. 779–790, 2019.

28

slide-30
SLIDE 30

Thanks for listening!