Re: Calculating a mean band [message #54825] |
Wed, 11 July 2007 08:48 |
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  |
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  |
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
|
|
|