Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

drawContours throws exception

Hello, I use opencv3.3.1 from ros-kinetic When executing this code

            vector <vector <Point2i> > testContour;
            vector <Point2i> testedge;
            testedge.push_back(Point2i(240,240));
            testedge.push_back(Point2i(120,240));
            testedge.push_back(Point2i(120,120));
            testedge.push_back(Point2i(240,120));
            testContour.push_back(testedge);
            vector <Point2i> testedge2;
            testedge2.push_back(Point2i(200,200));
            testedge2.push_back(Point2i(100,200));
            testedge2.push_back(Point2i(100,100));
            testedge2.push_back(Point2i(200,100));
            testContour.push_back(testedge2);
    drawContours(image, edgeVector, -1,/*it->getColor()*/Scalar(255,255,255),CV_FILLED,LINE_8);

i get the following error:

OpenCV Error: Assertion failed (reader.ptr != __null) in cvDrawContours, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgproc/src/drawing.cpp, line 2603 terminate called after throwing an instance of 'cv::Exception' what(): /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgproc/src/drawing.cpp:2603: error: (-215) reader.ptr != __null in function cvDrawContours

now this only happens after updating the ros packages... before it ran fine.....

now i don't understand why exactly the reader.ptr() is __null, since my counturs vector is filled as u can see above, also google is quite emoty of that problem.

best regards, homes

drawContours throws exception

Hello, I use opencv3.3.1 from ros-kinetic When executing this code

            vector <vector <Point2i> > testContour;
            vector <Point2i> testedge;
            testedge.push_back(Point2i(240,240));
            testedge.push_back(Point2i(120,240));
            testedge.push_back(Point2i(120,120));
            testedge.push_back(Point2i(240,120));
            testContour.push_back(testedge);
            vector <Point2i> testedge2;
            testedge2.push_back(Point2i(200,200));
            testedge2.push_back(Point2i(100,200));
            testedge2.push_back(Point2i(100,100));
            testedge2.push_back(Point2i(200,100));
            testContour.push_back(testedge2);
    drawContours(image, edgeVector, testContour, -1,/*it->getColor()*/Scalar(255,255,255),CV_FILLED,LINE_8);

i get the following error:

OpenCV Error: Assertion failed (reader.ptr != __null) in cvDrawContours, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgproc/src/drawing.cpp, line 2603 terminate called after throwing an instance of 'cv::Exception' what(): /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgproc/src/drawing.cpp:2603: error: (-215) reader.ptr != __null in function cvDrawContours

now this only happens after updating the ros packages... before it ran fine.....

now i don't understand why exactly the reader.ptr() is __null, since my counturs vector is filled as u can see above, also google is quite emoty of that problem.

best regards, homes

edit: it works now with the testContour, but it doesn't appear to work with a dynamically filled Contour vector. Am I correct in my assumption, that this means i am trying to pass a undefined pointer to the drawContours function?