openCV python 加减法

a1 = np.array([255, 2, 100], dtype='uint8')
a2 = np.array([200, 3, 200], dtype='uint8')

"numpy 会溢出"
a3 = a1+a2   # [199, 5, 44]
a4 = a1-a2   # [55 255 156]

"小于0为0,大于255为55"
a5 = cv.add(a1, a2)         # [[255] [  5] [255]]
a6 = cv.subtract(a1, a2)    # [[55]  [ 0] [ 0]]

你可能感兴趣的:(numpy,python,机器学习)