educelab.imgproc.conversion

educelab.imgproc.conversion.as_dtype(image, dtype) ndarray

Convert an image to a specific fundamental dtype. Automatically performs dynamic range adjustment.

Parameters:
  • image (ArrayLike) – Input image.

  • dtype (numpy.dtype) – Output dtype.

Returns:

Converted image.

Return type:

ArrayLike

educelab.imgproc.conversion.uint_to_dtype(image, bpc: int, dtype=<class 'numpy.float32'>) ndarray

Convert an uint image with an effective bit depth bpc to a specific fundamental dtype. Unlike as_dtype(), this function allows you to specify the input’s effective bit depth independent of the array’s dtype. This is useful when working with 10-/12-/14-bit raw images which are stored in an uint16 pixel type.

Parameters:
  • image (ArrayLike) – Input image.

  • bpc (int) – Effective bit depth.

  • dtype (numpy.dtype) – Output dtype.

Returns:

Converted image.

Return type:

ArrayLike