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

Home » Public Forums » archive » Re: Calculating a mean band
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
Re: Calculating a mean band [message #54825] Wed, 11 July 2007 08:48
Conor is currently offline  Conor
Messages: 138
Registered: February 2007
Senior Member
On Jul 11, 11:32 am, "Jean H." <jghas...@DELTHIS.ucalgary.ANDTHIS.ca>
wrote:
> Julio wrote:
>> Hi there!
>
>> Very simple question... I have a multi-band image (36 bands) and I
>> need to calcultate the average of the bands, pixel by pixel.
>
>> If I do that:
>
>> average_array=mean(multi_band)
>
>> I get a single value, because it doesn't work pixel by pixel. So, how
>> can I do to make a mean band of all the 36 bands??
>
>> Comments welcome.
>
>> Best!
>> Julio
>
> Hi,
>
> You can easily make the sum of you band along a dimension... so
> average_array = total(multi_band, 3) / nbOfBands
>
> Jean


You could also do it this way, assuming image=fltarr(x,y,36)

mean_image = rebin(x,y,1)

I'm not sure which way is faster
Re: Calculating a mean band [message #54827 is a reply to message #54825] Wed, 11 July 2007 08:32 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Julio wrote:
> Hi there!
>
> Very simple question... I have a multi-band image (36 bands) and I
> need to calcultate the average of the bands, pixel by pixel.
>
> If I do that:
>
> average_array=mean(multi_band)
>
> I get a single value, because it doesn't work pixel by pixel. So, how
> can I do to make a mean band of all the 36 bands??
>
> Comments welcome.
>
> Best!
> Julio
>

Hi,

You can easily make the sum of you band along a dimension... so
average_array = total(multi_band, 3) / nbOfBands

Jean
Re: Calculating a mean band [message #54828 is a reply to message #54827] Wed, 11 July 2007 08:30 Go to previous message
greg.addr is currently offline  greg.addr
Messages: 160
Registered: May 2007
Senior Member
On Jul 11, 5:08 pm, Julio <j...@cpa.unicamp.br> wrote:
> Hi there!
>
> Very simple question... I have a multi-band image (36 bands) and I
> need to calcultate the average of the bands, pixel by pixel.
>
> If I do that:
>
> average_array=mean(multi_band)
>
> I get a single value, because it doesn't work pixel by pixel. So, how
> can I do to make a mean band of all the 36 bands??
>
> Comments welcome.
>
> Best!
> Julio

If you have image=fltarr(x,y,36), try mean_image=total(image,3)/36

Greg
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: text positioning within multiple plots
Next Topic: Re: Griddata and Contour questions

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

Current Time: Wed Oct 08 13:41:49 PDT 2025

Total time taken to generate the page: 0.00611 seconds