

# Initialize individual sampling face count # For each person, enter one numeric face idįace_id = input('\n enter user id end press => ') #cam = cv2.VideoCapture(0) # For CSI CameraĬam = cv2.VideoCapture('rtsp://ip address:port/user=admin&password=admin123&channel=1&stream=1.sdp?') # Use your RTSP Linkįace_detector = cv2.CascadeClassifier('/home/pi/haarcascades/haarcascade_frontalface_default.xml') => Each face will have a unique numeric integer ID as 1, 2, 3, etc => Faces will be stored on a directory: dataset/ (if does not exist, pls create one) Gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)Ĭv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)Ĭapture multiple Faces from multiple users to be stored on a DataBase (dataset directory) #For CSI Camera => cv2.VideoCapture(0), For USB Camera => cv2.VideoCapture(1) & For IP Camera => cv2.VideoCapture("Your RTSP Link")Ĭam = cv2.VideoCapture('rtsp://ip addrss:port/user=admin&password=admin123&channel=1&stream=1.sdp?') import numpy as np import cv2įaceCascade = cv2.CascadeClassifier('Cascades/haarcascade_frontalface_default.xml') Those XML files can be downloaded from haarcascades directory. OpenCV already contains many pre-trained classifiers for face, eyes, smile, etc. If you want to train your own classifier for any object like car, planes etc. The good news is that OpenCV comes with a trainer as well as a detector. Then we need to extract features from it. Initially, the algorithm needs a lot of positive images (images of faces) and negative images (images without faces) to train the classifier. To detect a face (or any objects), is using the " Haar Cascade classifier". Before anything, you must "capture" a face (Phase 1) in order to recognize it, when compared with a new face captured in the future (Phase 3). The most basic task on Face Recognition is of course, "Face Detecting".
Ip camera viewer pro face detection install#
Note: While importing opencv if you get error like "ImportError: /usr/local/lib/python3.7/dist-packages/cv2/: undefined symbol: _atomic_fetch_add_8", then use "sudo pip3 install opencv-contrib-python=3.4.6.27" - this command as the latest version of openCV doesn't work with Raspberry Pi. sudo pip3 install opencv-contrib-python=3.4.6.27 sudo apt-get install libatlas-base-devġ1. sudo apt-get install libqtgui4 libqtwebkit4 libqt4-testħ. sudo apt-get install libhdf5-serial-devĦ. sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-100ĥ.
Ip camera viewer pro face detection how to#
How to install opencv in raspberry pi | pythonpip installation
