Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can perform arithmetic operations on image in the most straightforward way. Here some examples:

Mat yourImage;
....                         // set values in your image
yourImage += 2;              // add 2 to each pixel in image
yourImage.col(3) *= 1.5;     // multiply each value in column 3 by 1.5
yourImage.row(5) = 7*yourImage.row(4) - 8*yourImage.row(3) - 1; // you can guess what it does :)

And so on.