필터 지우기
필터 지우기

Connected points

조회 수: 1 (최근 30일)
Romendra
Romendra 2012년 1월 23일
Hi, I need to know if there is any way to find the indices of connected points. To be more specific, is there any way that to preserve those indices so that it could be used for comparison in an altered matrix( the matrix comes from a picture). Thanks for the help.
  댓글 수: 3
Romendra
Romendra 2012년 1월 23일
My working matrix is 128x256 but as a sample
a=[1 1 0 0 0 1
1 0 0 0 1 1
0 0 0 0 0 1
0 0 0 0 0 0]
I then used bwlabeln(a) to find the connected points which gave me
a_connected=[ 1 1 0 0 0 2
1 0 0 0 2 2
0 0 0 0 0 2
0 0 0 0 0 0]
What i need to do is check this against another matrix( as i said a picture) to see if there is any difference. The connected points indicate an object of interest in the picture.
Any ideas??
Thanks
Romendra
Romendra 2012년 1월 23일
Also I am doing object by object comparison. So I need to compare a set of connected points to another set in an altered matrix.

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

채택된 답변

Walter Roberson
Walter Roberson 2012년 1월 23일
regionprops() can return the indices of the points for each region.
Or more simply,
find(a==2)
  댓글 수: 11
Romendra
Romendra 2012년 1월 25일
I used regionprops and extracted both the linear index and value associated with it.
Thanks for help
Walter Roberson
Walter Roberson 2012년 1월 25일
The [] is left-square-bracket followed by right-square-bracket. That command is there to toss out the 0's that correspond to "no object present here".

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by