I shearing object with findHomography then get error
OpenCV Error: Bad argument (The input arrays should be 2D or 3D point sets) in cv::findHomography, file src\fundam.cpp, line 362
Exception in thread "main" java.lang.RuntimeException: src\fundam.cpp:362: error: (-5) The input arrays should be 2D or 3D point sets in function cv::findHomography
Here my code:
Rect box = rr.boundingRect();
Point2f points = new Point2f(4);
rr.points(points);
Point2f src = new Point2f(4);
src.put(points.get(0));
src.put(points.get(1));
src.put(points.get(3));
src.put(points.get(2));
Point2f dest = new Point2f(4);
dest.put(new Point2f(0,0));
dest.put(new Point2f(box.width(),0));
dest.put(new Point2f(0,box.height()));
dest.put(new Point2f(box.width(),box.height()));
Mat h = opencv_calib3d.findHomography(new Mat(src),new Mat(dest));
Mat out = new Mat();
warpPerspective(subImage,out,h,box.size(),INTER_LINEAR,BORDER_CONSTANT,Scalar.all(0));
Imshow.showMultiple("Shear",out);