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

int[] myPolygon = new int[] { point1.x, point1.y, point2.x, point2.y, ... };
cvCountourArea(???, null, 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);

10-06 14:46