2
votes

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.

1

1 Answers

3
votes

You can use the cv::MatExpr::mul() function (Python equivalent) to write something like:

cv::Mat C = A.mul(W1) + B.mul(W2);