Working with Floating Point Images

Images with floating point pixel values, usually GeoTIFF or TIFF, store float pixel values as 32-bit single precision float. LEADTOOLS supports loading and creating bitmaps with floating point pixel values.

They can be converted to grayscale integer for access to all the other LEADTOOLS functionality. However, this conversion causes the floating point data to be rescaled to a range between 0 and the value for white of the target bits per pixel (255 for 8-bit, 65535 for 16-bit, etc).

The values in a floating point image are 32-bit single precision float. The images are grayscale, and consequently, RasterImage.BitsPerPixel should be 32 and RasterImage.Order = RasterByteOrder.Gray.

Identify Bitmaps Containing Floating Point Values

A bitmap has floating point values if it has RasterImage.Float set to true.

To find out if a file has floating point pixels, call RasterCodecs.GetInformation and examine the CodecsImageInfo.IsFloat property.

Load or Create a Bitmap with Floating Point Values

Load or create a bitmap with floating point values as follows:

Formats Supporting Floating Point Data

The following formats support bitmap floating point data to load and save:

Operations Supported in Bitmap Floating Points

The supported operations below are guaranteed to work as specified. Besides those, other operations might work or fail and may return an error code or produce incorrect results.

  1. Dispose: RasterImage.Dispose.
  2. Access or release of the image data: using RasterImage.Access and RasterImage.Release to examine and modify its pixels.
  3. Get or set the bitmap row data: RasterImage.GetRow, RasterImage.SetRow, RasterImage.GetRowColumn, and RasterImage.SetRowColumn.
  4. Convert pixel values to integer: GrayscaleCommand.

Note

The convertion of floating points to integer has side effects that need to be carefully considered before applying the operation.

  1. This operation will convert and rescale the floating point values to unsigned integers.
  2. The floating point values are rescaled so the maximum value for the bitmap is converted to white, the minimum values to black and the others to grayscale values. The maximum value will be converted to: 0xFF (8-bit bitmaps), 0xFFF (12-bit bitmaps), 0xFFFF (16-bit bitmaps), 0xFFFFFFFF (32-bit bitmaps).

Access to the Floating Point Values in the Bitmap

For an example, refer to CodecsLoadOptions.NoImageDataConversion.

See Also

Help Version 22.0.2023.7.17
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Imaging, Medical, and Document

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.