Reader small image

You're reading from  iOS Application Development with OpenCV 3

Product typeBook
Published inJun 2016
Reading LevelIntermediate
PublisherPackt
ISBN-139781785289491
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Joseph Howse
Joseph Howse
author image
Joseph Howse

Joseph Howse lives in a Canadian fishing village, where he chats with his cats, crafts his books, and nurtures an orchard of hardy fruit trees. He is President of Nummist Media Corporation, which exists to support his books and to provide mentoring and consulting services, with a specialty in computer vision. On average, in 2015-2022, Joseph has written 1.4 new books or new editions per year for Packt. He also writes fiction, including an upcoming novel about the lives of a group of young people in the last days of the Soviet Union.
Read more about Joseph Howse

Right arrow

Defining faces and a face detector


Let's define faces and a face detector in pure C++ code without using any dependencies except OpenCV. This ensures that the computer vision functionality of ManyMasks is portable. We could reuse the core of our code on a different platform with a different set of UI libraries.

A face has a species. For our purposes, this could be Human, Cat, or Hybrid. Let's create a header file, Species.h, and define the following enum in it:

#ifndef SPECIES_H
#define SPECIES_H

enum Species {
  Human,
  Cat,
  Hybrid
};

#endif // !SPECIES_H

A face also has a matrix of image data and three feature points representing the centers of the eyes and tip of the nose. We may construct a face in any of the following ways:

  • Specify a species, matrix, and feature points.

  • Create an empty face with default values, including an empty matrix.

  • Copy an existing face.

  • Merge two existing faces.

Let's create another header file, Face.h, and declare the following public interface of a Face class...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
iOS Application Development with OpenCV 3
Published in: Jun 2016Publisher: PacktISBN-13: 9781785289491

Author (1)

author image
Joseph Howse

Joseph Howse lives in a Canadian fishing village, where he chats with his cats, crafts his books, and nurtures an orchard of hardy fruit trees. He is President of Nummist Media Corporation, which exists to support his books and to provide mentoring and consulting services, with a specialty in computer vision. On average, in 2015-2022, Joseph has written 1.4 new books or new editions per year for Packt. He also writes fiction, including an upcoming novel about the lives of a group of young people in the last days of the Soviet Union.
Read more about Joseph Howse