cvlee.cpp.svn-base
来自「非结构化路识别」· SVN-BASE 代码 · 共 1,445 行 · 第 1/5 页
SVN-BASE
1,445 行
// Return: 1, if convertion was succesfully completed
// 0, if some error occures
//F*/
/*
OPENCVAPI int _cvConvert(CvVoronoiDiagram2D* VoronoiDiagram,
CvMemStorage* VoronoiStorage,
int change_orientation);
*/
OPENCVAPI int _cvConvert(CvVoronoiDiagram2D* VoronoiDiagram,
CvVoronoiDiagramInt VoronoiDiagramInt,
CvSet* &NewSiteSeqPrev,
CvSeqWriter &NodeWriter,
CvSeqWriter &EdgeWriter,
CvMemStorage* VoronoiStorage,
int change_orientation);
/*F///////////////////////////////////////////////////////////////////////////////////////
// Author: Andrey Sobolev
// Name: _cvConvertSameOrientation
// Purpose : Function convert internal representation of VD (via
// structs CvVoronoiSiteInt, CvVoronoiEdgeInt,CvVoronoiNodeInt) into
// external representation of VD (via structs CvVoronoiSite2D, CvVoronoiEdge2D,
// CvVoronoiNode2D) without change of orientation
// Context:
// Parameters:
// VoronoiDiagram: in
// VoronoiStorage: in
/
// Return: 1, if convertion was succesfully completed
// 0, if some error occures
//F*/
/*
OPENCVAPI int _cvConvertSameOrientation(CvVoronoiDiagram2D* VoronoiDiagram,
CvMemStorage* VoronoiStorage);
*/
OPENCVAPI int _cvConvertSameOrientation(CvVoronoiDiagram2D* VoronoiDiagram,
CvVoronoiDiagramInt VoronoiDiagramInt,
CvSet* &NewSiteSeqPrev,
CvSeqWriter &NodeWriter,
CvSeqWriter &EdgeWriter,
CvMemStorage* VoronoiStorage);
/*F///////////////////////////////////////////////////////////////////////////////////////
// Author: Andrey Sobolev
// Name: _cvConvertChangeOrientation
// Purpose : Function convert internal representation of VD (via
// structs CvVoronoiSiteInt, CvVoronoiEdgeInt,CvVoronoiNodeInt) into
// external representation of VD (via structs CvVoronoiSite2D, CvVoronoiEdge2D,
// CvVoronoiNode2D) with change of orientation
// Context:
// Parameters:
// VoronoiDiagram: in
// VoronoiStorage: in
/
// Return: 1, if convertion was succesfully completed
// 0, if some error occures
//F*/
/*
OPENCVAPI int _cvConvertChangeOrientation(CvVoronoiDiagram2D* VoronoiDiagram,
CvMemStorage* VoronoiStorage);
*/
OPENCVAPI int _cvConvertChangeOrientation(CvVoronoiDiagram2D* VoronoiDiagram,
CvVoronoiDiagramInt VoronoiDiagramInt,
CvSet* &NewSiteSeqPrev,
CvSeqWriter &NodeWriter,
CvSeqWriter &EdgeWriter,
CvMemStorage* VoronoiStorage);
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Compute sites for external polygon.
Arguments
pVoronoiDiagram : in, pointer to struct, which contains the
description of Voronoi Diagram
ContourSeq : in, vertices of polygon
pReflexSite: out, pointer to reflex site,if any exist,else NULL
orientation: in, orientation of contour ( = 1 or = -1)
type: in, type of vertices. The possible values are (int)1,
(float)1,(double)1.
Return: 1, if sites were succesfully constructed
0, if some error occures :
--------------------------------------------------------------------------*/
template<class T>
int _cvConstructExtSites(CvVoronoiDiagramInt* pVoronoiDiagram,
CvSeq* ContourSeq,
int orientation,
T /*type*/);
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Compute sites for internal polygon (for hole).
Arguments
pVoronoiDiagram : in, pointer to struct, which contains the
description of Voronoi Diagram
CurrSiteSeq: in, the sequence for sites to be constructed
CurrContourSeq : in, vertices of polygon
pTopSite: out, pointer to the most left site of polygon (it is the most left
vertex of polygon)
orientation: in, orientation of contour ( = 1 or = -1)
type: in, type of vertices. The possible values are (int)1,
(float)1,(double)1.
Return: 1, if sites were succesfully constructed
0, if some error occures :
--------------------------------------------------------------------------*/
template<class T>
int _cvConstructIntSites(CvVoronoiDiagramInt* pVoronoiDiagram,
CvSeq* CurrSiteSeq,
CvSeq* CurrContourSeq,
pCvVoronoiSite &pTopSite,
int orientation,
T /*type*/);
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Compute the simple chains of sites for external polygon.
Arguments
pVoronoiDiagram : in&out, pointer to struct, which contains the
description of Voronoi Diagram
Return: 1, if chains were succesfully constructed
0, if some error occures
--------------------------------------------------------------------------*/
OPENCVAPI int _cvConstructExtChains(CvVoronoiDiagramInt* pVoronoiDiagram);
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Compute the simple chains of sites for internal polygon (= hole)
Arguments
pVoronoiDiagram : in, pointer to struct, which contains the
description of Voronoi Diagram
CurrSiteSeq : in, the sequence of sites
CurrChainSeq : in,the sequence for chains to be constructed
pTopSite : in, the most left site of hole
Return :
--------------------------------------------------------------------------*/
OPENCVAPI void _cvConstructIntChains(CvVoronoiDiagramInt* pVoronoiDiagram,
CvSeq* CurrChainSeq,
CvSeq* CurrSiteSeq,
pCvVoronoiSite pTopSite);
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Compute the initial Voronoi Diagram for single site
Arguments
pVoronoiDiagram : in, pointer to struct, which contains the
description of Voronoi Diagram
pSite: in, pointer to site
Return :
--------------------------------------------------------------------------*/
OPENCVAPI void _cvConstructEdges(pCvVoronoiSite pSite,CvVoronoiDiagramInt* pVoronoiDiagram);
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Function moves each node on small random value. The nodes are taken
from pVoronoiDiagram->NodeSeq.
Arguments
pVoronoiDiagram : in, pointer to struct, which contains the
description of Voronoi Diagram
begin,end: in, the first and the last nodes in pVoronoiDiagram->NodeSeq,
which moves
shift: in, the value of maximal shift.
Return :
--------------------------------------------------------------------------*/
OPENCVAPI void _cvRandomModification(CvVoronoiDiagramInt* pVoronoiDiagram, int begin, int end, float shift);
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Compute the internal Voronoi Diagram for external polygon.
Arguments
pVoronoiDiagram : in, pointer to struct, which contains the
description of Voronoi Diagram
Return : 1, if VD was constructed succesfully
0, if some error occure
--------------------------------------------------------------------------*/
OPENCVAPI int _cvConstructExtVD(CvVoronoiDiagramInt* pVoronoiDiagram);
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Compute the external Voronoi Diagram for each internal polygon (hole).
Arguments
pVoronoiDiagram : in, pointer to struct, which contains the
description of Voronoi Diagram
Return :
--------------------------------------------------------------------------*/
OPENCVAPI void _cvConstructIntVD(CvVoronoiDiagramInt* pVoronoiDiagram);
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Function joins the Voronoi Diagrams of different
chains into one Voronoi Diagram
Arguments
pVoronoiDiagram : in, pointer to struct, which contains the
description of Voronoi Diagram
pChain1,pChain1: in, given chains
Return : 1, if joining was succesful
0, if some error occure
--------------------------------------------------------------------------*/
OPENCVAPI int _cvJoinChains(pCvVoronoiChain pChain1,
pCvVoronoiChain pChain2,
CvVoronoiDiagramInt* pVoronoiDiagram);
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Function finds the nearest site for top vertex
(= the most left vertex) of each hole
Arguments
pVoronoiDiagram : in, pointer to struct, which contains the
description of Voronoi Diagram
Return :
--------------------------------------------------------------------------*/
OPENCVAPI void _cvFindNearestSite(CvVoronoiDiagramInt* pVoronoiDiagram);
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Function seeks for site, which has common bisector in
final VD with top vertex of given hole. It stores in pHole->opposite_site.
The search begins from Hole->nearest_site and realizes in clockwise
direction around the top vertex of given hole.
Arguments
pVoronoiDiagram : in, pointer to struct, which contains the
description of Voronoi Diagram
pHole : in, given hole
Return : 1, if the search was succesful
0, if some error occure
--------------------------------------------------------------------------*/
OPENCVAPI int _cvFindOppositSiteCW(pCvVoronoiHole pHole, CvVoronoiDiagramInt* pVoronoiDiagram);
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Function seeks for site, which has common bisector in
final VD with top vertex of given hole. It stores in pHole->opposite_site.
The search begins from Hole->nearest_site and realizes in counterclockwise
direction around the top vertex of given hole.
Arguments
pVoronoiDiagram : in, pointer to struct, which contains the
description of Voronoi Diagram
pHole : in, given hole
Return : 1, if the search was succesful
0, if some error occure
--------------------------------------------------------------------------*/
OPENCVAPI int _cvFindOppositSiteCCW(pCvVoronoiHole pHole,CvVoronoiDiagramInt* pVoronoiDiagram);
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Function merges external VD of hole and internal VD, which was
constructed ealier.
Arguments
pVoronoiDiagram : in, pointer to struct, which contains the
description of Voronoi Diagram
pHole : in, given hole
Return : 1, if merging was succesful
0, if some error occure
--------------------------------------------------------------------------*/
OPENCVAPI int _cvMergeVD(pCvVoronoiHole pHole,CvVoronoiDiagramInt* pVoronoiDiagram);
/*////////////////////////////////////////////////////////////////////////////////////////
// Computation of bisectors //
////////////////////////////////////////////////////////////////////////////////////////*/
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Compute the bisector of two sites
Arguments
pSite_left,pSite_right: in, given sites
pVoronoiDiagram : in, pointer to struct, which contains the
description of Voronoi Diagram
pEdge : out, bisector
Return :
--------------------------------------------------------------------------*/
void _cvCalcEdge(pCvVoronoiSite pSite_left,
pCvVoronoiSite pSite_right,
pCvVoronoiEdge pEdge,
CvVoronoiDiagramInt* pVoronoiDiagram);
/*--------------------------------------------------------------------------
Author : Andrey Sobolev
Description : Compute the bisector of point and site
Arguments
pSite : in, site
pNode : in, point
pVoronoiDiagram : in, pointer to struct, which contains the
description of Voronoi Diagram
pEdge : out, bisector
Return :
--------------------------------------------------------------------------*/
void _cvCalcEdge(pCvVoronoiSite pSite,
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?