Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Green photo using ImageAnalysis

96 views
Skip to first unread message
Assigned to charco...@google.com by tah...@google.com

Anton Ivanov

unread,
Dec 5, 2024, 12:56:59 PM12/5/24
to Android CameraX Discussion Group
Hey,
Currently we are using this combination of use cases: Perview, Video, ImageAnalysis.
We take photos using the image that is passed in ImageAnalysis use case.
We just got a report of green photos on this device https://oukitel.com/products/oukitel-wp32?srsltid=AfmBOoqcBtAV4jSiTd1jbygWxhS877aCKDpW-6E7ITPlkZ9jz-Cdcfut
We don't hav it on us currently. The video seems to be ok.
Could you advice something here?
selfie_green.jpeg

Anton Ivanov

unread,
Dec 5, 2024, 1:08:29 PM12/5/24
to Android CameraX Discussion Group, Anton Ivanov
The set up for the image analysis is like this
ImageAnalysis.Builder()
.setResolution(settings.analysisResolution)
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
.setOutputImageRotationEnabled(true)
.setOutputImageFormat(ImageAnalysis.OUTPUT_IMAGE_FORMAT_RGBA_8888)
.build()

Charcoal Chen

unread,
Dec 26, 2024, 9:42:59 PM12/26/24
to Android CameraX Discussion Group, anton....@revolut.com

Thanks for reaching out to the Android CameraX Discussion Group. Apologies for the delayed response.

Since this issue appears only on a specific device and the recorded video looks normal, it's likely a device-specific problem with the ImageAnalysis (YUV_420_888) stream. This suggests the device's camera might not be providing complete U/V plane data. I was able to reproduce a similar issue by manually clearing the U/V data before converting the image to a bitmap. Unfortunately, without access to the device, it's difficult to pinpoint the exact cause.

Here are a few workarounds you could try:

Use PreviewView: If your app uses or can switch to PreviewView, you can obtain a bitmap directly using PreviewView#getBitmap(). This might bypass the problematic ImageAnalysis stream.

Separate Image Capture: If you're using ImageAnalysis for taking photos, consider adding an ImageCapture UseCase specifically for capturing still images. This would ensure proper image capture independent of the ImageAnalysis issue. You could implement this as a general solution or specifically target the OUKITEL device.

Experiment with Resolutions: Sometimes, these issues arise when the UseCases use specific set of resolutions. If possible, try using a ResolutionSelector to test various resolution combinations for Preview, VideoCapture, and ImageAnalysis. This might help identify a configuration that avoids the issue.

I hope these suggestions help! Let us know if you have any further questions or need additional assistance.

Anton Ivanov

unread,
Jan 7, 2025, 10:23:07 AMJan 7
to Android CameraX Discussion Group, charco...@google.com, Anton Ivanov
Thanks for your reply.
Regarding your advice:
1. Use PreviewView - this seems like the less desirable solution.
2. Separate Image Capture - we have this implemented actually. The problem with it that we are having abrupt image freezes on one of our devices while running it. We will file a separate bug report once another developer from our team comes back.
3. This is hard to do as we don't have the device available.

Reply all
Reply to author
Forward
0 new messages