OpenCV 学习笔记——cv.addWeighted
addWeighted()函数
addWeighted()函数:用来将两个图片进行融合。
dst = cv.addWeighted( src1, alpha, src2, beta,gamma, dst, dtype)
官方文档解释为
- 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.
- gamma scalar added to each sum.
- dst output array that has the same size and number of channels as the input arrays.
- 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().
大致意思如下
src1
:插入的第一个图片;src2
:插入的第二个图片;alpha
:double类型,加权系数,是src1图片的融合占比 ;beta
:double类型,加权系数,是src2图片的融合占比;gamma
:double类型,加权后图像的偏移量;dst
:输出图像;dtype
:默认为-1。
该函数的计算公式为