Trace Boundary
Trace object boundaries in binary images
Library
Analysis & Enhancement
visionanalysis
Description
The Trace Boundary block traces object boundaries in binary images, where nonzero pixels represent objects and 0 pixels represent the background.
Port Descriptions
Port | Input/Output | Supported Data Types |
---|---|---|
BW | Vector or matrix that represents a binary image | Boolean |
Start Pt | One-based [x y] coordinates of the boundary starting point. |
|
Pts | M-by-2 matrix of [x y] coordinates of the boundary points, where M represents the number of traced boundary pixels. M must be less than or equal to the value specified by the Maximum number of boundary pixels parameter. | Same as Start Pts port |
Parameters
- Connectivity
Specify which pixels are connected to each other. If you want a pixel to be connected to the pixels on the top, bottom, left, and right, select
4
. If you want a pixel to be connected to the pixels on the top, bottom, left, right, and diagonally, select8
. For more information about this parameter, see the Label block reference page.- Initial search direction
Specify the first direction in which to look to find the next boundary pixel that is connected to the starting pixel.
If, for the Connectivity parameter, you select
4
, the following figure illustrates the four possible initial search directions:If, for the Connectivity parameter, you select
8
, the following figure illustrates the eight possible initial search directions:- Trace direction
Specify the direction in which to trace the boundary. Your choices are
Clockwise
orCounterclockwise
.- Maximum number of boundary pixels
Specify the maximum number of boundary pixels for each starting point. The block uses this value to preallocate the number of rows of the Pts port output matrix so that it can hold all the boundary pixel location values.
Use the Maximum number of boundary pixels parameter to specify the maximum number of boundary pixels for the starting point.
See Also
Computer Vision Toolbox™ software | |
Computer Vision Toolbox software | |
Image Processing Toolbox™ software | |
Image Processing Toolbox software |