calibrate {pliman} | R Documentation |
Calibrates distances of landmarks
Description
Calibrating the actual size is possible if any interlandmark distance on the image is known. calibrate() can be used to determine the size of a known distance (cm) on the graph. I invite users to photograph the object together with a scale (e.g., ruler, micrometer...).
Usage
calibrate(img, viewer = get_pliman_viewer())
Arguments
img |
An |
viewer |
The viewer option. If not provided, the value is retrieved
using |
Value
A numeric (double
) scalar value indicating the scale (in pixels per
unit of known distance).
References
Claude, J. (2008) Morphometrics with R, Use R! series, Springer 316 pp.
Examples
if(isTRUE(interactive())){
library(pliman)
#### compute scale (dots per unit of known distance) ####
# only works in an interactive section
# objects_300dpi.jpg has a known resolution of 300 dpi
img <- image_pliman("objects_300dpi.jpg")
# Larger square: 10 x 10 cm
# 1) Run the function calibrate()
# 2) Use the left mouse button to create a line in the larger square
# 3) Declare a known distance (10 cm)
# 4) See the computed scale (pixels per cm)
calibrate(img)
# scale ~118
# 118 * 2.54 ~300 DPI
}