Direct Graphical Models  v.1.7.0
MarkerHistogram.h
1 // Histogram Marker Class
2 // Written by Sergey Kosov in 2015 for Project X
3 #pragma once
4 
5 #include "Marker.h"
6 
7 namespace DirectGraphicalModels
8 {
9  class CTrainNode;
10  namespace vis
11  {
12 
13  // ================================ Histogram Marker Class ================================
20  class CMarkerHistogram : public CMarker
21  {
22  public:
30  DllExport CMarkerHistogram(const CTrainNode& nodeTrainer, default_pallete palette = DEF_PALETTE_12, vec_string_t vFeatureNames = vec_string_t())
31  : CMarker(palette)
32  , m_nodeTrainer(nodeTrainer)
33  , m_vFeatureNames(vFeatureNames)
34  {}
43  DllExport CMarkerHistogram(const CTrainNode& nodeTrainer, const vec_nColor_t& vPalette, vec_string_t vFeatureNames = vec_string_t())
44  : CMarker(vPalette)
45  , m_nodeTrainer(nodeTrainer)
46  , m_vFeatureNames(vFeatureNames)
47  {}
48  DllExport virtual ~CMarkerHistogram(void) = default;
49 
54  DllExport Mat drawHistogram(void) const { return drawHistogram(CV_RGB(0, 0, 0)); }
60  DllExport Mat drawHistogram2D(void) const { return drawHistogram2D(CV_RGB(0, 0, 0)); }
71  DllExport Mat drawClassificationMap2D(float Z) const;
77  DllExport void showHistogram(void);
81  DllExport void close(void) const;
82 
83 
84  private:
92  DllExport Mat drawHistogram(Scalar color) const;
99  DllExport Mat drawHistogram2D(Scalar color) const;
105  int getActiveState(Scalar color) const;
112  Mat drawFeatureHistogram(word f, int activeState = -1) const;
119  Mat drawFeatureHistogram2D(word f, int activeState = -1) const;
126  Mat drawLegend(int maxHeight, int activeState = -1) const;
127 
128 
129  protected:
131 
132 
133  private:
134  static const Size margin;
135  static const byte bkgIntencity;
136  static const double frgWeight;
137  static const std::string wndName;
138 
139  vec_string_t m_vFeatureNames;
140  };
141 
142 } }
void close(void) const
Closes the histogram window.
std::vector< std::pair< Scalar, std::string > > vec_nColor_t
Definition: types.h:73
Mat drawHistogram(void) const
Draws a figure with the visualization of feature densitiy distributions.
Default Pallete with 12 colors.
Definition: Marker.h:47
Mat drawFeatureHistogram(word f, int activeState=-1) const
Draws a single feature histogram.
Mat drawHistogram2D(void) const
Draws a figure with the visualization of 2-dimensional node potentials histogram. ...
const CTrainNode & m_nodeTrainer
The node trainer.
CMarkerHistogram(const CTrainNode &nodeTrainer, default_pallete palette=DEF_PALETTE_12, vec_string_t vFeatureNames=vec_string_t())
Constructor with default palette.
void showHistogram(void)
Visualizes the feature densitiy distributions in a separate window with user interaction.
Mat drawClassificationMap2D(float Z) const
Draws a figure with the visualization of 2-dimensional classification map.
CMarkerHistogram(const CTrainNode &nodeTrainer, const vec_nColor_t &vPalette, vec_string_t vFeatureNames=vec_string_t())
Constructor with custom palette.
Mat drawLegend(int maxHeight, int activeState=-1) const
Draws a legend to the main figure.
default_pallete
Default palettes.
Definition: Marker.h:42
Mat drawFeatureHistogram2D(word f, int activeState=-1) const
Draws a 2-dimensional feature histogram.
Base abstract class for node potentials training.
Definition: TrainNode.h:47
int getActiveState(Scalar color) const
Retrieves a chosen by an user state, from the color.