googlesamples / android-vision

Deprecated: The Mobile Vision API is now a part of ML Kit: Check out this repo:
https://github.com/firebase/quickstart-android/tree/master/mlkit
Apache License 2.0
2.93k stars 1.73k forks source link

camera2 with mobile vision? #65

Open vietnt134 opened 8 years ago

vietnt134 commented 8 years ago

Hello,

I saw that Camera is now deprecated and the recommend is to use camera2, do you guy have plan for switching mobile-vision to camera2 or do you have any idea how to use camera2 on mobile-vision?

Thanks and regards

Viet

pm0733464 commented 8 years ago

There are no near term plans for a camera2 version of the CameraSource class in the official API. However, given how the API is structured, an alternate version of CameraSource could be written by the developer community that uses camera2. All of the existing APIs for working with frames and detectors are sufficient to support a camera2 implementation as well.

aagarw33 commented 7 years ago

Hi @pm0733464 if not now - will there be support for Camera2API in future, if in later release of Android the deprecated CameraAPI is completely removed?

Thanks, Akash

pm0733464 commented 7 years ago

I highly doubt that CameraAPI would be completely removed, but we'd have to discuss it if things change.

aagarw33 commented 7 years ago

Thank you for swift response. Ok so it is safe to use it then, as any upcoming changes will be accommodated.

badrimurali commented 7 years ago

hi Why is the image quality is very poor when compressed to jpeg

Carpetfizz commented 7 years ago

Any update on camera2 support for Google Vision, or a link to a "community made" CameraSource class ?

victor-lund commented 7 years ago

Any updates here...? Please?

pm0733464 commented 7 years ago

I am not aware of any plans to develop an official camera2 version of CameraSource. But it would be good if the developer community would develop one, which is possible since it would not require any changes to the existing public vision API.

EzequielAdrianM commented 7 years ago

@pm0733464 That would be nice! But how can we help the Developer community to develop it?

victor-lund commented 7 years ago

@pm0733464 Any pointers-in-right direction on how we would go about this?

@EzequielAdrianM +1

pm0733464 commented 7 years ago

There's an open source version of CameraSource (camera1 version) available on GitHub. You should be able to use a similar structure to develop a camera2 version. The code is here:

https://github.com/googlesamples/android-vision/blob/master/visionSamples/barcode-reader/app/src/main/java/com/google/android/gms/samples/vision/barcodereader/ui/camera/CameraSource.java

It feeds frames that it acquires from the camera into an associated detector like this:

mDetector.receiveFrame(outputFrame);

https://github.com/googlesamples/android-vision/blob/master/visionSamples/barcode-reader/app/src/main/java/com/google/android/gms/samples/vision/barcodereader/ui/camera/CameraSource.java#L1205

You'd implement an alternate version of this CameraSource class which also keeps a reference to an underlying detector. Your implementation would use the camera2 API to receive preview images from the camera, construct Frame objects, and pass those frames into the underlying detector.

EzequielAdrianM commented 7 years ago

And finally got it! Here is the piece of software you here looking for. It took me a couple of days to finish it. It is open for everyone. Please test and comment in which devices worked. Thanks!

Camera2Vision

ghost commented 6 years ago

I checked EzequielAdrianM Camera2Vision code, it is a great solution. Congrats!!! I would like to know if it is possible to save the video with the faces landmarks, so anytime i open the saved video be able to watch this faces landmarks? Thanks!!!

famm2005 commented 6 years ago

Hi Ezequiel,

I can not make your Camera2Vision code work on Raspberry Pi 3 with the camera v2 in Android Things v1.0.1, it is giving the following error:

06-29 17: 08: 14.578 10191-10242 / com.example.ezequiel.camera2 E / CameraCaptureSession: Session 0: Failed to create capture session; configuration failed

You could help me?

famm2005 commented 5 years ago

How to programmatically configure Static or DHCP Ethernet connection in Android Things?