I'm pretty new to OpenCV. Basically I want my RPi to do facial recognition with OpenCV and then log (save only the face as a picture) and store it in a database. How would I achieve this? I also want it to log the time/date and potentially the GPS coordinates of the capture.

1 Answer 1


...and then log (save only the face as a picture)

I take it that you need just the face, and not a name to go with the face. If so, you should implement just face detection, not face recognition. Have a look at the facedetect project in opencv samples distribution. A more thorough source of information is the Mastering OpenCV book (Chapter 8).

You also need to think about environmental conditions, such as ambient lighting. Face detection doesn't work well in low light / night conditions. You may have to setup an IR illuminator and remove the IR filter of your camera to capture faces at night.

log the time/date

The pi does not have a realtime clock to track time. Either have your Pi connected to Internet all the time so that it can get current date/time over NTP. Or buy a RTC module and connect it via GPIO pins.

GPS coordinates

If the camera you are using is location capable, you can extract GPS position from the EXIF metadata in image. Otherwise, you'll need a GPS module connected via GPIO pins. Or a secondary device like a GPS capable mobile phone to provide the coordinates to the Pi over a network connection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.