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=1739610486-3l46PFg432eLq453lvVK0y9WTBAkIagw-0-7362a906f76f9af7a6be2fc4a501cade)
Let's see how the preceding instructions work when we execute them.