Module: data

Standard test images.

For more images, see

skimage.data.astronaut() Colour image of the astronaut Eileen Collins.
skimage.data.binary_blobs([length, ...]) Generate synthetic binary image with several rounded blob-like objects.
skimage.data.camera() Gray-level “camera” image.
skimage.data.checkerboard() Checkerboard image.
skimage.data.chelsea() Chelsea the cat.
skimage.data.clock() Motion blurred clock.
skimage.data.coffee() Coffee cup.
skimage.data.coins() Greek coins from Pompeii.
skimage.data.horse() Black and white silhouette of a horse.
skimage.data.hubble_deep_field() Hubble eXtreme Deep Field.
skimage.data.immunohistochemistry() Immunohistochemical (IHC) staining with hematoxylin counterstaining.
skimage.data.imread(fname[, as_grey, ...]) Load an image from file.
skimage.data.lena(*args, **kwargs) Deprecated function. Use skimage.data.astronaut instead.
skimage.data.load(f) Load an image file located in the data directory.
skimage.data.moon() Surface of the moon.
skimage.data.page() Scanned page.
skimage.data.rocket() Launch photo of DSCOVR on Falcon 9 by SpaceX.
skimage.data.text() Gray-level “text” image used for corner detection.
skimage.data.use_plugin(name[, kind]) Set the default plugin for a specified operation.
skimage.data.deprecated([alt_func, behavior]) Decorator to mark deprecated functions with warning.

astronaut

skimage.data.astronaut()[source]

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 <http://grin.hq.nasa.gov/ABSTRACTS/GPN-2000-001177.html>`__.

No known copyright restrictions, released into the public domain.

binary_blobs

skimage.data.binary_blobs(length=512, 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.

Parameters:

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.

Returns:

blobs : ndarray of bools

Output binary image

Examples

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

camera

skimage.data.camera()[source]

Gray-level “camera” image.

Often used for segmentation and denoising examples.

checkerboard

skimage.data.checkerboard()[source]

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.

chelsea

skimage.data.chelsea()[source]

Chelsea the cat.

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

Notes

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

clock

skimage.data.clock()[source]

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

coffee

skimage.data.coffee()[source]

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

Notes

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

coins

skimage.data.coins()[source]

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.

Notes

This image was downloaded from the Brooklyn Museum Collection.

No known copyright restrictions.

horse

skimage.data.horse()[source]

Black and white silhouette of a horse.

This image was downloaded from openclipart <http://openclipart.org/detail/158377/horse-by-marauder>

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

hubble_deep_field

skimage.data.hubble_deep_field()[source]

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.

Notes

This image was downloaded from HubbleSite.

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

immunohistochemistry

skimage.data.immunohistochemistry()[source]

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.

imread

skimage.data.imread(fname, as_grey=False, plugin=None, flatten=None, **plugin_args)[source]

Load an image from file.

Parameters:

fname : string

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

as_grey : bool

If True, convert color images to grey-scale (32-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.

Returns:

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.

lena

skimage.data.lena(*args, **kwargs)[source]

Deprecated function. Use skimage.data.astronaut instead.

Colour “Lena” image.

This image has been removed from scikit-image due to copyright concerns.

The standard, yet sometimes controversial Lena test image was scanned from the November 1972 edition of Playboy magazine. From an image processing perspective, this image is useful because it contains smooth, textured, shaded as well as detail areas.

load

skimage.data.load(f)[source]

Load an image file located in the data directory.

Parameters:

f : string

File name.

Returns:

img : ndarray

Image loaded from skimage.data_dir.

moon

skimage.data.moon()[source]

Surface of the moon.

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

page

skimage.data.page()[source]

Scanned page.

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

rocket

skimage.data.rocket()[source]

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.

Notes

This image was downloaded from SpaceX Photos.

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

text

skimage.data.text()[source]

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

Notes

This image was downloaded from Wikipedia <http://en.wikipedia.org/wiki/File:Corner.png>`__.

No known copyright restrictions, released into the public domain.

use_plugin

skimage.data.use_plugin(name, kind=None)[source]

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

Parameters:

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

available_plugins
List of available plugins

Examples

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.

deprecated

class skimage.data.deprecated(alt_func=None, behavior='warn')[source]

Bases: object

Decorator to mark deprecated functions with warning.

Adapted from <http://wiki.python.org/moin/PythonDecoratorLibrary>.

Parameters:

alt_func : str

If given, tell user what function to use instead.

behavior : {‘warn’, ‘raise’}

Behavior during call to deprecated function: ‘warn’ = warn user that function is deprecated; ‘raise’ = raise error.

__init__(alt_func=None, behavior='warn')[source]