When I opened the .py file in colab
using:
from google.colab import files
uploaded = files.upload()
for fn in uploaded.keys():
print('User uploaded file "{name}" with length {length} bytes'.format(
name=fn, length=len(uploaded[fn])))
the file loaded and saved properly. but when I was opening it using the command:
python "mypuppy.py"
it loaded but an error occurred in Open CV:
Traceback (most recent call last): File "mypuppy.py", line 4, in cv2.imshow('puppy.jpg',img) cv2.error: OpenCV(3.4.3) /io/opencv/modules/highgui/src/window.cpp:356: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'
The Original .py file is as follows:
import cv2
img = cv2.imread('puppy.jpg')
while True:
from google.colab.patches import cv2_imshow
cv2_imshow(img)
#If we've waited atleast 1ms AND we've pressed the ESC
if cv2.waitkey(1) & 0xFF == 27:
break
cv2.destroyAllWindows()