June 2019
Intermediate to advanced
348 pages
8h 28m
English
In the preceding subsection, we loaded our prepared ornaments as instances of cv::Mat into our application. Now, let's draw them onto the faces we detected from the camera in this subsection.
Now, let's see the glasses ornament. There are many things to do before we put the glasses on a face. First, our glasses in the ornament image have a fixed width, but the faces we detected in the video may be any width, so we should resize the glasses to match the faces according to width. Then, our glasses are placed horizontally, but the faces in the video may be tilted, or even rotated 90 degrees, so we must rotate our glasses to fit the slant of the faces. At last, we should find a proper position to draw the glasses.
Read now
Unlock full access