1 #include "GraphDense.h" 19 DGM_ASSERT_MSG((pot.cols == 1) && (pot.rows ==
getNumStates()),
"Potential size (%d x %d) does not match (%d x %d)", pot.cols, pot.rows, 1,
getNumStates());
20 DGM_ASSERT_MSG(pot.type() == CV_32FC1,
"Potential type is not CV_32FC1");
28 DGM_ASSERT_MSG(start_node + pots.rows <
getNumNodes(),
"Node %zu is out of range %zu", start_node + pots.rows,
getNumNodes());
30 DGM_ASSERT_MSG(pots.type() == CV_32FC1,
"Potentials type is not CV_32FC1");
39 if (pot.empty() || pot.cols != 1 || pot.rows !=
getNumStates() || pot.type() != CV_32FC1)
44 pot.at<
float>(s, 0) = pPot[s];
49 if (!num_nodes) num_nodes =
getNumNodes() - start_node;
50 DGM_ASSERT_MSG(start_node + num_nodes <=
getNumNodes(),
"The given ranges exceed the number of nodes(%zu)",
getNumNodes());
59 if (!vNodes.empty()) vNodes.clear();
byte getNumStates(void) const
Returns number of states (classes)
size_t getNumNodes(void) const override
Returns the number of nodes in the graph.
size_t addNode(const Mat &pot=EmptyMat) override
Adds an additional node (with specified potentional)
Mat m_nodePotentials
The container for the node potentials: Mat(nNodes, nStates, CV_32FC1), i.e. every row is a node poten...
void setNodes(size_t start_node, const Mat &pots) override
Fills the graph nodes with new potentials.
void getNode(size_t node, Mat &pot) const override
Returns the node potential.
void setNode(size_t node, const Mat &pot) override
Sets or changes the potential of node.
void getChildNodes(size_t node, vec_size_t &vNodes) const override
Returns the set of IDs of the child nodes of the argument node.
void getNodes(size_t start_node, size_t num_nodes, Mat &pots) const override
Returns the node potentials.