0

I am following the instructions left in this post about how to feather edges on a masked image. I am up to the point of trying to threshold my grayscaled image but I keep receiving a 'tuple index out of range' error whenever I try

image = cv2.imread(path)
blurred1 = cv2.GaussianBlur(image, (21,21), 0)
blurmask = np.zeros(image.shape[:2], dtype="uint8")
gray = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY)
cv2_imshow(gray)
thresh = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY)[2]

error:

   IndexError                                Traceback (most recent call last)

<ipython-input-40-906f123ffaf8> in <module>()
      5 gray = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY)
      6 cv2_imshow(gray)
----> 7 thresh = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY)[2]

IndexError: tuple index out of range
HEART LOCKET
  • 53
  • 1
  • 3

0 Answers0