khoo
Posts:
63
Registered:
8/9/08
|
|
Re: How to calculate the angle between two images?
Posted:
Apr 5, 2009 9:54 AM
|
|
> > the max_angle i find is 1 every time..but when i check im8 value, got other value max than 1..so how i need to do the find the peak value? > > The correlation you should get from doing the Re(IFFT ....) is a one dimensional graph, whereas the max(max... you are applying is for a 2 dimensional matrix. > > Try to plot what you have called im8 and see if you end up with a graph showing a peak. > > When I try to access your image I get a message indicating it has been deleted or removed. > > Sorry about your dead line, but it is Sunday here, and it is only just luck I caught this mail, as I have family responsibilities to deal with on a weekend. > > Good Luck & Regards
> > Dave Robinson Bro Dave, this is the code i do until currently...the max value i find is very large...i no sure i got do what wrong o not...but pls teach me how to find the correct angle..
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);
im=imread('image2.jpg'); im2=imresize(im,size(im11),'bicubic'); 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; %subplot(2,1,2);hist(im22222); im7=(hist(im22222)); im77=conj(fft(im7)); im8=real(ifft(im66.*im77)); im9=transform(im8); max_value=max(im9) hist(im8);
below is the function i try to convert the image to 1 Dimensional matric function b=transform(a)
[row,column]=size(a); b=[];
for i=1:row for j=1:column b=[b a(i,j)]; end end
|
|