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);
312 void getValues(
const vpMatrix &m,
unsigned int start,
unsigned int end,
vpColVector &s)
const;
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);
394 void init(
const vpFeatureLuminance &luminance, 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
Class to combine luminance features (photometric servoing)
std::shared_ptr< vpLuminanceMapping > & getMapping()
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
vpFeatureLuminance & getLuminanceFeature()
Class that defines the image luminance visual feature.
static const int DEFAULT_BORDER
Helper class to iterate and get/set the values from a matrix, following a zigzag pattern.
vpMatrix m_Dcols
DCT representation of the image.
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.
vpLuminanceDCT & operator=(const vpLuminanceDCT &)=default
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.
Base class for functions that map an image and its interaction matrix to a different domain.
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.
virtual ~vpLuminancePCA()
std::shared_ptr< vpColVector > getMean() const
Get , the mean image computed from the dataset.
std::shared_ptr< vpMatrix > getBasis() const
Get , the subspace projection matrix ( )
vpColVector getExplainedVariance() const
Get the values of explained variance by each of the eigen vectors.
Implementation of a matrix and operations on matrices.