How to overlay 3D objects on a video

Now that we have all the different blocks, we are ready to build the final system. Let's say we want to overlay a pyramid on top of our cardboard box, as shown here:

Let's tilt the cardboard box to see what happens:

Looks like the pyramid is following the surface. Let's add a second target:

You can keep adding more targets and all those pyramids will be tracked nicely. Let's see how to do this using OpenCV ...

Get OpenCV 3.x with Python By Example - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.