How to get camera instance from cwac- cam2 for face detection? - android

I would like to know how to get camera instance from CWAC- CAM2 library in android so that I can attach face detector to camera for face detection. Need know how to do this in android ?

That is not supported by the library. Use the camera APIs directly, skipping the library.

Related

Camera2 face detection without mlkit

we were using camerax with mlkit for face detection. but now we need to move our face detection module to the dynamic feature module and mlkit is currently not supported. it is crashing at run time.
now I'm looking for a solution where I don't want to use firebase mlkit. is it possible to use camera2 API to detect faces and draw face rectangle on preview?.

How get a reference to the camera instance

I'm developing an AR application using ARCore and got stuck in the following issue.
I want to get the Camera instance, that the ARCore session initializes, in order to configure it myself(change preview resolution, bitrate, white balance and so on).
Unfortunately, ARCore uses an object called Session(which is also part of ARCore lib) which uses Tango(was taken from Tango Project). The Tango object handles the hardware camera through JNI calls.
ARCore doesn't have API to configure the camera and getting it through reflection seems like a bad idea.
Anybody?

Access Android camera object on runtime (Unity, Vuforia)

I'm writing Unity for Android app which uses Vuforia Augmented Reality framework.
I need manually change camera exposure to reach better augmentation. The problem is that Vuforia hides all work with camera and make it inaccessible from outside.
Also Vuforia itself uses JNI to work with device's camera.
When I try to do next in my Android plugin:
Camera camera = Camera.open();
I got CAMERA_ERROR_EVICTED exception: "Camera was disconnected due to use by higher priority user."
Is it any way to get current Camera object using JNI or any other approach?
Thanks for any help.

OpenCV for Android: Autofocus native camera

Is it possible to control autofocus feature of Android camera, using OpenCV's libnative_camera*.so ?
Or maybe it's possible to manually set focus distance?
Is there alternative approach (May be, it's better to use Android API to control camera and then grab frame in onPreview events and pass it to native code)?
If your intention is to control the camera on your own, then Android Camera APIs suck. As such Android APIs suck when it comes to offering your hardware camera device number to JavaCV native camera library. Without a native device number, JavaCV would be clueless to connect to the appropriate camera (Front or Back).
If your intention is only to perform object detection and stuff, well Android Camera APIs coupled with JavaCV should work. Setup a callbackBuffer of sufficient size, setPreviewCallbackWithBuffer, setup sufficient preview frame-rate, and once you start getting preview-frames in ImageFormat.NV21 format (mind you!!, this is the only format supported for preview-frames even in ICS), pass them off to JavaCV for performing object detection.
AutoFocus on Android Camera APIs suck big time. I have been researching for over a month for feasible solutions.

how to include face-detection in my camera app lifecycle?

i've written an app that starts up the camera. i'd like to include face detection. i've found some code that detects faces in a given bitmap image but this image is loaded from the res/drawable directory. What i'm wanting is to scan the camera's preview for faces. can anyone shed light on which camera method should handle the detection. for example is it the surfaceChanged() where i would do the detection? i understand that i may need to use a previewcallback method. can anyone point me in the correct direction
thanks
You may use a third-party libraries ,like OpenCV, or something like the Android2.2 face detection Api to finish that job. And you should by careful as the previewcallback will give you a yuv byte array, so you need to transfer it to rgb.
This tutorial from the new Android face detector API shows how to use the face detector in conjunction with the camera preview:
https://developers.google.com/vision/face-tracker-tutorial

Categories

Resources