Home > Back-end >  About the data structure in the OPENCV is how to return a responsibility?
About the data structure in the OPENCV is how to return a responsibility?

Time:09-30

Call the OPENCV delaunay function

The question is: I want to find each of the points of the triangle, such as three points which is the first triangle, until finally a triangle,
As can be found by CvSubdiv to this relationship, but I can't find in view the source code completely \ look not to understand, hope ace to give directions in this field, thank you!

Now meet the code below
Initialization:

The static CvSubdiv2D * init_delaunay (CvMemStorage * storage,//initializes the triangle dissection structure, for its allocation unit
CvRect the rect)
{
CvSubdiv2D * subdiv;//data unit of triangular subdivision

Subdiv subdiv=cvCreateSubdiv2D (CV_SEQ_KIND_SUBDIV2D, sizeof (*),
Sizeof (CvSubdiv2DPoint),
Sizeof (CvQuadEdge2D),
Storage);
CvInitSubdivDelaunay2D (subdiv, the rect);

Return subdiv;
}

Insert function:
VectorFor (I=0; i <5; I++)
{
CvPoint2D32f fp=CvPoint2D32f ((float) (rand () % (the rect. Width - 10)),//make some constraints from the borders within 10 pixels,
(float) (rand () % (the rect. Height - 10)));
Points. The push_back (fp);

//locate_point (subdiv, fp, img, active_facet_color);//anchor point position, and draw the point where the voronoi surface edge,
CvShowImage (win, img); Refresh//

If (cvWaitKey (100) & gt;=0)
break;

CvSubdivDelaunay2DInsert (subdiv, fp);//insert that point to the triangle subdivision, of this triangle subdivision
//cvCalcSubdivVoronoi2D (subdiv);//computing Voronoi subdivision, sometimes we don't need
CvSet (img, bkgnd_color, 0);//set the image background color to white
Draw_subdiv (img, subdiv, delaunay_color voronoi_color);
CvShowImage (win, img);

//cvWaitKey ();
If (cvWaitKey (100) & gt;=0)
break;
}

The question is: I want to find each of the points of the triangle, such as three points which is the first triangle, until finally a triangle,
As can be found by CvSubdiv to this relationship, but I can't find in view the source code completely \ look not to understand, hope ace to give directions in this field, thank you!
  • Related