CImg中的blur

I have been assuming for quite some time that "blur" and "get_blur" are Gaussian blurs.

1) I recently noticed that the documentation says it is a Canny-Deriche filter. This confused me because the only Canny-Deriche filter I know is an edge filter.

I did some tests to see if it is in fact a Gaussian blur. Because the Gaussian is the only kernel linear operator, this should hold:

G(s1)*G(s2) = G( sqrt(s1^2 + s2^2) )

I did a test, and it is fairly close, but not equivalent -- the two-pass blurred image was slightly more blurred than the single pass version. This could be due to approximation or round-off errors.

Because a Gaussian is linearly separable, it should also be the case that

G_x(s1)*G_y(s1) = G(s1)

I did a test of this, and they appeared very much equal. So it seems that the blur function is in fact a Gaussian blur. But why is it called Canny-Deriche in the documentation then?

2) Secondly, I am curious how the function is implemented -- does it use 2 passes with recursive filters?


The blur() function in CImg is indeed not a Gaussian one, but it should be close enough for usual applications.

1) The fact is that it is implemented using a recursive Deriche filter which theoretically implements the convolution with the kernel g(x) = exp(-k|x|).
Here, the 'k' parameter is automatically chosen from 'sigma' (the blur amplitude) so that the filter has the same values at 'g(sigma)'.
This is why is is relatively close to a real Gaussian function f(x) = exp(-x*x/2sigma).

2) You are absolutely right, this is implemented as a 2 passes recursive filter.

David.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值