View source: R/utils_landmarks.R
calibrate | R Documentation |
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...).
calibrate(img, viewer = get_pliman_viewer())
img |
An |
viewer |
The viewer option. If not provided, the value is retrieved
using |
A numeric (double
) scalar value indicating the scale (in pixels per
unit of known distance).
Claude, J. (2008) Morphometrics with R, Use R! series, Springer 316 pp.
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
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.