fredericjs/surfalize

Gaussian kernel ISO 16610-21/-61

dhueser opened this issue · 1 comments

Dear Frederic,

  • in filter.py line 46 you have the conversion from cut off wavelength to sigma
46: return cutoff / (2 * np.sqrt(2 * np.log(2)))
  • kernel according to ISO 16610-21 and -61 $s(u) \propto \exp(-\pi (\frac{u}{\alpha \lambda_c})^2)$ where $\alpha = \sqrt{\frac{\log(2)}{\pi}}$
  • Gaussian as of ndimage: $g(u) \propto \exp(-\frac{1}{2} (\frac{u}{\sigma})^2 )$
  • i.e. $\frac{1}{2 \sigma^2} = \frac{\pi}{(\alpha \lambda_c)^2}$
  • inserting $\alpha = \sqrt{\frac{\log(2)}{\pi}}$ we obtain $\frac{1}{2 \sigma^2} = \frac{\pi^2}{\log(2) \lambda_c^2}$
  • i.e. $2 \sigma^2 = \log(2) (\frac{\lambda_c}{\pi} )^2$
  • i.e. $\sigma = \sqrt{\frac{\log(2)}{2}} \frac{\lambda_c}{\pi}$
  • therefore, could it be that in line 46 of filter.py you might have ment?
46: return (cutoff/np.pi) * (np.sqrt(np.log(2)/2))

Best wishes - Dorothee

Thanks Dorothee,

I'm not sure anymore how I arrived at the current implementation for sigma, but there is definitely an error. Your implement is correct, at least it's what I obtain for the standard deviation when I equate a general Gaussian kernel with the kernel function proposed by ISO 16610.

Thanks alot for correcting this mistake. I have published a fix in v0.8.2

Best
Frederic