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

Home » Public Forums » archive » correlation of single pixels
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
correlation of single pixels [message #81971] Mon, 05 November 2012 01:51 Go to next message
haikoley is currently offline  haikoley
Messages: 5
Registered: November 2012
Junior Member
Hi there,

I have two images showing the same scenery from different angles. What I want to find out is the pixel-offset of every(!) single pixel using correlation, but correlate and c_correlate only correlates two arrays and not a single value and an array. Is there something I can do?

Regards,
max
Re: correlation of single pixels [message #82029 is a reply to message #81971] Mon, 12 November 2012 10:40 Go to previous message
Klemen is currently offline  Klemen
Messages: 80
Registered: July 2009
Member
Hi Max,

no x and y are in this case just the regression variables. See:
https://groups.google.com/forum/?fromgroups=#!topic/comp.lan g.idl-pvwave/F2E8cLePGsQ

Computing correlation using IDL function CORRELATE is ok, if you have to do it once. But here you have to do it within each area of interest a couple of times (considering set of possible offsets in x and y direction) so you have to use 4 FOR loops which will run slow!

Thus you should ask yourself first, how large is the data set you want to process. If you are sure that your offset are not larger than 2 pixels, then you might go for the slow version. That would be something like:

results_corr = make_array(...
results_offx = make_array(...
results_offy = make_array(...
FOR xall=xstart,xend do begin
FOR yall=ystart,yend do begin
search_area = data[xall-search_size:yall+search_size]
template = data[xall-template_size:yall+template_size]
FOR xoff=-search_size:search_size do begin
FOR yoff=-search_size:search_size do begin
data = (shift(search_area, xoff, yoff))[right indeice]
corr = correlate(data[*], template[*])
if corr gt results_corr[xall, yall] then begin
results_corr[xall, yall] = corr
results_offx[xall, yall] = xoff
results_offy[xall, yall] = yoff
endif
endfor
endfor
endfor
endfor
Re: correlation of single pixels [message #82036 is a reply to message #81971] Mon, 12 November 2012 02:24 Go to previous message
haikoley is currently offline  haikoley
Messages: 5
Registered: November 2012
Junior Member
Hi Klemen,

Well, I'm quite new to IDL and that code still looks very complex to me (in fact I didn't expect it to be so complicated^^). I guess in your code x and y are the pixel offsets, is that correct?

Max
Re: correlation of single pixels [message #84712 is a reply to message #82036] Mon, 12 November 2012 10:28 Go to previous message
Klemen is currently offline  Klemen
Messages: 80
Registered: July 2009
Member
Hi Max,

no x and y are in this case just the regression variables. See:
https://groups.google.com/forum/?fromgroups=#!topic/comp.lan g.idl-pvwave/F2E8cLePGsQ

Computing correlation using IDL function CORRELATE is ok, if you have to do it once. But here you have to do it within each area of interest a couple of times (considering set of possible offsets in x and y direction) so you have to use 4 FOR loops which will run slow!

Thus you should ask yourself first, how large is the data set you want to process. If you are sure that your offset are not larger than 2 pixels, then you might go for the slow version. That would be something like:

results = make_array(...
FOR xall=xstart,xend do begin
FOR yall=ystart,yend do begin
search_area = data[xall-search_size:yall+search_size]
template = data[xall-template_size:yall+template_size]
FOR xsearch=0,2*search_size+1 do begin
FOR ysearch=0,2*search_size+1 do begin
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Crashing ROI's
Next Topic: Re: Beginner: Oplot line t^(-5/3)

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

Current Time: Wed Oct 08 15:09:46 PDT 2025

Total time taken to generate the page: 0.00584 seconds