【发布时间】:2022-01-19 19:24:54
【问题描述】:
我正在尝试读取网站上的图像,例如,我将图像链接传递给 cv2.imgread(https://website.com/photo.jpg)。但它返回一个NoneType。错误说TypeError: cannot unpack non-iterable NoneType object
这是我的代码:
def get_isbn(x):
print(x)
image = cv2.imread(x)
print(type(image))
detectedBarcodes = decode(image)
for barcode in detectedBarcodes:
(x, y, w, h) = barcode.rect
cv2.rectangle(image, (x, y), (x + w, y + h), (255, 0, 0), 5)
# print(barcode.data)
# print(type(barcode.data))
byte_isbn = barcode.data
string_isbn = str(byte_isbn, encoding='utf-8')
return string_isbn
x 是我的 url 作为参数。
【问题讨论】:
-
用字符串 url 尝试 VideoCapture
-
我只想处理一张图片,
-
VideoCapture 可以读取图像文件。也许它也可以读取图像文件的网址?
标签: opencv cv2 opencv-python