Search code examples
androidface-detection

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


Solution

  • 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.