user678392
user678392

Reputation: 2031

Incompatible Mat in OpenCV for Android

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

Answers (2)

Yegor Koldov
Yegor Koldov

Reputation: 292

You could use:

MatOfPoint matOfPoint = ...code to receive ... 

MatOfPoint2f mat2f = new MatOfPoint2f();
matOfPoint.convertTo(mat2f, CvType.CV_32FC2);

Upvotes: 2

user1755546
user1755546

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

Related Questions