Please see the following blog post for more details about this code
Alpha Blending using OpenCV (C++ / Python)