1.3.49
 
Loading...
Searching...
No Matches
CameraCalibration Struct Reference

Camera calibration structure used for camera calibration tasks. More...

#include <CameraCalibration.h>

Data Structures

struct  GradientDescentParameters
 Parameter struct for gradient descent. More...
 
struct  LabColor
 Structure to store Lab color values. More...
 

Public Member Functions

 CameraCalibration (helios::Context *context)
 
std::vector< uintaddCheckerboard (const helios::int2 &boardsidesize, const float &patchsize, const helios::vec3 &centrelocation, const helios::vec3 &rotationrad, bool firstblack=true)
 Add checker board geometry into context.
 
std::vector< uintaddDefaultCheckerboard (const helios::vec3 &centrelocation, const helios::vec3 &rotationrad)
 Add default checker board geometry into context.
 
std::vector< uintaddColorboard (const helios::vec3 &centrelocation, float patchsize, const helios::vec3 &rotationrad, const std::vector< std::vector< helios::RGBcolor > > &colorassignment={}, const std::vector< std::vector< std::string > > &spectrumassignment={})
 Add color board geometry into context.
 
std::vector< uintaddColorboard (const helios::vec3 &centrelocation, float patchsize, const helios::vec3 &rotationrad, const std::vector< std::vector< helios::RGBcolor > > &colorassignment, const std::vector< std::vector< std::string > > &spectrumassignment, const std::string &colorboard_type)
 Add color board geometry into context with colorboard type labeling.
 
std::vector< uintaddDefaultColorboard (const helios::vec3 &centrelocation, float patchsize=0.5, const helios::vec3 &rotationrad=helios::make_vec3(0, 0, 0))
 Add default color board (DGK-DKK) with spectral reflectivity values.
 
std::vector< uintaddDGKColorboard (const helios::vec3 &centrelocation, float patchsize=0.5, const helios::vec3 &rotationrad=helios::make_vec3(0, 0, 0))
 Add DGK-DKK calibration color board.
 
std::vector< uintaddCalibriteColorboard (const helios::vec3 &centrelocation, float patchsize=0.5, const helios::vec3 &rotationrad=helios::make_vec3(0, 0, 0))
 Add Calibrite ColorChecker Classic calibration color board.
 
std::vector< uintaddSpyderCHECKRColorboard (const helios::vec3 &centrelocation, float patchsize=0.5, const helios::vec3 &rotationrad=helios::make_vec3(0, 0, 0))
 Add Datacolor SpyderCHECKR 24 calibration color board.
 
std::vector< uintgetColorBoardUUIDs ()
 Retrieves a list of color board UUIDs.
 
bool writeSpectralXMLfile (const std::string &filename, const std::string &note, const std::string &label, std::vector< helios::vec2 > *spectrum)
 Write XML file from spectral vectors containing both wavelengths and spectral values.
 
bool loadXMLlabeldata (const std::string &filename, const std::string &labelname, std::vector< helios::vec2 > &spectraldata)
 Load XML file and save data in spectral vectors containing both wavelengths and spectral values.
 
float GradientDescent (std::vector< std::vector< float > > *expandedcameraspectra, const std::vector< std::vector< float > > &expandedconstinput, const float &learningrate, const std::vector< std::vector< float > > &truevalues)
 Reduce calibration error based on gradient descent.
 
std::vector< float > updateCameraResponseSpectra (const std::vector< std::string > &camerareponselabels, const std::string &cameralabel, const std::map< uint, std::vector< helios::vec2 > > &simulatedinputspectra, const std::vector< std::vector< float > > &truevalues)
 Update camera response spectra.
 
void preprocessSpectra (const std::vector< std::string > &sourcelabels, const std::vector< std::string > &cameralabels, std::vector< std::string > &objectlabels, helios::vec2 &wavelengthrange, const std::string &targetlabel="")
 Preprocess all spectra for modelling.
 
void distortImage (const std::string &cameralabel, const std::vector< std::string > &bandlabels, const helios::vec2 &focalxy, std::vector< double > &distCoeffs, helios::int2 cameraresolution)
 Get distorted image.
 
float getCameraResponseScale (const std::string &cameralabel, const helios::int2 cameraresolution, const std::vector< std::string > &bandlabels, const std::vector< std::vector< float > > &truevalues)
 Get camera spectral response scale.
 
std::vector< uintreadROMCCanopy ()
 Read ROMC canopy file (Used for self test).
 
void writeCalibratedCameraResponses (const std::vector< std::string > &camerareponselabels, const std::string &calibratemark, float scale)
 Write calibrated camera response spectra.
 
std::string detectColorBoardType () const
 Detect which colorboard type is present in the scene.
 
std::vector< LabColorgetReferenceLab_DGK () const
 Get reference Lab values for DGK colorboard (18 patches)
 
std::vector< LabColorgetReferenceLab_Calibrite () const
 Get reference Lab values for Calibrite ColorChecker Classic (24 patches)
 
std::vector< LabColorgetReferenceLab_SpyderCHECKR () const
 Get reference Lab values for Datacolor SpyderCHECKR 24 (24 patches)
 
LabColor rgbToLab (const helios::vec3 &rgb) const
 Convert RGB color to Lab color space (RGB as vec3 [0,1])
 
helios::vec3 labToRgb (const LabColor &lab) const
 Convert Lab color to RGB color space (returns vec3 [0,1])
 
double deltaE76 (const LabColor &lab1, const LabColor &lab2) const
 Calculate Delta E 76 (CIE76) color difference between two Lab colors.
 
double deltaE2000 (const LabColor &lab1, const LabColor &lab2) const
 Calculate Delta E 2000 color difference between two Lab colors (more perceptually accurate)
 

Data Fields

GradientDescentParameters responseupdateparameters
 
std::map< std::string, std::map< std::string, std::vector< helios::vec2 > > > processedspectra
 

Detailed Description

Camera calibration structure used for camera calibration tasks.

Definition at line 21 of file CameraCalibration.h.

Constructor & Destructor Documentation

◆ CameraCalibration()

CameraCalibration::CameraCalibration ( helios::Context context)
explicit

Definition at line 20 of file CameraCalibration.cpp.

Member Function Documentation

◆ addCalibriteColorboard()

std::vector< uint > CameraCalibration::addCalibriteColorboard ( const helios::vec3 centrelocation,
float  patchsize = 0.5,
const helios::vec3 rotationrad = helios::make_vec3(0, 0, 0) 
)

Add Calibrite ColorChecker Classic calibration color board.

Parameters
[in]centrelocationLocation of the board (vec3 on coordinates x,y,z)
[in]patchsizeSize of each color patch in color board
[in]rotationradRadians of rotation (vec3 on coordinates x,y,z)
Returns
A vector of UUIDs making up the color board patches

Definition at line 219 of file CameraCalibration.cpp.

◆ addCheckerboard()

std::vector< uint > CameraCalibration::addCheckerboard ( const helios::int2 boardsidesize,
const float &  patchsize,
const helios::vec3 centrelocation,
const helios::vec3 rotationrad,
bool  firstblack = true 
)

Add checker board geometry into context.

Parameters
[in]boardsidesizesize of check board
[in]patchsizesize of each square patch
[in]centrelocationlocation of the board (vec3 on coordinates x,y,z)
[in]rotationradradians of rotation (vec3 on coordinates x,y,z)
[in]firstblackinitial the color of first square patch (black or white)

Definition at line 23 of file CameraCalibration.cpp.

◆ addColorboard() [1/2]

std::vector< uint > CameraCalibration::addColorboard ( const helios::vec3 centrelocation,
float  patchsize,
const helios::vec3 rotationrad,
const std::vector< std::vector< helios::RGBcolor > > &  colorassignment,
const std::vector< std::vector< std::string > > &  spectrumassignment,
const std::string &  colorboard_type 
)

Add color board geometry into context with colorboard type labeling.

Parameters
[in]centrelocationlocation of the board center (vec3 on coordinates x,y,z)
[in]patchsizesize of each square color patch on the board
[in]rotationradrotation the board about x-, y-, and z-axes
[in]colorassignmentColor of each patch and size of color board. First index is the row and second index is the column.
[in]spectrumassignmentLabel of global data corresponding to the reflectance spectrum of each color patch on the color board. First index is the row and second index is the column.
[in]colorboard_typeString identifier for the colorboard type (e.g., "DGK", "Calibrite", "SpyderCHECKR")

Definition at line 140 of file CameraCalibration.cpp.

◆ addColorboard() [2/2]

std::vector< uint > CameraCalibration::addColorboard ( const helios::vec3 centrelocation,
float  patchsize,
const helios::vec3 rotationrad,
const std::vector< std::vector< helios::RGBcolor > > &  colorassignment = {},
const std::vector< std::vector< std::string > > &  spectrumassignment = {} 
)

Add color board geometry into context.

Parameters
[in]centrelocationlocation of the board center (vec3 on coordinates x,y,z)
[in]patchsizesize of each square color patch on the board
[in]rotationradrotation the board about x-, y-, and z-axes
[in]colorassignment[OPTIONAL] Color of each patch and size of color board. First index is the row and second index is the column.
[in]spectrumassignment[OPTIONAL] Label of global data corresponding to the reflectance spectrum of each color patch on the color board. First index is the row and second index is the column.

Definition at line 81 of file CameraCalibration.cpp.

◆ addDefaultCheckerboard()

std::vector< uint > CameraCalibration::addDefaultCheckerboard ( const helios::vec3 centrelocation,
const helios::vec3 rotationrad 
)

Add default checker board geometry into context.

Parameters
[in]centrelocationlocation of the board (vec3 on coordinates x,y,z)
[in]rotationradradians of rotation (vec3 on coordinates x,y,z)

Definition at line 73 of file CameraCalibration.cpp.

◆ addDefaultColorboard()

std::vector< uint > CameraCalibration::addDefaultColorboard ( const helios::vec3 centrelocation,
float  patchsize = 0.5,
const helios::vec3 rotationrad = helios::make_vec3(0, 0, 0) 
)

Add default color board (DGK-DKK) with spectral reflectivity values.

Parameters
[in]centrelocationLocation of the board (vec3 on coordinates x,y,z)
[in]patchsizeSize of each color patch in color board
[in]rotationradRadians of rotation (vec3 on coordinates x,y,z)
Returns
A vector of UUIDs making up the color board patches

Definition at line 200 of file CameraCalibration.cpp.

◆ addDGKColorboard()

std::vector< uint > CameraCalibration::addDGKColorboard ( const helios::vec3 centrelocation,
float  patchsize = 0.5,
const helios::vec3 rotationrad = helios::make_vec3(0, 0, 0) 
)

Add DGK-DKK calibration color board.

Parameters
[in]centrelocationLocation of the board (vec3 on coordinates x,y,z)
[in]patchsizeSize of each color patch in color board
[in]rotationradRadians of rotation (vec3 on coordinates x,y,z)
Returns
A vector of UUIDs making up the color board patches

Definition at line 205 of file CameraCalibration.cpp.

◆ addSpyderCHECKRColorboard()

std::vector< uint > CameraCalibration::addSpyderCHECKRColorboard ( const helios::vec3 centrelocation,
float  patchsize = 0.5,
const helios::vec3 rotationrad = helios::make_vec3(0, 0, 0) 
)

Add Datacolor SpyderCHECKR 24 calibration color board.

Parameters
[in]centrelocationLocation of the board (vec3 on coordinates x,y,z)
[in]patchsizeSize of each color patch in color board
[in]rotationradRadians of rotation (vec3 on coordinates x,y,z)
Returns
A vector of UUIDs making up the color board patches

Definition at line 233 of file CameraCalibration.cpp.

◆ deltaE2000()

double CameraCalibration::deltaE2000 ( const LabColor lab1,
const LabColor lab2 
) const

Calculate Delta E 2000 color difference between two Lab colors (more perceptually accurate)

Definition at line 988 of file CameraCalibration.cpp.

◆ deltaE76()

double CameraCalibration::deltaE76 ( const LabColor lab1,
const LabColor lab2 
) const

Calculate Delta E 76 (CIE76) color difference between two Lab colors.

Definition at line 979 of file CameraCalibration.cpp.

◆ detectColorBoardType()

std::string CameraCalibration::detectColorBoardType ( ) const

Detect which colorboard type is present in the scene.

Definition at line 832 of file CameraCalibration.cpp.

◆ distortImage()

void CameraCalibration::distortImage ( const std::string &  cameralabel,
const std::vector< std::string > &  bandlabels,
const helios::vec2 focalxy,
std::vector< double > &  distCoeffs,
helios::int2  cameraresolution 
)

Get distorted image.

Parameters
[in]cameralabelLabel of camera.
[in]bandlabelsLabel vector of bands.
[in]focalxyFocal length xy of camera.
[in]distCoeffsDistortion coefficients.
[in]cameraresolutionResolution of camera.
[in]cameraresolutionResolution of camera for distortion.

Definition at line 455 of file CameraCalibration.cpp.

◆ getCameraResponseScale()

float CameraCalibration::getCameraResponseScale ( const std::string &  cameralabel,
const helios::int2  cameraresolution,
const std::vector< std::string > &  bandlabels,
const std::vector< std::vector< float > > &  truevalues 
)

Get camera spectral response scale.

Parameters
[in]cameralabelLabel of camera.
[in]cameraresolutionResolution of camera.
[in]bandlabelsLabel vector of bands.
[in]truevaluesTrue color board values.

Definition at line 670 of file CameraCalibration.cpp.

◆ getColorBoardUUIDs()

std::vector< uint > CameraCalibration::getColorBoardUUIDs ( )

Retrieves a list of color board UUIDs.

Returns
A vector containing the UUIDs of color boards.

Definition at line 247 of file CameraCalibration.cpp.

◆ getReferenceLab_Calibrite()

std::vector< CameraCalibration::LabColor > CameraCalibration::getReferenceLab_Calibrite ( ) const

Get reference Lab values for Calibrite ColorChecker Classic (24 patches)

Definition at line 770 of file CameraCalibration.cpp.

◆ getReferenceLab_DGK()

std::vector< CameraCalibration::LabColor > CameraCalibration::getReferenceLab_DGK ( ) const

Get reference Lab values for DGK colorboard (18 patches)

Definition at line 744 of file CameraCalibration.cpp.

◆ getReferenceLab_SpyderCHECKR()

std::vector< CameraCalibration::LabColor > CameraCalibration::getReferenceLab_SpyderCHECKR ( ) const

Get reference Lab values for Datacolor SpyderCHECKR 24 (24 patches)

Definition at line 801 of file CameraCalibration.cpp.

◆ GradientDescent()

float CameraCalibration::GradientDescent ( std::vector< std::vector< float > > *  expandedcameraspectra,
const std::vector< std::vector< float > > &  expandedconstinput,
const float &  learningrate,
const std::vector< std::vector< float > > &  truevalues 
)

Reduce calibration error based on gradient descent.

Parameters
[in]expandedcameraspectraExpanded camera response spectra to be updated.
[in]expandedconstinputExpanded input spectra.
[in]learningrateLearning rate.
[in]truevaluesTrue color board values.
Returns
A float of loss.

Definition at line 299 of file CameraCalibration.cpp.

◆ labToRgb()

helios::vec3 CameraCalibration::labToRgb ( const LabColor lab) const

Convert Lab color to RGB color space (returns vec3 [0,1])

Definition at line 933 of file CameraCalibration.cpp.

◆ loadXMLlabeldata()

bool CameraCalibration::loadXMLlabeldata ( const std::string &  filename,
const std::string &  labelname,
std::vector< helios::vec2 > &  spectraldata 
)

Load XML file and save data in spectral vectors containing both wavelengths and spectral values.

Parameters
[in]filenameName with path of XML file
[in]labelnameLabel name of data
[in]spectraldataAn empty spectral vector to be filled

Definition at line 285 of file CameraCalibration.cpp.

◆ preprocessSpectra()

void CameraCalibration::preprocessSpectra ( const std::vector< std::string > &  sourcelabels,
const std::vector< std::string > &  cameralabels,
std::vector< std::string > &  objectlabels,
helios::vec2 wavelengthrange,
const std::string &  targetlabel = "" 
)

Preprocess all spectra for modelling.

Parameters
[in]sourcelabelsLabel vector of source spectra.
[in]cameralabelsLabel vector of camera spectra.
[in]objectlabelsLabel vector of object spectra.
[in,out]wavelengthrangeMin and max of wavelength boundary.
[in]targetlabelLabel of target spectrum used for interpolation.

Definition at line 546 of file CameraCalibration.cpp.

◆ readROMCCanopy()

std::vector< uint > CameraCalibration::readROMCCanopy ( )

Read ROMC canopy file (Used for self test).

Returns
A vector of ROMC canopy UUIDs.

Definition at line 709 of file CameraCalibration.cpp.

◆ rgbToLab()

CameraCalibration::LabColor CameraCalibration::rgbToLab ( const helios::vec3 rgb) const

Convert RGB color to Lab color space (RGB as vec3 [0,1])

Definition at line 895 of file CameraCalibration.cpp.

◆ updateCameraResponseSpectra()

std::vector< float > CameraCalibration::updateCameraResponseSpectra ( const std::vector< std::string > &  camerareponselabels,
const std::string &  cameralabel,
const std::map< uint, std::vector< helios::vec2 > > &  simulatedinputspectra,
const std::vector< std::vector< float > > &  truevalues 
)

Update camera response spectra.

Parameters
[in]camerareponselabelsLabel vector of camera response spectra to be updated.
[in]cameralabelLabel of camera to be used for simulation.
[in]simulatedinputspectraInput spectra.
[in]truevaluesTrue color board values.
Returns
A vector of training losses.

Definition at line 372 of file CameraCalibration.cpp.

◆ writeCalibratedCameraResponses()

void CameraCalibration::writeCalibratedCameraResponses ( const std::vector< std::string > &  camerareponselabels,
const std::string &  calibratemark,
float  scale 
)

Write calibrated camera response spectra.

Parameters
[in]camerareponselabelsLabel vector of original camera response spectra to be written.
[in]calibratemarkCalibration mark.
[in]scaleManually adjustable Scaling factor for calibrated camera response spectra.

Definition at line 441 of file CameraCalibration.cpp.

◆ writeSpectralXMLfile()

bool CameraCalibration::writeSpectralXMLfile ( const std::string &  filename,
const std::string &  note,
const std::string &  label,
std::vector< helios::vec2 > *  spectrum 
)

Write XML file from spectral vectors containing both wavelengths and spectral values.

Parameters
[in]filenameName with path of XML file
[in]noteNote to write in XML file
[in]labelLabel of spectral data to write in XML file
[in]spectrumPointer of spectrum to write in XML file

Definition at line 251 of file CameraCalibration.cpp.

Field Documentation

◆ processedspectra

std::map<std::string, std::map<std::string, std::vector<helios::vec2> > > CameraCalibration::processedspectra

Definition at line 195 of file CameraCalibration.h.

◆ responseupdateparameters

GradientDescentParameters CameraCalibration::responseupdateparameters

Definition at line 163 of file CameraCalibration.h.


The documentation for this struct was generated from the following files: