I used cv2_imshow
:
import cv2
from google.colab.patches import cv2_imshow
frameWidth = 640
frameHeight = 480
cap = cv2.VideoCapture(0)
cap.set(3, frameWidth)
cap.set(4, frameHeight)
cap.set(10,150)
while True:
success, img = cap.read()
cv2_imshow(img)
if cv2.waitKey(1) and 0xFF == ord('q'):
break
got this error
AttributeError Traceback (most recent call last)
<ipython-input-17-8302024201cc> in <module>()
10 while True:
11 img = cap.read()
---> 12 cv2_imshow(img)
13 if cv2.waitKey(1) and 0xFF == ord('q'):
14 break
/usr/local/lib/python3.6/dist-packages/google/colab/patches/__init__.py in cv2_imshow(a)
20 image.
21 """
---> 22 a = a.clip(0, 255).astype('uint8')
23 # cv2 stores colors as BGR; convert to RGB
24 if a.ndim == 3:
AttributeError: 'tuple' object has no attribute 'clip'