plenoptic.convert_float_to_int#
- plenoptic.convert_float_to_int(image, dtype=<class 'numpy.uint8'>)[source]#
Convert numpy array from float to 8 or 16 bit integer.
We work with float images that lie between 0 and 1, but for saving them (either as png or in a numpy array), we typically want to convert them to 8 or 16 bit integers. This function does that by multiplying it by the max value for the target dtype (255 for 8 bit 65535 for 16 bit) and then converting it to the proper type.
- Parameters:
- Return type:
- Returns:
image – The converted image, now with specified dtype.
- Raises:
ValueError – If
imagemax is greater than 1.