From the course: OpenCV for Python Developers
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Solution: Eye detection
From the course: OpenCV for Python Developers
Solution: Eye detection
(upbeat music) - [Instructor] Now let's take a look at the solution to this challenge. As a reminder, we are tasked with drawing circles around all the eyes in an image. To do this, we're going to use the Haar Cascade method using the provided haarcascade_eye.xml file. Similar to the face trained file, this is pre-trained data around detecting eyes and images. Additionally, we're going to try and reduce the number of false positives and false negatives as much as possible. Now let's take a look at the chapter four, module six precluded Python file. In here we see that we already have our faces loaded in and read in in full color. Next, let's convert to gray using gray equals cv2.cvtColor and then passing an image. Then cv2.COLOR_BGR2GRAY. Then we will set our path to be our XML file, typing path equals haarcascade_eye.xml. Next, we'll create our eye_cascade object equals cv2.Cascade, capitalize, Classifier, also…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.