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

Home » Public Forums » archive » Re: Finding the mean of a set of images
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: Finding the mean of a set of images [message #32587 is a reply to message #32583] Tue, 22 October 2002 06:33 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
David Oesch <oesch@giub.unibe.ch> writes:

> Hello outthere,
>
> I know this topic was up before, but all I could find in the list was to
> go for CALL_EXTERNAL and use a FORTRAN etc. program. Here's my problem:
> Does anyone have an algorithm for finding the mean/standardeviation etc
> at each pixel position for a set of equal size 2-D images? Currently the
> only way I have to do this is to extract all the values for a given
> pixel position into a 1-D array and find the mean/standardeviation etc
> on that. Doing it pixel by pixel like this is inefficient in IDL so I am
> looking for an *array* based algorithm that would find all
> the mean/standardeviation etc in parallel.
> Any progs so far in IDL for this problem?..or a decent fortran or C program?


Sure, if you stack your image into a 3D image cube, then you would
have something like IMAGE = FLTARR(NX, NY, NIMAGES)

Then the mean image is:

mean = total(image,3)/nimages

The standard deviation is:

meancube = rebin(reform(mean,nx,ny,1),nx,ny,nimages)
std = sqrt(total((image - meancube)^2,3)/(nimages-1))

Now, what you meant by "etc" can get a little hairier. If you want to
do median you are probably in trouble, but min and max are easy too:

minimage = image(*,*,0)
maximage = minimage
for i = 1, nimages-1 do begin
minimage = minimage < image(*,*,i)
maximage = maximage > image(*,*,i)
endfor

It's a loop, but unless you have a bazillion images, it will be fast.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: WINDOW, /PIXMAP Question
Next Topic: Re: what is the most convenient way to read an image generated by ENVI in IDL

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

Current Time: Fri Oct 10 14:04:22 PDT 2025

Total time taken to generate the page: 0.24018 seconds