[B,L,N,A] = bwboundaries(varargin)
B = BWBOUNDARIES(BW) traces the exterior boundary of objects, as well as boundaries of holes inside these objects!!
B: is a P-by-1 cell array, where P is the number of objects and holes. Each cell contains a Q-by-2 matrix, where Q is the number of boundary pixels for the corresponding region. Each row of these Q-by-2 matrices contains the row and column coordinates of a boundary pixel. The coordinates are ordered in a clockwise direction.
像素联通方式:默认是8联通的
系数默认也是:'holes‘ 可以设置 'noholes' 选项;
L: the label matrix, ——labeled the Objects and holes。k-th region includes all elements in L that have value k. The number of objects and holes represented by L is equal to max(L(:))
N: the number of objects, 在 B 中的 P 个对象和洞, 对 大于 N 的 为洞
A: represents the parent-child-hole dependencies
m <= P
enclosing_boundary = find(A(m,:)); % B{m}被包围的区间;
enclosed_boundaries = find(A(:,m)); %被 B{m} 包围的