Hi I have the following code and have some output as follows:
I =
0 1 1 1 1 1 0
1 0 0 0 0 0 1
1 0 1 1 1 0 1
1 0 1 1 1 0 1
1 0 0 0 0 0 1
0 1 1 1 1 1 0
K>> boundary = bwboundaries(I,8,'noholes'); K>> boundary
boundary =
[19x2 double]
[ 7x2 double]
here is two boundary, I need to know how to determine which boundary is interior, Here [ 7x2 double] is in interior region of [19x2 double]. How to determine that easily?
Can anybody help?
Thanks

 採用された回答

Andrei Bobrov
Andrei Bobrov 2011 年 6 月 21 日

0 投票

>> [B,L] = bwboundaries(I,8,'noholes')
B =
[19x2 double]
[ 7x2 double]
L =
0 1 1 1 1 1 0
1 0 0 0 0 0 1
1 0 2 2 2 0 1
1 0 2 2 2 0 1
1 0 0 0 0 0 1
0 1 1 1 1 1 0
>>
B{1} -> label 1 (L == 1)
B{2} -> label 2 (L == 2)
EDIT 2
>> [B,L,N,A] = bwboundaries(I,8,'noholes')
B =
[19x2 double]
[ 7x2 double]
L =
0 1 1 1 1 1 0
1 0 0 0 0 0 1
1 0 2 2 2 0 1
1 0 2 2 2 0 1
1 0 0 0 0 0 1
0 1 1 1 1 1 0
N =
2
A =
(2,1) 1
>> full(A)
ans =
0 0
1 0
Having label 2 (number row A = 2) inside label 1(column number 1of matrix A)

3 件のコメント

Mohammad Golam Kibria
Mohammad Golam Kibria 2011 年 6 月 21 日
It will give the position but I need to know is there any
idea to compare that label2 is inside lable1
Andrei Bobrov
Andrei Bobrov 2011 年 6 月 21 日
Dear Mohammad! Please reading help function 'bwboundaries'.
Mohammad Golam Kibria
Mohammad Golam Kibria 2011 年 6 月 22 日
Thanks, Now It is clear

サインインしてコメントする。

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2011 年 6 月 21 日

0 投票

You could also do an
Ibwnoholes = imfill(I,'holes');
which will fill the holes and then that boundary won't show up.

カテゴリ

ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by