bwlabel() and then regionprops . If the labels differ for the two positions then they are not connected; if they are connected, then the pixel list from regionprops will show the path, provided there are no "spurs".
finding adjacent value in a matrix
1 次查看(过去 30 天)
显示 更早的评论
Hi, I have a portion of a matrix as follows:
I =
0 1 0 0 1 0
0 0 0 1 0 0
0 0 0 0 0 0
0 0 1 1 0 0
0 1 0 0 1 0
1 0 0 0 0 1
I know the position of two 1s i.e (6,1) and (6,6). I need to know whether this two 1s are connected and if connected the positions of all 1s from first 1 to last 1. connected means any of eight neighbor of 1st 1 has 1,any of eight neighbor of 1st 1's neighbor has value 1 and it ends at 1 at (6,6) Here (1,2) and (1,5) is not connected but (6,1) and (6,6) are connected
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!