Note an error when adding two matrices with values 200 and 100, the documentation mentions that it will top out at 255 and the result is 300, i have the version 4.10.0
please show code, so others can try to reproduce, ty.
I can confirm this issue as well as it seems that the documentation of the tutorials does not generating the intended behavior OpenCV: Arithmetic Operations on Images
Now if I run the following code on opencv 4.10 python bindings (I downgraded numpy to 1.26.4 to be sure):
import cv2 as cv
import numpy as np
x = np.uint8([255])
y = np.uint8([10])
print(cv.add(x,y))
I get
[[265.]
[ 0.]
[ 0.]
[ 0.]]
According to the tutorial it should be [[255]]
so it doesn’t saturates and also it makes a 1-4 array.
I could make an issue but I’m not sure if this is an error in documentation reporting or an error in the numpy handling of the bindings. But for now just FYI
see the links I posted above for what’s going on and why this might be the case.
Ah yes thanks. I did see your comment and I indeed also slightly suspected the python bindings but haven’t dugged that deep into the code yet.
I was trying to find the github ticket for this particular issue and determine if this constitutes a tutorial/documentation change or a fix in the bindings. But I believe I’ve just found it indeed so I’ll continue the discussion there: Strange behaviour of cv2.add operation · Issue #25165 · opencv/opencv · GitHub