Ask Your Question

addWeighted() function in cv2

asked 2017-01-11 22:16:53 -0600

beginner19 gravatar image

The addWeighted function can be defined as cv2.addWeighted(src1, alpha, src2, beta, gamma[, dst[, dtype]]) → dst

src1 – first input array.
alpha – weight of the first array elements.
src2 – second input array of the same size and channel number as src1.
beta – weight of the second array elements.
dst – output array that has the same size and number of channels as the input arrays.
gamma – scalar added to each sum.
dtype – optional depth of the output array; when both input arrays have the same depth, dtype can be set to -1, which will be equivalent to src1.depth().

but in case of image addition src1 and src2 will be the two images we want to add .. How these images are converted into arrays ? as addweighted takes argument in terms of arrays

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2017-01-12 03:11:39 -0600

berak gravatar image

yes, the docs might be confusing, but in python, you simply need a 2d numpy array per image (e.g., what cv2.imread() returns)

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-01-11 22:16:53 -0600

Seen: 10,954 times

Last updated: Jan 12 '17