Previous Article Next Article OpenCV Face Detection with Raspberry Pi – Robotics with Python p.7
Posted in Python

OpenCV Face Detection with Raspberry Pi – Robotics with Python p.7

OpenCV Face Detection with Raspberry Pi – Robotics with Python p.7 Posted on January 21, 201824 Comments



Next, we’re going to touch on using OpenCV with the Raspberry Pi’s camera, giving our robot the gift of sight. There are many steps involved to this process, so there’s a lot that is about to be thrown your way. If at any point you’re stuck/lost/whatever, feel free to ask questions on the video and I will try to help where possible. There are a lot of moving parts here. If all else fails, I have hosted my Raspberry Pi image: https://drive.google.com/file/d/0B11p78NlrG-vZzdJLWYxcU5iMXM/view?usp=sharing

OpenCV stands for Open Computer Vision, and it is an open source computer vision and machine learning library. To start, you will need to get OpenCV on to your Raspberry Pi.

Raspberry Pi + OpenCV

Keep in mind, the “make” part of this tutorial will take 9-10 hours on a Raspberry Pi Model B+. The Raspberry Pi 2 will do it in more like 2-4 hours. Either way, it will take a while. I just did it overnight one night.

Text-based version and sample code: http://pythonprogramming.net/raspberry-pi-camera-opencv-face-detection-tutorial/

http://pythonprogramming.net

24 comments

  1. I keep getting this stupid error when I run the code:

    NameError: name 'numpy' is not defined.
    I have tried doing import numpy instead of import numpy as np but no luck :/ spent a good few hours on it now and got no where. so frustrating! Any help would be much appreciated.
    thanks in advance!

  2. I'm getting an error that says "!empty() in function detectMultiScale" for the line "faces = face_cascade.detectMultiScale(gray, 1.1, 5)" does anyone know a solution to the error?

  3. I have a question. I don't have any issues running opencv on the pi itself. But if I try to run from another computer thru the network, it can't open the video. Even running on the pi. I was expecting it to open the video on the pi but it just errors out. Any suggestions?

  4. Why can't we just do cv2.VideoCapture(0) as we did in Windows , for getting the camera feed ? Why do we have to jump through loops of io/picamera modules and then convert to numpy array , just to get the image from camera ??

  5. Hi, Ive flashed the image you hosted onto my sd card. However on the bootup it only shows a rainbow boot screen and doesnt get through that. Do you have any idea of what I can do?

  6. Thanks for the tutorial. Are u aware of any contrast detection code or utility (used for focus confirmation) available on this platform?
    Pi camera will scan camera viewfinder and confirm focus when lens lock focus on subject. Just curious…

  7. sir I did the palm detection using raspberry pi but the video stream is accompanied with high latency so how to remove the latency… it works pretty well in laptops basically in Fedora operating system but in Raspbian os the latency is high

  8. Hi Sentdex! I downloaded the sd image from google drive und used etcher to write the image onto my 16gb SD card. worked fine, but when I insertr the sd card into the pi, it just opens te colorful screen and doesnt load the operating system. Do you know why?

  9. Hi,
    thank you very much for your time and for your videos.
    I do have a problem with the IMG file you put in your comments.
    I've a very poor broadband line and I cannot manage to download it. I've even used my mobile to download it but each time I'm powering the Raspberry it does boot. I've tried different Raspberry and different SD Cards, but the problem is still there.
    did you have comments about your IMG file ? is it possible for you to split it in 3 or 4 parts (QuickPar ?)
    Thanks in advance for your help
    Regards
    Erix

  10. I need to get an output from buzzer… like my RPi detects the face and starts the buzzer and second thing is my Raspberry Pi detects male and female separately and provides different output. Is this possible then suggest the solution.

Leave a Reply

Your email address will not be published. Required fields are marked *