from sklearn.datasets import load_sample_image
image = load_sample_image(“image.png”)
报错如下:
AttributeError: Cannot find sample image: image.png
sklearn库使用的是库自带的内置图片,所以()里的内容要和已有的图片名称相同,只有china.jpg和flower.jpg
这是load_sample_image()函数的内容:
def load_sample_image(image_name):
"""Load the numpy array of a single sample image
Read more in the :ref:`User Guide <sample_images>`.
Parameters
----------
image_name : {`china.jpg`, `flower.jpg`}
The name of the sample image loaded
flower=load_sample_image('flower.jpg')
china=load_sample_image('china.jpg')
cv2.imshow('flower',flower)
cv2.imshow('china',china)
cv2.waitKey(0)