sklearn.datasets.load_sample_image¶
sklearn.datasets.load_sample_image(image_name)
加载单个样本图像的numpy数组
在用户指南中阅读更多内容。
参数 | 说明 |
---|---|
image_name | {china.jpg , flower.jpg }加载的样本图像的名称 |
返回值 | 说明 |
---|---|
img | 3D array 图像为numpy数组:高度x宽度x颜色 |
示例
>>> from sklearn.datasets import load_sample_image
>>> china = load_sample_image('china.jpg') # doctest: +SKIP
>>> china.dtype # doctest: +SKIP
dtype('uint8')
>>> china.shape # doctest: +SKIP
(427, 640, 3)
>>> flower = load_sample_image('flower.jpg') # doctest: +SKIP
>>> flower.dtype # doctest: +SKIP
dtype('uint8')
>>> flower.shape # doctest: +SKIP
(427, 640, 3)