Reputation: 2031
prevPts = new MatOfPoint2f(prev);
prev
is a Mat;
The first line prevPts = new MatOfPoint2f(prev);
raises and exception Incompatible MAT. I don't understand why it is doing this. The API says that MatOfPoint2f can take in a MAT.
Upvotes: 1
Views: 1927
Reputation: 292
You could use:
MatOfPoint matOfPoint = ...code to receive ...
MatOfPoint2f mat2f = new MatOfPoint2f();
matOfPoint.convertTo(mat2f, CvType.CV_32FC2);
Upvotes: 2
Reputation: 1049
Constructor of new 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?
}
check your MAT object
Upvotes: 0