rgb.calibrate: Calibration of existing color sampled data

Description Usage Arguments Value Examples

View source: R/rgb.calibrate.R

Description

Calibration of existing color sampled data

Usage

1
2
3
4
5
6
7
8
9
rgb.calibrate(
  sampled.array,
  imagedir,
  image.names,
  calib.file,
  color.standard.values = NULL,
  px.radius = 2,
  flip.y.values = F
)

Arguments

sampled.array

Previously sampled data from the rgb.measure function.

imagedir

directory of images to measure for calibration. Only images with landmarks will be processed. The landmark file names are assumed to exactly match the image names.

image.names

A vector of image names to look for in imagedir.

color.standard.values

a matrix of known values for collected color standard points. Should be N_points x 3

px.radius

The size of the circular neighborhood (in pixels) to sample color around each triangulated point.

flip.y.values

should the calbration points be flipped to match the images?

Value

The function will return $sampled.color– an N_points x 3 (RGB) x N_observations array of sampled color values. A tri.surf.points class object will also be returned as $delaunay. Finally, a calibrated array of color values will be returned under $calibrated

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#load landmarks and covariate data
guppy.lms <- tps2array(system.file("extdata", "original_lms.TPS", package = "Colormesh"))
specimen.factors <- read.csv(system.file("extdata", "specimen_factors.csv", package = "Colormesh"), header = F)
calib.file <- tps2array(system.file("extdata", "calib_LM_coords.TPS", package = "Colormesh"))
consensus <- tps2array(system.file("extdata", "consensus_LM_coords.TPS", package = "Colormesh"))
test.image <- image_reader(paste0(path.package("Colormesh"),"/extdata/unwarped_images/"), "GPLP_unw_001.jpg")
delaunay.map <- tri.surf(consensus, point.map = c(1,8:17,2, 18:19,3,20:27,4, 28:42,5,43:52,6,53:54,7,55:62), 3, test.image)

rgb.test <- rgb.measure(imagedir = paste0(path.package("Colormesh"),"/extdata/unwarped_images/"), image.names = specimen.factors[,2], delaunay.map = delaunay.map, linearize.color.space = F)

calibration.test <- rgb.calibrate(rgb.test, imagedir = paste0(path.package("Colormesh"),"/extdata/original_images/"), image.names = specimen.factors[,1], calib.file = calib.file)

#check result####
plot(calibration.test, individual = 2, style = "comparison")

J0vid/Colormesh documentation built on Feb. 4, 2022, 1:33 a.m.