Skip to Content
Hands-On Robotics Programming with C++
book

Hands-On Robotics Programming with C++

by Dinesh Tavasalkar
March 2019
Intermediate to advanced
312 pages
7h 37m
English
Packt Publishing
Content preview from Hands-On Robotics Programming with C++

Detecting the right eye

The programming logic for detecting the right eye is very similar to detecting the left eye. The only thing that we have to change is the classifier name and some variable names to distinguish the left and right eyes. To detect the right eye, perform these steps:

  1. Load the haarcascade_righteye_2splits cascade classifier:
CascadeClassifier eyeDetectorright("haarcascade_righteye_2splits.xml");
  1. Inside the face-detection for loop, find the face region. Then, use the detectMultiScale function to detect the right eye. Use the circle function to create a green circle around the right eye. To do so, use the following code:
Mat faceroi = videofeed(face[f]); vector<Rect>  righteye;eyeDetectorright.detectMultiScale(faceROI, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn Robotics Programming

Learn Robotics Programming

Danny Staple
C++ Reactive Programming

C++ Reactive Programming

Praseed Pai, Peter Abraham

Publisher Resources

ISBN: 9781789139006Supplemental Content