{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / util / dtype / convert

function

skimage.util.dtype:convert

source: /dev/scikit-image/src/skimage/util/dtype.py :399

Signature

def   convert ( image dtype force_copy = False uniform = False )

Summary

Convert an image to the requested data-type.

Extended Summary

Warnings are issued in case of precision loss, or when negative values are clipped during conversion to unsigned integer types (sign loss).

Floating point values are expected to be normalized and will be clipped to the range [0.0, 1.0] or [-1.0, 1.0] when converting to unsigned or signed integers respectively.

Numbers are not shifted to the negative side when converting from unsigned to signed integer types. Negative values will be clipped when converting to unsigned integers.

Parameters

image : ndarray

Input image.

dtype : dtype

Target data-type.

force_copy : bool, optional

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

uniform : bool, optional

Uniformly quantize the floating point range to the integer range. By default (uniform=False) floating point values are scaled and rounded to the nearest integers, which minimizes back and forth conversion errors.

Warns

: FutureWarning:

The use of this function is discouraged as its behavior may change dramatically in scikit-image 1.0. This function will be removed in scikit-image 1.0.

Notes

Aliases

  • skimage.util.dtype.convert