In [2]:
import cv2
import numpy as np
import matplotlib.pyplot as plt

%matplotlib inline

In [3]:
org_img=cv2.imread('img/circles.png')                # read sample image

min = np.array([0,0,0],np.uint8)
max = np.array([0,0,255],np.uint8)                   # threshold min and max limits

hsv_img = cv2.cvtColor(org_img,cv2.COLOR_BGR2HSV)    # convert color space from BGR to HSV
thr_img = cv2.inRange(hsv_img,min,max)               # apply the selected threshold

cv2.imwrite('img/circles.jpg',thr_img);            # write the threshold image to disk

In [8]:
cv2.imshow(thr_img)
plt.title('Threshold Image')
plt.show()


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-f4339b039fb5> in <module>()
----> 1 cv2.imshow(thr_img)
      2 plt.title('Threshold Image')
      3 plt.show()

TypeError: Required argument 'mat' (pos 2) not found

In [ ]: