Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
iOS Application Development with OpenCV 3

You're reading from   iOS Application Development with OpenCV 3 Create four mobile apps and explore the world through photography and computer vision

Arrow left icon
Product type Paperback
Published in Jun 2016
Publisher Packt
ISBN-13 9781785289491
Length 228 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Joseph Howse Joseph Howse
Author Profile Icon Joseph Howse
Joseph Howse
Arrow right icon
View More author details
Toc

Table of Contents (7) Chapters Close

Preface 1. Setting Up Software and Hardware FREE CHAPTER 2. Capturing, Storing, and Sharing Photos 3. Blending Images 4. Detecting and Merging Faces of Mammals 5. Classifying Coins and Commodities Index

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 chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime