Images can be combined in different ways. Since they are regular matrices, they can be added, subtracted, multiplied, or divided. OpenCV offers various image arithmetic operators and their use is discussed in this recipe.
Let's work with a second image that we will combine to our input image using an arithmetic operator. The following represents the second image:
Here we add two images. This is useful when one wants to create some special effects or to overlay information over an image. We do this by calling the
cv::add function, or more precisely here, the
cv::addWeighted function since ...