使用全息视图显示来自 url 的图像

Display image from url using holoviews

如何显示来自 url 的图像。 这导致错误

import urllib
img = urllib.request.urlopen('https://www.edgystl.com/wp-content/uploads/2018/01/leather-bicker-jacket-model-street-style-men-1-e1530998880646.jpg')
hv.RGB(img)

HoloViews RGB 元素通常期望 NumPy 数组,从图像获取数组的最简单方法是使用 PIL(或 Pillow)库并使用请求下载它。这是它的样子:

from PIL import Image
import requests
from io import BytesIO

url = 'https://www.edgystl.com/wp-content/uploads/2018/01/leather-bicker-jacket-model-street-style-men-1-e1530998880646.jpg'
response = requests.get(url)
img = Image.open(BytesIO(response.content))
hv.RGB(np.array(img))

原来可以用skimage来完成

import holoviews as hv
from skimage import io

img = io.imread('https://www.edgystl.com/wp-content/uploads/2018/01/leather-bicker-jacket-model-street-style-men-1-e1530998880646.jpg')
hv.RGB(np.array(img))