Search code examples
c++opencvopencv3.0delaunay

How to get vertex index from Subdiv2D Delaunay triangulation


I am using OpenCV 3.1 and want to know how to get the vertex index of an edge in Subdiv2D Delaunay triangulation, not only the vertex coordinates? I want to use this index to keep the vertex value for further interpolation.

For example:

cv::Subdiv2D subdiv(rect);
// Insert some points to subdiv....
cv::Point2f org, dst;
subdiv.edgeOrg(edge, &org); // starting point of edge

This gives me only the coordinates of the vertex in org.

I've seen that in OpenCV 2.4, we could use the CvSubdiv2DPoint type, which held the id in addition to the standard Point32f. In OpenCV 3.1, I can't find this struct and it looks like it had been removed for some reason.


Solution

  • So turned out that in OpenCV 3 some of the functions in cv::Subdiv2D which were void now returns an integer. In my case I found out that subdiv.edgeOrg(...) and subdiv.edgeDst(...) returns the vertex id as integer.