sebastianbeyer / fasticonv

Fast image convolution in Fortran
4 stars 0 forks source link

Too small size for the sliding window? #1

Open perrette opened 8 years ago

perrette commented 8 years ago

Hi @sebastianbeyer,

Nice work. I am a bit too lazy to go in the full code for now, but looking at the "naive" example, I see the Gaussian Kernel with r parameter is used with a moving window of size 2*r. I would pick at least 2*r, otherwise you cut 1 large chunk of the weights (~1/3). What do you think?

gaussian_kernel

perrette commented 8 years ago

"The NVidia implementation uses a kernel size of int(sigma*3)."

"You may experiment using a smaller kernel size with higher values of sigma for performance considerations."

http://stackoverflow.com/a/17860899/2192272

sebastianbeyer commented 8 years ago

I am no sure what you mean... in the example?

perrette commented 8 years ago

I mean in your main code. Look at the figure in 1d. The parameter is r=1. The question is: which cutoff? Non zero values exist until infinity. That's always a problem with convolution. In practice, for x>3 values are close to zero so the true convoluion result (inf) and a cut-off version of it would probably be similar. But if you cutoff at x=1 you will perform something that is quite far from actual gaussian convolution. If all you want is to get some blurring that may be fine, but you may lose other properties...

IMO, rcut = 3×r is a good option.