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

Home » Public Forums » archive » fft and least sqaues problem
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
fft and least sqaues problem [message #81144] Tue, 14 August 2012 07:06
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
Hi Folks,

I try to estimate the subpixelshifts if an image is compared with its shifted represenetation, but something is going wrong. Maybe somebody can help me.

s=size(im,/dim)*1.
im1 =im
dx=.25
dy=.3
im2=image_shift(im1,dx,dy);more precise then interpolate(im,findgen(s[0])+dx,findgen(s[1])+dy,/grid,/cubi c)
fim1=fft(im1,-1)
fim2=fft(im2,-1)
corr=fim1*conj(fim1)/abs(fim1*fim2)
corr=shift(corr,s/2)
phase=atan(imaginary(corr)/real_part(corr))
wx=(findgen(s) mod s[0])*2.*!pi/s[0]
wy=(rebin(findgen(1,s[1]),s))*2.*!pi/s[1]
r=5;fitting radius
phase2=phase[s[0]/2 - r : s[0]/2 + r,s[1]/2 - r : s[1]/2 + r]
wx2=wx[s[0]/2 - r : s[0]/2 + r,s[1]/2 - r : s[1]/2 + r]
wy2=wy[s[0]/2 - r : s[0]/2 + r,s[1]/2 - r : s[1]/2 + r]
print,la_least_squares(transpose([[wx2[*]],[wy2[*]]]),phase2 [*])

The last line should give dx and dy but its erroneous. I don't really know why!

Thanks in advance

CR
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Memory Allocation Problem
Next Topic: How to prevent proliferation of leftover objects when NG plots are included in unit tests.

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

Current Time: Wed Oct 08 19:09:41 PDT 2025

Total time taken to generate the page: 0.00651 seconds