1 | initial version |
indeed, your Mat's have the wrong type.
if you got an array of Points called 'corners', try like this:
// // both must be in the same order / winding ! // MatOfPoint2f src = new MatOfPoint2f( corners[0], // tl corners[1], // tr corners[2], // br corners[3], // bl );
MatOfPoint2f dst = new MatOfPoint2f( new org.opencv.core.Point(0,0), new org.opencv.core.Point(w,0), new org.opencv.core.Point(w.h), new org.opencv.core.Point(0,h) );
Mat pTransform = Imgproc.getPerspectiveTransform(src, dst);
2 | No.2 Revision |
indeed, your Mat's have the wrong type.
if you got an array of Points called 'corners', try like this:
//
// both must be in the same order / winding !
//
MatOfPoint2f src = new MatOfPoint2f(
corners[0], // tl
corners[1], // tr
corners[2], // br
corners[3], // bl
Mat pTransform = Imgproc.getPerspectiveTransform(src, dst);
3 | No.3 Revision |
indeed, your Mat's have the wrong type.
if you got an array of Points called 'corners', try like this:
//
// both must be in the same order / winding !
//
MatOfPoint2f src = new MatOfPoint2f(
corners[0], // tl
corners[1], // tr
corners[2], // br
corners[3], // bl
);
MatOfPoint2f dst = new MatOfPoint2f(
new org.opencv.core.Point(0,0),
new org.opencv.core.Point(w,0),
new org.opencv.core.Point(w.h),
new org.opencv.core.Point(0,h)
);
4 | No.4 Revision |
indeed, your Mat's have the wrong type.
if you got an array of Points called 'corners', try like this:
//
// both must be in the same order / winding !
//
MatOfPoint2f src = new MatOfPoint2f(
corners[0], // tl
corners[1], // tr
corners[2], // br
corners[3], // bl
);
MatOfPoint2f dst = new MatOfPoint2f(
new org.opencv.core.Point(0,0),
org.opencv.core.Point(0,0), // awt has a Point class too, thus the pesky canonical name here
new org.opencv.core.Point(w,0),
new org.opencv.core.Point(w.h),
new org.opencv.core.Point(0,h)
);
Mat pTransform = Imgproc.getPerspectiveTransform(src, dst);
5 | No.5 Revision |
indeed, your Mat's have the wrong type.
if you got an array of Points called 'corners', try like this:
//
// both must be in the same order / winding !
//
MatOfPoint2f src = new MatOfPoint2f(
corners[0], // tl
corners[1], // tr
corners[2], // br
corners[3], // bl
);
MatOfPoint2f dst = new MatOfPoint2f(
new org.opencv.core.Point(0,0), // awt has a Point class too, thus the pesky so needs canonical name here
new org.opencv.core.Point(w,0),
new org.opencv.core.Point(w.h),
new org.opencv.core.Point(0,h)
);
Mat pTransform = Imgproc.getPerspectiveTransform(src, dst);