如何在 Python cv2 中从 Internet URL 读取图像?
这个堆栈溢出答案,
import cv2.cv as cv
import urllib2
from cStringIO import StringIO
import PIL.Image as pil
url="some_url"
img_file = urllib2.urlopen(url)
im = StringIO(img_file.read())
不好,因为 Python 向我报告:
TypeError: object.__new__(cStringIO.StringI) is not safe, use cStringIO.StringI.__new__