@Test public void testTransform() throws Exception { Mat original = Imgcodecs.imread(testPath + "dukes_livingroom.jpeg"); ROI roi = new ROI("near", 0, 0.4, 1, 0.6); Mat image = roi.region(original); Polygon imagePolygon = new ImagePolygon(image.size(), 0, 0, 1, 0, 1, 1, 0, 1); Polygon worldPolygon = new ImagePolygon(image.size(), 0.30, 0.20, 0.80, 0.28, 0.96, 0.62, 0.15, 0.46); PerspectiveShift perspectiveShift = new PerspectiveShift(imagePolygon, worldPolygon); Mat shifted = perspectiveShift.apply(image); if (debug) { System.out.println("worldp:" + perspectiveShift.worldPolygon); System.out.println("world: " + perspectiveShift.worldPoints); writeImage("roiImage", image); writeImage("shiftedImage", shifted); } }
@Override public Mat apply(Mat srcImage) { Mat destImage = new Mat(); Imgproc.warpPerspective(srcImage, destImage, perspectiveTransform, srcImage.size()); return destImage; }
PerspectiveShift implements UnaryOperator<Mat> { @Override public Mat apply(Mat srcImage) { Mat destImage = new Mat(); Imgproc.warpPerspective(srcImage, destImage, perspectiveTransform, srcImage.size()); return destImage; } }
PerspectiveShift implements UnaryOperator<Mat> { @Override public Mat apply(Mat srcImage) { Mat destImage = new Mat(); Imgproc.warpPerspective(srcImage, destImage, perspectiveTransform, srcImage.size()); return destImage; } PerspectiveShift(Polygon imagePolygon, Polygon worldPolygon); }
PerspectiveShift implements UnaryOperator<Mat> { @Override public Mat apply(Mat srcImage) { Mat destImage = new Mat(); Imgproc.warpPerspective(srcImage, destImage, perspectiveTransform, srcImage.size()); return destImage; } PerspectiveShift(Polygon imagePolygon, Polygon worldPolygon); @Override Mat apply(Mat srcImage); }
PerspectiveShift implements UnaryOperator<Mat> { @Override public Mat apply(Mat srcImage) { Mat destImage = new Mat(); Imgproc.warpPerspective(srcImage, destImage, perspectiveTransform, srcImage.size()); return destImage; } PerspectiveShift(Polygon imagePolygon, Polygon worldPolygon); @Override Mat apply(Mat srcImage);  }