This function allows users to interactively edit and analyze an image using mapview and mapedit packages.
image_view(
img,
object = NULL,
r = 1,
g = 2,
b = 3,
alpha = 0.7,
attribute = "area",
title = "Edit the image",
show = c("rgb", "index"),
index = "B",
max_pixels = 1e+06,
downsample = NULL,
color_regions = custom_palette(),
quantiles = c(0, 1),
domain = NULL,
...
)
An sf
object, the same object returned by mapedit::editMap()
.
An Image
object.
(Optional). An object computed with analyze_objects()
. If an
object is informed, an additional layer is added to the plot, showing the
contour of the analyzed objects, with a color gradient defined by
attribute
.
The layer for the Red, Green and Blue band, respectively.
Defaults to 1
, 2
, and 3
.
The transparency level of the rectangles' color (between 0 and 1).
The name of the quantitative variable in the
object_index
to be used for coloring the rectangles.
The title of the map view. Use to provide short orientations to the user.
The display option for the map view. Options are "rgb" for RGB view and "index" for index view.
The index to use for the index view. Defaults to "B".
integer > 0. Maximum number of cells to use for the plot.
If max_pixels < npixels(img)
, regular sampling is used before plotting.
integer; for each dimension the number of
pixels/lines/bands etc that will be skipped; Defaults to NULL
, which will
find the best downsampling factor to approximate the max_pixels
value.
The color palette for displaying index values. Default
is custom_palette()
.
the upper and lower quantiles used for color stretching. If
set to NULL
, stretching is performed basing on 'domain' argument.
the upper and lower values used for color stretching. This is
used only if 'quantiles'
is NULL
. If both 'domain'
and 'quantiles'
are set to NULL
, stretching is applied based on min-max values.
Additional arguments to be passed to downsample_fun
.
if(interactive()){
# Example usage:
img <- image_pliman("sev_leaf.jpg")
image_view(img)
}
Run the code above in your browser using DataLab