grabCut | R Documentation |
grabCut
performs image segmentation (i.e., partition of
the image into coherent regions) using the GrabCut method.
grabCut(
image,
mask,
rect = rep(1, 4),
bgdModel,
fgdModel,
iter = 1,
mode = "EVAL"
)
image |
An 8-bit (8U), 3-channel |
mask |
An 8-bit (8U), single-channel
|
rect |
A vector defining the region of interest containing a segmented
object. The pixels outside of the region of interest are marked as "obvious
background". |
bgdModel |
A 1x65, single-channel, 64-bit (64F) |
fgdModel |
A 1x65, single-channel, 64-bit (64F) |
iter |
Number of iterations (default: 1) the algorithm should make
before returning the result. Note that the result can be refined with
further calls with |
mode |
A character string indicating the operation mode of the function. It can be any of the following:
|
This function returns nothing. It modifies in place mask
,
bgdModel
, and fgdModel
.
Simon Garnier, garnier@njit.edu
Image
balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
mask <- zeros(nrow(balloon), ncol(balloon), 1)
bgdModel <- zeros(1, 65, 1, "64F")
fgdModel <- zeros(1, 65, 1, "64F")
grabCut(balloon, mask, c(290, 170, 160, 160), bgdModel, fgdModel, iter = 5, mode = "RECT")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.