Python3 Opencv reads the network picture

from urllib import request
import numpy as np
import cv2

resp = request.urlopen("http://jy.haifandata.com:8881/img/tj.jpg")
image = np.asarray(bytearray(resp.read()), dtype="uint8")
image = cv2.imdecode(image, cv2.IMREAD_COLOR)

cv2.imshow('image', image)
cv2.waitKey(0)

 

Published 35 original articles · won praise 9 · views 30000 +

Guess you like

Origin blog.csdn.net/ZHOUYONGXYZ/article/details/104836949