亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? graph.h

?? 動態(tài)場景中運動目標(biāo)檢測提取與跟蹤 對新手很有用
?? H
?? 第 1 頁 / 共 2 頁
字號:
/* graph.h */
/*
	This software library implements the maxflow algorithm
	described in

		"An Experimental Comparison of Min-Cut/Max-Flow Algorithms for Energy Minimization in Vision."
		Yuri Boykov and Vladimir Kolmogorov.
		In IEEE Transactions on Pattern Analysis and Machine Intelligence (PAMI), 
		September 2004

	This algorithm was developed by Yuri Boykov and Vladimir Kolmogorov
	at Siemens Corporate Research. To make it available for public use,
	it was later reimplemented by Vladimir Kolmogorov based on open publications.

	If you use this software for research purposes, you should cite
	the aforementioned paper in any resulting publication.

	----------------------------------------------------------------------

	REUSING TREES:

	Starting with version 3.0, there is a also an option of reusing search
	trees from one maxflow computation to the next, as described in

		"Efficiently Solving Dynamic Markov Random Fields Using Graph Cuts."
		Pushmeet Kohli and Philip H.S. Torr
		International Conference on Computer Vision (ICCV), 2005

	If you use this option, you should cite
	the aforementioned paper in any resulting publication.
*/
	


/*
	For description, license, example usage see README.TXT.
*/

#ifndef __GRAPH_H__
#define __GRAPH_H__

#include <string.h>
#include "block.h"

#include <assert.h>
// NOTE: in UNIX you need to use -DNDEBUG preprocessor option to supress assert's!!!



// captype: type of edge capacities (excluding t-links)
// tcaptype: type of t-links (edges between nodes and terminals)
// flowtype: type of total flow
//
// Current instantiations are in instances.inc
template <typename captype, typename tcaptype, typename flowtype> class Graph
{
public:
	typedef enum
	{
		SOURCE	= 0,
		SINK	= 1
	} termtype; // terminals 
	typedef int node_id;

	/////////////////////////////////////////////////////////////////////////
	//                     BASIC INTERFACE FUNCTIONS                       //
    //              (should be enough for most applications)               //
	/////////////////////////////////////////////////////////////////////////

	// Constructor. 
	// The first argument gives an estimate of the maximum number of nodes that can be added
	// to the graph, and the second argument is an estimate of the maximum number of edges.
	// The last (optional) argument is the pointer to the function which will be called 
	// if an error occurs; an error message is passed to this function. 
	// If this argument is omitted, exit(1) will be called.
	//
	// IMPORTANT: It is possible to add more nodes to the graph than node_num_max 
	// (and node_num_max can be zero). However, if the count is exceeded, then 
	// the internal memory is reallocated (increased by 50%) which is expensive. 
	// Also, temporarily the amount of allocated memory would be more than twice than needed.
	// Similarly for edges.
	// If you wish to avoid this overhead, you can download version 2.2, where nodes and edges are stored in blocks.
	Graph(int node_num_max, int edge_num_max, void (*err_function)(char *) = NULL);

	// Destructor
	~Graph();

	// Adds node(s) to the graph. By default, one node is added (num=1); then first call returns 0, second call returns 1, and so on. 
	// If num>1, then several nodes are added, and node_id of the first one is returned.
	// IMPORTANT: see note about the constructor 
	node_id add_node(int num = 1);

	// Adds a bidirectional edge between 'i' and 'j' with the weights 'cap' and 'rev_cap'.
	// IMPORTANT: see note about the constructor 
	void add_edge(node_id i, node_id j, captype cap, captype rev_cap);

	// Adds new edges 'SOURCE->i' and 'i->SINK' with corresponding weights.
	// Can be called multiple times for each node.
	// Weights can be negative.
	// NOTE: the number of such edges is not counted in edge_num_max.
	//       No internal memory is allocated by this call.
	void add_tweights(node_id i, tcaptype cap_source, tcaptype cap_sink);


	// Computes the maxflow. Can be called several times.
	// FOR DESCRIPTION OF reuse_trees, SEE mark_node().
	// FOR DESCRIPTION OF changed_list, SEE remove_from_changed_list().
	flowtype maxflow(bool reuse_trees = false, Block<node_id>* changed_list = NULL);

	// After the maxflow is computed, this function returns to which
	// segment the node 'i' belongs (Graph<captype,tcaptype,flowtype>::SOURCE or Graph<captype,tcaptype,flowtype>::SINK).
	//
	// Occasionally there may be several minimum cuts. If a node can be assigned
	// to both the source and the sink, then default_segm is returned.
	termtype what_segment(node_id i, termtype default_segm = SOURCE);



	//////////////////////////////////////////////
	//       ADVANCED INTERFACE FUNCTIONS       //
	//      (provide access to the graph)       //
	//////////////////////////////////////////////

private:
	struct node;
	struct arc;

public:

	////////////////////////////
	// 1. Reallocating graph. //
	////////////////////////////

	// Removes all nodes and edges. 
	// After that functions add_node() and add_edge() must be called again. 
	//
	// Advantage compared to deleting Graph and allocating it again:
	// no calls to delete/new (which could be quite slow).
	//
	// If the graph structure stays the same, then an alternative
	// is to go through all nodes/edges and set new residual capacities
	// (see functions below).
	void reset();

	////////////////////////////////////////////////////////////////////////////////
	// 2. Functions for getting pointers to arcs and for reading graph structure. //
	//    NOTE: adding new arcs may invalidate these pointers (if reallocation    //
	//    happens). So it's best not to add arcs while reading graph structure.   //
	////////////////////////////////////////////////////////////////////////////////

	// The following two functions return arcs in the same order that they
	// were added to the graph. NOTE: for each call add_edge(i,j,cap,cap_rev)
	// the first arc returned will be i->j, and the second j->i.
	// If there are no more arcs, then the function can still be called, but
	// the returned arc_id is undetermined.
	typedef arc* arc_id;
	arc_id get_first_arc();
	arc_id get_next_arc(arc_id a);

	// other functions for reading graph structure
	int get_node_num() { return node_num; }
	int get_arc_num() { return (int)(arc_last - arcs); }
	void get_arc_ends(arc_id a, node_id& i, node_id& j); // returns i,j to that a = i->j

	///////////////////////////////////////////////////
	// 3. Functions for reading residual capacities. //
	///////////////////////////////////////////////////

	// returns residual capacity of SOURCE->i minus residual capacity of i->SINK
	tcaptype get_trcap(node_id i); 
	// returns residual capacity of arc a
	captype get_rcap(arc* a);

	/////////////////////////////////////////////////////////////////
	// 4. Functions for setting residual capacities.               //
	//    NOTE: If these functions are used, the value of the flow //
	//    returned by maxflow() will not be valid!                 //
	/////////////////////////////////////////////////////////////////

	void set_trcap(node_id i, tcaptype trcap); 
	void set_rcap(arc* a, captype rcap);

	////////////////////////////////////////////////////////////////////
	// 5. Functions related to reusing trees & list of changed nodes. //
	////////////////////////////////////////////////////////////////////

	// If flag reuse_trees is true while calling maxflow(), then search trees
	// are reused from previous maxflow computation. 
	// In this case before calling maxflow() the user must
	// specify which parts of the graph have changed by calling mark_node():
	//   add_tweights(i),set_trcap(i)    => call mark_node(i)
	//   add_edge(i,j),set_rcap(a)       => call mark_node(i); mark_node(j)
	//
	// This option makes sense only if a small part of the graph is changed.
	// The initialization procedure goes only through marked nodes then.
	// 
	// mark_node(i) can either be called before or after graph modification.
	// Can be called more than once per node, but calls after the first one
	// do not have any effect.
	// 
	// NOTE: 
	//   - This option cannot be used in the first call to maxflow().
	//   - It is not necessary to call mark_node() if the change is ``not essential'',
	//     i.e. sign(trcap) is preserved for a node and zero/nonzero status is preserved for an arc.
	//   - To check that you marked all necessary nodes, you can call maxflow(false) after calling maxflow(true).
	//     If everything is correct, the two calls must return the same value of flow. (Useful for debugging).
	void mark_node(node_id i);

	// If changed_list is not NULL while calling maxflow(), then the algorithm
	// keeps a list of nodes which could potentially have changed their segmentation label.
	// Nodes which are not in the list are guaranteed to keep their old segmentation label (SOURCE or SINK).
	// Example usage:
	//
	//		typedef Graph<int,int,int> G;
	//		G* g = new Graph(nodeNum, edgeNum);
	//		Block<G::node_id>* changed_list = new Block<G::node_id>(128);
	//
	//		... // add nodes and edges
	//
	//		g->maxflow(); // first call should be without arguments
	//		for (int iter=0; iter<10; iter++)
	//		{
	//			... // change graph, call mark_node() accordingly
	//
	//			g->maxflow(true, changed_list);
	//			G::node_id* ptr;
	//			for (ptr=changed_list->ScanFirst(); ptr; ptr=changed_list->ScanNext())
	//			{
	//				G::node_id i = *ptr; assert(i>=0 && i<nodeNum);
	//				g->remove_from_changed_list(i);
	//				// do something with node i...
	//				if (g->what_segment(i) == G::SOURCE) { ... }
	//			}
	//			changed_list->Reset();
	//		}
	//		delete changed_list;
	//		
	// NOTE:
	//  - If changed_list option is used, then reuse_trees must be used as well.
	//  - In the example above, the user may omit calls g->remove_from_changed_list(i) and changed_list->Reset() in a given iteration.
	//    Then during the next call to maxflow(true, &changed_list) new nodes will be added to changed_list.
	//  - If the next call to maxflow() does not use option reuse_trees, then calling remove_from_changed_list()
	//    is not necessary. ("changed_list->Reset()" or "delete changed_list" should still be called, though).
	void remove_from_changed_list(node_id i) 
	{ 
		assert(i>=0 && i<node_num && nodes[i].is_in_changed_list); 
		nodes[i].is_in_changed_list = 0;
	}






?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美黄色影院| 肉肉av福利一精品导航| 久久男人中文字幕资源站| 欧美一区二区不卡视频| 欧美日本一区二区| 麻豆成人免费电影| 久久精品国产一区二区三区免费看| 中文字幕精品综合| 777色狠狠一区二区三区| 欧美精品 日韩| 91精品国产综合久久婷婷香蕉 | 成人永久免费视频| 国产美女精品在线| 成人激情动漫在线观看| 久久国产精品第一页| 国内外成人在线视频| 国产精品一区二区果冻传媒| 五月天欧美精品| 亚洲六月丁香色婷婷综合久久| 久久综合九色综合97_久久久| 欧美亚洲国产一卡| 欧美久久婷婷综合色| 日韩欧美一卡二卡| 日本一区二区成人在线| 亚洲精品免费视频| 日本亚洲最大的色成网站www| 亚洲精品v日韩精品| 亚洲成人精品一区二区| 国产精品久久久久永久免费观看| 欧美变态口味重另类| 国产欧美一二三区| 日韩免费一区二区三区在线播放| 欧美日韩国产乱码电影| 精品国产精品网麻豆系列| 国产日韩综合av| 樱桃视频在线观看一区| 久久精品免费看| 99久久99久久精品免费看蜜桃| 国产福利精品导航| 国产精品911| 91久久香蕉国产日韩欧美9色| 91亚洲精品久久久蜜桃网站| 欧美日韩卡一卡二| www日韩大片| 亚洲曰韩产成在线| 国产一区二区三区日韩| 日本国产一区二区| 精品国产一区二区精华| 精品国产91九色蝌蚪| 亚洲男同1069视频| 韩国欧美国产一区| 欧美一a一片一级一片| 欧美大片一区二区三区| 亚洲欧洲99久久| 蜜臀av性久久久久蜜臀aⅴ流畅 | 成人免费高清在线| 成人黄色免费短视频| 99久久久久久| 欧美一区二区精品久久911| 亚洲欧洲另类国产综合| 亚洲免费在线播放| 国产精品夜夜爽| 欧美一区二区视频免费观看| 国产精品欧美一级免费| 亚洲天堂中文字幕| 韩国精品主播一区二区在线观看| 顶级嫩模精品视频在线看| 欧美影视一区二区三区| 国产精品久久久久久久裸模| 亚洲人一二三区| 国产精品一区二区黑丝| 97久久精品人人做人人爽50路| 国产欧美精品国产国产专区| 国产精品人妖ts系列视频| 亚洲美女视频一区| 国产69精品久久777的优势| 欧美一区二区三区四区视频| 亚洲三级在线观看| 国产福利一区二区| 精品国产伦一区二区三区观看体验 | 国产成人综合网| 欧美成人video| 日本不卡中文字幕| 欧美三级视频在线观看| 亚洲日本护士毛茸茸| 成人激情动漫在线观看| 久久久91精品国产一区二区精品 | 久久精品99国产精品| 欧美午夜不卡视频| 亚洲精品综合在线| 不卡视频在线观看| 中文字幕av在线一区二区三区| 一区二区三区免费看视频| 卡一卡二国产精品| 欧美一卡2卡三卡4卡5免费| 亚洲国产三级在线| 国产一区二区日韩精品| 精品入口麻豆88视频| 免费的成人av| 日韩美女视频一区二区在线观看| 国产精品久久久久久妇女6080 | 国产一区福利在线| 久久综合色鬼综合色| 美女精品自拍一二三四| 日韩三级在线观看| 久久99久久99| 欧洲生活片亚洲生活在线观看| 精品区一区二区| 亚洲小说春色综合另类电影| 日本道在线观看一区二区| 亚洲午夜免费福利视频| 欧美日韩一卡二卡三卡 | 亚洲一区二区视频在线| 91麻豆精品一区二区三区| 亚洲欧美福利一区二区| 欧美三级视频在线播放| 午夜av区久久| 日韩午夜激情电影| 国产呦萝稀缺另类资源| 欧美群妇大交群中文字幕| 日本在线播放一区二区三区| 欧美精品久久99久久在免费线 | 加勒比av一区二区| 国产日韩亚洲欧美综合| 不卡一区二区在线| 一区二区三区电影在线播| 福利电影一区二区| 亚洲欧美综合网| 欧美日本在线视频| 激情综合色丁香一区二区| 国产精品三级久久久久三级| 国产中文字幕一区| 一色屋精品亚洲香蕉网站| 91国在线观看| 日韩av在线播放中文字幕| 久久色中文字幕| 中文字幕久久午夜不卡| 91在线视频播放地址| 亚洲国产精品久久久久婷婷884| 91在线免费视频观看| 偷窥少妇高潮呻吟av久久免费| 欧美三级视频在线| 狠狠色丁香婷综合久久| 亚洲欧美激情在线| 一本大道综合伊人精品热热| 天天亚洲美女在线视频| 国产情人综合久久777777| 国产成人亚洲综合a∨猫咪| 欧美精品一区二区久久婷婷| 91日韩精品一区| 蜜臀av一级做a爰片久久| 国产精品麻豆视频| 欧美一区二区三区啪啪| 成人精品小蝌蚪| 日韩国产欧美三级| 国产精品欧美一区喷水| 欧美一个色资源| 一本色道久久综合狠狠躁的推荐 | 免费一级片91| 日韩视频一区二区三区| 美女精品一区二区| 亚洲欧洲日本在线| 欧美影院午夜播放| 国产mv日韩mv欧美| 日本美女一区二区三区| 最好看的中文字幕久久| 精品少妇一区二区三区在线视频| 国产一区二区三区四区五区入口 | 一区二区免费看| 久久久久成人黄色影片| 欧美理论片在线| 91在线视频观看| 国产二区国产一区在线观看| 日韩av一区二区三区四区| 久久综合九色综合97_久久久| 国产成人免费网站| 日韩二区三区四区| 久久综合色婷婷| 91精品国产91久久久久久一区二区| 久久国内精品视频| 中文字幕乱码日本亚洲一区二区 | 日韩欧美国产一区二区在线播放| 免费成人在线观看| 亚洲成av人片在线观看| 亚洲精品中文在线影院| 欧美激情一区二区在线| 精品va天堂亚洲国产| 欧美一级日韩免费不卡| 国产成人精品午夜视频免费| 日本欧美肥老太交大片| 午夜国产不卡在线观看视频| 一区二区久久久| 亚洲人成7777| 精品久久人人做人人爰| 日韩一级高清毛片| 99精品视频一区二区三区| 高清av一区二区| 日韩精品成人一区二区三区| 国产日韩欧美精品综合| 国产亚洲欧美日韩俺去了|