Posts

Showing posts with the label OpenCV with webcam

Face Detection using Python and OpenCV with webcam

Image
  Face Detection using Python and OpenCV with webcam How to use : Create a directory in your pc and name it (say project) Create two python files named create_data.py and face_recognize.py, copy the first source code and second source code in it respectively. Copy haarcascade_frontalface_default.xml to the project directory, you can get it in opencv or from here . You are ready to now run the following codes. create_data.py # Creating database # It captures images and stores them in datasets # folder under the folder name of sub_data import cv2, sys, numpy, os haar_file = 'haarcascade_frontalface_default.xml' # All the faces data will be # present this folder datasets = 'G:\PARAS\datasets' //make datasets as new folder like i did in this path then sub # These are sub data sets of folder, # for my faces I've used my name you can # change the label here akhi is a sub folder insde datasets where web image will store by webcamera sub_data = 'akhi' path = os.pat