public static < T extends ImageGray < T > > Planar < T > bitmapToPlanar ( Bitmap input , Planar < T > output , Class < T > type , byte [ ] storage ) { if ( output == null ) { output = new Planar <> ( type , input . getWidth ( ) , input . getHeight ( ) , 3 ) ; } else { int numBands = Math . min ( 4 , Math . max ( 3 , output . getNumBands ( ) ) ) ; output . reshape ( input . getWidth ( ) , input . getHeight ( ) , numBands ) ; } if ( storage == null ) storage = declareStorage ( input , null ) ; input . copyPixelsToBuffer ( ByteBuffer . wrap ( storage ) ) ; if ( type == GrayU8 . class ) ImplConvertBitmap . arrayToPlanar_U8 ( storage , input . getConfig ( ) , ( Planar ) output ) ; else if ( type == GrayF32 . class ) ImplConvertBitmap . arrayToPlanar_F32 ( storage , input . getConfig ( ) , ( Planar ) output ) ; else throw new IllegalArgumentException ( "Unsupported BoofCV Type" ) ; return output ; }
Converts Bitmap image into Planar image of the appropriate type .