0

What is the recommended way to extract the actual pixels represented by the Face objects detected through the Android gms.vision.face.* packages?

I am working with the FaceTracker sample code from here for retrieving video frames from the device camera, and running them through face detection.

The pipeline attaches a Face Detector to a CameraSource which receives Frames from a SurfaceView object. The Face Detector creates Face objects for each detected face. However, as far as I can tell, Face objects do not hold the underlying pixels that the face encompasses. I would like to store the detected face for future verification.

One possible solution (as far as I can tell) would be to receive a frame from the SurfaceView, hold on to that buffer, call the face detection on the single Frame, then use the Face objects returned to extract the pixels. However, I do not know enough about the implementation details to guess at the possible overhead of making a call with a single frame (model initialization, etc.). I'm re-familiarizing myself with Java after 10 years away, which means I'm also a bit slow grasping the code I'm reading :)

Any preferred solutions out there?

  • You can't receive frames, or anything else, from SurfaceView. It's a producer-consumer pair, where the producer (Surface) lives in the app, and the consumer is the system compositor (SurfaceFlinger). So I'm not quite sure what your current setup does. cf. https://source.android.com/devices/graphics/architecture.html – fadden Feb 11 '16 at 01:23
  • Thanks for the comment. Here is the image that I was describing, for clarification: https://developers.google.com/vision/images/face-tracker-pipeline.png – James Hodson Feb 11 '16 at 02:51
  • 1
    See a suggested approach here: http://stackoverflow.com/questions/32299947/mobile-vision-api-concatenate-new-detector-object-to-continue-frame-processing/32314136#32314136 – pm0733464 Feb 12 '16 at 15:36
  • Thanks, that's exactly the conclusion I came to, and have just finished implementing. It's good to have the independent validation, though! I wish I had been able to find it in the first place. – James Hodson Feb 12 '16 at 19:18
  • Can you post as an answer so that I can accept it? – James Hodson Feb 12 '16 at 19:19
  • any approach??? – Hamid Reza Jul 04 '17 at 11:29

0 Answers0