Navigation

Documentation Home

 

Contents

Version

Module: util

skimage.util.img_as_float(image[, force_copy]) Convert an image to double-precision floating point format.
skimage.util.img_as_int(image[, force_copy]) Convert an image to 16-bit signed integer format.
skimage.util.img_as_ubyte(image[, force_copy]) Convert an image to 8-bit unsigned integer format.
skimage.util.img_as_uint(image[, force_copy]) Convert an image to 16-bit unsigned integer format.

img_as_float

skimage.util.img_as_float(image, force_copy=False)

Convert an image to double-precision floating point format.

Parameters :

image : ndarray

Input image.

force_copy : bool

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

Returns :

out : ndarray of float64

Output image.

Notes

The range of a floating point image is [0, 1]. Negative input values will be shifted to the positive domain.

img_as_int

skimage.util.img_as_int(image, force_copy=False)

Convert an image to 16-bit signed integer format.

Parameters :

image : ndarray

Input image.

force_copy : bool

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

Returns :

out : ndarray of uint16

Output image.

Notes

If the input data-type is positive-only (e.g., uint8), then the output image will still only have positive values.

img_as_ubyte

skimage.util.img_as_ubyte(image, force_copy=False)

Convert an image to 8-bit unsigned integer format.

Parameters :

image : ndarray

Input image.

force_copy : bool

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

Returns :

out : ndarray of ubyte (uint8)

Output image.

Notes

If the input data-type is positive-only (e.g., uint16), then the output image will still only have positive values.

img_as_uint

skimage.util.img_as_uint(image, force_copy=False)

Convert an image to 16-bit unsigned integer format.

Parameters :

image : ndarray

Input image.

force_copy : bool

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

Returns :

out : ndarray of uint16

Output image.

Notes

Negative input values will be shifted to the positive domain.