File Exchange

image thumbnail

Fast Bilateral Filt​er

version 1.0.0.0 (10.2 KB) by Kunal Chaudhury
Fast O(1) Bilateral Filter

4 Downloads

Updated 30 Apr 2012

View License

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," arXiv:1203.5128v1.

Comments and Ratings (3)

Xiaohua

It's really very good code. Thank you very much.
But I think there has a little bug in the following code:
for k = 2 : n
if mod(k - 1, w) == 0
L(k) = template(ii , k);
R(n - k + 1) = template(ii , n - k + 1);
else
L(k) = max( L(k-1) , template(ii, k) );
R(n - k + 1) = max( R(n - k + 2), template(ii, n - k + 1) );
end
end

For example, given the following data
Original: 18 8 13 9 12 20 5 7 3 15 6
If applying the above code manually to the above data with kernel size 3, the output is
Result1: 18 18 13 13 20 12 20 7 15 15 15
At the sixth data 20, the filtered result is 12. This is obviously not correct.
The above bug can be corrected like this
for k = 2 : n
if mod(k - 1, w) == 0
L(k) = template(ii , k);
else
L(k) = max( L(k-1) , template(ii, k) );
end
if(mod(n - k + 1,w)==0
R(n - k + 1) = template(ii , n - k + 1);
else
R(n - k + 1) = max( R(n - k + 2), template(ii, n - k + 1) );
end
end
The judgement of mod() should be separated for L and R. Isn't right?
The the result becomes
Result2: 18 18 13 13 20 20 20 7 15 15 15
Anyway, thank you for your code and paper.

tiantian

The code is very useful. Thanks for your contribution

good,thank u sir for the code.

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux