-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

OpenCV 3 Computer Vision Application Programming Cookbook
By :

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 with our input image using an arithmetic operator. The following represents this second image:
Here, we add two images. This is useful when we want 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 we want a weighted sum as follows:
cv::addWeighted(image1,0.7,image2,0.9,0.,result);
The operation results in a new image:
All binary arithmetic functions work the same way. Two inputs are provided and a third parameter specifies the output. In some cases, weights that are used as scalar multipliers in the operation...
Change the font size
Change margin width
Change background colour