Mat::mul can be used to perform an element-wise multiplication of two Mat objects. Needless to say, this same function can also be used for element-wise division. Here's an example:
Mat result = A.mul(B);
You can also supply an additional scale parameter that will be used to scale the result. Here's another example:
double scale = 0.75; Mat result = A.mul(B, scale);