OpenCV for Unity  2.6.0
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.9.0/index.html ) for the details of the argument of the method.
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
OpenCVForUnity.ImgprocModule.Subdiv2D Class Reference
Inheritance diagram for OpenCVForUnity.ImgprocModule.Subdiv2D:
OpenCVForUnity.DisposableOpenCVObject OpenCVForUnity.DisposableObject

Public Member Functions

IntPtr getNativeObjAddr ()
 
 Subdiv2D ()
 
 Subdiv2D (Rect rect)
 
void initDelaunay (Rect rect)
 Creates a new empty Delaunay subdivision. More...
 
int insert (Point pt)
 Insert a single point into a Delaunay triangulation. More...
 
void insert (MatOfPoint2f ptvec)
 Insert multiple points into a Delaunay triangulation. More...
 
int locate (Point pt, int[] edge, int[] vertex)
 Returns the location of a point within a Delaunay triangulation. More...
 
int findNearest (Point pt, Point nearestPt)
 Finds the subdivision vertex closest to the given point. More...
 
int findNearest (Point pt)
 Finds the subdivision vertex closest to the given point. More...
 
void getEdgeList (MatOfFloat4 edgeList)
 Returns a list of all edges. More...
 
void getLeadingEdgeList (MatOfInt leadingEdgeList)
 Returns a list of the leading edge ID connected to each triangle. More...
 
void getTriangleList (MatOfFloat6 triangleList)
 Returns a list of all triangles. More...
 
void getVoronoiFacetList (MatOfInt idx, List< MatOfPoint2f > facetList, MatOfPoint2f facetCenters)
 Returns a list of all Voronoi facets. More...
 
Point getVertex (int vertex, int[] firstEdge)
 Returns vertex location from vertex ID. More...
 
Point getVertex (int vertex)
 Returns vertex location from vertex ID. More...
 
int getEdge (int edge, int nextEdgeType)
 Returns one of the edges related to the given edge. More...
 
int nextEdge (int edge)
 Returns next edge around the edge origin. More...
 
int rotateEdge (int edge, int rotate)
 Returns another edge of the same quad-edge. More...
 
int symEdge (int edge)
 
int edgeOrg (int edge, Point orgpt)
 Returns the edge origin. More...
 
int edgeOrg (int edge)
 Returns the edge origin. More...
 
int edgeDst (int edge, Point dstpt)
 Returns the edge destination. More...
 
int edgeDst (int edge)
 Returns the edge destination. More...
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Static Public Member Functions

static Subdiv2D __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 

Public Attributes

const int PTLOC_ERROR = -2
 
const int PTLOC_OUTSIDE_RECT = -1
 
const int PTLOC_INSIDE = 0
 
const int PTLOC_VERTEX = 1
 
const int PTLOC_ON_EDGE = 2
 
const int NEXT_AROUND_ORG = 0x00
 
const int NEXT_AROUND_DST = 0x22
 
const int PREV_AROUND_ORG = 0x11
 
const int PREV_AROUND_DST = 0x33
 
const int NEXT_AROUND_LEFT = 0x13
 
const int NEXT_AROUND_RIGHT = 0x31
 
const int PREV_AROUND_LEFT = 0x20
 
const int PREV_AROUND_RIGHT = 0x02
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Properties inherited from OpenCVForUnity.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

Constructor & Destructor Documentation

◆ Subdiv2D() [1/2]

OpenCVForUnity.ImgprocModule.Subdiv2D.Subdiv2D ( )

creates an empty Subdiv2D object. To create a new empty Delaunay subdivision you need to use the initDelaunay function.

◆ Subdiv2D() [2/2]

OpenCVForUnity.ImgprocModule.Subdiv2D.Subdiv2D ( Rect  rect)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
rectRectangle that includes all of the 2D points that are to be added to the subdivision.
The function creates an empty Delaunay subdivision where 2D points can be added using the function
insert() . All of the points to be added must be within the specified rectangle, otherwise a runtime
error is raised.

Member Function Documentation

◆ __fromPtr__()

static Subdiv2D OpenCVForUnity.ImgprocModule.Subdiv2D.__fromPtr__ ( IntPtr  addr)
static

◆ Dispose()

override void OpenCVForUnity.ImgprocModule.Subdiv2D.Dispose ( bool  disposing)
protectedvirtual

◆ edgeDst() [1/2]

int OpenCVForUnity.ImgprocModule.Subdiv2D.edgeDst ( int  edge,
Point  dstpt 
)

Returns the edge destination.

Parameters
edgeSubdivision edge ID.
dstptOutput vertex location.
@returns vertex ID.

◆ edgeDst() [2/2]

int OpenCVForUnity.ImgprocModule.Subdiv2D.edgeDst ( int  edge)

Returns the edge destination.

Parameters
edgeSubdivision edge ID.
dstptOutput vertex location.
@returns vertex ID.

◆ edgeOrg() [1/2]

int OpenCVForUnity.ImgprocModule.Subdiv2D.edgeOrg ( int  edge,
Point  orgpt 
)

Returns the edge origin.

Parameters
edgeSubdivision edge ID.
orgptOutput vertex location.
@returns vertex ID.

◆ edgeOrg() [2/2]

int OpenCVForUnity.ImgprocModule.Subdiv2D.edgeOrg ( int  edge)

Returns the edge origin.

Parameters
edgeSubdivision edge ID.
orgptOutput vertex location.
@returns vertex ID.

◆ findNearest() [1/2]

int OpenCVForUnity.ImgprocModule.Subdiv2D.findNearest ( Point  pt,
Point  nearestPt 
)

Finds the subdivision vertex closest to the given point.

Parameters
ptInput point.
nearestPtOutput subdivision vertex point.
The function is another function that locates the input point within the subdivision. It finds the
subdivision vertex that is the closest to the input point. It is not necessarily one of vertices
of the facet containing the input point, though the facet (located using locate() ) is used as a
starting point.

@returns vertex ID.

◆ findNearest() [2/2]

int OpenCVForUnity.ImgprocModule.Subdiv2D.findNearest ( Point  pt)

Finds the subdivision vertex closest to the given point.

Parameters
ptInput point.
nearestPtOutput subdivision vertex point.
The function is another function that locates the input point within the subdivision. It finds the
subdivision vertex that is the closest to the input point. It is not necessarily one of vertices
of the facet containing the input point, though the facet (located using locate() ) is used as a
starting point.

@returns vertex ID.

◆ getEdge()

int OpenCVForUnity.ImgprocModule.Subdiv2D.getEdge ( int  edge,
int  nextEdgeType 
)

Returns one of the edges related to the given edge.

Parameters
edgeSubdivision edge ID.
nextEdgeTypeParameter specifying which of the related edges to return. The following values are possible:
  • NEXT_AROUND_ORG next around the edge origin ( eOnext on the picture below if e is the input edge)
  • NEXT_AROUND_DST next around the edge vertex ( eDnext )
  • PREV_AROUND_ORG previous around the edge origin (reversed eRnext )
  • PREV_AROUND_DST previous around the edge destination (reversed eLnext )
  • NEXT_AROUND_LEFT next around the left facet ( eLnext )
  • NEXT_AROUND_RIGHT next around the right facet ( eRnext )
  • PREV_AROUND_LEFT previous around the left facet (reversed eOnext )
  • PREV_AROUND_RIGHT previous around the right facet (reversed eDnext )
quadedge.png
sample output
Returns
edge ID related to the input edge.

◆ getEdgeList()

void OpenCVForUnity.ImgprocModule.Subdiv2D.getEdgeList ( MatOfFloat4  edgeList)

Returns a list of all edges.

Parameters
edgeListOutput vector.
The function gives each edge as a 4 numbers vector, where each two are one of the edge
vertices. i.e. org_x = v[0], org_y = v[1], dst_x = v[2], dst_y = v[3].

◆ getLeadingEdgeList()

void OpenCVForUnity.ImgprocModule.Subdiv2D.getLeadingEdgeList ( MatOfInt  leadingEdgeList)

Returns a list of the leading edge ID connected to each triangle.

Parameters
leadingEdgeListOutput vector.
The function gives one edge ID for each triangle.

◆ getNativeObjAddr()

IntPtr OpenCVForUnity.ImgprocModule.Subdiv2D.getNativeObjAddr ( )

◆ getTriangleList()

void OpenCVForUnity.ImgprocModule.Subdiv2D.getTriangleList ( MatOfFloat6  triangleList)

Returns a list of all triangles.

Parameters
triangleListOutput vector.
The function gives each triangle as a 6 numbers vector, where each two are one of the triangle
vertices. i.e. p1_x = v[0], p1_y = v[1], p2_x = v[2], p2_y = v[3], p3_x = v[4], p3_y = v[5].

◆ getVertex() [1/2]

Point OpenCVForUnity.ImgprocModule.Subdiv2D.getVertex ( int  vertex,
int []  firstEdge 
)

Returns vertex location from vertex ID.

Parameters
vertexvertex ID.
firstEdgeOptional. The first edge ID which is connected to the vertex.
Returns
vertex (x,y)

◆ getVertex() [2/2]

Point OpenCVForUnity.ImgprocModule.Subdiv2D.getVertex ( int  vertex)

Returns vertex location from vertex ID.

Parameters
vertexvertex ID.
firstEdgeOptional. The first edge ID which is connected to the vertex.
Returns
vertex (x,y)

◆ getVoronoiFacetList()

void OpenCVForUnity.ImgprocModule.Subdiv2D.getVoronoiFacetList ( MatOfInt  idx,
List< MatOfPoint2f facetList,
MatOfPoint2f  facetCenters 
)

Returns a list of all Voronoi facets.

Parameters
idxVector of vertices IDs to consider. For all vertices you can pass empty vector.
facetListOutput vector of the Voronoi facets.
facetCentersOutput vector of the Voronoi facets center points.

◆ initDelaunay()

void OpenCVForUnity.ImgprocModule.Subdiv2D.initDelaunay ( Rect  rect)

Creates a new empty Delaunay subdivision.

Parameters
rectRectangle that includes all of the 2D points that are to be added to the subdivision.

◆ insert() [1/2]

int OpenCVForUnity.ImgprocModule.Subdiv2D.insert ( Point  pt)

Insert a single point into a Delaunay triangulation.

Parameters
ptPoint to insert.
The function inserts a single point into a subdivision and modifies the subdivision topology
appropriately. If a point with the same coordinates exists already, no new point is added.
@returns the ID of the point.

@note If the point is outside of the triangulation specified rect a runtime error is raised.

◆ insert() [2/2]

void OpenCVForUnity.ImgprocModule.Subdiv2D.insert ( MatOfPoint2f  ptvec)

Insert multiple points into a Delaunay triangulation.

Parameters
ptvecPoints to insert.
The function inserts a vector of points into a subdivision and modifies the subdivision topology
appropriately.

◆ locate()

int OpenCVForUnity.ImgprocModule.Subdiv2D.locate ( Point  pt,
int []  edge,
int []  vertex 
)

Returns the location of a point within a Delaunay triangulation.

Parameters
ptPoint to locate.
edgeOutput edge that the point belongs to or is located to the right of it.
vertexOptional output vertex the input point coincides with.
The function locates the input point within the subdivision and gives one of the triangle edges
or vertices.

@returns an integer which specify one of the following five cases for point location:
-  The point falls into some facet. The function returns #PTLOC_INSIDE and edge will contain one of
   edges of the facet.
-  The point falls onto the edge. The function returns #PTLOC_ON_EDGE and edge will contain this edge.
-  The point coincides with one of the subdivision vertices. The function returns #PTLOC_VERTEX and
   vertex will contain a pointer to the vertex.
-  The point is outside the subdivision reference rectangle. The function returns #PTLOC_OUTSIDE_RECT
   and no pointers are filled.
-  One of input arguments is invalid. A runtime error is raised or, if silent or "parent" error
   processing mode is selected, #PTLOC_ERROR is returned.

◆ nextEdge()

int OpenCVForUnity.ImgprocModule.Subdiv2D.nextEdge ( int  edge)

Returns next edge around the edge origin.

Parameters
edgeSubdivision edge ID.
@returns an integer which is next edge ID around the edge origin: eOnext on the
picture above if e is the input edge).

◆ rotateEdge()

int OpenCVForUnity.ImgprocModule.Subdiv2D.rotateEdge ( int  edge,
int  rotate 
)

Returns another edge of the same quad-edge.

Parameters
edgeSubdivision edge ID.
rotateParameter specifying which of the edges of the same quad-edge as the input one to return. The following values are possible:
  • 0 - the input edge ( e on the picture below if e is the input edge)
  • 1 - the rotated edge ( eRot )
  • 2 - the reversed edge (reversed e (in green))
  • 3 - the reversed rotated edge (reversed eRot (in green))
Returns
one of the edges ID of the same quad-edge as the input edge.

◆ symEdge()

int OpenCVForUnity.ImgprocModule.Subdiv2D.symEdge ( int  edge)

Member Data Documentation

◆ NEXT_AROUND_DST

const int OpenCVForUnity.ImgprocModule.Subdiv2D.NEXT_AROUND_DST = 0x22

◆ NEXT_AROUND_LEFT

const int OpenCVForUnity.ImgprocModule.Subdiv2D.NEXT_AROUND_LEFT = 0x13

◆ NEXT_AROUND_ORG

const int OpenCVForUnity.ImgprocModule.Subdiv2D.NEXT_AROUND_ORG = 0x00

◆ NEXT_AROUND_RIGHT

const int OpenCVForUnity.ImgprocModule.Subdiv2D.NEXT_AROUND_RIGHT = 0x31

◆ PREV_AROUND_DST

const int OpenCVForUnity.ImgprocModule.Subdiv2D.PREV_AROUND_DST = 0x33

◆ PREV_AROUND_LEFT

const int OpenCVForUnity.ImgprocModule.Subdiv2D.PREV_AROUND_LEFT = 0x20

◆ PREV_AROUND_ORG

const int OpenCVForUnity.ImgprocModule.Subdiv2D.PREV_AROUND_ORG = 0x11

◆ PREV_AROUND_RIGHT

const int OpenCVForUnity.ImgprocModule.Subdiv2D.PREV_AROUND_RIGHT = 0x02

◆ PTLOC_ERROR

const int OpenCVForUnity.ImgprocModule.Subdiv2D.PTLOC_ERROR = -2

◆ PTLOC_INSIDE

const int OpenCVForUnity.ImgprocModule.Subdiv2D.PTLOC_INSIDE = 0

◆ PTLOC_ON_EDGE

const int OpenCVForUnity.ImgprocModule.Subdiv2D.PTLOC_ON_EDGE = 2

◆ PTLOC_OUTSIDE_RECT

const int OpenCVForUnity.ImgprocModule.Subdiv2D.PTLOC_OUTSIDE_RECT = -1

◆ PTLOC_VERTEX

const int OpenCVForUnity.ImgprocModule.Subdiv2D.PTLOC_VERTEX = 1

The documentation for this class was generated from the following file: