Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid ICS API 14 - Camera.Face face recognition
    primarykey
    data
    text
    <p>Attempting to use Android 4 API 14 face recognition found in Camera.Face class.</p> <p>I'm having difficulty getting values for face coordinates [Left/Right eye, mouth].</p> <p>Device im using is Samsung Galaxy Tab 2 [GT-P5100] with Android 4.0.4 </p> <p>I'm initialising face detection something like below code snippet and the value of <em>camera.getParameters().getMaxNumDetectedFaces()</em> is returned as 3 when running on the above mentioned device.</p> <p>Now when face is introduced to the surface frame and detected in face detection listener, it returns back the values in <em>faces[0].rect.flattenToString()</em> identifying position of the face on surface. However the rest of the values i.e. face id, left/right eye and mouth are returned as -1 and Null respectively.</p> <p>This behaviour is described in <a href="http://developer.android.com/reference/android/hardware/Camera.Face.html" rel="noreferrer" title="Android documentation">documentation</a> as </p> <blockquote> <p>This is an optional field, may not be supported on all devices. If not supported, the value will always be set to null. The optional fields are supported as a set. Either they are all valid, or none of them are.</p> </blockquote> <p>So the question is am I missing something or is it simply that my device can not support Android api face recognition as found in Camera.Face?</p> <p>It is worth to mention that same device offeres face log in to the device, which is configured trough user settings.</p> <pre><code> FaceDetectionListener faceDetectionListener = new FaceDetectionListener(){ @Override public void onFaceDetection(Face[] faces, Camera camera) { if (faces.length == 0){ prompt.setText(" No Face Detected! "); }else{ prompt.setText(String.valueOf(faces.length) + " Face Detected :) [ " + faces[0].rect.flattenToString() + "Coordinates : Left Eye - " + faces[0].leftEye + "]" ) ; Log.i("TEST", "face coordinates = Rect :" + faces[0].rect.flattenToString()); Log.i("TEST", "face coordinates = Left eye : " + String.valueOf(faces[0].leftEye)); Log.i("TEST", "face coordinates = Right eye - " + String.valueOf(faces[0].rightEye)); Log.i("TEST", "face coordinates = Mouth - " + String.valueOf(faces[0].mouth)); } </code></pre> <p>.....</p> <pre><code> if (camera != null){ try { camera.setPreviewDisplay(surfaceHolder); camera.startPreview(); prompt.setText(String.valueOf( "Max Face: " + camera.getParameters().getMaxNumDetectedFaces())); camera.startFaceDetection(); previewing = true; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload