What am I doing wrong here?
vector <vector<Point> > contourElement;
for (int counter = 0; counter < contours -> size (); counter ++)
{
contourElement.push_back (contours -> at (counter));
const Point *elementPoints [1] = {contourElement.at (0)};
int numberOfPoints [] = {contourElement.at (0).size ()};
fillPoly (contourMask, elementPoints, numberOfPoints, 1, Scalar (0, 0, 0), 8);
I keep getting an error on the const Point part. The compiler says
error: cannot convert 'std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >' to 'const cv::Point*' in initialization
What am I doing wrong? (PS: Obviously ignore the missing bracket at the end of the for loop due to this being only part of my code)
Just for the record (and because the opencv docu is very sparse here) a more reduced snippet using the c++ API:
std::vector<cv::Point> fillContSingle;
[...]
//add all points of the contour to the vector
fillContSingle.push_back(cv::Point(x_coord,y_coord));
[...]
std::vector<std::vector<cv::Point> > fillContAll;
//fill the single contour
//(one could add multiple other similar contours to the vector)
fillContAll.push_back(fillContSingle);
cv::fillPoly( image, fillContAll, cv::Scalar(128));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With