public static void yu12ToBoof(byte[] data, int width, int height, ImageBase output) {

        if( output instanceof Planar) {
            Planar ms = (Planar) output;
            ms.reshape(width,height,3);

            if( BoofConcurrency.USE_CONCURRENT ) {
                if (ms.getBandType() == GrayU8.class) {
                    ImplConvertYV12_MT.yv12ToPlanarRgb_U8(data, ms);
                } else if (ms.getBandType() == GrayF32.class) {
                    ImplConvertYV12_MT.yv12ToPlanarRgb_F32(data, ms);
                } else {
                    throw new IllegalArgumentException("Unsupported output band format");
                }
            } else {
                if (ms.getBandType() == GrayU8.class) {
                    ImplConvertYV12.yv12ToPlanarRgb_U8(data, ms);
                } else if (ms.getBandType() == GrayF32.class) {
                    ImplConvertYV12.yv12ToPlanarRgb_F32(data, ms);
                } else {
                    throw new IllegalArgumentException("Unsupported output band format");
                }
            }
        } else if( output instanceof ImageGray) {
            if (output.getClass() == GrayU8.class) {
                yu12ToGray(data, width, height, (GrayU8) output);
            } else if (output.getClass() == GrayF32.class) {
                yu12ToGray(data, width, height, (GrayF32) output);
            } else {
                throw new IllegalArgumentException("Unsupported output type");
            }
        } else if( output instanceof ImageInterleaved ) {
            ((ImageMultiBand)output).reshape(width,height,3);

            if( BoofConcurrency.USE_CONCURRENT ) {
                if (output.getClass() == InterleavedU8.class) {
                    ImplConvertYV12_MT.yv12ToInterleaved(data, (InterleavedU8) output);
                } else if (output.getClass() == InterleavedF32.class) {
                    ImplConvertYV12_MT.yv12ToInterleaved(data, (InterleavedF32) output);
                } else {
                    throw new IllegalArgumentException("Unsupported output type");
                }
            } else {
                if (output.getClass() == InterleavedU8.class) {
                    ImplConvertYV12.yv12ToInterleaved(data, (InterleavedU8) output);
                } else if (output.getClass() == InterleavedF32.class) {
                    ImplConvertYV12.yv12ToInterleaved(data, (InterleavedF32) output);
                } else {
                    throw new IllegalArgumentException("Unsupported output type");
                }
            }
        } else {
            throw new IllegalArgumentException("Boofcv image type not yet supported");
        }
    }
public static void yu12ToBoof ( byte [ ] data , int width , int height , ImageBase output ) { if ( output instanceof Planar ) { Planar ms = ( Planar ) output ; ms . reshape ( width , height , 3 ) ; if ( BoofConcurrency . USE_CONCURRENT ) { if ( ms . getBandType ( ) == GrayU8 . class ) { ImplConvertYV12_MT . yv12ToPlanarRgb_U8 ( data , ms ) ; } else if ( ms . getBandType ( ) == GrayF32 . class ) { ImplConvertYV12_MT . yv12ToPlanarRgb_F32 ( data , ms ) ; } else { throw new IllegalArgumentException ( "Unsupported output band format" ) ; } } else { if ( ms . getBandType ( ) == GrayU8 . class ) { ImplConvertYV12 . yv12ToPlanarRgb_U8 ( data , ms ) ; } else if ( ms . getBandType ( ) == GrayF32 . class ) { ImplConvertYV12 . yv12ToPlanarRgb_F32 ( data , ms ) ; } else { throw new IllegalArgumentException ( "Unsupported output band format" ) ; } } } else if ( output instanceof ImageGray ) { if ( output . getClass ( ) == GrayU8 . class ) { yu12ToGray ( data , width , height , ( GrayU8 ) output ) ; } else if ( output . getClass ( ) == GrayF32 . class ) { yu12ToGray ( data , width , height , ( GrayF32 ) output ) ; } else { throw new IllegalArgumentException ( "Unsupported output type" ) ; } } else if ( output instanceof ImageInterleaved ) { ( ( ImageMultiBand ) output ) . reshape ( width , height , 3 ) ; if ( BoofConcurrency . USE_CONCURRENT ) { if ( output . getClass ( ) == InterleavedU8 . class ) { ImplConvertYV12_MT . yv12ToInterleaved ( data , ( InterleavedU8 ) output ) ; } else if ( output . getClass ( ) == InterleavedF32 . class ) { ImplConvertYV12_MT . yv12ToInterleaved ( data , ( InterleavedF32 ) output ) ; } else { throw new IllegalArgumentException ( "Unsupported output type" ) ; } } else { if ( output . getClass ( ) == InterleavedU8 . class ) { ImplConvertYV12 . yv12ToInterleaved ( data , ( InterleavedU8 ) output ) ; } else if ( output . getClass ( ) == InterleavedF32 . class ) { ImplConvertYV12 . yv12ToInterleaved ( data , ( InterleavedF32 ) output ) ; } else { throw new IllegalArgumentException ( "Unsupported output type" ) ; } } } else { throw new IllegalArgumentException ( "Boofcv image type not yet supported" ) ; } }
Converts a YU12 encoded byte array into a BoofCV formatted image.

@param data (input) YU12 byte array
@param width (input) image width
@param height (input) image height
@param output (output) BoofCV image