opencv-python
opencv-python copied to clipboard
addWeighted outputs incorrectly when any element in src2 is zero
Expected behaviour
For each pixel, the output should follow dst = src1 * alpha + src2 * beta + gamma
Actual behaviour
If a pixel's value in src2 is zero, dst = src1
For example, given alpha = 0.5 src1 [110 126 239] src2 [0 0 0] dst [110 126 239]
Steps to reproduce
- example code
alpha = 0.5
beta = 1.0 - alpha
dst = cv2.addWeighted(src1, alpha, src2, beta, 0.0)
-
operating system: Ubuntu 20.04.6 LTS
-
architecture: x86
-
opencv-python version: 4.10.0
Issue submission checklist
- [ ] This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
- [x] I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
- [x] The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
- [x] I'm using the latest version of
opencv-python