| [Top] [Up] [Prev] [Next] | [Up] [Basic Concepts] [Demonstrations] [Functions] | SDC Morphology Toolbox V1.1 15Jan02 |
The input image is read.
a = mmreadgray('chickparts.tif'); mmshow(a);
|
Convert to binary objects by thresholding and then labeling the objects.
b = mmcmp(a,'>=', uint8(100)); mmshow(b); c = mmlabel(b); mmlblshow(c,'border');
|
Measure the area o each object and put this value as the pixel object value. For displaying purpose, overlay the background as red in the right image below.
d = mmblob(c,'area'); mmshow(d); mmshow(d, mmcmp(d,'==',0)); Warning: Converting image from scalar to uint16. Warning: Converting image from scalar to uint16.
|
The wings are detected by finding objects with area 100 and 2500 pixels. The tights are selected as connected objects with area between 2500 and 5500 pixels.
wings = mmcmp( uint16(100),'<=',d, '<=', uint16(2500)); mmshow(wings); tights = mmcmp( uint16(2500),'<',d, '<=', uint16(5500)); mmshow(tights);
|
The legs+tights have area larger than 5500 and smaller than 8500 pixels and the breast is the largest connected object with area larger than 8500 pixels
legs = mmcmp( uint16(5500), '<', d, '<=', uint16(8500)); mmshow(legs); breast = mmcmp( d,'>', uint16(8500)); mmshow(breast);
|
Overlay the contour of the detected parts over the original image
mmshow(a, mmgradm(wings), mmgradm(tights), mmgradm(legs),mmgradm(breast));
|
| [Top] [Up] [Prev] [Next] | [Up] [Basic Concepts] [Demonstrations] [Functions] |
|
| Copyright (c) 1998-2002 by SDC Information Systems | ||