Docs for 0.13.1
All versions

Module: data

Standard test images.

For more images, see Colour image of the astronaut Eileen Collins.[length, …]) Generate synthetic binary image with several rounded blob-like objects. Gray-level “camera” image. Checkerboard image. Chelsea the cat. Motion blurred clock. Coffee cup. Greek coins from Pompeii. Context for use in testing to catch known warnings matching regexes Black and white silhouette of a horse. Hubble eXtreme Deep Field.[, force_copy]) Convert an image to boolean format. Immunohistochemical (IHC) staining with hematoxylin counterstaining.[, as_grey, …]) Load an image from file.[, as_grey]) Load an image file located in the data directory. Scikit-image logo, a RGBA image. Surface of the moon. Scanned page. Launch photo of DSCOVR on Falcon 9 by SpaceX. Rectified stereo image pair with ground-truth disparities. Gray-level “text” image used for corner detection.[, kind]) Set the default plugin for a specified operation.


Colour image of the astronaut Eileen Collins.

Photograph of Eileen Collins, an American astronaut. She was selected as an astronaut in 1992 and first piloted the space shuttle STS-63 in 1995. She retired in 2006 after spending a total of 38 days, 8 hours and 10 minutes in outer space.

This image was downloaded from the NASA Great Images database <>`__.

No known copyright restrictions, released into the public domain.


astronaut : (512, 512, 3) uint8 ndarray

Astronaut image.

binary_blobs, blob_size_fraction=0.1, n_dim=2, volume_fraction=0.5, seed=None)[source]

Generate synthetic binary image with several rounded blob-like objects.


length : int, optional

Linear size of output image.

blob_size_fraction : float, optional

Typical linear size of blob, as a fraction of length, should be smaller than 1.

n_dim : int, optional

Number of dimensions of output image.

volume_fraction : float, default 0.5

Fraction of image pixels covered by the blobs (where the output is 1). Should be in [0, 1].

seed : int, optional

Seed to initialize the random number generator. If None, a random seed from the operating system is used.


blobs : ndarray of bools

Output binary image


>>> from skimage import data
>>> data.binary_blobs(length=5, blob_size_fraction=0.2, seed=1)
array([[ True, False,  True,  True,  True],
       [ True,  True,  True, False,  True],
       [False,  True, False,  True,  True],
       [ True, False, False,  True,  True],
       [ True, False, False, False,  True]], dtype=bool)
>>> blobs = data.binary_blobs(length=256, blob_size_fraction=0.1)
>>> # Finer structures
>>> blobs = data.binary_blobs(length=256, blob_size_fraction=0.05)
>>> # Blobs cover a smaller volume fraction of the image
>>> blobs = data.binary_blobs(length=256, volume_fraction=0.3)


Gray-level “camera” image.

Often used for segmentation and denoising examples.


camera : (512, 512) uint8 ndarray

Camera image.


Checkerboard image.

Checkerboards are often used in image calibration, since the corner-points are easy to locate. Because of the many parallel edges, they also visualise distortions particularly well.


checkerboard : (200, 200) uint8 ndarray

Checkerboard image.


Chelsea the cat.

An example with texture, prominent edges in horizontal and diagonal directions, as well as features of differing scales.


chelsea : (300, 451, 3) uint8 ndarray

Chelsea image.


No copyright restrictions. CC0 by the photographer (Stefan van der Walt).


Motion blurred clock.

This photograph of a wall clock was taken while moving the camera in an aproximately horizontal direction. It may be used to illustrate inverse filters and deconvolution.

Released into the public domain by the photographer (Stefan van der Walt).


clock : (300, 400) uint8 ndarray

Clock image.


Coffee cup.

This photograph is courtesy of Pikolo Espresso Bar. It contains several elliptical shapes as well as varying texture (smooth porcelain to course wood grain).


coffee : (400, 600, 3) uint8 ndarray

Coffee image.


No copyright restrictions. CC0 by the photographer (Rachel Michetti).


Greek coins from Pompeii.

This image shows several coins outlined against a gray background. It is especially useful in, e.g. segmentation tests, where individual objects need to be identified against a background. The background shares enough grey levels with the coins that a simple segmentation is not sufficient.


coins : (303, 384) uint8 ndarray

Coins image.


This image was downloaded from the Brooklyn Museum Collection.

No known copyright restrictions.


Context for use in testing to catch known warnings matching regexes


matching : list of strings or compiled regexes

Regexes for the desired warning to catch


Uses all_warnings to ensure all warnings are raised. Upon exiting, it checks the recorded warnings for the desired matching pattern(s). Raises a ValueError if any match was not found or an unexpected warning was raised. Allows for three types of behaviors: and, or, and optional matches. This is done to accomodate different build enviroments or loop conditions that may produce different warnings. The behaviors can be combined. If you pass multiple patterns, you get an orderless and, where all of the warnings must be raised. If you use the | operator in a pattern, you can catch one of several warnings. Finally, you can use |AZ in a pattern to signify it as optional.


>>> from skimage import data, img_as_ubyte, img_as_float
>>> with expected_warnings(['precision loss']):
...     d = img_as_ubyte(img_as_float(data.coins()))


Black and white silhouette of a horse.

This image was downloaded from openclipart <>

Released into public domain and drawn and uploaded by Andreas Preuss (marauder).


horse : (328, 400) bool ndarray

Horse image.


Hubble eXtreme Deep Field.

This photograph contains the Hubble Telescope’s farthest ever view of the universe. It can be useful as an example for multi-scale detection.


hubble_deep_field : (872, 1000, 3) uint8 ndarray

Hubble deep field image.


This image was downloaded from HubbleSite.

The image was captured by NASA and may be freely used in the public domain.

img_as_bool, force_copy=False)[source]

Convert an image to boolean format.


image : ndarray

Input image.

force_copy : bool, optional

Force a copy of the data, irrespective of its current dtype.


out : ndarray of bool (bool_)

Output image.


The upper half of the input dtype’s positive range is True, and the lower half is False. All negative values (if present) are False.


Immunohistochemical (IHC) staining with hematoxylin counterstaining.

This picture shows colonic glands where the IHC expression of FHL2 protein is revealed with DAB. Hematoxylin counterstaining is applied to enhance the negative parts of the tissue.

This image was acquired at the Center for Microscopy And Molecular Imaging (CMMI).

No known copyright restrictions.


immunohistochemistry : (512, 512, 3) uint8 ndarray

Immunohistochemistry image.

imread, as_grey=False, plugin=None, flatten=None, **plugin_args)[source]

Load an image from file.


fname : string

Image file name, e.g. test.jpg or URL.

as_grey : bool

If True, convert color images to grey-scale (64-bit floats). Images that are already in grey-scale format are not converted.

plugin : str

Name of plugin to use. By default, the different plugins are tried (starting with the Python Imaging Library) until a suitable candidate is found. If not given and fname is a tiff file, the tifffile plugin will be used.


img_array : ndarray

The different colour bands/channels are stored in the third dimension, such that a grey-image is MxN, an RGB-image MxNx3 and an RGBA-image MxNx4.

Other Parameters:

plugin_args : keywords

Passed to the given plugin.

flatten : bool

Backward compatible keyword, superseded by as_grey.

plugin_args : keywords

Passed to the given plugin.

load, as_grey=False)[source]

Load an image file located in the data directory.


f : string

File name.

as_grey : bool, optional

Convert to greyscale.


img : ndarray

Image loaded from skimage.data_dir.


Surface of the moon.

This low-contrast image of the surface of the moon is useful for illustrating histogram equalization and contrast stretching.


moon : (512, 512) uint8 ndarray

Moon image.


Scanned page.

This image of printed text is useful for demonstrations requiring uneven background illumination.


page : (191, 384) uint8 ndarray

Page image.


Launch photo of DSCOVR on Falcon 9 by SpaceX.

This is the launch photo of Falcon 9 carrying DSCOVR lifted off from SpaceX’s Launch Complex 40 at Cape Canaveral Air Force Station, FL.


rocket : (427, 640, 3) uint8 ndarray

Rocket image.


This image was downloaded from SpaceX Photos.

The image was captured by SpaceX and released in the public domain.


Rectified stereo image pair with ground-truth disparities.

The two images are rectified such that every pixel in the left image has its corresponding pixel on the same scanline in the right image. That means that both images are warped such that they have the same orientation but a horizontal spatial offset (baseline). The ground-truth pixel offset in column direction is specified by the included disparity map.

The two images are part of the Middlebury 2014 stereo benchmark. The dataset was created by Nera Nesic, Porter Westling, Xi Wang, York Kitajima, Greg Krathwohl, and Daniel Scharstein at Middlebury College. A detailed description of the acquisition process can be found in [R181182].

The images included here are down-sampled versions of the default exposure images in the benchmark. The images are down-sampled by a factor of 4 using the function skimage.transform.downscale_local_mean. The calibration data in the following and the included ground-truth disparity map are valid for the down-sampled images:

Focal length:           994.978px
Principal point x:      311.193px
Principal point y:      254.877px
Principal point dx:      31.086px
Baseline:               193.001mm

img_left : (500, 741, 3) uint8 ndarray

Left stereo image.

img_right : (500, 741, 3) uint8 ndarray

Right stereo image.

disp : (500, 741, 3) float ndarray

Ground-truth disparity map, where each value describes the offset in column direction between corresponding pixels in the left and the right stereo images. E.g. the corresponding pixel of img_left[10, 10 + disp[10, 10]] is img_right[10, 10]. NaNs denote pixels in the left image that do not have ground-truth.


The original resolution images, images with different exposure and lighting, and ground-truth depth maps can be found at the Middlebury website [R182182].


[R181182](1, 2) D. Scharstein, H. Hirschmueller, Y. Kitajima, G. Krathwohl, N. Nesic, X. Wang, and P. Westling. High-resolution stereo datasets with subpixel-accurate ground truth. In German Conference on Pattern Recognition (GCPR 2014), Muenster, Germany, September 2014.
[R182182](1, 2)


Gray-level “text” image used for corner detection.


text : (172, 448) uint8 ndarray

Text image.


This image was downloaded from Wikipedia <>`__.

No known copyright restrictions, released into the public domain.

use_plugin, kind=None)[source]

Set the default plugin for a specified operation. The plugin will be loaded if it hasn’t been already.


name : str

Name of plugin.

kind : {‘imsave’, ‘imread’, ‘imshow’, ‘imread_collection’, ‘imshow_collection’}, optional

Set the plugin for this function. By default, the plugin is set for all functions.

See also

List of available plugins


To use Matplotlib as the default image reader, you would write:

>>> from skimage import io
>>> io.use_plugin('matplotlib', 'imread')

To see a list of available plugins run io.available_plugins. Note that this lists plugins that are defined, but the full list may not be usable if your system does not have the required libraries installed.