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

Home » Public Forums » archive » Re: fft and least sqaues problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: fft and least sqaues problem [message #81142 is a reply to message #81141] Tue, 14 August 2012 07:50 Go to previous messageGo to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Tuesday, August 14, 2012 4:06:53 PM UTC+2, (unknown) wrote:
> 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

Maybe it's a typo, but you defined the phase-correlation "corr" as:
corr=fim1*conj(fim1)/abs(fim1*fim2)
instead of:
corr=fim1*conj(fim2)/abs(fim1*fim2)
Try that...

Did you have a look at: http://en.wikipedia.org/wiki/Phase_correlation ?

Cheers,
Helder
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Coyote Library Updates
Next Topic: RESOLVE_ROUTINE not finding MEDIAN function?

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

Current Time: Fri Oct 10 09:57:20 PDT 2025

Total time taken to generate the page: 0.64031 seconds