An interactive section where the user will be able to click on the image to
select landmarks manually is open. With each mouse click, a point is drawn
and an upward counter is shown in the console. After n
counts or after the
user press Esc, the interactive process is interrupted and a data.frame
with the x
and y
coordinates for the landmarks is returned.
landmarks(
img,
n = Inf,
viewer = get_pliman_viewer(),
scale = NULL,
calibrate = FALSE
)
A data.frame
with the x
and y
-coordinates from the landmarks.
An Image
object.
The number of landmarks to produce. Defaults to Inf
. In this case,
landmarks are chosen up to the user press Esc.
The viewer option. If not provided, the value is retrieved
using get_pliman_viewer()
. This option controls the type of viewer to use
for interactive plotting. The available options are "base" and "mapview".
If set to "base", the base R graphics system is used for interactive
plotting. If set to "mapview", the mapview package is used. To set this
argument globally for all functions in the package, you can use the
set_pliman_viewer()
function. For example, you can run
set_pliman_viewer("mapview")
to set the viewer option to "mapview" for
all functions.
A known scale of the coordinate values. If NULL
(default)
scale = 1
is used.
A logical argument indicating whether a calibration step
must be performed before picking up the landmarks. If so, calibrate()
is
called internally. Users must then select two points and indicate a known
distance. A scale value will internally be computed and used in the
correction of the coordinates (from pixels to the unit of the known
distance).
Claude, J. (2008) Morphometrics with R, Use R! series, Springer 316 pp.
if(isTRUE(interactive())){
library(pliman)
img <- image_pliman("potato_leaves.jpg")
x <- landmarks(img)
}
Run the code above in your browser using DataLab