Function File: im2single (img)
Function File: im2single (img, "indexed")

Convert image to single precision.

The conversion of img to single precision, is dependent on the type of input image. The following input classes are supported:

uint8, uint16, and int16

The whole range of values from the class (see getrangefromclass) are scaled for the interval [0 1], e.g., if input image was uint8, intensity values of 0, 127, and 255, are converted to intensity of 0, 0.498, and 1.

logical

True and false values are assigned a value of 0 and 1 respectively.

double

Values are cast to double precision.

single

Returns the same image.

If the second argument is the string "indexed", then values are cast to single precision, and a +1 offset is applied if input is an integer class.

See also: im2bw, imcast, im2uint8, im2double, im2int16, im2uint16.

Package: image