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

No TextureView support #15

Closed
bryanstern opened this issue Aug 25, 2015 · 7 comments
Closed

No TextureView support #15

bryanstern opened this issue Aug 25, 2015 · 7 comments

Comments

@bryanstern
Copy link

The CameraSource class currently only supports sending preview frames to a SurfaceView.
https://developers.google.com/android/reference/com/google/android/gms/vision/CameraSource.html#start(android.view.SurfaceHolder)

It would be great if it also supported TextureView in the same way as this View is much more flexible. The decompiled CameraSource suggests this should be possible as calling CameraSource#start without a SurfaceView will actually send the preview frames to an unused SurfaceTexture.

Working around this with reflection (grabbing the camera, stopping the preview, adding a TextureView, and restarting) is really slow because starting the preview is slow and now happens 2x.

Please let me know if there is a better place to provide this feedback.

@pm0733464
Copy link
Contributor

The issue with supporting TextureView in the API is that it is not backward compatible to gingerbread, since that class was introduced later in ice cream sandwich. We typically have the official Google Play services APIs fully support devices back to gingerbread.

With that said, the CameraSource class isn't closely tied to the rest of the mobile vision implementation, so the rest of the API could be used without it. If your app doesn't need to support gingerbread devices, it wouldn't be too hard for you to replace CameraSource with your own camera managing class (which used TextureView). The main interaction between the camera source and the detector (and associated pipeline) is this method for sending preview frames into the detector:

https://developers.google.com/android/reference/com/google/android/gms/vision/Detector.html#receiveFrame(com.google.android.gms.vision.Frame)

You'd just need to have your camera managing class call this to pump preview frames into the detector/pipeline.

@bryanstern
Copy link
Author

Thanks, thats the route I ultimately ended up going. It would be nice if you could include the CameraSource source.

On a side note, I'm curious why you chose to support API 10+ instead of 14+.

@reisub
Copy link

reisub commented Nov 25, 2016

With news about dropping Gingerbread from Play services, do you plan to add TextureView support to mobile vision API?

@ajaysaini-sgvu
Copy link

+1

@mypplication
Copy link

+1000

@AndrewVovk
Copy link

++

@ajhool
Copy link

ajhool commented May 22, 2017

Clarification on this issue:
My understanding of this issue is that people want to control the camera using separate logic and only want android-vision to interact with a TextureView rendering. Does android-vision require camera control (eg. to focus on an area of interest)?

If, for instance, a prerecorded mp4 video was playing in a SurfaceView, could android-vision parse out text/objects/barcodes from the video? Modern video players use TextureViews, so it certainly makes sense to add TextureView support for that.

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

7 participants