Direct Graphical Models  v.1.7.0
PriorNode.cpp
1 #include "PriorNode.h"
2 #include "macroses.h"
3 
4 namespace DirectGraphicalModels
5 {
6 
7 void CPriorNode::addNodeGroundTruth(const Mat &gt)
8 {
9  DGM_ELEMENTWISE1<CPriorNode, &CPriorNode::addNodeGroundTruth>(*this, gt);
10 }
11 
13 {
14  DGM_ASSERT_MSG(gt < m_nStates, "The groundtruth value %d is out of range %d", gt, m_nStates);
15  m_histogramPrior.at<int>(gt, 0)++;
16 }
17 
19 {
20  Mat res;
21  double Sum = sum(m_histogramPrior)[0];
22  m_histogramPrior.convertTo(res, CV_32FC1, 1.0 / Sum);
23  return res;
24 }
25 }
Mat calculatePrior(void) const
Calculates the prior probabilies.
Definition: PriorNode.cpp:18
void addNodeGroundTruth(const Mat &gt)
Adds ground truth values to the co-occurance histogram vector.
Definition: PriorNode.cpp:7
Mat m_histogramPrior
The class cooccurance histogram.
Definition: Prior.h:51
byte m_nStates
The number of states (classes)