From 55ba0af2bcb33bcc26194997894b57b6da9bca83 Mon Sep 17 00:00:00 2001 From: Alexander Mordvintsev Date: Mon, 4 Jul 2011 14:13:57 +0000 Subject: [PATCH] use addWeighted for blending --- samples/python2/watershed.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/python2/watershed.py b/samples/python2/watershed.py index f35248a..5d45417 100644 --- a/samples/python2/watershed.py +++ b/samples/python2/watershed.py @@ -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): -- 2.7.4