1

如何创建轮廓以传递给 cvContourArea?我有四个 2D 点,但不知道创建 CvSeq。

int[] myPolygon = new int[] { point1.x, point1.y, point2.x, point2.y, ... };
cvCountourArea(???, null, 0);
4

1 回答 1

0

我找到了解决方案:

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);
于 2013-04-03T05:25:57.120 回答