1

How to create the contour to pass to cvContourArea? I have four 2D points, but don't know to create the CvSeq.

int[] myPolygon = new int[] { point1.x, point1.y, point2.x, point2.y, ... };
cvCountourArea(???, null, 0);
Oliv
  • 10,221
  • 3
  • 55
  • 76

1 Answers1

0

I found the solution:

int[] myPolygon = new int[] { point1.x, point1.y, point2.x, point2.y, ... };
Mat rectMat = cvCreateMat(1, myPolygon.length/2, CV_32SC2);
rectMat.getIntBuffer().put(myPolygon);
cvCountourArea(rectMat, CV_WHOLE_SEQ, 0);
cvReleaseMat(rectMat);
Oliv
  • 10,221
  • 3
  • 55
  • 76