Direct Graphical Models  v.1.7.0
SparseCoding.h
1 // Sparse Coding feature extraction class interface
2 // Written by Sergey G. Kosov in 2016 for Project X
3 #pragma once
4 
5 #include "ILocalFeatureExtractor.h"
6 #include "SparseDictionary.h"
7 #include "SquareNeighborhood.h"
8 
9 namespace DirectGraphicalModels {
10  namespace fex
11  {
12  // ================================ SC Class ==============================
18  {
19  public:
24  DllExport CSparseCoding(const Mat &img) : ILocalFeatureExtractor(img) {}
25  DllExport virtual ~CSparseCoding(void) {}
26 
27  DllExport virtual Mat get(void) const { return get(m_img, getDictionary()); }
28 
39  DllExport static Mat get(const Mat &img, const Mat &D, SqNeighbourhood nbhd = sqNeighbourhood(3));
50  DllExport static vec_mat_t get_v(const Mat &img, const Mat &D, SqNeighbourhood nbhd = sqNeighbourhood(3));
51  };
52  }
53 }
Sparse Dictionary Learning class.
CSparseCoding(const Mat &img)
Constructor.
Definition: SparseCoding.h:24
Sparse Coding feature extraction class.
Definition: SparseCoding.h:17
SqNeighbourhood sqNeighbourhood(int leftGap, int rightGap, int upperGap, int lowerGap)
Initializes the square neighborhood structure.
static vec_mat_t get_v(const Mat &img, const Mat &D, SqNeighbourhood nbhd=sqNeighbourhood(3))
Extracts the sparse coding feature.
Interface class for local feature extraction algorithms.
Mat getDictionary(void) const
Returns dictionary .
const Mat m_img
Container for the image, from which the features are to be extracted.