title: How to create Bitmap from grayscaled byte buffer image?
body: <p>I am trying to get frame image to process while using new Android face detection mobile vision api.</p>
  
  <p>So I have created Custom Detector to get Frame and tried to call getBitmap() method but it is null so I accessed grayscale data of frame. Is there a way to create bitmap from it or similiar image holder class?</p>
  
  <pre><code>public class CustomFaceDetector extends Detector&lt;Face&gt; {
  private Detector&lt;Face&gt; mDelegate;
  
  public CustomFaceDetector(Detector&lt;Face&gt; delegate) {
      mDelegate = delegate;
  }
  
  public SparseArray&lt;Face&gt; detect(Frame frame) {
      ByteBuffer byteBuffer = frame.getGrayscaleImageData();
      byte[] bytes = byteBuffer.array();
      int w = frame.getMetadata().getWidth();
      int h = frame.getMetadata().getHeight();
      // Byte array to Bitmap here
      return mDelegate.detect(frame);
  }
  
  public boolean isOperational() {
      return mDelegate.isOperational();
  }
  
  public boolean setFocus(int id) {
      return mDelegate.setFocus(id);
  }}
  </code></pre>