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

Home » Public Forums » archive » Moving Average on Hyperspectral dataset
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Moving Average on Hyperspectral dataset [message #53154] Mon, 26 March 2007 16:03
rafaloos is currently offline  rafaloos
Messages: 15
Registered: January 2006
Junior Member
Hi, all ...
We are trying to do a moving average on our dataset. The dataset comes
from a Hyperspectral sensor and has 296 samples, 2000 lines and 492
bands.
We need to go through each pixel and do a moving average on the
spectral bands. So in the end we will have a dataset with the same
dimensions as the original but with smooth spectra. And because of the
moving average kernel size, we will have some empty bands at the
beginning and at the end.


Here is the code that we are using now ...

>>>> IMAGE = (296, 2000, 492)

--------------------------------------

Step = FIX(Kernel / 2)

FOR samples = 0 , 295 DO BEGIN
FOR lines = 0, 1999 DO BEGIN
FOR bands = Step, 491 - Step DO BEGIN
ARR_TEMP = MEAN(IMAGE[samples, lines,bands-Step:bands
+step])
IMAGE[samples, lines, bands] = ARR_TEMP
IMAGE[samples, lines, 0:step-1] = 0
IMAGE[samples, lines, bands-(Step):bands-1] =
0
ENDFOR
ENDFOR
ENDFOR

--------------------------------------

With the loops the code takes about 3 hours ... Is there a way to
speed it up ?

Thank you
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: adding columns to a binary table in a fits file
Next Topic: Menu Hierarchy

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

Current Time: Wed Oct 08 17:45:17 PDT 2025

Total time taken to generate the page: 0.00426 seconds