@Test public void testScalingIfNeedWhenSuitableSizeButDiffChannel() { int width1 = 60; int height1 = 110; int channel1 = BufferedImage.TYPE_BYTE_GRAY; BufferedImage img1 = makeRandomBufferedImage(true, width1, height1); ImageLoader loader1 = new ImageLoader(height1, width1, channel1); BufferedImage scaled1 = loader1.scalingIfNeed(img1, false); assertEquals(width1, scaled1.getWidth()); assertEquals(height1, scaled1.getHeight()); assertEquals(channel1, scaled1.getType()); assertEquals(1, scaled1.getSampleModel().getNumBands()); int width2 = 70; int height2 = 120; int channel2 = BufferedImage.TYPE_BYTE_GRAY; BufferedImage img2 = makeRandomBufferedImage(false, width2, height2); ImageLoader loader2 = new ImageLoader(height2, width2, channel2); BufferedImage scaled2 = loader2.scalingIfNeed(img2, false); assertEquals(width2, scaled2.getWidth()); assertEquals(height2, scaled2.getHeight()); assertEquals(channel2, scaled2.getType()); assertEquals(1, scaled2.getSampleModel().getNumBands()); }
protected BufferedImage scalingIfNeed(BufferedImage image, boolean needAlpha) { return scalingIfNeed(image, height, width, channels, needAlpha); }
ImageLoader extends BaseImageLoader { protected BufferedImage scalingIfNeed(BufferedImage image, boolean needAlpha) { return scalingIfNeed(image, height, width, channels, needAlpha); } }
ImageLoader extends BaseImageLoader { protected BufferedImage scalingIfNeed(BufferedImage image, boolean needAlpha) { return scalingIfNeed(image, height, width, channels, needAlpha); } ImageLoader();  ImageLoader(long height, long width);  ImageLoader(long height, long width, long channels);  ImageLoader(long height, long width, long channels, boolean centerCropIfNeeded); }
ImageLoader extends BaseImageLoader { protected BufferedImage scalingIfNeed(BufferedImage image, boolean needAlpha) { return scalingIfNeed(image, height, width, channels, needAlpha); } ImageLoader();  ImageLoader(long height, long width);  ImageLoader(long height, long width, long channels);  ImageLoader(long height, long width, long channels, boolean centerCropIfNeeded); INDArray asRowVector(File f); INDArray asRowVector(InputStream inputStream); INDArray asRowVector(BufferedImage image); INDArray toRaveledTensor(File file); INDArray toRaveledTensor(InputStream is); INDArray toRaveledTensor(BufferedImage image); INDArray toBgr(File file); INDArray toBgr(InputStream inputStream); INDArray toBgr(BufferedImage image); INDArray asMatrix(File f); @Override INDArray asMatrix(File f, boolean nchw); INDArray asMatrix(InputStream inputStream); @Override INDArray asMatrix(InputStream inputStream, boolean nchw); @Override org.datavec.image.data.Image asImageMatrix(File f); @Override org.datavec.image.data.Image asImageMatrix(File f, boolean nchw); @Override org.datavec.image.data.Image asImageMatrix(InputStream inputStream); @Override org.datavec.image.data.Image asImageMatrix(InputStream inputStream, boolean nchw); INDArray asMatrix(BufferedImage image); INDArray asImageMiniBatches(File f, int numMiniBatches, int numRowsPerSlice); int[] flattenedImageFromFile(File f); int[][] fromFile(File file); int[][][] fromFileMultipleChannels(File file); static BufferedImage toImage(INDArray matrix); void toBufferedImageRGB(INDArray arr, BufferedImage image); static BufferedImage toBufferedImage(Image img, int type); BufferedImage centerCropIfNeeded(BufferedImage img); }
ImageLoader extends BaseImageLoader { protected BufferedImage scalingIfNeed(BufferedImage image, boolean needAlpha) { return scalingIfNeed(image, height, width, channels, needAlpha); } ImageLoader();  ImageLoader(long height, long width);  ImageLoader(long height, long width, long channels);  ImageLoader(long height, long width, long channels, boolean centerCropIfNeeded); INDArray asRowVector(File f); INDArray asRowVector(InputStream inputStream); INDArray asRowVector(BufferedImage image); INDArray toRaveledTensor(File file); INDArray toRaveledTensor(InputStream is); INDArray toRaveledTensor(BufferedImage image); INDArray toBgr(File file); INDArray toBgr(InputStream inputStream); INDArray toBgr(BufferedImage image); INDArray asMatrix(File f); @Override INDArray asMatrix(File f, boolean nchw); INDArray asMatrix(InputStream inputStream); @Override INDArray asMatrix(InputStream inputStream, boolean nchw); @Override org.datavec.image.data.Image asImageMatrix(File f); @Override org.datavec.image.data.Image asImageMatrix(File f, boolean nchw); @Override org.datavec.image.data.Image asImageMatrix(InputStream inputStream); @Override org.datavec.image.data.Image asImageMatrix(InputStream inputStream, boolean nchw); INDArray asMatrix(BufferedImage image); INDArray asImageMiniBatches(File f, int numMiniBatches, int numRowsPerSlice); int[] flattenedImageFromFile(File f); int[][] fromFile(File file); int[][][] fromFileMultipleChannels(File file); static BufferedImage toImage(INDArray matrix); void toBufferedImageRGB(INDArray arr, BufferedImage image); static BufferedImage toBufferedImage(Image img, int type); BufferedImage centerCropIfNeeded(BufferedImage img);  }