code: public static <T extends ImageGray<T>>
  	T bitmapToGray( Bitmap input , T output , Class<T> imageType , byte[] storage) {
  		if( imageType == GrayF32.class )
  			return (T)bitmapToGray(input,(GrayF32)output,storage);
  		else if( imageType == GrayU8.class )
  			return (T)bitmapToGray(input,(GrayU8)output,storage);
  		else
  			throw new IllegalArgumentException("Unsupported BoofCV Image Type");
  		
  	}
docs: Converts Bitmap image into a single band image of arbitrary type.
  
  @see #declareStorage(android.graphics.Bitmap, byte[])
  
  @param input Input Bitmap image.
  @param output Output single band image.  If null a new one will be declared.
  @param imageType Type of single band image.
  @param storage Byte array used for internal storage. If null it will be declared internally.
  @return The converted gray scale image.