From cf1587da5ed153812dff4c8d4b741470ce6ebea4 Mon Sep 17 00:00:00 2001 From: saurabhritu <31028981+saurabhritu@users.noreply.github.com> Date: Sat, 17 Apr 2021 14:00:44 +0530 Subject: [PATCH] There must be a change in line No. 86, 90 & 93. I have tried on my system and I think there must be an exchange of mask between line 90 & 93, and if I set the thresh hold value to 150 in line 86 then it shows the complete logo on the image. --- .../py_core/py_image_arithmetics/py_image_arithmetics.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/py_tutorials/py_core/py_image_arithmetics/py_image_arithmetics.rst b/source/py_tutorials/py_core/py_image_arithmetics/py_image_arithmetics.rst index 86895c9..5b0ad32 100644 --- a/source/py_tutorials/py_core/py_image_arithmetics/py_image_arithmetics.rst +++ b/source/py_tutorials/py_core/py_image_arithmetics/py_image_arithmetics.rst @@ -83,14 +83,14 @@ I want to put OpenCV logo above an image. If I add two images, it will change co # Now create a mask of logo and create its inverse mask also img2gray = cv2.cvtColor(img2,cv2.COLOR_BGR2GRAY) - ret, mask = cv2.threshold(img2gray, 10, 255, cv2.THRESH_BINARY) + ret, mask = cv2.threshold(img2gray, 150, 255, cv2.THRESH_BINARY) mask_inv = cv2.bitwise_not(mask) # Now black-out the area of logo in ROI - img1_bg = cv2.bitwise_and(roi,roi,mask = mask_inv) + img1_bg = cv2.bitwise_and(roi,roi,mask = mask) # Take only region of logo from logo image. - img2_fg = cv2.bitwise_and(img2,img2,mask = mask) + img2_fg = cv2.bitwise_and(img2,img2,mask = mask_inv) # Put logo in ROI and modify the main image dst = cv2.add(img1_bg,img2_fg)