Find boundary of binary object

I have a binary matrix consisting of a closed irregular shaped object. I want to find the boundary pixels. I tried using:
Bound=bwtraceboundarybwtraceboundary(logical(Bmatrix),[row,col],'S');
where [row,col] is the first non-zero pixel. However, I am running this with many different cases and I cannot manually look for the direction each time. I get the error:
"Error using bwtraceboundarymex The boundary trace failed to terminate correctly. The problem may have been caused by specifying an initial step direction that was inconsistent with the trace direction. Try specifying the trace direction explicitly."
Therefor, is there a better tool than bwtraceboundary in finding the object boundaries for cases like these?

댓글 수: 1

Ridwan Alam
Ridwan Alam 2019년 12월 14일
can you share your Bmatrix and [row,col] for us to try to debug?

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Line Plots에 대해 자세히 알아보기

태그

질문:

2019년 12월 14일

댓글:

2019년 12월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by