image_segment_manual {pliman} | R Documentation |
Image segmentation by hand
Description
This R code is a function that allows the user to manually segment an image based on the parameters provided. This only works in an interactive section.
Usage
image_segment_manual(
img,
shape = c("free", "circle", "rectangle"),
type = c("select", "remove"),
viewer = get_pliman_viewer(),
resize = TRUE,
edge = 5,
plot = TRUE
)
Arguments
img |
An |
shape |
The type of shape to use. Defaults to "free". Other possible values are "circle" and "rectangle". Partial matching is allowed. |
type |
The type of segmentation. By default ( |
viewer |
The viewer option. If not provided, the value is retrieved
using |
resize |
By default, the segmented object is resized to fill the
original image size. Use |
edge |
Number of pixels to add in the edge of the segmented object when
|
plot |
Plot the segmented object? Defaults to |
Details
If the shape is "free", it allows the user to draw a perimeter to select/remove objects. If the shape is "circle", it allows the user to click on the center and edge of the circle to define the desired area. If the shape is "rectangle", it allows the user to select two points to define the area.
Value
A list with the segmented image and the mask used for segmentation.
Examples
if (interactive()) {
img <- image_pliman("la_leaves.jpg")
seg <- image_segment_manual(img)
plot(seg$mask)
}