khoo
Posts:
63
Registered:
8/9/08


Re: How to calculate the angle between two images?
Posted:
Apr 7, 2009 3:28 AM


Bro Dave, i ady get the radians for the images..but now i got one problem show in my program..i use several images with different angles to test the code..but all i get is same radian..how come will like this?? and this is my code currently:
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; %subplot(2,1,1);hist(im11111); im6=hist(im11111(:),256); im66=fft(im6);
im2=imread('image2.jpg'); im22=rgb2gray(im2); im222=im2double(im22); im333=zeros(size(im111)); im333(1:size(im2,1),1:size(im2,2))=im222; [dx,dy]=gradient(im333); p2=atan2(dy,dx); im2222=edge(p2,'canny'); bw2 = bwmorph(im2222,'dilate'); im22222=p2.*bw2; %subplot(2,1,2);hist(im22222); im7=hist(im22222(:),256); im77=conj(fft(im7)); im8=real(ifft(im66.*im77)); im8(1)=0; plot(im8); [y,x]=max(im8); rel_deg=((x*(2*pi/256))*180)/pi;
if rel_deg>180; new_rel_deg=rel_deg180 else new_rel_deg=rel_deg end
pls help me..and what is zero packing??izit i need to use zero packing to get the correct angle??

