MatOfPoint matPt = contours.get(i)
minRect.set(i, Imgproc.fitEllipse( new MatOfPoint2f(matPt) ));
—— MatOfPoint作为minAreaRect的参数总是报错"throw new IllegalArgumentException("Incomatible Mat");
" ref: http://codego.net/475157/,不能直接把 MatOfPoint作为MatOfPoint2f的构造函数的参数
解决方法为MatOfPoint率MatOfPoint2f 改为
MatOfPoint matPt = contours.get(i);
MatOfPoint2f NewMtx = new MatOfPoint2f( matPt.toArray() );
minRect.add(Imgproc.minAreaRect(NewMtx));