Code covered by the BSD License

### Highlights from Fast Bilateral Filter

4.0
4.0 | 1 rating Rate this file 113 Downloads (last 30 days) File Size: 57.7 KB File ID: #36657 Version: 1.14

# Fast Bilateral Filter

### Kunal Chaudhury (view profile)

11 May 2012 (Updated )

Fast implementations of the bilateral and the joint/cross bilateral filter.

File Information
Description

MATLAB implementation of the fast O(1) bilateral filter described in the following papers:
[1] K.N. Chaudhury, D. Sage, and M. Unser, "Fast O(1) bilateral filtering using trigonometric range kernels," IEEE Trans. Image Processing, vol. 20, no. 11, 2011.

[2] K.N. Chaudhury, "Acceleration of the shiftable O(1) algorithm for bilateral filtering and non-local means," IEEE Transactions on Image Processing, vol. 22, no. 4, 2013.

Also included is the MATLAB implementation of joint bilateral filtering.

Required Products Image Processing Toolbox
MATLAB release MATLAB 8.4 (R2014b)
MATLAB Search Path
/
/FastBilateralFilter
/FastBilateralFilter/images
/__MACOSX
/__MACOSX/FastBilateralFilter
/__MACOSX/FastBilateralFilter/images
14 May 2015 Kunal Chaudhury

### Kunal Chaudhury (view profile)

Comment only
08 May 2015 Prabhakaran Sengodan

### Prabhakaran Sengodan (view profile)

Thanks for such a nice code. Working well for my purpose. Is the maxfilter function really needed? Is there any simple technique to approximately estimate T value? What will be the effect if I keep T as a constant(Say T = max(inputImage(:)); ). Advance thanks :)

Comment only
29 Apr 2013 Kunal Chaudhury

### Kunal Chaudhury (view profile)

Ben: Yes, you can modify the code for volume data as well. The dimension of the data is immaterial.

Comment only
20 Apr 2013 Ben

### Ben (view profile)

A quick question before trying it: does the code support 3D image?

Comment only
20 Nov 2012 Kunal Chaudhury

### Kunal Chaudhury (view profile)

Yes, it can introduce artifacts in the output if the actual T is much larger than 255. This could well be the case near edges
when processing images corrupted by noise
with large sigma. A better guess in this case would be T + C(sigma), where C(sigma) is a reasonable upper bound on the intensity variation induced by noise.

Comment only
19 Nov 2012 PeeVee

### PeeVee (view profile)

Does setting T to max (255 in my case) decrease the accuracy of the final result?

Comment only
19 Nov 2012 Kunal Chaudhury

### Kunal Chaudhury (view profile)

One can always use a good guess of the local dynamic range. The 'maxfilter' is not required in this case. Note, however, that the local dynamic range can be much smaller than 255(the global gynamic range) for a grayscale image, and in some cases, it might be difficult to make a good guess of T (eg, if there's a lot of noise).

Comment only
17 Nov 2012 PeeVee

### PeeVee (view profile)

Most of the time is spent on maxfilter for large image sizes. Is it really necessary, or can we just set T=255?

21 May 2012 Kunal Chaudhury

### Kunal Chaudhury (view profile)

Thanks Derek. Bug fixed.

Comment only
18 May 2012 Derek

### Derek (view profile)

Thanks! One bug: change line 66 in maxFilter.m to
R(m - k + 1) = max( R(m - k + 2), template(m - k + 1, jj));

otherwise will get error if width<height

Comment only
14 May 2012 Curtis

### Curtis (view profile)

Nice effort!

Comment only
11 May 2012 1.7

21 May 2012 1.8

Code for joint filtering of multiband images added (Courtsey of Derek).

08 Aug 2012 1.10

A minor update.

22 Aug 2012 1.12

Replaced 'parfor' loop with 'for' loop.

18 Apr 2013 1.13

Replaced rand( ) by randn( ) in the file *demo*.

24 Jun 2014 1.14

Small fixes made to speedup the code.

12 Jul 2015 1.14

Sterling's formula used to approximate the factorial computation. As a result, the filter can now be used with small range bandwidth, e.g., at \sigma_r=1.

13 Jul 2015 1.14

some minor fix.