Android Face Detection using OpenCV/JavaCV - android

I want to know how I implement Android Face Detection using OpenCV/JavaCV. Any one have idea about that or have code please comment on this or put the code. I want get faces from the Phone Gallery and detect them..

For face detectiion you can use the built in FaceDetector in the Android SDK, It returns face positions and angles in BMPs. But it's not very fast.
You can Also use the javaCV face detection but before to start i recommend you to see this article to see advantages and constarint of some API that you can use and also compare Performance
For FaceDetector you can see these links
Link 1
Link 2
Here's a realtime face detection sample using FaceDetector and OpenGL (draws rectangles) which works in Android 2.2
You can also use OpenCV in Android
You'd better try this on Linux (I've tried it on Windows, but failed).
Finally JavaCV (strongly recommended)
There is a sample code of realtime face detection using the camera. See "javacv-src-*.zip" on the download page.

The timing figures on the screenshot from K_Anas are shockingly slow... my app on my HTC Desire S with the OpenCV library (here) does 4+ fps...
My demo app on Play Store (eurgh) is here. In the menu the first item takes you to my web page for the app with source code snippets. 1) install OpenCV, 2) get the supplied samples running, 3) edit "Tutorial 2 OpenCVSamples" and drop my code snippets into the frame processing loop.
I claim no credit for the app, it is just a slightly enlarged and adjusted version of the sample which comes with the OpenCV library.

Related

Using two cameras at a same time in Android Things

I am in a situation where I need to use two cameras at a same time.
I have been looking up in internet for Camera2 api examples. Although not successful in developing my own camera app the way I want for android phone, I found some examples which open the camera.
Now I have a situation. I would like to know if I can access two cameras simultaneously in Android Things Odroid N2+ board. This is because I am working on the app that needs to open two cameras and display at the same time. For processing the image, I am planning to use OpenCV library.
Is this possible in Android/Odroid ?
I also recommend to use UVC Library to access two camera. Android Things is not fit to this problem. I think this example help you. https://github.com/saki4510t/UVCCamera

Facial expressions identification like snapchat

I am working on app that detect eye blink of the user. I have been searching the web for 2 days but still don't have clear vision about how this can be done.
As far as i have knew is that the system supports face detection which is detecting if there is a face in the picture and locating it.
But this works only with images and detect only faces which is not what i need. I need to open an camera activity and directly detect the face of the user and locate his eyes and other facial parts and wait till he blinks, like when you long click on the screen on snap chat.
I have seen a lot about open-cv but still not sure what it is or how to use it or if it seize my goals.
Note: snap chat has no API released for the technology used, and even it doesn't let anyone to talk to the engineers behind this technology.
I know that openCV has the ability to allow image processing on the device's camera feed (as opposed to only being able to process still images).
Here is an introductory tutorial on eye detection using openCV:
http://romanhosek.cz/android-eye-detection-and-tracking-with-opencv/
If you can't find eye-blink detection tutorials in a google search, I think you'll have to create the code for eye-blink detection on your own, but I think openCV will be a helpful tool in doing so. There are lots of beginner openCV tutorials to help you get started.

how can i set the camera function that anti-shake(image Stabilizer) at android

I've made a Camera App.
I want to add the functionality of anti-shake.
But I could not find the setting for anti-shake(image Stabilizer).
Plz Help me!!
Usually Image Stabilizer is a built-in camera feature, while OIS (Optical-Image-Stabilization) is a built-in hardware feature; by now really few devices support them.
If device hasn't a built-in feature, i think you cannot do anything.
Android doesn't provide a direct API to manage image stabilization, but you may try:
if android.hardware.Camera.getParameters().getSupportedSceneModes(); contains steadyphoto keyword (see here), your device supports a kind of stabilization (usually it shots when accelerometer data indicates a "stable" situation)
check android.hardware.Camera.getParameters().flatten(); for a "OIS" or "image-stabilizer" keyword/values or similar to use in Parameters.set(key, value);. For the Samsung Galaxy Camera you should use parameters.set("image-stabilizer", "ois");//can be "ois" or "off"
if you are really boring you may try reading the accelerometer data and decide to shot when the device looks steady.
Good luck.
If you want to develop software image stabilizer, OpenCV is helpful library for you. Following is the one of the way to stabilize the image using Feature.
At first, you should extract feature from image using feature extractor like SIFT, SURF algorithm. In my case, FAST+ORB algorithm is best. If you want more information, See this paper
After you get the features in images, you should find matching features with images.there are several matcher but Bruteforce matcher is not bad. If Bruteforce is slow in your system, you should use a algorithm like KD-Tree.
Last, you should get geometric transformation matrix which is minimize error of transformed points. You can use RANSAC algorithm in this process.
You can develop all this process using OpenCV and I already developed it in mobile devices. See this repository

android - eye detection even without face detection during camera preview

is there any library for detecting an eye in a given rectangle (and the eye's size) , while the camera preview is still showing its content (non stop) ?
i need to find an easy way to acheive this . i've found out that there is an API for face detection , and that on android 4 they also added eyes detection , but only if it found a face , yet i need to find an eye even without any face.
You could always ook at the source code for Android and see how they do Eye detection.
Otherwise check out this question: OpenCV eye tracking on Android
If you want to see an example of opencv on android, click on this open source code.
opencv is best lib for working with face and eye Detection Using opencv you can do:
http://opencv-code.com/tutorials/eye-detection-and-tracking/
Example Code:
http://romanhosek.cz/android-eye-detection-and-tracking-with-opencv/

Android face detector using android camera

I've read its possible to use the built in android face detector to find the position of faces in a bitmap. Does anyone know of any examples of doing this using the camera as an input?
Its possible with the Face Detection APIs in ICS. Refer the camera section on this page:
http://developer.android.com/sdk/android-4.0.html
You must register a FaceDetectionListener and then call camera.startFaceDetection(). Please read the link above for more details.
I wrote some sample code. It isn't perfect since its Work In Progress but the face detection bit works just fine:
https://docs.google.com/open?id=0B2Nu5U2Cz81qZExGQ25sWVdRd21IOExUUTZsZzFoZw

Categories

Resources