'for printing image the following error is hapening
CODE
import numpy as np import cv2 from google.colab.patches import cv2_imshow img=cv2.imread('/gdrive/My Drive/Colab Notebooks/merlin_190860876_3e2e2660-237f-487c-ae56-5438019051a3-superJumbo.jpeg') cv2_imshow(img)
print("Showing the red channel") RedChannel=img[:,:,2] cv2_imshow(RedChannel) print("Showing the Green channel") RedChannel=img[:,:,1] cv2_imshow(GreenChannel)
AttributeError Traceback (most recent call last) in () 3 from google.colab.patches import cv2_imshow 4 img=cv2.imread('/gdrive/My Drive/Colab Notebooks/merlin_190860876_3e2e2660-237f-487c-ae56-5438019051a3-superJumbo.jpeg') ----> 5 cv2_imshow(img) 6 7 print("Showing the red channel")
/usr/local/lib/python3.7/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: 'NoneType' object has no attribute 'clip'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|