khoo
Posts:
63
Registered:
8/9/08


Re: How to calculate the angle between two images?
Posted:
Apr 4, 2009 2:53 PM


> The computation itself should be easy, simply FFT both histograms  remember this results in complex answers  don't throw away the phase, do complex arithmetic for the next phase which is > > multiply the spectrum of one histogram by the complex conjugate of the second spectrum (remember to .* not *) then find the real part of the inverse transform of the product. > > Look at this resulting vector, and hopefully you should find a peak value corresponding to the relative rotation angle between the two images. If you do, come back and we will discuss the zero packing to get better angular resolution, if not then we need to see the type of image you are working with. > > Regards > > Dave Robinson
bro, i face some error at the times there...
this is the error code i get ??? Error using ==> times Matrix dimensions must agree.
and this is the code currently..which do until the .* you teach me..
clear all;clc
im1=imread('image1.jpg'); im11=rgb2gray(im1); im111=im2double(im11); [dx,dy]=gradient(im111); p1=atan2(dy,dx); im1111=edge(p1,'canny'); bw1 = bwmorph(im1111,'dilate'); im11111=p1.*bw1; im6=hist(im11111); im66=fft(im6);
im2=imread('image2.jpg'); im22=rgb2gray(im2); im222=im2double(im22); [dx,dy]=gradient(im222); p2=atan2(dy,dx); im2222=edge(p2,'canny'); bw2 = bwmorph(im2222,'dilate'); im22222=p2.*bw2; im7=hist(im22222); im77=fft(im7); im777=conj(im77);
im8=im66.*im777; imshow(im8)
and this is both image i try to find the angles
[IMG]http://i278.photobucket.com/albums/kk119/khoo011/image1.jpg[/IMG] [IMG]http://i278.photobucket.com/albums/kk119/khoo011/image2.jpg[/IMG]

