Skip to contents

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.

Usage

landmarks(
  img,
  n = Inf,
  viewer = get_pliman_viewer(),
  scale = NULL,
  calibrate = FALSE
)

Arguments

img

An Image object.

n

The number of landmarks to produce. Defaults to Inf. In this case, landmarks are chosen up to the user press Esc.

viewer

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.

scale

A known scale of the coordinate values. If NULL (default) scale = 1 is used.

calibrate

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).

Value

A data.frame with the x and y-coordinates from the landmarks.

References

Claude, J. (2008) Morphometrics with R, Use R! series, Springer 316 pp.

Examples

if(isTRUE(interactive())){
library(pliman)
img <- image_pliman("potato_leaves.jpg")
x <- landmarks(img)
}