public byte[] createBuffer(CameraInfo info, int surfaceWidth, int surfaceHeight) {
   byte[] buffer =
       buffers.createBuffer(info.getImageWidth(), info.getImageHeight(), info.getImageDepth());
   buffers.setROI(
       createROI(info.getImageWidth(), info.getImageHeight(), surfaceWidth, surfaceHeight));
   buffers.setRotation(info.getRotation());
   buffers.setFrontFacing(info.isFrontFacing());
   createSettings();
   return buffer;
 }
  public void setData(final byte[] data) {
    buffers.setImage(data);
    try {
      for (ImageProcessor imageProcessor : pipeline) {
        imageProcessor.process(buffers);
      }

      if (overlay != null) {
        final Bitmap overlayBitmap = buffers.createOverlayBitmap();
        if (overlayBitmap != null) {
          overlay.post(
              new Runnable() {
                @Override
                public void run() {

                  overlay.setImageBitmap(overlayBitmap);
                }
              });
        }
      }
    } catch (Exception e) {
      Log.e("Detector", e.getMessage(), e);
    }
  }