Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Draw Contours error daaaaaaaaa

Hello,

I'm trying to draw countours (Java) and I get this error.

OpenCV Error: Assertion failed (0 <= contourIdx && contourIdx < (int)last) in drawContours, file ~/code/OpenCV/opencv-2.4.6.1/modules/imgproc/src/contours.cpp, line 1810
Exception in thread "main" CvException [org.opencv.core.CvException: /home/slani/code/OpenCV/opencv-2.4.6.1/modules/imgproc/src/contours.cpp:1810: error: (-215) 0 <= contourIdx && contourIdx < (int)last in function drawContours
]
    at org.opencv.imgproc.Imgproc.drawContours_2(Native Method)
    at org.opencv.imgproc.Imgproc.drawContours(Imgproc.java:5013)
    at HsvImage.main(HsvImage.java:83)

Can someone please explain me what this error mean. Thanks,

Draw Contours error daaaaaaaaaerror

Hello,

I'm trying to draw countours (Java) and I get this error.

OpenCV Error: Assertion failed (0 <= contourIdx && contourIdx < (int)last) in drawContours, file ~/code/OpenCV/opencv-2.4.6.1/modules/imgproc/src/contours.cpp, line 1810
Exception in thread "main" CvException [org.opencv.core.CvException: /home/slani/code/OpenCV/opencv-2.4.6.1/modules/imgproc/src/contours.cpp:1810: error: (-215) 0 <= contourIdx && contourIdx < (int)last in function drawContours
]
    at org.opencv.imgproc.Imgproc.drawContours_2(Native Method)
    at org.opencv.imgproc.Imgproc.drawContours(Imgproc.java:5013)
    at HsvImage.main(HsvImage.java:83)

Can someone please explain me what this error mean. Thanks,

click to hide/show revision 3
retagged

updated 2013-10-11 08:19:49 -0600

berak gravatar image

Draw Contours error

Hello,

I'm trying to draw countours (Java) and I get this error.

OpenCV Error: Assertion failed (0 <= contourIdx && contourIdx < (int)last) in drawContours, file ~/code/OpenCV/opencv-2.4.6.1/modules/imgproc/src/contours.cpp, line 1810
Exception in thread "main" CvException [org.opencv.core.CvException: /home/slani/code/OpenCV/opencv-2.4.6.1/modules/imgproc/src/contours.cpp:1810: error: (-215) 0 <= contourIdx && contourIdx < (int)last in function drawContours
]
    at org.opencv.imgproc.Imgproc.drawContours_2(Native Method)
    at org.opencv.imgproc.Imgproc.drawContours(Imgproc.java:5013)
    at HsvImage.main(HsvImage.java:83)

Can someone please explain me what this error mean. Thanks,

Draw Contours error

Hello,

I'm trying to draw countours (Java) and I get this error.

OpenCV Error: Assertion failed (0 <= contourIdx && contourIdx < (int)last) in drawContours, file ~/code/OpenCV/opencv-2.4.6.1/modules/imgproc/src/contours.cpp, line 1810
Exception in thread "main" CvException [org.opencv.core.CvException: /home/slani/code/OpenCV/opencv-2.4.6.1/modules/imgproc/src/contours.cpp:1810: error: (-215) 0 <= contourIdx && contourIdx < (int)last in function drawContours
]
    at org.opencv.imgproc.Imgproc.drawContours_2(Native Method)
    at org.opencv.imgproc.Imgproc.drawContours(Imgproc.java:5013)
    at HsvImage.main(HsvImage.java:83)

Can someone please explain me what this error mean. Thanks,

P.S. Code

// convert color space
Imgproc.GaussianBlur(frame, smooth, new Size(19,19), 0.0);
Imgproc.cvtColor(smooth, hsvFrame, Imgproc.COLOR_BGR2HSV);
// checks if array elements lie beween min and max
Core.inRange(hsvFrame, min, max, thresholded);
Core.inRange(hsvFrame, min2, max2, thresholded2);
Core.bitwise_or(thresholded, thresholded2, thresholded);

Imgproc.findContours(thresholded, contours, hierarchy, Imgproc.RETR_CCOMP, Imgproc.CHAIN_APPROX_SIMPLE);
Imgproc.drawContours(frame, contours, 4, new Scalar(40, 233, 45,0 ));

panel.setImage(frame);
HSVpanel.setImage(thresholded);
panel.repaint();
HSVpanel.repaint();