bwperim
Find perimeter pixels of binary objects.
📝Syntax
BW2 = bwperim(BW)
BW2 = bwperim(BW, conn)
📥Input Arguments
Parameter Description
BW Input binary image. Nonzero values are treated as true.
conn Connectivity, either 4 or 8.
📤Output Arguments
Parameter Description
BW2 Logical image containing perimeter pixels.
📄Description

Find perimeter pixels of binary objects. Supported connectivities are 4 and 8.

💡Examples
Find object perimeter
BW=false(64,64); BW(20:44,20:44)=true;
P=bwperim(BW);
figure; imagesc(P); g=linspace(0,1,64)'; colormap([g g g]); title('Perimeter');
Example illustration
🔗See Also
bwmorphbwboundaries
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub