evlib.vis.utils

Utility functions for coloring, loading, etc.

Functions

color_depth(depth, min_depth, max_depth)

Color depth image.

color_depth_with_nan(depth, min_depth, ...)

Color depth image even with nan values.

color_optical_flow(flow_v, flow_h[, ...])

Color optical flow.

load_image(image)

A wrapper function to get image and returns PIL Image object.

evlib.vis.utils.load_image(image)

A wrapper function to get image and returns PIL Image object.

Parameters:

image (str or np.ndarray) – If it is str, open and load the image. If it is numpy array, it converts to PIL.Image.

Returns:

PIl Image object.

Return type:

Image.Image

evlib.vis.utils.color_depth_with_nan(depth, min_depth, max_depth, fillnan)

Color depth image even with nan values. The nan will be padded with fillnan value.

Parameters:
  • depth (np.ndarray) – [1, H, W]?

  • min_depth (float)

  • max_depth (float)

  • fillnan (float)

Returns:

[H, W, 3] colored depth arrat.

Return type:

ndarray

evlib.vis.utils.color_depth(depth, min_depth, max_depth)

Color depth image.

Parameters:
  • depth (np.ndarray) – [1, H, W]? # TODO test and check

  • min_depth (float)

  • max_depth (float)

Returns:

[H, W, 3] colored depth array.

Return type:

ndarray

evlib.vis.utils.color_optical_flow(flow_v, flow_h, max_magnitude=None, ord=1.0)

Color optical flow.

Parameters:
  • flow_v (numpy.ndarray) – [H x W], vertical direction.

  • flow_h (numpy.ndarray) – [H x W], horizontal direction.

  • max_magnitude (float, optional) – Max magnitude used for the colorization. Defaults to None.

  • ord (float) – 1: our usual, 0.5: DSEC colorinzing.

Returns:

[W, H, 3] color_wheel (np.ndarray): [H, H, 3] color wheel max_magnitude (float): max magnitude of the flow.

Return type:

flow_rgb (np.ndarray)