Code covered by the BSD License  

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Fast Bilateral Filter

4.0
4.0 | 1 rating Rate this file 73 Downloads (last 30 days) File Size: 49.6 KB File ID: #36657 Version: 2.2
image thumbnail

Fast Bilateral Filter

by

Kunal Chaudhury (view profile)

 

11 May 2012 (Updated )

Fast bilateral filtering using trigonometric approximations.

| Watch this File

File Information
Description

MATLAB implementation of the fast 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, pp. 3376-3382, 2011.
[2] S. Ghosh and K.N. Chaudhury, "On fast bilateral filtering using Fourier kernels," IEEE Signal Processing Letters, vol. 23, no. 5, pp. 570-573, 2016.
The approximation in [1] is used for wide range kernels, while the one in [2] is used for narrow range kernels.

Required Products Image Processing Toolbox
MATLAB release MATLAB 8.4 (R2014b)
MATLAB Search Path
/
/FastBilateralFilterV2
/FastBilateralFilterV2/images
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (15)
16 Apr 2016 Kunal Chaudhury

Kunal Chaudhury (view profile)

Andre Filipe: Yes, one can easily adapt the present code for cross bilateral filtering.

Comment only
15 Apr 2016 Andre Filipe

is it possible to adapt this code to get the smoothing of image A, while preserving the edges of image B (instead of smoothing A, while preserving the edges of A)? Thanks

Comment only
11 Mar 2016 Kunal Chaudhury

Kunal Chaudhury (view profile)

Mikkel Gammelgaard: The code will not work on a point cloud, but could be extended to do that if there is a fast algorithm for performing smoothing on the point cloud. The whole filtering can be decomposed into a series of such smoothing operations.

Comment only
01 Mar 2016 Mikkel Gammelgaard

Before trying, would this code work for a point cloud of xyz?

Comment only
14 May 2015 Kunal Chaudhury

Kunal Chaudhury (view profile)

Prabhakaran Sengodan: Please see my comments from Nov 19/20.

Comment only
08 May 2015 Prabhakaran Sengodan

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
Updates
11 May 2012 1.7

screenshot added.

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.

06 Apr 2016 2.1

new version: optimized to work with narrow range kernels.

06 Apr 2016 2.1

minor fix

12 Apr 2016 2.2

a bug in the maxFilter code was fixed (thanks to Pravin Nair).

Contact us