sklearn.datasets.load_sample_image

sklearn.datasets.load_sample_image(image_name)

Load the numpy array of a single sample image

Read more in the User Guide.

Parameters:

image_name : {china.jpg, flower.jpg}

The name of the sample image loaded

Returns:

img : 3D array

The image as a numpy array: height x width x color

Examples

>>> 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)

Examples using sklearn.datasets.load_sample_image