Ask Your Question

Sodat's profile - activity

2019-08-02 10:30:36 -0600 received badge  Popular Question (source)
2013-07-15 09:48:05 -0600 answered a question [Java OpenCV] Fatal error in Imgproc.arcLength

Well, I seem to have solved the problem, though I'm not sure why...

By using:

contours2f.fromArray(contours.toArray());

instead of:

contours.copyTo(contours2f);

to copy the content of my MatOfPoint into my MatOfPoint2f, I don't fail the assertion anymore and my program is running fine (except it finds waaaay too many squares, but I'm trying to tweak it).

2013-07-15 04:17:59 -0600 commented question [Java OpenCV] Fatal error in Imgproc.arcLength

Thanks for the answer berak ! My mat is a MatOfPoint2f, in which I copy a MatOfPoint:

MatOfPoint contours = (previous code)

MatOfPoint2f contours2f = new MatOfPoint2f();

contours.copyTo(contours2f);

How can I copy the data in a MatOfPoint in a MatOfPoint2f and still keep type and depth coeherent?

2013-07-10 09:15:33 -0600 received badge  Editor (source)
2013-07-10 09:14:52 -0600 asked a question [Java OpenCV] Fatal error in Imgproc.arcLength

I've been trying to recode the squares.cpp C++ example in Java, using OpenCV 2.4.6, and I'm stuck with an error I don't understand:

OpenCV Error: Assertion failed (curve.checkVector(2) >= 0 && (curve.depth() == CV_32F || curve.depth() == CV_32S)) in arcLength, file /local/XXXX/libs/opencv-2.4.6/modules/imgproc/src/contours.cpp, line 1886

But when I check my curve, I get:

  • curve.checkVector(2) = 4

  • curve toString output: Mat [ 4 * 1 * CV_32SC2, isCont=true, isSubmat=false, nativeObj=0x7ffca453be90, dataAddr=0x7ffca4588720 ]

So I should be able to pass the assertion, but I fail.

Is CV_32SC2 different from CV_32S?