reference
labkit.image.im2double
Convert image data to double using MATLAB's im2double contract.
Syntax
imageOut = labkit.image.im2double(imageIn)
imageOut = labkit.image.im2double(indexedImage, "indexed")Description
Converts image data to double without requiring Image Processing Toolbox. Logical values become 0 or 1. uint8 and uint16 values are divided by the maximum value of their class. int16 values are mapped linearly from the complete signed range to [0,1]. single and double values are converted to double without rescaling or clipping.
For uint8 or uint16 indexed images, the "indexed" form converts the zero-based integer storage to one-based double colormap indices. For example, uint8 values [0 1] become [1 2]. Empty input returns an empty double array.
Inputs
imageIn- Logical, uint8, uint16, int16, single, or double image array.
imageType- Optional character vector or scalar string "indexed". No other image-type value is accepted.
Outputs
imageOut- Double array with the same size as imageIn.
Errors
labkit:image:im2double:InvalidImageType- imageType is not "indexed".
labkit:image:im2double:UnsupportedClass- imageIn has an unsupported numeric class.
Example
intensity = labkit.image.im2double(uint8([0 128 255]));
indices = labkit.image.im2double(uint8([0 1 2]), "indexed");Related APIs
labkit.image.ensureRgb— Return image data with exactly three color channels.labkit.image.rgb2gray— Convert RGB data using MATLAB's rgb2gray call contract.labkit.image.adjustBrightnessContrast— Apply simple brightness and contrast adjustment.labkit.image.adjustHueSaturation— Apply HSV hue and saturation adjustment.labkit.image.assertSupportedPaths— Throw when any path has an unsupported image extension.labkit.image.displayName— Return a short image-file display name.labkit.image.fileDialogFilter— Return a file-chooser-compatible image filter.labkit.image.grayWorldWhiteBalance— Apply generic gray-world white balance.
Source
This page is generated from the MATLAB help text in +labkit/+image/im2double.m.