Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YuvToRgbConverter sample incorrect working #207

Closed
AlexanderMatveev opened this issue Apr 18, 2020 · 3 comments
Closed

YuvToRgbConverter sample incorrect working #207

AlexanderMatveev opened this issue Apr 18, 2020 · 3 comments
Assignees

Comments

@AlexanderMatveev
Copy link

AlexanderMatveev commented Apr 18, 2020

YuvToRgbConverter class generates wrong RGB image.

Creating converter and bitmap:

yuvToRgbConverter = YuvToRgbConverter(applicationContext)
previewBitmap =
            Bitmap.createBitmap(previewSize.width, previewSize.height, Bitmap.Config.RGB_565)

Converting ImageProxy image to RGB using example code (https://developer.android.com/training/camerax/analyze):

override fun analyze(imageProxy: ImageProxy, rotationDegrees: Int) {
// ...
yuvToRgbConverter.yuvToRgb(imageProxy.image!!, previewBitmap)

Gives result (upper is original TextureView, lower is RGB bitmap result):

ezgif-6-9e3adcbc01dd

@owahltinez
Copy link
Contributor

Please see this file for sample usage. If you are still seeing issues then, unfortunately, it is likely a device bug in the implementation of the YUV to RGB converter and there is not much we can do about it.

@AlexanderMatveev
Copy link
Author

@owahltinez yes, it's working. Thank you for fast response. I'm closing this issue and going to research example you gave.

@AlexanderMatveev
Copy link
Author

AlexanderMatveev commented Apr 18, 2020

My mistake was expecting ImageAnalysis.Analyzer to return image with width and height I'm setting with ImageAnalysis.Builder's setTargetResolution. I was creating my bitmap with size not same as Analyzer image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants