comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » STANDARD DEVIATON
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: STANDARD DEVIATON [message #21053 is a reply to message #20952] Fri, 04 August 2000 00:00 Go to previous messageGo to previous message
Ben Marriage is currently offline  Ben Marriage
Messages: 12
Registered: June 1999
Junior Member
Struan Gray wrote:
root.
>
>
> function imageSD, image
>
> localmean = smooth(float(image), 3, /edge_truncate)
> localsd = (float(image)-temporary(localmean))^^2
> localsd = smooth(temporary(localsd), 3, /edge_truncate)
> localsd = sqrt(temporary(localsd))
>
> return, localsd
>
> end
>
>
> Struan

I believe that this gives different results to the inbuilt IDL routines.
The problem is a wee bit more complicated than it looks.

My routine:

;=========================================================== ==
function ben_imageSD, image

siz = size(image,/dim)

standdev = fltarr(siz[0],siz[1])

for i=1,siz[0]-2 do begin
for j=1,siz[1]-2 do begin
standdev[i,j] = sqrt(total((image[i-1:i+1,j-1:j+1]-$

total(image[i-1:i+1,j-1:j+1])/9.)^2)/8.)
endfor ;tricky bit ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
endfor ;to do without loops
return,standdev
end
;=========================================================== ==

IDL's version:

;=========================================================== ==
function IDL_imageSD, image

siz = size(image,/dim)

standdev = fltarr(siz[0],siz[1])

for i=1,siz[0]-2 do begin
for j=1,siz[1]-2 do begin
standdev[i,j]=stddev(image[i-1:i+1,j-1:j+1])
endfor
endfor
return,standdev
end
;=========================================================== ==

They do similar things but with loops. Can't figure out how to do this
without loops!

Thanks,
Ben
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Dear Santa: PVWAVE Style Date/Time Axes in IDL
Next Topic: Re: object newbie

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:03:38 PDT 2025

Total time taken to generate the page: 0.00184 seconds