Reader small image

You're reading from  Python Robotics Projects

Product typeBook
Published inMay 2018
Reading LevelIntermediate
PublisherPackt
ISBN-139781788832922
Edition1st Edition
Languages
Concepts
Right arrow
Author (1)
Prof. Diwakar Vaish
Prof. Diwakar Vaish
author image
Prof. Diwakar Vaish

Prof. Diwakar Vaish is a robotics scientist and the inventor of Manav (India's first indigenous humanoid robot), the world's first mind-controlled wheelchair, brain cloning, and the world's cheapest ventilator. He has also been a guest lecturer at over 13 IITs and various other institutions. He is the founder of A-SET Robotics, a leading robotics research company based in New Delhi.
Read more about Prof. Diwakar Vaish

Right arrow

Knowing the face


All right, we have detected the face by using a few lines of code, but I would not consider it to be a very big victory as we were fighting using the sword made by other developers. The learning set imported was a generic face learned set. However, in this chapter, we will go ahead and make our very own learning set to recognize a specific human face. This is really a cool thing and I'm sure you will love doing it.

So, let's get started. As you did earlier, go through the explanation first and then write the code so that you understand it very well.

Firstly, we are using the program to capture the images of the object that needs to be detected. In our case, this object will be a person and his face. So, let's see what we need to do:

import cv2
import numpy as np

faceDetect = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
cam = cv2.VideoCapture(0)

sampleNum = 0

id = raw_input('enter user id')

while True:
        ret,img = cam.read()
        gray = cv2.cvtColor...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Python Robotics Projects
Published in: May 2018Publisher: PacktISBN-13: 9781788832922

Author (1)

author image
Prof. Diwakar Vaish

Prof. Diwakar Vaish is a robotics scientist and the inventor of Manav (India's first indigenous humanoid robot), the world's first mind-controlled wheelchair, brain cloning, and the world's cheapest ventilator. He has also been a guest lecturer at over 13 IITs and various other institutions. He is the founder of A-SET Robotics, a leading robotics research company based in New Delhi.
Read more about Prof. Diwakar Vaish