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

Aligning and blending face elements


The rest of our app's functionality is in the implementation of the Face class. Create a new file, Face.cpp. Remember that Face has a species, matrix of image data, and coordinates for the centers of the eyes and tip of the nose. Also remember that we designed Face as an immutable type, and for this reason the constructor copies a given matrix rather than storing a reference to external data. At the start of Face.cpp, let's implement the constructor that takes a species, matrix, and feature points as arguments:

#include <opencv2/imgproc.hpp>

#include "Face.h"

Face::Face(Species species, const cv::Mat &mat,
    const cv::Point2f &leftEyeCenter,
    const cv::Point2f &rightEyeCenter, const cv::Point2f &noseTip)
: species(species)
, leftEyeCenter(leftEyeCenter)
, rightEyeCenter(rightEyeCenter)
, noseTip(noseTip)
{
  mat.copyTo(this->mat);
}

Face also has the following default constructor for an empty face:

Face::Face() {
}

The following...

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