Label connected components in 2-D array

버전 1.4.0.0 (2.85 KB) 작성자: Damien Garcia
LABEL is a generalization of BWLABEL
다운로드 수: 3K
업데이트 날짜: 2011/1/28

라이선스 보기

LABEL is a generalization of BWLABEL: BWLABEL works with 2-D binary images only, whereas LABEL works with 2-D arrays of any class.

L = LABEL(I,N) returns a matrix L, of the same size as I, containing labels for the connected components in I. Two adjacent components (pixels), of respective indexes IDX1 and IDX2, are connected if I(IDX1) and I(IDX2) are equal.

N can have a value of either 4 or 8, where 4 specifies 4-connected objects and 8 specifies 8-connected objects; if the argument is omitted, it defaults to 8.

Important remark:
-----------------------
NaN values are ignored and considered as background. Because LABEL works with arrays of any class, the 0s are NOT considered as the background.

Note:
------
The elements of L are integer values greater than or equal to 0. The pixels labeled 0 are the background (corresponding to the NaN components of the input array). The pixels labeled 1 make up one object, the pixels labeled 2 make up a second object, and so on.

[L,NUM] = LABEL(...) returns in NUM the number of connected objects found in I.

[L,NUM,SZ] = LABEL(...) returns a matrix SZ, of the same size as I, that contains the sizes of the connected objects. For a pixel whose index is IDX, we have: SZ(IDX) = NNZ(L==L(IDX)).

Examples:
----------
Enter "help label" in the Matlab Command Window for two examples.

------
http://www.biomecardio.com/matlab
-----

인용 양식

Damien Garcia (2024). Label connected components in 2-D array (https://www.mathworks.com/matlabcentral/fileexchange/26946-label-connected-components-in-2-d-array), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2008b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Region and Image Properties에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.4.0.0

"if nargin>1" (line 156) has been replaced by "if nargout>1"

1.3.0.0

"Important remark" has been added in the help text

1.2.0.0

The help text was incomplete.

1.1.0.0

Only tags and help text were modified.

1.0.0.0