ResizeProcessor implements SinglebandImageProcessor<Float,FImage> { public static int zoom( FImage in, int newX, int newY ) { ResizeFilterFunction filter = new BasicFilter(); return zoom( in, newX, newY, filter, filter.getDefaultSupport() ); } ResizeProcessor( Mode mode );  ResizeProcessor( float amount, ResizeFilterFunction ff );  ResizeProcessor( float newX, float newY, ResizeFilterFunction ff );  ResizeProcessor( float amount );  ResizeProcessor( float newX, float newY );  ResizeProcessor(int newX, int newY, boolean aspectRatio ); @Override void processImage(FImage image); static I doubleSize(I image); static FImage doubleSize(FImage image); static I halfSize(I image); static FImage halfSize(FImage image); static FImage resample( FImage in, int newX, int newY ); static FImage resample( FImage in, int newX, int newY, boolean aspect ); static int zoom( FImage in, int newX, int newY ); static int zoom( FImage in, int newX, int newY, ResizeFilterFunction filterf, double fwidth ); static int zoom(FImage in, FImage dst, ResizeFilterFunction filterf, double fwidth ); static int zoom(FImage in, Rectangle inRect, FImage dst, Rectangle dstRect); static int zoom(FImage in, Rectangle inRect, FImage dst, Rectangle dstRect, ResizeFilterFunction filterf, double fwidth );  }
@Test public void testBoundedZoom() throws Exception { FImage image = ImageUtilities.readF(ResizeProcessorTest.class.getResourceAsStream("/org/openimaj/image/data/sinaface.jpg")); FImage imageOut = new FImage(200,100); ResizeFilterFunction filter = new BSplineFilter(); Rectangle inLoc = new Rectangle(30f,30f,100f,100f); Rectangle outLoc = imageOut.getBounds(); int ret = ResizeProcessor.zoom( image, inLoc, imageOut, outLoc, filter, filter.getDefaultSupport() ); assertTrue(ret != -1); imageOut = new FImage(20,20); outLoc = imageOut.getBounds(); ret = ResizeProcessor.zoom( image, inLoc, imageOut, outLoc, filter, filter.getDefaultSupport() ); assertTrue(ret != -1); long start = System.currentTimeMillis(); for (int i = 0; i < 10000; i++) { ResizeProcessor.zoom( image, inLoc, imageOut, outLoc, filter, filter.getDefaultSupport() ); } long end = System.currentTimeMillis(); System.out.println("Time taken (inplace zoom): " + (end - start)); start = System.currentTimeMillis(); for (int i = 0; i < 10000; i++) { FImage imageExtracted = image.extractROI(inLoc); ResizeProcessor.zoom( imageExtracted, imageOut, filter, filter.getDefaultSupport() ); } end = System.currentTimeMillis(); System.out.println("Time taken (extract/zoom): " + (end - start)); }