Reputation: 25914
I'm trying to blend two images in OpenCV using cv2.addweighted() but I would like to specify a different alpha weight for each pixel instead of one weight for all the pixels. Is it possible to do this in OpenCV or do I have to write my own, slow function.
Upvotes: 2
Views: 2463
Reputation: 17295
You can use the cv::MatExpr::mul()
function (Python equivalent) to write something like:
cv::Mat C = A.mul(W1) + B.mul(W2);
Upvotes: 3