0

I'm trying to do real time hand detection app . In android devices not all devices support RGB output from camera devices. Mediapipe seems to work on RGB frames by default. As Mediapipe might be trained on RGB images so I just can't give YUV frames as input without conversion.

Conversion using loops is too costly , Using library like opencv is overkill just for coversion (as it increases app size), Neon implementation is hard for me as beginner programmer .

Is there is any MediaPipe way to convert to RGB format? (Answers on android way are also welcome)

(I'm using camera2 api , I can't use cameraX as my use case doesn't support it)

BRUCE
  • 153
  • 5
  • While [Android Renderscript is deprecated](https://android-developers.googleblog.com/2021/04/android-gpu-compute-going-forward.html) there are existing questions like [YUV_420_888 interpretation on Samsung Galaxy S7 (Camera2)](https://stackoverflow.com/q/36212904/295004) or try to leverage the existing Camera2 demo code for [YuvToRgbConverter.kt](https://github.com/android/camera-samples/blob/main/Camera2Basic/utils/src/main/java/com/example/android/camera/utils/YuvToRgbConverter.kt) – Morrison Chang Sep 02 '21 at 05:50

1 Answers1

0

Starting from version 1.1.0-alpha08 you can safely request RGBA format.

Documentation states that:

Add setOutputImageFormat API for image analysis config. User can select ImageAnalysis.OUTPUT_IMAGE_FORMAT_YUV_420_888 or ImageAnalysis.OUTPUT_IMAGE_FORMAT_RGBA_8888. By default, ImageAnalysis.OUTPUT_IMAGE_FORMAT_YUV_420_888 will be selected.

Orcun
  • 650
  • 1
  • 7
  • 16