Home Using getVoronoiFacetList but can't get clockwise vertexes
Reply: 0

Using getVoronoiFacetList but can't get clockwise vertexes

hohoko
1#
hohoko Published in 2017-12-07 06:45:41Z

I want to creat voronoi diagram by using opencv(getVoronoiFacetList) , and get the vertexes of each polygon.The code is attached as follows:

void getVoronoi(Mat Image, vector<cv::Point2f> vecCenterList) {
    Rect rect(0, 0,Image.cols, Image.rows); 
    Subdiv2D subdiv(rect); 
    for (size_t i = 0; i < vecCenterList.size(); i++)
    {
        subdiv.insert(vecCenterList[i]);
    }
    vector<vector<cv::Point2f> > vecPolylist;
    vector<cv::Point2f> centers;
    subdiv.getVoronoiFacetList(std::vector<int>(), vecPolylist, centers); 
}

But when I check the vertexes' coordinate I find they didn't save in the same direction(clockwise ),you can see in following pictures(index[3] to index[4] in the anti-clockwise ):

the vertexes of polygon153, polygon153

I don't know how to figure out this error, or did I do some wrong operations to cause this error? Thanks for any help!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.304551 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO