AttocubeScan.convert

AttocubeScan.convert(dtype, force_copy=False, uniform=False, normalise=True)

Convert an image to the requested data-type.

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) – Force a copy of the data, irrespective of its current dtype.

  • uniform (bool) – 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.

  • normalise (bool) – When converting from int types to float normalise the resulting array by the maximum allowed value of the int type.

References

  1. DirectX data conversion rules. http://msdn.microsoft.com/en-us/library/windows/desktop/dd607323%28v=vs.85%29.aspx

2, Data Conversions.

In “OpenGL ES 2.0 Specification v2.0.25”, pp 7-8. Khronos Group, 2010.

3, Proper treatment of pixels as integers. A.W. Path.

In “Graphics Gems I”, pp 249-256. Morgan Kaufmann, 1990.

4, Dirty Pixels. J. Blinn.

In “Jim Blinn’s corner: Dirty Pixels”, pp 47-57. Morgan Kaufmann, 1998.