nickponline
nickponline

Reputation: 25914

In OpenCV can you have a weight per pixel with addWeighted?

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

Answers (1)

Adi Shavit
Adi Shavit

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

Related Questions