/** * Sets interpolation to use nearest-neighbor */ public FDistort interpNN() { return interp(InterpolationType.NEAREST_NEIGHBOR); }
/** * Specifies the input and output image and sets interpolation to BILINEAR, black image border, cache is off. */ public FDistort init(ImageBase input, ImageBase output) { this.input = input; this.output = output; inputType = input.getImageType(); interp(InterpolationType.BILINEAR); border(0); cached = false; distorter = null; outputToInput = null; return this; }
/** * Constructor which specifies the characteristics of the undistorted image * * @param width Width of undistorted image * @param height Height of undistorted image * @param imageType Type of undistorted image */ public RemovePerspectiveDistortion( int width , int height , ImageType<T> imageType ) { output = imageType.createImage(width,height); distort = new FDistort(imageType); distort.output(output); distort.interp(InterpolationType.BILINEAR).transform(homography); for (int i = 0; i < 4; i++) { associatedPairs.add( new AssociatedPair()); } associatedPairs.get(0).p1.set(0,0); associatedPairs.get(1).p1.set(output.width-1,0); associatedPairs.get(2).p1.set(output.width-1,output.height-1); associatedPairs.get(3).p1.set(0,output.height-1); }
/** * Constructor which specifies the characteristics of the undistorted image * * @param width Width of undistorted image * @param height Height of undistorted image * @param imageType Type of undistorted image */ public RemovePerspectiveDistortion( int width , int height , ImageType<T> imageType ) { this(width,height); output = imageType.createImage(width,height); distort = new FDistort(imageType); distort.output(output); distort.interp(InterpolationType.BILINEAR).transform(transform); }
private void applyScaling() { scaledImage.reshape(panel.getWidth(), panel.getHeight()); if( scaledImage.width <= 0 || scaledImage.height <= 0 ) { return; } if( latestImage.width != 0 && latestImage.height != 0 ) { new FDistort(latestImage, scaledImage).interp(interpType).border(BorderType.EXTENDED).scale().apply(); BufferedImage out = ConvertBufferedImage.convertTo(scaledImage, null, true); panel.setImageUI(out); panel.repaint(); } }