OpenCV 4 Computer Vision Application Programming Cookbook(Fourth Edition)
上QQ阅读APP看书,第一时间看更新

How to do it...

Here, we add two images. This is useful when you want to create some special effects or to overlay information over an image:

  1. Call the cv::add function or, more precisely here, the cv::addWeighted function, since we want a weighted sum as follows:
   cv::addWeighted(image1,0.7,image2,0.9,0.,result); 

The operation results in a new image, as seen in the following screenshot:

Let's see how the preceding instructions work when we execute them.