code: public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data, int width, int height) {
      Rect rect = getFramingRectInPreview();
      if (rect == null) {
        return null;
      }
      // Go ahead and assume it's YUV rather than die.
      return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
                                          rect.width(), rect.height(), false);
    }
docs: A factory method to build the appropriate LuminanceSource object based on the format
  of the preview buffers, as described by Camera.Parameters.
  
  @param data A preview frame.
  @param width The width of the image.
  @param height The height of the image.
  @return A PlanarYUVLuminanceSource instance.