use addWeighted for blending

This commit is contained in:
Alexander Mordvintsev 2011-07-04 14:13:57 +00:00
parent 85166360f1
commit 55ba0af2bc

View File

@ -31,7 +31,8 @@ class App:
def watershed(self):
m = self.markers.copy()
cv2.watershed(self.img, m)
vis = np.uint8( (self.img + self.colors[np.maximum(m, 0)]) / 2 )
overlay = self.colors[np.maximum(m, 0)]
vis = cv2.addWeighted(self.img, 0.5, overlay, 0.5, 0.0, dtype=cv2.CV_8UC3)
cv2.imshow('watershed', vis)
def run(self):