prevPts = new MatOfPoint2f(prev);
prev
是Mat;
第一行prevPts = new MatOfPoint2f(prev);
引发异常不兼容MAT。我不明白为什么这样做。 API说MatOfPoint2f可以接受MAT。
答案 0 :(得分:1)
您可以使用:
MatOfPoint matOfPoint = ...code to receive ...
MatOfPoint2f mat2f = new MatOfPoint2f();
matOfPoint.convertTo(mat2f, CvType.CV_32FC2);
答案 1 :(得分:0)
新MatofPoint2f(MAT)的构造函数:
public MatOfPoint2f(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
检查您的MAT对象