March 2019
Intermediate to advanced
538 pages
13h 38m
English
When the alien mode is first started, we will draw the face outline on top of the camera frame so the user knows where to put their face. We will draw a big ellipse covering 70% of the image height, with a fixed aspect ratio of 0.72, so that the face will not become too skinny or fat depending on the aspect ratio of the camera:
// Draw the color face onto a black background. Mat faceOutline = Mat::zeros(size, CV_8UC3); Scalar color = CV_RGB(255,255,0); // Yellow. auto thickness = 4; // Use 70% of the screen height as the face height. auto sw = size.width; auto sh = size.height; int faceH = sh/2 * 70/100; // "faceH" is radius of the ellipse. // Scale the width to be the same nice shape for any screen ...
Read now
Unlock full access