sklearn.datasets.load_sample_image()

sklearn.datasets.load_sample_image(image_name) [source]

Load the numpy array of a single sample image

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

1
2
3
4
5
6
7
8
9
10
11
>>> from sklearn.datasets import load_sample_image
>>> china = load_sample_image('china.jpg')  
>>> china.dtype                             
dtype('uint8')
>>> china.shape                             
(427, 640, 3)
>>> flower = load_sample_image('flower.jpg')
>>> flower.dtype                            
dtype('uint8')
>>> flower.shape                            
(427, 640, 3)

Examples using sklearn.datasets.load_sample_image

doc_scikit_learn
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.