image_segment_mask {pliman} | R Documentation |
Segment an Image
object using a brush mask
Description
It combines make_mask()
and make_brush()
to segment an Image
object
using a brush of desired size, shape, and position.
Usage
image_segment_mask(
img,
size,
shape = "disc",
rel_pos_x = 0.5,
rel_pos_y = 0.5,
type = c("binary", "shadow"),
col_background = "white",
plot = TRUE,
...
)
Arguments
img |
A |
size |
A numeric containing the size of the brush in pixels. This should be an odd number; even numbers are rounded to the next odd one. |
shape |
A character vector indicating the shape of the brush. Can be
|
rel_pos_x , rel_pos_y |
A relative position to include the brush in the image. Defaults to 0.5. This means that the brush will be centered in the original image. Smaller values move the brush toward the left and top, respectively. |
type |
Defines the type of the mask. By default, a binary mask is
applied. This results in white pixels in the original image that matches
the 0s pixels in the brush. If |
col_background |
Background color after image segmentation. Defaults to
|
plot |
Plots the generated mask? Defaults to |
... |
Further arguments passed on to |
Value
A color Image
object
Examples
img <- image_pliman("soybean_touch.jpg")
plot(img)
image_segment_mask(img, size = 601)
image_segment_mask(img,
size = 401,
shape = "diamond",
rel_pos_x = 0,
rel_pos_y = 0,
type = "shadow")