34#ifndef VP_FEATURE_LUMINANCE_MAPPING_H
35#define VP_FEATURE_LUMINANCE_MAPPING_H
36#include <visp3/core/vpConfig.h>
37#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
41#include <visp3/core/vpImage.h>
42#include <visp3/core/vpMatrix.h>
43#include <visp3/visual_features/vpBasicFeature.h>
44#include <visp3/visual_features/vpFeatureLuminance.h>
167 vpLuminancePCA(
const std::shared_ptr<vpMatrix> &basis,
const std::shared_ptr<vpColVector> &mean,
const vpColVector &explainedVariance);
184 void init(
const std::shared_ptr<vpMatrix> &basis,
const std::shared_ptr<vpColVector> &mean,
const vpColVector &variance);
191 std::shared_ptr<vpMatrix>
getBasis()
const {
return m_basis; }
196 std::shared_ptr<vpColVector>
getMean()
const {
return m_mean; }
220 void save(
const std::string &basisFilename,
const std::string &meanFileName,
const std::string &explainedVarianceFile)
const;
231 static vpLuminancePCA load(
const std::string &basisFilename,
const std::string &meanFileName,
const std::string &explainedVarianceFile);
233#ifdef VISP_HAVE_MODULE_IO
245 static vpLuminancePCA learn(
const std::vector<std::string> &imageFiles,
const unsigned int projectionSize,
const unsigned int imageBorder = 0);
271 std::shared_ptr<vpMatrix> m_basis;
272 std::shared_ptr<vpColVector> m_mean;
275 unsigned int m_Ih, m_Iw;
303 void init(
unsigned rows,
unsigned cols);
324 std::vector<unsigned> m_rowIndex;
325 std::vector<unsigned> m_colIndex;
343 void init(
const unsigned int k)
362 void computeDCTMatrix(
vpMatrix &D,
unsigned int n)
const;
363 void computeDCTMatrices(
unsigned int rows,
unsigned int cols);
392 void init() VP_OVERRIDE;
393 void init(
const vpCameraParameters &cam,
unsigned int h,
unsigned int w,
double Z, std::shared_ptr<vpLuminanceMapping> mapping);
405 unsigned int = 1) const VP_OVERRIDE
408 unsigned int = 1) const VP_OVERRIDE
414 vpMatrix interaction(
unsigned int select = FEATURE_ALL) VP_OVERRIDE;
417 void print(
unsigned int select = FEATURE_ALL)
const VP_OVERRIDE;
420 std::shared_ptr<vpLuminanceMapping> &
getMapping() {
return m_mapping; }
423 std::shared_ptr<vpLuminanceMapping> m_mapping;
class that defines what is a visual feature
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
Class to define RGB colors available for display functionalities.
static const vpColor green
std::shared_ptr< vpLuminanceMapping > & getMapping()
void buildFrom(vpImage< unsigned char > &I)
vpFeatureLuminanceMapping(const vpCameraParameters &cam, unsigned int h, unsigned int w, double Z, const std::shared_ptr< vpLuminanceMapping > mapping)
void display(const vpCameraParameters &, const vpImage< unsigned char > &, const vpColor &=vpColor::green, unsigned int=1) const VP_OVERRIDE
void display(const vpCameraParameters &, const vpImage< vpRGBa > &, const vpColor &=vpColor::green, unsigned int=1) const VP_OVERRIDE
virtual ~vpFeatureLuminanceMapping()=default
vpFeatureLuminanceMapping * duplicate() const VP_OVERRIDE
vpFeatureLuminance & getLuminanceFeature()
vpFeatureLuminanceMapping & operator=(const vpFeatureLuminanceMapping &f)
Class that defines the image luminance visual feature.
static const int DEFAULT_BORDER
Definition of the vpImage class member functions.
Helper class to iterate and get/set the values from a matrix, following a zigzag pattern.
void init(unsigned rows, unsigned cols)
Initialize the ZigZag object. Computes and stores the zigzag indexing for a given matrix size.
void setValues(const vpColVector &s, unsigned int start, vpMatrix &m) const
set the values in the matrix, according to the values stored in the vector s and the zigzag indexing ...
void getValues(const vpMatrix &m, unsigned int start, unsigned int end, vpColVector &s) const
Fill the vector s with (end - start) values, according to the zigzag matrix indexing strategy.
Implementation of marchand20a.
void inverse(const vpColVector &s, vpImage< unsigned char > &I) VP_OVERRIDE
Reconstruct I from a representation s.
vpMatrix m_Dcols
DCT representation of the image.
vpLuminanceDCT & operator=(const vpLuminanceDCT &)=default
vpLuminanceDCT::vpMatrixZigZagIndex m_zigzag
Luminance interaction matrix, seen as six image planes.
vpMatrix m_dct
Image as a matrix.
void init(const unsigned int k)
Initialize the DCT object with the number of required components.
void map(const vpImage< unsigned char > &I, vpColVector &s) VP_OVERRIDE
Map an image I to a representation s. This representation s has getProjectionSize() rows.
void interaction(const vpImage< unsigned char > &I, const vpMatrix &LI, const vpColVector &s, vpMatrix &L) VP_OVERRIDE
Compute the interaction matrix associated with the representation s.
vpMatrix m_Imat
image dimensions (without borders)
std::array< vpMatrix, 6 > m_dIdrPlanes
the computed DCT matrices. The separable property of DCt is used so that a 1D DCT is computed on rows...
vpLuminanceDCT(const unsigned int k)
Build a new DCT object.
unsigned int getProjectionSize() const
Returns the size of the space to which an image is mapped to.
virtual ~vpLuminanceMapping()
virtual void interaction(const vpImage< unsigned char > &I, const vpMatrix &LI, const vpColVector &s, vpMatrix &L)=0
Compute the interaction matrix associated with the representation s.
unsigned int getBorder() const
Returns the number of pixels that are removed by the photometric VS computation.
virtual void inverse(const vpColVector &s, vpImage< unsigned char > &I)=0
Reconstruct I from a representation s.
vpLuminanceMapping(unsigned int mappingSize)
Construct a new vp Luminance Mapping object.
void setBorder(unsigned border)
Set the number of pixels that are removed by the photometric VS computation This function should be c...
virtual void map(const vpImage< unsigned char > &I, vpColVector &s)=0
Map an image I to a representation s. This representation s has getProjectionSize() rows.
unsigned m_border
Final vector size.
Implementation of marchand19a.
virtual ~vpLuminancePCA()
std::shared_ptr< vpMatrix > getBasis() const
Get , the subspace projection matrix ( ).
std::shared_ptr< vpColVector > getMean() const
Get , the mean image computed from the dataset.
vpColVector getExplainedVariance() const
Get the values of explained variance by each of the eigen vectors.
Implementation of a matrix and operations on matrices.