rgb.measure: Color sampling from a set of pre-warped images

Description Usage Arguments Value Examples

View source: R/rgb.measure.R

Description

Color sampling from a set of pre-warped images

Usage

1
2
3
4
5
6
7
rgb.measure(
  imagedir,
  image.names,
  delaunay.map,
  px.radius = 2,
  linearize.color.space = F
)

Arguments

imagedir

directory of images to measure. 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. These images should be unwarped or deformed to a common reference shape.

delaunay.map

delaunay triangulation object

px.radius

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

linearize.color.space

should the sampled color data be transformed into linear color space

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#covariate data and consensus lms
specimen.factors <- read.csv(system.file("extdata", "specimen_factors.csv", package = "Colormesh"), header = F)
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)

plot(rgb.test, individual = 5)
plot(rgb.test, individual = 5, style = "comparison")

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