Skip to contents

selectROI allows the user to select a region of interest (ROI) in an image. An ROI is a polygonal region selected by clicking on the locations of the vertices of the polygon.

Usage

selectROI(image, window_name = "Display", scale = 1, return_mask = TRUE)

Arguments

image

An Image object.

window_name

A character string representing the name of the display window (default: "Display").

scale

The scaling of the display relative to the image size (default: 1).

return_mask

Should the function return a mask of the ROI. The mask is an 8-bit single-channel image with the pixels inside the ROI painted white and the pixels outside the ROI painted black (default: TRUE).

Value

If return_mask == FALSE, a data frame with the following two columns:

x:

the x coordinates of the ROI polygon.

y:

the y coordinates of the ROI polygon.

If return_mask == TRUE, a list containing the data frame containing the coordinates of the ROIand an 8-bit single-channel image corresponding to the mask of the ROI.

Author

Simon Garnier, garnier@njit.edu

Examples

if (FALSE) { # \dontrun{
balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
selectROI(balloon)
} # }