Hello everyone, I hope you can help me with a specific issue. I have been using the function connectedComponentsWithStats to extract the centroid of an object in an image. Here is part of my code,
int num_objects = connectedComponentsWithStats(img, labels, stats, centroids);
cout << "Object " << i << "with position: " << centroids.at<Point2d>(i) << endl;
when I try to debug this instruction I get the following error: C:\fakepath\Error.jpg
I am trying to obtain a point (x, y) which the definition type of each element is a double or CV_64F. When I run the following instruction, I can see all the values of all the found centroids. Nevertheless when I try to retrieve just one specific centroid, the centroid reference "centroids.at<point2d>(i)" just lanch the failure message
cout <<"positions: " << centroids << endl;
I really appreciate any suggestion that can help me retrieve a particular centroid point information in the correct format (double)
Thank you in advance