fast and compression free rgb or bgr buffer for image capture

39 views
Skip to first unread message

Christian Günther

unread,
Nov 21, 2022, 11:33:49 AM11/21/22
to Android CameraX Discussion Group
Hi there,

i do image analyzation on higher resolution images than the imageAnalyzis use-case could provide. Therefore i need compression free image capture. At the moment i am using therefore the yuv target to avoid jpeg compression and i do yuv to rgb conversion with renderscript.

After i have seen that libyuv is able to do it alot faster for the imageAnalyzation use case https://medium.com/androiddevelopers/convert-yuv-to-rgb-for-camerax-imageanalysis-6c627f3a0292 i was wondering, why we don't have this option for the image capture use-case? It would be nice to get the yuv to rgb conversion performance benefits also there.

Does anyone have any thoughts or suggestions why this libyuv based conversion is restricted to imageAnalyzation?

Kailiang Chen

unread,
Nov 21, 2022, 12:53:47 PM11/21/22
to Android CameraX Discussion Group, christian...@authentic.network
Hi Christian,

We added YUV2RGB for ImageAnalysis first because it's a highly requested feature from the users, to connect with downstream pipeline (e.g. TensorflowLite).
For ImageCapture, many users only want to save it as JPEG image.

We will consider adding this option for ImageCapture, as a new feature request b/259964379.
Thanks for the feedback.

Best,
Kailiang

Christian Günther

unread,
Nov 22, 2022, 3:31:06 AM11/22/22
to Android CameraX Discussion Group, kail...@google.com, Christian Günther
Hi Kailiang,

Thanks a lot for the clarification and the corresponding feature request.

best,
Christian

Kailiang Chen

unread,
Nov 22, 2022, 2:31:02 PM11/22/22
to Android CameraX Discussion Group, christian...@authentic.network, Kailiang Chen
Hi Christian,

No problem. 
I am wonder how you get the YUV image in ImageCapture now? 
IIUC, it should be JPEG format.

Best,
Kailiang

Christian Günther

unread,
Nov 23, 2022, 3:39:19 AM11/23/22
to Android CameraX Discussion Group, kail...@google.com, Christian Günther
Sry i used the wrong answer button. I repeat now shortly that when other people are also reading this track here:

I am going for a jpeg fallback for devices not supporting the yuv+yuv+prev configuration. But most devices do. I achieve the yuv config for image capture with:
```
captureBuilder.setBufferFormat(ImageFormat.YUV_420_888);
```

best,
Christian
Reply all
Reply to author
Forward
0 new messages