gauss_smooth with integers [message #88878] |
Tue, 01 July 2014 01:10  |
greg.addr
Messages: 160 Registered: May 2007
|
Senior Member |
|
|
The GAUSS_SMOOTH (introduced 8.1) documentation appears to suggest it should work on integer arrays, but I can't get anything useful without converting to float. I can do this but, since I'm constrained by memory usage, I'd be glad to know if there is a way (although maybe it has to be converted to float internally anyway?)
a=intarr(800,800)
a[*,400]=1000
a[400,*]=1000
tvscl,a
tvscl,gauss_smooth(a,20,kernel=k)
tvscl,k
...there's no smoothing because the kernel is zeros with a single 1 at the centre.
cheers,
Greg
|
|
|
Re: gauss_smooth with integers [message #88881 is a reply to message #88878] |
Tue, 01 July 2014 03:04   |
Fabzi
Messages: 305 Registered: July 2010
|
Senior Member |
|
|
Hi,
if you check the code from gauss_smooth you can see where the problem
occurs. Gauss_smooth generates internally a normalized kernel and then
fixes it to integer.
Based on this code you can do your own cuisine using convol:
a=intarr(800,800)
a[*,400]=1000 & a[400,*]=1000
; this call is necessary to compile "create_gaussian"
tvscl, gauss_smooth(a, 20)
; parameters are arbitrary, be careful
k = FIX(create_gaussian(20, 100, 2) * 100)
tvscl, convol(a, k, total(k))
Cheers,
Fabien
|
|
|
|