image_converter
Image array inspection and conversion utilities.
- robotblockset.cameras.image_converter.is_image_array(image: object) typing_extensions.TypeGuard.<class 'numpy.ndarray'>[source]
Check whether an object looks like an image array.
checks if an object is a numpy array with 3 dimensions, which is the only thing all image formats have in common
- robotblockset.cameras.image_converter.is_float_image_array(image: object) bool[source]
checks if an object is a valid float image array by checking - if it is a valid image array - if it contains floats - and if the first element is in the right range
- robotblockset.cameras.image_converter.is_int_image_array(image: ndarray) bool[source]
checks if an object is a valid int image array by checking - if it is a valid image array - if it contains ints - and if the first element is in the right range
- class robotblockset.cameras.image_converter.ImageConverter(image_in_numpy_float_format: ndarray)[source]
Bases:
objectUtility class to convert between numpy arrays of different image formats.
Only supports cpu-located images. Convert cuda images to cpu images (if you can afford it) or re-implement with torch.
Note that these conversions may not be optimal, because we use an intermediate numpy float format. So, there may be a conversion from type A to type B that is faster if you do it directly, but we don’t implement that here to keep implementation complexity low. See also https://github.com/airo-ugent/airo-mono/issues/132.
- classmethod from_numpy_format(image: ndarray) ImageConverter[source]
- classmethod from_numpy_int_format(image: ndarray) ImageConverter[source]
- classmethod from_opencv_format(image: ndarray) ImageConverter[source]
- classmethod from_torch_format(image: ndarray) ImageConverter[source]
- property image_in_numpy_format: ndarray
- property image_in_opencv_format: ndarray
- property image_in_torch_format: ndarray
- property image_in_numpy_int_format: ndarray
Functions
|
checks if an object is a valid float image array by checking - if it is a valid image array - if it contains floats - and if the first element is in the right range |
|
Check whether an object looks like an image array. |
|
checks if an object is a valid int image array by checking - if it is a valid image array - if it contains ints - and if the first element is in the right range |
Classes
|
Utility class to convert between numpy arrays of different image formats. |