Trace object boundaries in binary images
The Trace Boundary block traces object boundaries in binary images, where nonzero pixels represent objects and 0 pixels represent the background.
|Port||Input/Output||Supported Data Types|
Vector or matrix that represents a binary image
One-based [x y] coordinates of the boundary starting point.
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
The Trace Boundary dialog box appears as shown in the following figure.
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, select 8. For more information about this parameter, see the Label block reference page.
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:
Specify the direction in which to trace the boundary. Your choices are Clockwise or Counterclockwise.
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.