Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: How to calculate the angle between two images? Date: Mon, 6 Apr 2009 12:15:05 +0000 (UTC) Organization: STFC Rutherford Appleton Laboratory Lines: 27 Message-ID: <grcro9$209$1@fred.mathworks.com> References: <gr4ten$oks$1@fred.mathworks.com> <gr4u55$add$1@fred.mathworks.com> <gr4v19$60a$1@fred.mathworks.com> <gr82h2$d9h$1@fred.mathworks.com> <gr86ie$m8l$1@fred.mathworks.com> <gr96k1$cgv$1@fred.mathworks.com> <gra0s1$7d0$1@fred.mathworks.com> <gra1tq$a1t$1@fred.mathworks.com> <grad5q$cai$1@fred.mathworks.com> <graed8$ope$1@fred.mathworks.com> <grce8v$8g$1@fred.mathworks.com> <grcfva$cbd$1@fred.mathworks.com> <grcqo9$17e$1@fred.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: webapp-03-blr.mathworks.com Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1239020105 2057 172.30.248.38 (6 Apr 2009 12:15:05 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Mon, 6 Apr 2009 12:15:05 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 968489 Xref: news.mathworks.com comp.soft-sys.matlab:530701 "khoo" <jim_khoo@hotmail.com> wrote in message <grcqo9$17e$1@fred.mathworks.com>... > > Why are you histogramming im8? which should be the correlation that you are looking for - just plot im8 and if everything else is correct then you should have one dimensional distribution reaching a peak at the position corresponding to the relative rotation angle of the 2 images. > > > > Regards > > > > Dave Robinson > > Bro Dave, this is the im8 graph after i plot out..but why the peak will at left side?? izit my inverse FFt do wrong? > > http://i278.photobucket.com/albums/kk119/khoo011/grapg.jpg > > and this is the part of code after i change..jz the below part of the code > > im7=hist(im22222(:),256); > im77=conj(fft(im7)); > im8=real(ifft(im66.*im77)); > plot(im8) Had you considered that the results just might be right? Think about it - when you rotated the image, do the the actual image boundaries rotate?. You had some almost circular details toward the centre of the image, rotating a circle will generate exactly the same angle image irrespective of the amount of twist. If your image contains aliasing (digital stepping in the image), these will always generate detail usually at 0 and 90 degrees. Remember that your x scale needs to be rescaled such that 0 -> 256 actually maps to 0 ->360 degrees. Meanwhile do the other spikes bear any relationship to the actual rotation angle between your images? If the zero degree spike offends you why not set it to zero - if you know that the two images do have a valid rotation Regards Dave Robinson