def fetch_cvimage_from_url(url, maxsize=10 * 1024 * 1024):
req = requests.get(url, timeout=5, stream=True)
content = ''
for chunk in req.iter_content(2048):
content += chunk
if len(content) > maxsize:
req.close()
raise ValueError('Response too large')
img_array = np.asarray(bytearray(content), dtype=np.uint8)
cv2_img_flag = cv2.CV_LOAD_IMAGE_COLOR
image = cv2.imdecode(img_array, cv2_img_flag)
return image
classifiers.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录