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 #21049 is a reply to message #20952] Fri, 04 August 2000 00:00 Go to previous messageGo to previous message
Struan Gray is currently offline  Struan Gray
Messages: 178
Registered: December 1995
Senior Member
I think this works:

; ************************************

function smg_imageSD, image

fimage = float(image)
localmean = smooth(fimage, 3)
sum = (fimage - localmean)^2
sum = temporary(sum) + $
shift((fimage - shift(localmean, 1, 1))^2,-1,-1)
sum = temporary(sum) + $
shift((fimage - shift(localmean, 0, 1))^2, 0,-1)
sum = temporary(sum) + $
shift((fimage - shift(localmean,-1, 1))^2, 1,-1)
sum = temporary(sum) + $
shift((fimage - shift(localmean, 1, 0))^2,-1, 0)
sum = temporary(sum) + $
shift((fimage - shift(localmean,-1, 0))^2, 1, 0)
sum = temporary(sum) + $
shift((fimage - shift(localmean, 1,-1))^2,-1, 1)
sum = temporary(sum) + $
shift((fimage - shift(localmean, 0,-1))^2, 0, 1)
sum = temporary(sum) + $
shift((fimage - shift(localmean,-1,-1))^2, 1, 1)

sum = sqrt(temporary(sum)/8)

dims = size(sum, /dim)
sum[0,*] = 0.0
sum[*,0] = 0.0
sum[dims(0)-1,*] = 0.0
sum[*,dims(1)-1] = 0.0

return, sum
end

; ************************************

You can generalise the shifting and put it into a double loop over the kernal
indices. You can also deal with edge-effects (and avoid the zeroing of edge
elements) if you creat an oversize image and pad it appropriately. On my
machine this is approx ten times faster than Ben_imageSD.


Struan
[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:37 PDT 2025

Total time taken to generate the page: 0.00408 seconds