饱和操作和模操作

使用cv2.add()将两个图像相加,可以使用numpy中的矩阵加法来实现。但是在opencv中加法是饱和操作,也就是有上限值,numpy会对结果取模。 
综上,使用opencv的效果更好

x = np.uint8([250])
y = np.uint8([10])
print cv2.add(x,y) # 250+10 = 260 => 255
print x+y # 250+10 = 260 % 256 = 4

posted @ 2018-09-09 09:01  青牛梦旅行  阅读(615)  评论(0编辑  收藏  举报