An error occurred while loading the file. Please try again.
-
2ab59b5b
#ifndef __LSRM_GRAPH_OPERATIONS_H
#define __LSRM_GRAPH_OPERATIONS_H
#include "lsrmGraph.h"
#include "lsrmNeighborhood.h"
#include <iostream>
#include <cassert>
#include <limits>
#include <map>
#include <utility>
#include <set>
namespace lsrm
{
template<class TSegmenter>
class GraphOperations
{
public:
/* Some convenient typedefs */
typedef TSegmenter SegmenterType;
typedef typename SegmenterType::ImageType ImageType;
typedef typename SegmenterType::GraphType GraphType;
typedef typename GraphType::NodeType NodeType;
typedef typename GraphType::EdgeType EdgeType;
typedef typename GraphType::NodePointerType NodePointerType;
typedef typename GraphType::NodeListType NodeList;
typedef typename GraphType::NodeIteratorType NodeIterator;
typedef typename GraphType::NodeConstIteratorType NodeConstIterator;
typedef typename GraphType::EdgeListType EdgeList;
typedef typename GraphType::EdgeIteratorType EdgeIterator;
typedef typename GraphType::EdgeConstIteratorType EdgeConstIterator;
using ContourOperator = lp::ContourOperations;
/*
* Given the size of the input image and the mask of the
* neighborhood, we initialize a new graph of nodes
*
* @params:
* GraphType& graph: reference to a graph of nodes
* const unsigned int width: width of the input image
* const unsigned int height: height of the input image
* CONNECTIVITY mask : mask of the neighborhood (4X4 or 8X8)
*/
static void InitNodes(ImageType * inputImg,
SegmenterType& seg,
CONNECTIVITY mask);
/*
* Given a graph of nodes, we explore all the nodes
* and for each node we compute his merging costs
* with all its neighboring nodes given a function
* to compute the merging cost between two nodes.
*
* @params:
* GraphType& graph: reference to the graph of nodes
* float(*fptr)(NodeType*, NodeType*): pointer to the function
* to compute the merging cost between two adjacent nodes.
*/
static void UpdateMergingCosts(SegmenterType& seg);
/*
* Given a node A, we analyse its best node B.
* If the node A is also node B's best node
* then it returns a pointer to node B if node A 's id
* is smaller or a pointer to node A if node B's id is
* smaller
* else it returns a null pointer.
* (Local Mutual Best Fitting Heuristic)