![OpenCV 4 Computer Vision Application Programming Cookbook(Fourth Edition)](https://wfqqreader-1252317822.image.myqcloud.com/cover/631/36698631/b_36698631.jpg)
上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:
- 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:
![](https://epubservercos.yuewen.com/87DAA0/19470379101492006/epubprivate/OEBPS/Images/11432918-dfcc-47e6-8080-5912612b6af8.png?sign=1738819402-swmHRHfoZVDWrqVvNOUmAP50iaeFrIpK-0-3bbeb9899e83c42f3d5ebd0e14655a84)
Let's see how the preceding instructions work when we execute them.