Direct Graphical Models  v.1.7.0
DirectGraphicalModels::vis::CMarkerHistogram Class Reference

Histogram Marker class. More...

#include <MarkerHistogram.h>

Inheritance diagram for DirectGraphicalModels::vis::CMarkerHistogram:
Collaboration diagram for DirectGraphicalModels::vis::CMarkerHistogram:

Public Member Functions

 CMarkerHistogram (const CTrainNode &nodeTrainer, default_pallete palette=DEF_PALETTE_12, vec_string_t vFeatureNames=vec_string_t())
 Constructor with default palette. More...
 
 CMarkerHistogram (const CTrainNode &nodeTrainer, const vec_nColor_t &vPalette, vec_string_t vFeatureNames=vec_string_t())
 Constructor with custom palette. More...
 
virtual ~CMarkerHistogram (void)=default
 
Mat drawHistogram (void) const
 Draws a figure with the visualization of feature densitiy distributions. More...
 
Mat drawHistogram2D (void) const
 Draws a figure with the visualization of 2-dimensional node potentials histogram. More...
 
Mat drawClassificationMap2D (float Z) const
 Draws a figure with the visualization of 2-dimensional classification map. More...
 
void showHistogram (void)
 Visualizes the feature densitiy distributions in a separate window with user interaction. More...
 
void close (void) const
 Closes the histogram window. More...
 
- Public Member Functions inherited from DirectGraphicalModels::vis::CMarker
 CMarker (default_pallete palette=DEF_PALETTE_12)
 Constructor with a default palette. More...
 
 CMarker (const vec_nColor_t &vPalette)
 Constructor with a custom palette. More...
 
virtual ~CMarker (void)
 
void markClasses (Mat &base, const Mat &classes, byte flag=0) const
 Visualizes the classes. More...
 
Mat drawPotentials (const Mat &potential, byte flag=0) const
 Visualizes the potentials. More...
 
Mat drawConfusionMatrix (const Mat &confusionMat, byte flag=0) const
 Visualizes a confusion matrix. More...
 

Protected Attributes

const CTrainNodem_nodeTrainer
 The node trainer. More...
 
- Protected Attributes inherited from DirectGraphicalModels::vis::CMarker
vec_nColor_t m_vPalette
 Pointer to the container with the palette. More...
 

Private Member Functions

Mat drawHistogram (Scalar color) const
 Draws the figure with a visualization of feature densitiy distributions. More...
 
Mat drawHistogram2D (Scalar color) const
 Draws the figure with the visualization of 2-dimensional node potentials histogram. More...
 
int getActiveState (Scalar color) const
 Retrieves a chosen by an user state, from the color. More...
 
Mat drawFeatureHistogram (word f, int activeState=-1) const
 Draws a single feature histogram. More...
 
Mat drawFeatureHistogram2D (word f, int activeState=-1) const
 Draws a 2-dimensional feature histogram. More...
 
Mat drawLegend (int maxHeight, int activeState=-1) const
 Draws a legend to the main figure. More...
 

Private Attributes

vec_string_t m_vFeatureNames
 

Static Private Attributes

static const Size margin = cv::Size(25, 16)
 
static const byte bkgIntencity = 50
 
static const double frgWeight = 0.75
 
static const std::string wndName = "Feature Histogram Viewer"
 

Detailed Description

Histogram Marker class.

This class allows to visualize the feature densitiy distributions (feature histograms), used in the naive bayes random model (Ref. CTrainNodeBayes).

Author
Sergey G. Kosov, serge.nosp@m.y.ko.nosp@m.sov@p.nosp@m.roje.nosp@m.ct-10.nosp@m..de

Definition at line 20 of file MarkerHistogram.h.

Constructor & Destructor Documentation

◆ CMarkerHistogram() [1/2]

DirectGraphicalModels::vis::CMarkerHistogram::CMarkerHistogram ( const CTrainNode nodeTrainer,
default_pallete  palette = DEF_PALETTE_12,
vec_string_t  vFeatureNames = vec_string_t() 
)
inline

Constructor with default palette.

Parameters
nodeTrainerThe node trainer.
paletteOne of the default palletes (Ref. default_pallete).
vFeatureNamesOptional list of feature names. For optimal performance, each feature name should have maximal 17 symbols.

Definition at line 30 of file MarkerHistogram.h.

◆ CMarkerHistogram() [2/2]

DirectGraphicalModels::vis::CMarkerHistogram::CMarkerHistogram ( const CTrainNode nodeTrainer,
const vec_nColor_t vPalette,
vec_string_t  vFeatureNames = vec_string_t() 
)
inline

Constructor with custom palette.

Parameters
nodeTrainerPointer to the CTrainNode class.
vPaletteCustom palette. It is represented as a std::vector of the custom entries of type:
std::make_pair(CV_RGB(r, g, b), "class name").
For optimal performance, class name should have maximal 10 symbols.
vFeatureNamesOptional list of feature names. For optimal performance, each feature name should have maximal 17 symbols.

Definition at line 43 of file MarkerHistogram.h.

◆ ~CMarkerHistogram()

virtual DirectGraphicalModels::vis::CMarkerHistogram::~CMarkerHistogram ( void  )
virtualdefault

Member Function Documentation

◆ close()

void DirectGraphicalModels::vis::CMarkerHistogram::close ( void  ) const

Closes the histogram window.

Definition at line 81 of file MarkerHistogram.cpp.

◆ drawClassificationMap2D()

Mat DirectGraphicalModels::vis::CMarkerHistogram::drawClassificationMap2D ( float  Z) const

Draws a figure with the visualization of 2-dimensional classification map.

This function calls the underlying node trainer to classify the area of 256 x 256 pixels, where every pixel (x, y) represents a 2-dimensional feature. The outcome visualization should illustrate how the underlying node trainer represents the feature distribution, which may be visualized with the drawHistogram2D() function

Note
Used for test purposes. Capable to visualize only 2-dimensional feature space.
Parameters
ZThe value of partition function for calling the CTrainNode::getNodePotentials() function.
Returns
Figure with visualized classification map.

Definition at line 14 of file MarkerHistogram.cpp.

Here is the call graph for this function:

◆ drawFeatureHistogram()

Mat DirectGraphicalModels::vis::CMarkerHistogram::drawFeatureHistogram ( word  f,
int  activeState = -1 
) const
private

Draws a single feature histogram.

Parameters
fFeature.
activeStateDesired state (class).
Returns
Figure with visualized feature histogram: Mat(100, 256, CV_8UC3).

Definition at line 144 of file MarkerHistogram.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawFeatureHistogram2D()

Mat DirectGraphicalModels::vis::CMarkerHistogram::drawFeatureHistogram2D ( word  f,
int  activeState = -1 
) const
private

Draws a 2-dimensional feature histogram.

Parameters
fFeature.
activeStateDesired state (class).
Returns
Figure with visualized 2-dimensional feature histogram.

Definition at line 194 of file MarkerHistogram.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawHistogram() [1/2]

Mat DirectGraphicalModels::vis::CMarkerHistogram::drawHistogram ( void  ) const
inline

Draws a figure with the visualization of feature densitiy distributions.

Returns
Figure with visualized histograms of the feature distributions.

Definition at line 54 of file MarkerHistogram.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawHistogram() [2/2]

Mat DirectGraphicalModels::vis::CMarkerHistogram::drawHistogram ( Scalar  color) const
private

Draws the figure with a visualization of feature densitiy distributions.

This function also allows for active user interaction: after the figure is drawn, user may click upon it, and the color of the clicked point is than transmitted to the fuction as argument. The function will redraw the fugure, depending on the input color.

Parameters
colorColor of a pixel from the resulting histogram. This optional parameter is used for active user interaction.
Returns
Figure with visualized histograms of the feature distributions.

Definition at line 88 of file MarkerHistogram.cpp.

Here is the call graph for this function:

◆ drawHistogram2D() [1/2]

Mat DirectGraphicalModels::vis::CMarkerHistogram::drawHistogram2D ( void  ) const
inline

Draws a figure with the visualization of 2-dimensional node potentials histogram.

Note
Used for test purposes. Capable to visualize only 2-dimensional feature space.
Returns
Figure with visualized histogram.

Definition at line 60 of file MarkerHistogram.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawHistogram2D() [2/2]

Mat DirectGraphicalModels::vis::CMarkerHistogram::drawHistogram2D ( Scalar  color) const
private

Draws the figure with the visualization of 2-dimensional node potentials histogram.

Note
Used for test purposes. Capable to visualize only 2-dimensional feature space.
Parameters
colorColor of a pixel from the resulting histogram. This optional parameter is used for active user interaction.
Returns
Figure with visualized classification map.

Definition at line 128 of file MarkerHistogram.cpp.

Here is the call graph for this function:

◆ drawLegend()

Mat DirectGraphicalModels::vis::CMarkerHistogram::drawLegend ( int  maxHeight,
int  activeState = -1 
) const
private

Draws a legend to the main figure.

Parameters
maxHeightThe maximal height of the legend figure.
activeStateDesired state (class).
Returns
Figure with visualized legend to the main figure.

Definition at line 244 of file MarkerHistogram.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getActiveState()

int DirectGraphicalModels::vis::CMarkerHistogram::getActiveState ( Scalar  color) const
private

Retrieves a chosen by an user state, from the color.

Parameters
colorColor of a pixel from the histogram figure.
Returns
Active state (class) if color matches the palette, -1 othervise.

Definition at line 134 of file MarkerHistogram.cpp.

Here is the caller graph for this function:

◆ showHistogram()

void DirectGraphicalModels::vis::CMarkerHistogram::showHistogram ( void  )

Visualizes the feature densitiy distributions in a separate window with user interaction.

This function creates an OpenCV window with the visualized histograms. Click on the color box for specific state (class) visualuzation.

Definition at line 66 of file MarkerHistogram.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ bkgIntencity

const byte DirectGraphicalModels::vis::CMarkerHistogram::bkgIntencity = 50
staticprivate

Definition at line 135 of file MarkerHistogram.h.

◆ frgWeight

const double DirectGraphicalModels::vis::CMarkerHistogram::frgWeight = 0.75
staticprivate

Definition at line 136 of file MarkerHistogram.h.

◆ m_nodeTrainer

const CTrainNode& DirectGraphicalModels::vis::CMarkerHistogram::m_nodeTrainer
protected

The node trainer.

Definition at line 130 of file MarkerHistogram.h.

◆ m_vFeatureNames

vec_string_t DirectGraphicalModels::vis::CMarkerHistogram::m_vFeatureNames
private

Definition at line 139 of file MarkerHistogram.h.

◆ margin

const cv::Size DirectGraphicalModels::vis::CMarkerHistogram::margin = cv::Size(25, 16)
staticprivate

Definition at line 134 of file MarkerHistogram.h.

◆ wndName

const std::string DirectGraphicalModels::vis::CMarkerHistogram::wndName = "Feature Histogram Viewer"
staticprivate

Definition at line 137 of file MarkerHistogram.h.


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