Plot region boundaries
obj = visboundaries(___)
H = visboundaries(___,Name,Value)
boundaries of regions in the binary image
the current axes.
BW is a 2D binary image where
pixels that are logical
true belong to the foreground
region and pixels that are logical
find the boundary pixel locations in the image.
region boundaries specified by
a cell array containing the boundary pixel locations of the regions,
similar in structure to the first output from
Each cell contains a Q-by-2 matrix, where Q is
the number of boundary pixels for the corresponding region. Each row
of these Q-by-2 matrices contains the row and column
coordinates of a boundary pixel.
region boundaries on the axes specified by
BW = imread('blobs.png');
B = bwboundaries(BW);
Display image and plot boundaries on image.
imshow(BW) hold on visboundaries(B)
Read image and display it.
I = imread('toyobjects.png'); imshow(I) hold on
Segment the image using active contour. First, specify the initial contour location close to the object that is to be segmented.
mask = false(size(I)); mask(50:150,40:170) = true;
Display the initial contour on the original image in blue.
Segment the image using the
'edge' method using 200 iterations.
bw = activecontour(I, mask, 200, 'edge');
Display the final contour on the original image in red.
visboundaries(bw,'Color','r'); title('Blue - Initial Contour, Red - Final Contour');
BW— Binary image
Binary image, specified as a logical array.
B— Boundary pixel locations
Boundary pixel locations, specified as a cell array of Q-by-2 matrices containing row and column coordinates, where Q is the number of boundary pixels for the corresponding region.
AX— Image on which to draw boundaries
Image on which to draw boundaries, specified as an axes object.
comma-separated pairs of
the argument name and
Value is the corresponding value.
Name must appear inside single quotes (
' '). You can
specify several name and value pair arguments in any order as
'Color'— Color of the boundary
Color of the boundary, specified as a MATLAB colorspec.
Complex Number Support: Yes
'LineStyle'— Style of boundary line
'-') (default) | MATLAB line spec
Style of boundary line, specified as a MATLAB line spec.
'LineWidth'— Width of the line used for the boundary
Width of the line used for the boundary, specified as a numeric value. Specify this value in points, where one point = 1/72 inch.
'EnhanceVisibility'— Augment the drawn boundary with contrasting features
Augment the drawn boundary with contrasting features to improve
visibility on a varying background, specified as the logical flag