-
Notifications
You must be signed in to change notification settings - Fork 762
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
fix: Add support for YUV_420_888 Image format. #732
base: develop
Are you sure you want to change the base?
Conversation
There's still the open issue of cleaning up the texture. I'd appreciate some feedback on how to change the API accordingly. I don't think there's a way around that. |
If you allow me, I will share with you the method I used to solve a similar problem. Maybe it can help:
|
I fixed the resource leak by making @wantroba thanks for providing an alternative solution! I feel it targets a slightly different use case (saving to file) as the one I target here (using as ML-Kit input). |
Casting the bytes to a type directly is not possible, thus allocating a new texture is necessary (and costly). But on the bright side, we avoid the conversion inside the camera plugin [0]. Or any other custom conversion code in dart, which is likely more costly. [0] https://github.com/flutter/packages/blob/d1fd6232ec33cd5a25aa762e605c494afced812f/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/media/ImageStreamReaderUtils.java#L35
Casting the bytes to a type directly is not possible, thus allocating a new texture is necessary (and costly).
But on the bright side, we avoid the conversion inside the camera plugin [0].
[0] https://github.com/flutter/packages/blob/d1fd6232ec33cd5a25aa762e605c494afced812f/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/media/ImageStreamReaderUtils.java#L35