Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="vtx"></param>
#else
        /// <summary>
        ///
        /// </summary>
        /// <param name="vtx"></param>
        /// <returns></returns>
#endif
        public static bool IS_GRAPH_VERTEX_VISITED(CvGraphVtx vtx)
        {
            if (vtx == null)
            {
                throw new ArgumentNullException("vtx");
            }
            return(IS_GRAPH_VERTEX_VISITED(vtx.CvPtr));
        }
Exemplo n.º 2
0
        /// <summary>
        /// グラフから辺を検出する(ポインタ指定)
        /// </summary>
        /// <param name="startVtx">辺の始点を示す頂点へのポインタ. </param>
        /// <param name="endVtx">辺の終点を示す頂点へのポインタ.無向グラフの場合,順序はどちらでもよい. </param>
        /// <returns>指定した二つの頂点を接続する辺</returns>
#else
        /// <summary>
        /// Finds edge in graph
        /// </summary>
        /// <param name="startVtx">Starting vertex of the edge. </param>
        /// <param name="endVtx">Ending vertex of the edge. For unoriented graph the order of the vertex parameters does not matter. </param>
        /// <returns>The function cvFindGraphEdge finds the graph edge connecting two specified vertices and returns pointer to it or NULL if the edge does not exists.</returns>
#endif
        public CvGraphEdge GraphFindEdgeByPtr(CvGraphVtx startVtx, CvGraphVtx endVtx)
        {
            return(Cv.GraphFindEdgeByPtr(this, startVtx, endVtx));
        }
Exemplo n.º 3
0
        /// <summary>
        /// グラフの深さ優先走査のためのクラスを生成する
        /// </summary>
        /// <param name="graph">グラフ</param>
        /// <param name="vtx">走査開始頂点.nullの場合,走査は先頭の頂点(頂点シーケンスのうち最小のインデックスを持つ頂点)から始まる.</param>
        /// <param name="mask">イベントマスク.どのイベントにユーザが着目したいのかを指定する.</param>
#else
        /// <summary>
        /// Creates structure for depth-first graph traversal
        /// </summary>
        /// <param name="graph">Graph. </param>
        /// <param name="vtx">Initial vertex to start from. If NULL, the traversal starts from the first vertex (a vertex with the minimal index in the sequence of vertices). </param>
        /// <param name="mask">Event mask indicating which events are interesting to the user (where cvNextGraphItem  function returns control to the user) It can be CV_GRAPH_ALL_ITEMS (all events are interesting) or combination of the following flags:
        /// <br/> * CV_GRAPH_VERTEX - stop at the graph vertices visited for the first time
        ///   <br/>* CV_GRAPH_TREE_EDGE - stop at tree edges (tree edge is the edge connecting the last visited vertex and the vertex to be visited next)
        /// <br/>* CV_GRAPH_BACK_EDGE - stop at back edges (back edge is an edge connecting the last visited vertex with some of its ancestors in the search tree)
        /// <br/>* CV_GRAPH_FORWARD_EDGE - stop at forward edges (forward edge is an edge conecting the last visited vertex with some of its descendants in the search tree). The forward edges are only possible during oriented graph traversal)
        ///   <br/>* CV_GRAPH_CROSS_EDGE - stop at cross edges (cross edge is an edge connecting different search trees or branches of the same tree. The cross edges are only possible during oriented graphs traversal)
        ///   <br/> * CV_GRAPH_ANY_EDGE - stop and any edge (tree, back, forward and cross edges)
        ///   <br/>* CV_GRAPH_NEW_TREE - stop in the beginning of every new search tree. When the traversal procedure visits all vertices and edges reachible from the initial vertex (the visited vertices together with tree edges make up a tree), it searches for some unvisited vertex in the graph and resumes the traversal process from that vertex. Before starting a new tree (including the very first tree when cvNextGraphItem is called for the first time) it generates CV_GRAPH_NEW_TREE event.
        ///    <br/> For unoriented graphs each search tree corresponds to a connected component of the graph.
        ///  <br/> * CV_GRAPH_BACKTRACKING - stop at every already visited vertex during backtracking - returning to already visited vertexes of the traversal tree.</param>
#endif
        public CvGraphScanner(CvGraph graph, CvGraphVtx vtx, GraphScannerMask mask)
            : this(CvInvoke.cvCreateGraphScanner(graph.CvPtr, (vtx == null) ? IntPtr.Zero : vtx.CvPtr, mask))
        {
        }
Exemplo n.º 4
0
        /// <summary>
        /// グラフの深さ優先走査のためのクラスを生成する
        /// </summary>
        /// <param name="graph">グラフ</param>
        /// <param name="vtx">走査開始頂点.nullの場合,走査は先頭の頂点(頂点シーケンスのうち最小のインデックスを持つ頂点)から始まる.</param>
#else
        /// <summary>
        /// Creates structure for depth-first graph traversal
        /// </summary>
        /// <param name="graph">Graph. </param>
        /// <param name="vtx">Initial vertex to start from. If NULL, the traversal starts from the first vertex (a vertex with the minimal index in the sequence of vertices). </param>
#endif
        public CvGraphScanner(CvGraph graph, CvGraphVtx vtx)
            : this(graph, vtx, GraphScannerMask.AllItems)
        {
        }
Exemplo n.º 5
0
        /// <summary>
        /// グラフ頂点のインデックスを返す
        /// </summary>
        /// <param name="vtx">グラフ頂点への参照</param>
        /// <returns>グラフ頂点のインデックスを返す</returns>
#else
        /// <summary>
        /// Returns index of graph vertex
        /// </summary>
        /// <param name="vtx">Graph vertex. </param>
        /// <returns>The function cvGraphVtxIdx returns index of the graph vertex.</returns>
#endif
        public int GraphVtxIdx(CvGraphVtx vtx)
        {
            return Cv.GraphVtxIdx(this, vtx);
        }
Exemplo n.º 6
0
        /// <summary>
        /// グラフの深さ優先走査のためのクラスを生成する
        /// </summary>
        /// <param name="graph">グラフ</param>
        /// <param name="vtx">走査開始頂点.nullの場合,走査は先頭の頂点(頂点シーケンスのうち最小のインデックスを持つ頂点)から始まる.</param>
#else
        /// <summary>
        /// Creates structure for depth-first graph traversal
        /// </summary>
        /// <param name="graph">Graph. </param>
        /// <param name="vtx">Initial vertex to start from. If NULL, the traversal starts from the first vertex (a vertex with the minimal index in the sequence of vertices). </param>
#endif
        public CvGraphScanner(CvGraph graph, CvGraphVtx vtx)
            : this(graph, vtx, GraphScannerMask.AllItems)
        {
        }
Exemplo n.º 7
0
        /// <summary>
        /// グラフ頂点のインデックスを返す
        /// </summary>
        /// <param name="vtx">グラフ頂点への参照</param>
        /// <returns>グラフ頂点のインデックスを返す</returns>
#else
        /// <summary>
        /// Returns index of graph vertex
        /// </summary>
        /// <param name="vtx">Graph vertex. </param>
        /// <returns>The function cvGraphVtxIdx returns index of the graph vertex.</returns>
#endif
        public int GraphVtxIdx(CvGraphVtx vtx)
        {
            return(Cv.GraphVtxIdx(this, vtx));
        }
Exemplo n.º 8
0
        /// <summary>
        /// グラフから頂点を削除する(ポインタ指定)
        /// </summary>
        /// <param name="vtx">削除される頂点へのポインタ</param>
        /// <returns>削除された辺の数,あるいは頂点がグラフに存在しない場合は-1</returns>
#else
        /// <summary>
        /// Removes vertex from graph
        /// </summary>
        /// <param name="vtx">Vertex to remove </param>
        /// <returns>The function cvGraphRemoveVtxByPtr removes a vertex from the graph together with all the edges incident to it. The function reports an error, if the vertex does not belong to the graph. The return value is number of edges deleted, or -1 if the vertex does not belong to the graph.</returns>
#endif
        public int GraphRemoveVtxByPtr(CvGraphVtx vtx)
        {
            return(Cv.GraphRemoveVtxByPtr(this, vtx));
        }
Exemplo n.º 9
0
        /// <summary>
        /// グラフに頂点を追加する
        /// </summary>
        /// <param name="vtx">追加される頂点の初期化に使用される,オプションの入力引数(sizeof(CvGraphVtx)の領域を超えたユーザー定義フィールドのみコピーされる). </param>
        /// <param name="inserted_vtx">新しい頂点のアドレスがここに書かれる.</param>
        /// <returns>頂点のインデックス</returns>
#else
        /// <summary>
        /// Adds vertex to graph
        /// </summary>
        /// <param name="vtx">Optional input argument used to initialize the added vertex (only user-defined fields beyond sizeof(CvGraphVtx) are copied). </param>
        /// <param name="inserted_vtx">The address of the new vertex is written there. </param>
        /// <returns>The function cvGraphAddVtx adds a vertex to the graph and returns the vertex index.</returns>
#endif
        public int GraphAddVtx(CvGraphVtx vtx, out CvGraphVtx inserted_vtx)
        {
            return Cv.GraphAddVtx(this, vtx, out inserted_vtx);
        }
Exemplo n.º 10
0
        /// <summary>
        /// グラフから辺を検出する(ポインタ指定)
        /// </summary>
        /// <param name="start_vtx">辺の始点を示す頂点へのポインタ. </param>
        /// <param name="end_vtx">辺の終点を示す頂点へのポインタ.無向グラフの場合,順序はどちらでもよい. </param>
        /// <returns>指定した二つの頂点を接続する辺</returns>
#else
        /// <summary>
        /// Finds edge in graph
        /// </summary>
        /// <param name="start_vtx">Starting vertex of the edge. </param>
        /// <param name="end_vtx">Ending vertex of the edge. For unoriented graph the order of the vertex parameters does not matter. </param>
        /// <returns>The function cvFindGraphEdge finds the graph edge connecting two specified vertices and returns pointer to it or NULL if the edge does not exists.</returns>
#endif
        public CvGraphEdge GraphFindEdgeByPtr(CvGraphVtx start_vtx, CvGraphVtx end_vtx)
        {
            return Cv.GraphFindEdgeByPtr(this, start_vtx, end_vtx);
        }
Exemplo n.º 11
0
        /// <summary>
        /// グラフから辺を検出する(ポインタ指定)
        /// </summary>
        /// <param name="graph">グラフ. </param>
        /// <param name="startVtx">辺の始点を示す頂点へのポインタ. </param>
        /// <param name="endVtx">辺の終点を示す頂点へのポインタ.無向グラフの場合,順序はどちらでもよい. </param>
        /// <returns>指定した二つの頂点を接続する辺</returns>
#else
        /// <summary>
        /// Finds edge in graph
        /// </summary>
        /// <param name="graph">Graph. </param>
        /// <param name="startVtx">Starting vertex of the edge. </param>
        /// <param name="endVtx">Ending vertex of the edge. For unoriented graph the order of the vertex parameters does not matter. </param>
        /// <returns>The function cvFindGraphEdge finds the graph edge connecting two specified vertices and returns pointer to it or NULL if the edge does not exists.</returns>
#endif
        public static CvGraphEdge GraphFindEdgeByPtr(CvGraph graph, CvGraphVtx startVtx, CvGraphVtx endVtx)
        {
            return FindGraphEdgeByPtr(graph, startVtx, endVtx);
        }
Exemplo n.º 12
0
        /// <summary>
        /// グラフから辺を検出する(ポインタ指定)
        /// </summary>
        /// <param name="graph">グラフ. </param>
        /// <param name="startVtx">辺の始点を示す頂点へのポインタ. </param>
        /// <param name="endVtx">辺の終点を示す頂点へのポインタ.無向グラフの場合,順序はどちらでもよい. </param>
        /// <returns>指定した二つの頂点を接続する辺</returns>
#else
        /// <summary>
        /// Finds edge in graph
        /// </summary>
        /// <param name="graph">Graph. </param>
        /// <param name="startVtx">Starting vertex of the edge. </param>
        /// <param name="endVtx">Ending vertex of the edge. For unoriented graph the order of the vertex parameters does not matter. </param>
        /// <returns>The function cvFindGraphEdge finds the graph edge connecting two specified vertices and returns pointer to it or NULL if the edge does not exists.</returns>
#endif
        public static CvGraphEdge FindGraphEdgeByPtr(CvGraph graph, CvGraphVtx startVtx, CvGraphVtx endVtx)
        {
            if (graph == null)
                throw new ArgumentNullException("graph");
            if (startVtx == null)
                throw new ArgumentNullException("startVtx");
            if (endVtx == null)
                throw new ArgumentNullException("endVtx");
            
            IntPtr result = NativeMethods.cvFindGraphEdgeByPtr(graph.CvPtr, startVtx.CvPtr, endVtx.CvPtr);
            if (result == IntPtr.Zero) 
                return null; 
            else 
                return new CvGraphEdge(result); 
        }
Exemplo n.º 13
0
        /// <summary>
        /// グラフから辺を検出する(ポインタ指定)
        /// </summary>
        /// <param name="startVtx">辺の始点を示す頂点へのポインタ. </param>
        /// <param name="endVtx">辺の終点を示す頂点へのポインタ.無向グラフの場合,順序はどちらでもよい. </param>
        /// <returns>指定した二つの頂点を接続する辺</returns>
#else
        /// <summary>
        /// Finds edge in graph
        /// </summary>
        /// <param name="startVtx">Starting vertex of the edge. </param>
        /// <param name="endVtx">Ending vertex of the edge. For unoriented graph the order of the vertex parameters does not matter. </param>
        /// <returns>The function cvFindGraphEdge finds the graph edge connecting two specified vertices and returns pointer to it or NULL if the edge does not exists.</returns>
#endif
        public CvGraphEdge FindGraphEdgeByPtr(CvGraphVtx startVtx, CvGraphVtx endVtx)
        {
            return Cv.FindGraphEdgeByPtr(this, startVtx, endVtx);
        }
Exemplo n.º 14
0
        /// <summary>
        /// グラフの深さ優先走査のためのクラスを生成する
        /// </summary>
        /// <param name="graph">グラフ</param>
        /// <param name="vtx">走査開始頂点.nullの場合,走査は先頭の頂点(頂点シーケンスのうち最小のインデックスを持つ頂点)から始まる.</param>
        /// <param name="mask">イベントマスク.どのイベントにユーザが着目したいのかを指定する.</param>
#else
        /// <summary>
        /// Creates structure for depth-first graph traversal
        /// </summary>
        /// <param name="graph">Graph. </param>
        /// <param name="vtx">Initial vertex to start from. If NULL, the traversal starts from the first vertex (a vertex with the minimal index in the sequence of vertices). </param>
        /// <param name="mask">Event mask indicating which events are interesting to the user (where cvNextGraphItem  function returns control to the user) It can be CV_GRAPH_ALL_ITEMS (all events are interesting) or combination of the following flags:
        /// <br/> * CV_GRAPH_VERTEX - stop at the graph vertices visited for the first time
        ///   <br/>* CV_GRAPH_TREE_EDGE - stop at tree edges (tree edge is the edge connecting the last visited vertex and the vertex to be visited next)
        /// <br/>* CV_GRAPH_BACK_EDGE - stop at back edges (back edge is an edge connecting the last visited vertex with some of its ancestors in the search tree)
        /// <br/>* CV_GRAPH_FORWARD_EDGE - stop at forward edges (forward edge is an edge conecting the last visited vertex with some of its descendants in the search tree). The forward edges are only possible during oriented graph traversal)
        ///   <br/>* CV_GRAPH_CROSS_EDGE - stop at cross edges (cross edge is an edge connecting different search trees or branches of the same tree. The cross edges are only possible during oriented graphs traversal)
        ///   <br/> * CV_GRAPH_ANY_EDGE - stop and any edge (tree, back, forward and cross edges)
        ///   <br/>* CV_GRAPH_NEW_TREE - stop in the beginning of every new search tree. When the traversal procedure visits all vertices and edges reachible from the initial vertex (the visited vertices together with tree edges make up a tree), it searches for some unvisited vertex in the graph and resumes the traversal process from that vertex. Before starting a new tree (including the very first tree when cvNextGraphItem is called for the first time) it generates CV_GRAPH_NEW_TREE event.
        ///    <br/> For unoriented graphs each search tree corresponds to a connected component of the graph.
        ///  <br/> * CV_GRAPH_BACKTRACKING - stop at every already visited vertex during backtracking - returning to already visited vertexes of the traversal tree.</param>
#endif
        public CvGraphScanner(CvGraph graph, CvGraphVtx vtx, GraphScannerMask mask)
            : this(NativeMethods.cvCreateGraphScanner(graph.CvPtr, (vtx == null) ? IntPtr.Zero : vtx.CvPtr, mask))
        {
        }
Exemplo n.º 15
0
        /// <summary>
        /// グラフに頂点を追加する
        /// </summary>
        /// <param name="vtx">追加される頂点の初期化に使用される,オプションの入力引数(sizeof(CvGraphVtx)の領域を超えたユーザー定義フィールドのみコピーされる). </param>
        /// <param name="insertedVtx">新しい頂点のアドレスがここに書かれる.</param>
        /// <returns>頂点のインデックス</returns>
#else
        /// <summary>
        /// Adds vertex to graph
        /// </summary>
        /// <param name="vtx">Optional input argument used to initialize the added vertex (only user-defined fields beyond sizeof(CvGraphVtx) are copied). </param>
        /// <param name="insertedVtx">The address of the new vertex is written there. </param>
        /// <returns>The function cvGraphAddVtx adds a vertex to the graph and returns the vertex index.</returns>
#endif
        public int GraphAddVtx(CvGraphVtx vtx, out CvGraphVtx insertedVtx)
        {
            return(Cv.GraphAddVtx(this, vtx, out insertedVtx));
        }
Exemplo n.º 16
0
        /// <summary>
        /// グラフから辺を削除する(ポインタ指定)
        /// </summary>
        /// <param name="startVtx">辺の始点を示す頂点へのポインタ.</param>
        /// <param name="endVtx">辺の終点を示す頂点へのポインタ.無向グラフの場合,順序はどちらでもよい. </param>
#else
        /// <summary>
        /// Removes edge from graph
        /// </summary>
        /// <param name="startVtx">Starting vertex of the edge. </param>
        /// <param name="endVtx">Ending vertex of the edge. For unoriented graph the order of the vertex parameters does not matter. </param>
        /// <remarks>The function cvGraphRemoveEdgeByPtr removes the edge connecting two specified vertices. If the vertices are not connected [in that order], the function does nothing.</remarks>
#endif
        public void GraphRemoveEdgeByPtr(CvGraphVtx startVtx, CvGraphVtx endVtx)
        {
            Cv.GraphRemoveEdgeByPtr(this, startVtx, endVtx);
        }
Exemplo n.º 17
0
        /// <summary>
        /// グラフから辺を削除する(ポインタ指定)
        /// </summary>
        /// <param name="start_vtx">辺の始点を示す頂点へのポインタ.</param>
        /// <param name="end_vtx">辺の終点を示す頂点へのポインタ.無向グラフの場合,順序はどちらでもよい. </param>
#else
        /// <summary>
        /// Removes edge from graph
        /// </summary>
        /// <param name="start_vtx">Starting vertex of the edge. </param>
        /// <param name="end_vtx">Ending vertex of the edge. For unoriented graph the order of the vertex parameters does not matter. </param>
        /// <remarks>The function cvGraphRemoveEdgeByPtr removes the edge connecting two specified vertices. If the vertices are not connected [in that order], the function does nothing.</remarks>
#endif
        public void GraphRemoveEdgeByPtr(CvGraphVtx start_vtx, CvGraphVtx end_vtx)
        {
            Cv.GraphRemoveEdgeByPtr(this, start_vtx, end_vtx);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 頂点に接続している辺の数を数える(ポインタ指定)
        /// </summary>
        /// <param name="vtx">頂点へのポインタ</param>
        /// <returns>指定した頂点に接続した(入る/出る両方向の)辺の数</returns>
#else
        /// <summary>
        /// Counts edges indicent to the vertex
        /// </summary>
        /// <param name="vtx">Index of the graph vertex.  </param>
        /// <returns>The function cvGraphVtxDegree returns the number of edges incident to the specified vertex, both incoming and outcoming.</returns>
#endif
        public int GraphVtxDegreeByPtr(CvGraphVtx vtx)
        {
            return(Cv.GraphVtxDegreeByPtr(this, vtx));
        }
Exemplo n.º 19
0
        /// <summary>
        /// グラフから頂点を削除する(ポインタ指定)
        /// </summary>
        /// <param name="vtx">削除される頂点へのポインタ</param>
        /// <returns>削除された辺の数,あるいは頂点がグラフに存在しない場合は-1</returns>
#else
        /// <summary>
        /// Removes vertex from graph
        /// </summary>
        /// <param name="vtx">Vertex to remove </param>
        /// <returns>The function cvGraphRemoveVtxByPtr removes a vertex from the graph together with all the edges incident to it. The function reports an error, if the vertex does not belong to the graph. The return value is number of edges deleted, or -1 if the vertex does not belong to the graph.</returns>
#endif
        public int GraphRemoveVtxByPtr(CvGraphVtx vtx)
        {
            return Cv.GraphRemoveVtxByPtr(this, vtx);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 頂点に接続している辺の数を数える(ポインタ指定)
        /// </summary>
        /// <param name="vtx">頂点へのポインタ</param>
        /// <returns>指定した頂点に接続した(入る/出る両方向の)辺の数</returns>
#else
        /// <summary>
        /// Counts edges indicent to the vertex
        /// </summary>
        /// <param name="vtx">Index of the graph vertex.  </param>
        /// <returns>The function cvGraphVtxDegree returns the number of edges incident to the specified vertex, both incoming and outcoming.</returns>
#endif
        public int GraphVtxDegreeByPtr(CvGraphVtx vtx)
        {
            return Cv.GraphVtxDegreeByPtr(this, vtx);
        }
Exemplo n.º 21
0
        /// <summary>
        /// グラフから辺を検出する(ポインタ指定)
        /// </summary>
        /// <param name="graph">グラフ. </param>
        /// <param name="start_vtx">辺の始点を示す頂点へのポインタ. </param>
        /// <param name="end_vtx">辺の終点を示す頂点へのポインタ.無向グラフの場合,順序はどちらでもよい. </param>
        /// <returns>指定した二つの頂点を接続する辺</returns>
#else
        /// <summary>
        /// Finds edge in graph
        /// </summary>
        /// <param name="graph">Graph. </param>
        /// <param name="start_vtx">Starting vertex of the edge. </param>
        /// <param name="end_vtx">Ending vertex of the edge. For unoriented graph the order of the vertex parameters does not matter. </param>
        /// <returns>The function cvFindGraphEdge finds the graph edge connecting two specified vertices and returns pointer to it or NULL if the edge does not exists.</returns>
#endif
        public static CvGraphEdge FindGraphEdgeByPtr(CvGraph graph, CvGraphVtx start_vtx, CvGraphVtx end_vtx)
        {
            if (graph == null)
            {
                throw new ArgumentNullException("graph");
            }
            if (start_vtx == null)
            {
                throw new ArgumentNullException("start_vtx");
            }
            if (end_vtx == null)
            {
                throw new ArgumentNullException("end_vtx");
            }
            IntPtr result = CvInvoke.cvFindGraphEdgeByPtr(graph.CvPtr, start_vtx.CvPtr, end_vtx.CvPtr);
            if (result == IntPtr.Zero) { return null; }
            else { return new CvGraphEdge(result); }
        }