# Finding the Angle of Intersection of elements from two images

조회 수: 4 (최근 30일)
Ari . 2015년 6월 25일
편집: Ashish Uthama . 2015년 6월 26일
I am trying to analyze the intersection points between two skeletonized, binary images.
An example of the two images that need to be compared are as below
First image: Second image: Using Imagej I can easily find where all the intersect points are.
However, what I need to do in Matlab is find where these two images intersect and find out at what angle they intersect.
There are many intersection points on each image so it can't be a "manual" process for each intersection.
Once I know the angle of intersection I need to be able to sort the intersection points based on the calculated angle.
Any help is much appreciated! Thanks!
##### 댓글 수: 2표시 이전 댓글 수: 1숨기기 이전 댓글 수: 1
Ari 2015년 6월 25일
편집: Matt J 님. 2015년 6월 25일
In each of the skeletonized images there are a bunch of lines and if you compare them they intersect at various points (which like you said can be found using the find function). Now, at the intersect point, I want to find the angle at which the line segment from one image intersects with a line segment from the other image (the intersect which caused the overlap). Thanks!

댓글을 달려면 로그인하십시오.

### 채택된 답변

Ashish Uthama 2015년 6월 25일
편집: Ashish Uthama 님. 2015년 6월 26일
Attached an image (generated by imshowpair). A rough off the top steps: (assumes the two images are available as logical matrices in im1 and im2)
• Use find(im1&im2) to obtain intersection points
• Since you dont have straight lines, pick a MxN window around a neighborhood of the intersection point to approximate the lines
• For each intersection point
1. Extract an MxN region from each image
2. Fit a line to each set of points in the MxN subregion (tons of ways to do this, search in this form or elsewhere)
3. Determine the angle (tons of ways to do this, search in this form or elsewhere)
Some code to help you get started (I couldn't go further since there are a lot of 'edge' cases that your question does not clarify. The key issue is that the image doest really have 'line' segments, and I am not sure how best to approximate. For example - uncomment the two lines and inspect each nhood - you'll know what I mean)
function t
imshowpair(im1,im2);
N = 10;
%%Find intersection points
%%Extract (2N+1)x(2N+1) window about each intersection point
for ind=1:numel(rInds)
rInd = rInds(ind);
cInd = cInds(ind);
% imshowpair(nhood1,nhood2);
% pause
% Rest of the logic goes here
end
end
##### 댓글 수: 2표시 이전 댓글 수: 1숨기기 이전 댓글 수: 1
Ashish Uthama 2015년 6월 26일
Added a code snippet to get you started.

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Image Arithmetic에 대해 자세히 알아보기

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!