You are here : matlabImage Processingvisboundaries

visboundaries() - Image Processing

visboundaries(BW) draws
boundaries of regions in the binary image BW on
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 false constitute
the background. visboundaries uses bwboundaries to
find the boundary pixel locations in the image.examplevisboundaries(B) draws
region boundaries specified by B, where B is
a cell array containing the boundary pixel locations of the regions,
similar in structure to the first output from bwboundaries.
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.visboundaries(AX,___) draws
region boundaries on the axes specified by AX.H = visboundaries(___) returns
a handle to an hggroup object for the boundaries. The hggroup object, H,
is the child of the axes object, AX.exampleH = visboundaries(___,Name,Value) passes
the name-value pair arguments to specify additional properties of
the boundaries. Parameter names can be abbreviated.


visboundaries(BW) examplevisboundaries(B) examplevisboundaries(AX,___)H = visboundaries(___)H = visboundaries(___,Name,Value) example


Compute Boundaries and Plot on ImageOpen This Example
Read image.BW = imread('blobs.png');
Compute boundaries.B = bwboundaries(BW);
Display image and plot boundaries on image.imshow(BW)
hold on

Visualize Segmentation ResultOpen This Example
Read image and display it.I = imread('toyobjects.png');
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.visboundaries(mask,'Color','b');

Segment the image using the 'edge' method using 200 = 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');

Output / Return Value


Alternatives / See Also