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++

Programming logic for smile recognition

The programming logic for smile recognition is similar to eye detection, and we will also write the smile-recognition program inside the face-detection for loop. To program smile recognition, follow these steps:

  1. Load the smile CascadeClassifier:
CascadeClassifier smileDetector("haarcascade_smile.xml");
  1. We need to detect the mouth region, which is inside the face region. The face region is again our region of interest, and to find the face region from the video feed, use will use the following command:
Mat faceroi = videofeed(face[f]);
  1. Declare a smile variable, which is a vector of the Rect type. Then, use the detectMultiScale function. In the detectMultiScale function, min neighbors is set to ...
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