Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Image rotation detection probelm
Replies: 32   Last Post: Aug 8, 2013 10:46 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Phillip

Posts: 12
Registered: 8/2/10
Re: Image rotation detection probelm
Posted: Aug 2, 2010 8:45 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I stumbled across this while trying to solve the same problem (determine rotation between 2 images). Thanks to those who posted here. You should only need the radon projection along one angle for one of the images. Also, the use of the FFT confused me so I have used it at the end to do the correlation in a more familiar way to me. Code snippet:

thetas = [-45 : 45]; % Enter desired range

P1 = radon(Image1,0); % Only 1 projection is needed for reference image
P2 = radon(Image2,thetas); % All projections to be considered for the other image

% Compare the projections for Image2 to the projection for Image1 using cross
% correlation. The most correlated projection gives the amount of image rotation.

for ii = 1:length(thetas)
b = P2(:,ii);
this_correlation = abs(ifft(P1.*conj(b)));
angle_scores(ii) = max(max(this_correlation));
end



"Yuan-Liang Tang" <john.doe.nospam@example.com> wrote in message <h8q5ba$fds$1@fred.mathworks.com>...
> Matt:
> The code you provided is really good. What I did is to further sum the columns of P1 and P2 and perform cross-correlation to find the angle of rotation. To be more specific,
>
> %%%%%%%%%%%%%%%%
> P1=abs(fft(radon(Image1)));
> P2=abs(fft(radon(Image2)));
> a = sum(P1);
> b = sum(P2);
> a = a-mean(a);
> b = b-mean(b);
> [m n] = max(xcorr(a, b));
> angle = length(a)-n+1 % The angle of rotation
> %%%%%%%%%%%%%%%%
>
> The code above worked just fine. However, what is the purpose of "fft" after radon transform? Can we skip the "fft" part? Thanks.
>
> Y.L. Tang
>
>
> "Matt " <xys@whatever.com> wrote in message <h1g8gu$mrc$1@fred.mathworks.com>...

> > "Pradyumna A" <a_pradyumna@yahoo.com> wrote in message <h1fn0q$aeg$1@fred.mathworks.com>...
> > > Hello,
> > >
> > > I have 2 images. One is the reference image and the other is the rotated version of the reference image. I would like to find what is the angle by which the 2nd image is rotated wrt 1st one. Also in future, the second image will be scaled

> > ----------
> >
> > In what way will the image be scaled? Do you mean stretched geometrically or do you mean all the pixel values will be scaled?
> >
> > ------

> > >and translated along with this rotation !. This has to be done automatically (without human interference in selecting feature points etc)
> > -----
> >
> > One thing you can try is to compute
> >
> > P1=abs(fft(radon(Image1)))
> > P2=abs(fft(radon(Image2)))
> >
> > You will see that P1 is shifted with respect to P2 by an amount corresponding to the rotation. You can use your favorite shift measurement technique (e.g. correlation) to calculate the shift, and hence the rotation. Also, translation will not affect P1 and P2.



Date Subject Author
6/19/09
Read Image rotation detection probelm
Pradyumna A
6/19/09
Read Re: Image rotation detection probelm
Matt
9/16/09
Read Re: Image rotation detection probelm
Hamid Reza Mohseni Nejad
8/2/10
Read Re: Image rotation detection probelm
Phillip
12/21/10
Read Re: Image rotation detection probelm
chee ali
12/21/10
Read Re: Image rotation detection probelm
Phillip
12/21/10
Read Re: Image rotation detection probelm
Matt J
12/21/10
Read Re: Image rotation detection probelm
Phillip
11/14/12
Read Re: Image rotation detection probelm
Darren g
11/14/12
Read Re: Image rotation detection probelm
Phillip
11/19/12
Read Re: Image rotation detection probelm
Darren g
11/19/12
Read Re: Image rotation detection probelm
Phillip
11/20/12
Read Re: Image rotation detection probelm
Darren g
11/20/12
Read Re: Image rotation detection probelm
Phillip
11/26/12
Read Re: Image rotation detection probelm
Darren g
11/26/12
Read Re: Image rotation detection probelm
Phillip
11/27/12
Read Re: Image rotation detection probelm
Darren g
11/28/12
Read Re: Image rotation detection probelm
Phillip
11/29/12
Read Re: Image rotation detection probelm
Darren g
12/2/12
Read Re: Image rotation detection probelm
Phillip
12/3/12
Read Re: Image rotation detection probelm
Darren g
12/4/12
Read Re: Image rotation detection probelm
Phillip
12/11/12
Read Re: Image rotation detection probelm
Darren g
12/11/12
Read Re: Image rotation detection probelm
Phillip
12/12/12
Read Re: Image rotation detection probelm
Darren g
12/12/12
Read Re: Image rotation detection probelm
Steven Lord
2/6/13
Read Re: Image rotation detection probelm
Darren g
12/20/12
Read Re: Image rotation detection probelm
Phillip
12/20/12
Read Re: Image rotation detection probelm
Kev
12/20/12
Read Re: Image rotation detection probelm
Kev
7/7/13
Read Re: Image rotation detection probelm
xmlfor
8/8/13
Read Re: Image rotation detection probelm
jacaboo

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.