This vignette demonstrates the full calibration pipeline for Cubert hyperspectral data: loading raw measurements, setting dark and white references, and reprocessing to calibrated reflectance.
Cubert cameras capture raw sensor data that must be calibrated through several stages:
The processing context holds calibration state and is created from the session file. If the session already contains embedded references, they are loaded automatically:
If the session does not contain embedded references, load them from separate files:
# Load dark reference
dark_session <- cuvis_session("path/to/dark.cu3s")
dark_mesu <- cuvis_get_measurement(dark_session, 1)
cuvis_set_reference(ctx, dark_mesu, "dark")
# Load white reference
white_session <- cuvis_session("path/to/white.cu3s")
white_mesu <- cuvis_get_measurement(white_session, 1)
cuvis_set_reference(ctx, white_mesu, "white")# Get raw data first
mesu_raw <- cuvis_get_measurement(session, 1)
cuvis_reprocess(ctx, mesu_raw, mode = "raw")
cube_raw <- cuvis_get_cube(mesu_raw)
# Compare a single pixel spectrum
pixel_raw <- cube_raw[50, 50, ]
pixel_ref <- cube[50, 50, ]
wavelengths <- attr(cube, "wavelengths")
# Raw counts and reflectance have different units, so each gets its own
# panel and axis instead of two curves sharing one plot
op <- par(mfrow = c(1, 2), mar = c(4.5, 4.5, 2.5, 1))
plot(wavelengths, pixel_raw, type = "l", lwd = 2, col = "#D55E00",
xlab = "Wavelength (nm)", ylab = "Raw signal (counts)",
main = "Raw")
plot(wavelengths, pixel_ref, type = "l", lwd = 2, col = "#0072B2",
xlab = "Wavelength (nm)", ylab = "Reflectance",
main = "Reflectance")
par(op)If you have the hyperspectR package installed, it uses cuvis.r as a backend: