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

Home » Public Forums » archive » Re: Correlation between bands using IDL
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: Correlation between bands using IDL [message #72013] Wed, 04 August 2010 22:10 Go to next message
Lavanya is currently offline  Lavanya
Messages: 7
Registered: August 2010
Junior Member
On Aug 4, 11:49 am, chris <rog...@googlemail.com> wrote:
> On 3 Aug., 11:30, Lavanya <lavany...@gmail.com> wrote:
>
>> Hi,
>
>> I am pretty much new in using IDL. I have been trying to read
>> multiband image data using envi_select and envi_file_query, where i
>> get the information about the data im using.
>> Now how could i find the correlation between any two bands (here the
>> number of bands i have is 242)
>> Finally i need to generate a output correlation matrix of 242 * 242.
>> Please help me how can i go about.
>
>> Thanks
>
> Hi,
> i don't understand what you want to do. Do you want to correlate
> pixel1 band1 with pixel2 band2, pixel1 band1 with pixel2 band3 and so
> on for all pixel and bands?
>
> Regards Chris

I wanted to find the correlation between
band1 band2, band1 band 3, band 1 band 4
band 2 band 1, band 2 band 3, band 2 band 4 and so on. Final result
should be of the matrix form n * n where n will be the number of bands
of the same image. Here i am using only one image which has 'n' bands

Please help

-Lavanya
Re: Correlation between bands using IDL [message #72037 is a reply to message #72013] Tue, 03 August 2010 23:49 Go to previous messageGo to next message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
On 3 Aug., 11:30, Lavanya <lavany...@gmail.com> wrote:
> Hi,
>
> I am pretty much new in using IDL. I have been trying to read
> multiband image data using envi_select and envi_file_query, where i
> get the information about the data im using.
> Now how could i find the correlation between any two bands (here the
> number of bands i have is 242)
> Finally i need to generate a output correlation matrix of 242 * 242.
> Please help me how can i go about.
>
> Thanks

Hi,
i don't understand what you want to do. Do you want to correlate
pixel1 band1 with pixel2 band2, pixel1 band1 with pixel2 band3 and so
on for all pixel and bands?

Regards Chris
Re: Correlation between bands using IDL [message #72054 is a reply to message #72037] Tue, 03 August 2010 05:34 Go to previous messageGo to next message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Aug 3, 2:30 am, Lavanya <lavany...@gmail.com> wrote:
> Hi,
>
> I am pretty much new in using IDL. I have been trying to read
> multiband image data using envi_select and envi_file_query, where i
> get the information about the data im using.
> Now how could i find the correlation between any two bands (here the
> number of bands i have is 242)
> Finally i need to generate a output correlation matrix of 242 * 242.
> Please help me how can i go about.
>
> Thanks

It does not make sense to find correlation matrix of 242 * 242. I
think what you need is using the Principal component analysis (PCA).
With this you
could find the maximum variance which presents the maximum variation.
And you can decrease your number of bands to few factors. David has a
very good article about that: http://www.dfanning.com/code_tips/pca.html
Cheers
Dave
Re: Correlation between bands using IDL [message #72159 is a reply to message #72013] Thu, 05 August 2010 00:25 Go to previous message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
On 5 Aug., 07:10, Lavanya <lavany...@gmail.com> wrote:
> On Aug 4, 11:49 am, chris <rog...@googlemail.com> wrote:
>
>
>
>
>
>> On 3 Aug., 11:30, Lavanya <lavany...@gmail.com> wrote:
>
>>> Hi,
>
>>> I am pretty much new in using IDL. I have been trying to read
>>> multiband image data using envi_select and envi_file_query, where i
>>> get the information about the data im using.
>>> Now how could i find the correlation between any two bands (here the
>>> number of bands i have is 242)
>>> Finally i need to generate a output correlation matrix of 242 * 242.
>>> Please help me how can i go about.
>
>>> Thanks
>
>> Hi,
>> i don't understand what you want to do. Do you want to correlate
>> pixel1 band1 with pixel2 band2, pixel1 band1 with pixel2 band3 and so
>> on for all pixel and bands?
>
>> Regards Chris
>
> I wanted to find the correlation between
> band1 band2, band1 band 3, band 1 band 4
> band 2 band 1, band 2 band 3, band 2 band 4 and so on. Final result
> should be of the matrix form n * n where n will be the number of bands
> of the same image. Here i am using only one image which has 'n' bands
>
> Please help
>
> -Lavanya

Ok, as far as I understand you want to compute the Band-To-Band
correlations. You could do this (not vectorized) in this way:

IDL> n=242l
IDL> image_size_x=10
IDL> image_size_y=10
IDL> image=randomn(seed,image_size_x,image_size_y,n)
IDL> l=lindgen(n,n) mod n
IDL> xind=l[*]
IDL> yind=(temporary(transpose(l)))[*]
IDL> corr=fltarr(n,n)
IDL> for i=0l,(n*n)-1l do corr[i] = correlate((image[*,*,xind[i]])[*],
(image[*,*,yind[i]])[*])
IDL> corr=reform(corr,n,n,/over)
IDL> tvscl, corr

Hope it helps

CR
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: What function do I have to use in IDL? MATLAB corresponded function
Next Topic: Re: lon-lat coordinates for Geotiff images?

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

Current Time: Wed Oct 08 17:34:41 PDT 2025

Total time taken to generate the page: 0.00644 seconds