parse_observations {Xcertainty}R Documentation

Pre-process training and experimental data from wide-format to long-format

Description

Photogrammetric data are often recorded in a wide-format data.frame, in which each row contains all measurement information for a single animal. The row contains the image information (i.e., observed altitude and sensor information) as well as all measurements for a given subject. This function parses the wide-format data into a normalized list of data.frame objects that separately describe the image and measurement data. This function can process observations of calibration data as well as experimental data.

Usage

parse_observations(
  x,
  subject_col,
  meas_col,
  tlen_col = NULL,
  image_col,
  barometer_col = NULL,
  laser_col = NULL,
  flen_col,
  iwidth_col,
  swidth_col,
  uas_col,
  timepoint_col = NULL,
  alt_conversion_col = NULL
)

Arguments

x

Wide-format data.frame describing images and measurements

subject_col

column name in x for subject IDs

meas_col

character vector of column names in x with pixel-counts for each measurement of a subject

tlen_col

column name in x with the true length value (i.e., in meters) of a measurement; primarily used to specify the true length value for an observation of a calibration object. If NULL, then no true length will be associated with the measurement.

image_col

column name in x containing names of images from which measurements are taken

barometer_col

column name in x with Barometer altimeter values

laser_col

column name in x with Laser altimeter values

flen_col

column name in x with camera focal lengths (mm)

iwidth_col

column name in x with image widths (pixels)

swidth_col

column name in x with camera sensor widths (mm)

uas_col

column names in x with UAS name or ID

timepoint_col

column name in x with a timepoint value of a measurement. If NULL, then all measurements are assumed to be at the same timepoint, or equivalently, that time does not matter for the analysis

alt_conversion_col

if not NULL, column name in x with an altitude used to convert measurement columns from lengths to pixels

Value

outputs a list with four elements:

pixel_counts

a tibble containing the measurements in pixels linked with Subject, Measurement description, Image, and the Timepoint

training_objects

a tibble containing the Subject, Measurement, Length, and Timepoint. NULL if no training objects were included

prediction_objects

a tibble containing the Subject, Measurement, and Timepoint. NULL if no prediction data included

image_info

a tibble containing the Image, Barometer, Laser, FocalLength, ImageWidth, SensorWidth, and UAS

Examples

# load example wide-format data
data("calibration")
data("whales")

# parse calibration study
calibration_data = parse_observations(
  x = calibration, 
  subject_col = 'CO.ID',
  meas_col = 'Lpix', 
  tlen_col = 'CO.L', 
  image_col = 'image', 
  barometer_col = 'Baro_Alt',
  laser_col = 'Laser_Alt', 
  flen_col = 'Focal_Length', 
  iwidth_col = 'Iw', 
  swidth_col = 'Sw',
  uas_col = 'uas'
)

# parse field study
whale_data = parse_observations(
  x = whales, 
  subject_col = 'whale_ID',
  meas_col = 'TL.pix', 
  image_col = 'Image', 
  barometer_col = 'AltitudeBarometer',
  laser_col = 'AltitudeLaser', 
  flen_col = 'FocalLength', 
  iwidth_col = 'ImageWidth', 
  swidth_col = 'SensorWidth', 
  uas_col = 'UAS',
  timepoint_col = 'year'
)

# combine parsed calibration and observation (whale) data
combined_data = combine_observations(calibration_data, whale_data)

[Package Xcertainty version 1.0.0 Index]