roi_select {colocr} | R Documentation |
Select regions of interest
Description
Select regions of interest in an image using different morphological operations
Usage
roi_select(
img,
threshold,
shrink = 5,
grow = 5,
fill = 5,
clean = 5,
tolerance = 0.1,
n = 1
)
Arguments
img |
|
threshold |
A |
shrink |
A |
grow |
A |
fill |
A |
clean |
A |
tolerance |
A |
n |
A |
Details
The function applies several imager
morphological
manipulations to select the regions of interest. These include
threshold
which sets all values below certain cut to
0; shrink
/grow
for pixel set
dilation and erosion; fill
/clean
for removing isolated regions and holes. When n
is provided, the
individual regions (connected components) are selected where tolerance
is used to determine if two pixels belong to the same region.
Value
A cimg
. The original input img
with an
additional attribute label
. label
is a vector
of
integer
s. The labels for the selected regions of interests starts
from 1 and 0 is ignored. When img
is a list, a list
is
returned.
Examples
# load images
fl <- system.file('extdata', 'Image0001_.jpg', package = 'colocr')
img <- image_load(fl)
# choose ROI
newimg <- roi_select(img, threshold = 90)
# check the ROI labels
unique(attr(newimg, 'label'))