return convertTo_U8((Planar<GrayU8>) ms, dst, orderRgb); } else if( GrayF32.class == ms.getBandType() ) { return convertTo_F32((Planar<GrayF32>) ms, dst, orderRgb); } else { throw new IllegalArgumentException("Planar type is not yet supported: "+ ms.getBandType().getSimpleName());
public static void main(String[] args) { BufferedImage original = UtilImageIO.loadImage(UtilIO.pathExample("simple_objects.jpg")); Planar<GrayF32> input = new Planar<>(GrayF32.class, original.getWidth(),original.getHeight(),3); ConvertBufferedImage.convertFromPlanar(original,input,true,GrayF32.class); Planar<GrayF32> output = new Planar<>(GrayF32.class, original.getWidth()/3,original.getHeight()/3,3); Planar<GrayF32> output2 = new Planar<>(GrayF32.class, original.getWidth()/3,original.getHeight()/3,3); AverageDownSampleOps.down(input, output); new FDistort(input,output2).scaleExt().apply(); BufferedImage outputFull = ConvertBufferedImage.convertTo_F32(output, null, true); BufferedImage outputFull2 = ConvertBufferedImage.convertTo_F32(output2, null, true); ShowImages.showWindow(original,"Original"); ShowImages.showWindow(outputFull,"3x small average"); ShowImages.showWindow(outputFull2,"3x small bilinear"); } }