简体   繁体   中英

Android camerav2 face detection and saving image

I have been trying to achieve this for a couple of days now, with more or less no luck.

Requirements: Tablet with Android 5.1 Use Android Face Detection (Camera V2) to constantly search for faces Once a face is found, save the current frame to the file system (optionally already crop the image to the location and size of the face) No visible camera preview

What I already achieved:

1) Using the CameraV2 I found the official FacialTracking example (finds and tracks faces, https://developers.google.com/vision/ ), but I can't find a way to access the current frame.

2) Using the old Camera API I found this nice app ( https://github.com/Macadamian/MonkeyCam ) which detects faces and can save the current frame to the filesystem. This solution however has a very high false positive rate for facial detection (this is why I would like to use the new CameraV2 api)

Does anyone have some experience with the CameraV2 api and can give me a hint, in which direction I could go from here?

I would really appreciate it!

Regards, Dustin

You could try something like what was recommended here:

Mobile Vision API - concatenate new detector object to continue frame processing

You'd change the detect method to do something like this:

public SparseArray<Face> detect(Frame frame) {
  SparseArray<Face> faces = mDelegate.detect(frame);
  if (faces.size() > 0) {
    // save the frame to the file system
  }
  return faces;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM