I keep getting an error when running the code below
import cv2
import urllib3 as urllib
import requests
import numpy as np
url = "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fwallup.net%2Fwp-content%2Fuploads%2F2016%2F03%2F10%2F343179-landscape-nature.jpg"
r = requests.get(url)
imgar = np.array(bytearray(r.text,'utf-8'),dtype=np.uint8)
img = cv2.imdecode(imgar,-1)
cv2.imshow('img',img)
cv2.waitKey()
Error:
cv2.imshow('img',img)
cv2.error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-kh7iq4w7\opencv\modules\highgui\src\window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
This error keeps happening no matter what I change the photo to and I'm unsure why, thanks