lazysnapping
Segment image into foreground and background using graph-based segmentation
Syntax
Description
BW = lazysnapping(___,
segments the image or volume using name-value pairs to control aspects of the
segmentation.Name,Value)
Examples
Input Arguments
Name-Value Arguments
Output Arguments
Tips
The lazy snapping algorithm developed by Li et al. clusters foreground and background values using the K-means method. This implementation of the lazy snapping algorithm does not cluster similar foreground or background pixels. To improve performance, reduce the number of pixels with similar values that are identified as foreground or background.
To obtain masks
foremaskorbackmaskinteractively, you can draw an ROI on the image then create a mask from the ROI by using thecreateMaskfunction. For more information, see Create ROI Shapes.To obtain pixel indices
foreindorbackindinteractively, you can draw aPolylineROI object by using thedrawpolylinefunction. Get the x- and y-coordinates of the vertices from thePositionproperty of thePolyline. Finally, convert the coordinates to linear indices by using thesub2indfunction. Note that thesub2indfunction uses (row, column) coordinates instead of (x, y) coordinates.
References
[1] Y. Li, S. Jian, C. Tang, H. Shum, Lazy Snapping In Proceedings from the 31st International Conference on Computer Graphics and Interactive Techniques, 2004.
Version History
Introduced in R2017a







