Thread Subject: angle between 2 lines on image

 Subject: angle between 2 lines on image From: Kurt Date: 5 Feb, 2011 10:51:03 Message: 1 of 9 Hello everyone, I have an image with 2 lines , this can be seen at : http://img46.imageshack.us/img46/5347/imagekci.jpg I am trying to compute the angle between these 2 lines. But I think the angle between these 2 lines should be small , but instead I get 175 degrees. I'm not sure if I'm missing something. Any help is welcome. --kurtis My code is : %------------------------------------------------------- clc;clear all;close all;      lines = [144 58 310 35                  464 126 332 134 ]         u1 =lines(:,1);      v1 =lines(:,2);      u2 =lines(:,3);      v2 = lines(:,4) ;            e1 = [ u1 v1 ]      e2 = [ u2 v2 ]            midpt =[ (u1+u2)/2 (v1+v2)/2 ]       [m n]=size(u1); One = ones(m,1)  e1_i = (horzcat(e1,One))' % homogeneous coordinates  e2_i = (horzcat(e2,One))' % homogeneous coordinates  l_ht_i = cross(e1_i,e2_i)   u_l_ht_i = l_ht_i(1,:) v_l_ht_i = l_ht_i(2,:)  colsPerIter =1 ; for i = 1:size(l_ht_i,2)            from = (i-1)*colsPerIter+1            to = from+colsPerIter-1              l_i{i} = l_ht_i(:,from:to) / (sqrt( (u_l_ht_i(:,from:to) )^2 + (v_l_ht_i(:,from:to))^2 ) ) end l_i = cell2mat(l_i) % normalized homogeneous representation of lines li_1 =l_i(1,1); li_2 =l_i(2,1); lj_1 =l_i(1,2); lj_2 =l_i(2,2); theta_ij = acosd( (li_1*lj_1) + (li_2*lj_2) ) % compute angle between the 2 lines %---------------------------------------------------------------------------------------------------------
 Subject: angle between 2 lines on image From: ImageAnalyst Date: 5 Feb, 2011 16:12:13 Message: 2 of 9 Well one man's 175 degrees is another man's 5 degrees. Just subtract the number from 180 if the number is more than 90.
 Subject: angle between 2 lines on image From: Kurt Date: 5 Feb, 2011 17:26:03 Message: 3 of 9 I missed that....thanks again pal. Is it possible for you to give me your general view and let me know if my way of getting the angle seems ok ? take care --kurtis
 Subject: angle between 2 lines on image From: Kurt Date: 5 Feb, 2011 17:35:04 Message: 4 of 9 hey pal, just to let you know. If you remember the 'local' line detection I was trying to do with the floor mat image, where you recommended me to the hough. I was basically trying to implement an algorithm known as 'moving edges algorithm'm tracks a line in an image sequence given an estimate of it from a previous frame. Let me know if you heard of this and your thoughts if any..... cheers again kurtis
 Subject: angle between 2 lines on image From: ImageAnalyst Date: 5 Feb, 2011 17:47:12 Message: 5 of 9 kurtis: I don't really know much about motion analysis or motion estimation. I'd go here though if I needed to find out more about it. http://iris.usc.edu/Vision-Notes/bibliography/contentsmotion-i.html#Motion%20Analysis%20--Low-Level,%20Image%20Level%20Analysis,%20Mosaic%20Generation,%20Super%20Resolution,%20Shape%20from%20Motion
 Subject: Question maximum finding the maximum gradient From: Kurt Date: 6 Feb, 2011 22:28:03 Message: 8 of 9 hi pal, I'm a bit confused. --------------------------------------------------------------- An example I found does it like this :  [dx,dy] = gradient(G); % G is a 2D Gaussian  Ix = conv2(I,dx,’same’); Iy = conv2(I,dy,’same’); ---------------------------------------------------------------- ----------------------------------------------------------- Another example does it like this : [gx,gy] = gradient(J); mag = sqrt(gx.*gx+gy.*gy); -------------------------------------------------------------- In this first example will the magnitude just be : mag = sqrt(Ix.*Ix+Iy.*Iy); if so why is no conv2 used in example 2? Also, can you let me know what is an example of a 2D Gaussian I could possibly use?

Everyone's Tags:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.