35 #ifndef IMAGEGRAPH_HEADER
36 #define IMAGEGRAPH_HEADER
43 #include <unordered_map>
58 LinkEdge(
int src_ = -1,
int dst_ = -1,
float score_ = 0.0,
int p_match_ = 0,
int g_match_ = 0):
59 src(src_), dst(dst_), score(score_), p_match(p_match_), g_match(g_match_) {}
80 ImageNode(
int idx_ = -1,
const std::string &iname =
"",
const std::string &sname =
""): idx(idx_), image_name(iname), sift_name(sname) {}
96 typedef std::unordered_map<int, LinkEdge> EdgeMap;
97 typedef std::vector<std::vector<LinkEdge> > Edge2dArray;
102 ImageGraph(
const std::vector<std::string> &image_filenames,
const std::vector<std::string> &sift_filenames);
106 void addEdge(
int src,
int dst,
double score = 0.0);
109 void addEdgeu(
int src,
int dst,
double score = 0.0);
113 bool kargerCut(std::vector<std::vector<int> > &global_min_cut);
117 bool queryExpansion(Edge2dArray &expansion_lists,
int level,
int inlier_threshold = 150);
118 bool queryExpansionSub(
int src,
int tgt,
double score, Edge2dArray &expansion_lists,
bool **visit_mat,
int level,
int inlier_threshold);
120 bool graphvizu(std::string gv_filename, std::string graph_name);
128 std::vector<ImageNode> nodes_;
129 std::vector<EdgeMap> adj_maps_;
133 #endif // IMAGEGRAPH_HEADER
ImageNode(int idx_=-1, const std::string &iname="", const std::string &sname="")
Definition: image_graph.h:80
int nodeNum()
Definition: image_graph.cpp:319
the image node used in image graph class
Definition: image_graph.h:75
std::string sift_name
the sift name
Definition: image_graph.h:79
void addNode()
Definition: image_graph.cpp:70
void addEdge(int src, int dst, double score=0.0)
Brief add one-way edge.
Definition: image_graph.cpp:84
void addEdgeu(int src, int dst, double score=0.0)
Brief add undirected edge.
Definition: image_graph.cpp:103
size_t dst
Definition: image_graph.h:53
bool kargerCut(std::vector< std::vector< int > > &global_min_cut)
Definition: image_graph.cpp:151
edge struct used in image graph class
Definition: image_graph.h:50
ImageGraph(int size)
Brief construct ananymous image graph without filenames.
Definition: image_graph.cpp:51
bool graphvizu(std::string gv_filename, std::string graph_name)
Brief output the undirected visualization code for graphviz.
Definition: image_graph.cpp:286
bool queryExpansionSub(int src, int tgt, double score, Edge2dArray &expansion_lists, bool **visit_mat, int level, int inlier_threshold)
Definition: image_graph.cpp:212
std::string image_name
the image name
Definition: image_graph.h:78
float score
Definition: image_graph.h:54
int p_match
Definition: image_graph.h:55
int numConnectedComponents(int threshold=0)
Brief compute the number of connected components in a undirected graph (edge (i,j) and edge (j...
Definition: image_graph.cpp:116
void showInfo()
Brief output the information.
Definition: image_graph.cpp:274
int adjListSize(int idx)
Definition: image_graph.cpp:318
ImageNode(const ImageNode &node)
Copy constructor.
Definition: image_graph.h:83
LinkEdge(int src_=-1, int dst_=-1, float score_=0.0, int p_match_=0, int g_match_=0)
Definition: image_graph.h:58
bool queryExpansion(Edge2dArray &expansion_lists, int level, int inlier_threshold=150)
Brief Query expansion and its sub-routine.
Definition: image_graph.cpp:230
int idx
the optional original index (maybe in the image_list)
Definition: image_graph.h:77
LinkEdge(const LinkEdge &e)
Copy constructor.
Definition: image_graph.h:62
namespace vot contains libvot functions and classes.
Definition: image_graph.cpp:49
int g_match
Definition: image_graph.h:56
bool consolidate(int k)
Brief Remove the singleton node from the graph.
Definition: image_graph.cpp:207
size_t src
Definition: image_graph.h:52
Image graph class.
Definition: image_graph.h:94