#'Create a camera cast ensemble object
#'
#'Create a camera cast ensemble object which is one or more camera casts, of the
#'same situation with identical timestamps
#'
#'@param ensemble list of list of lists, generated by reading in the JSON file,
#'use read_motion_data to read in a JSON file and convert to to a ensemble
#'@param fix_timestamps logical. Should missing timestamps in situations where
#'a camera didn't register anything be added.
#'@author Janek
#'@encoding UTF-8
create_camera_cast_ensemble_object <- function(ensemble, fix_timestamps = TRUE){
camera_cast_ensemble <- list()
camera_cast_ensemble$n_observations <- length(ensemble)
camera_cast_ensemble$n_cameras <- max(vapply(ensemble, length, numeric(1)))
frame_with_all_sensors <- which.max(vapply(ensemble, length, numeric(1)))[1]
camera_cast_ensemble$sensorIds <- vapply(ensemble[[frame_with_all_sensors]],
function(i) i$sensorId, character(1))
camera_cast_ensemble$casts <- lapply(camera_cast_ensemble$sensorIds,
create_camera_cast_object,
skeleton_list = ensemble)
if(fix_timestamps){
camera_cast_ensemble <- fix_timestamps(camera_cast_ensemble)
}
class(camera_cast_ensemble) <- c("camera_cast_ensemble")
camera_cast_ensemble
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.