evlib.utils.basics

Basic utility functions.

Functions

generate_events(n_events, height, width[, ...])

Generate random events.

generate_random_optical_flow(image_size, max_val)

Generate random optical flow.

generate_uniform_optical_flow(image_size, ...)

Generate uniform optical flow.

evlib.utils.basics.generate_events(n_events, height, width, tmin=0.0, tmax=0.5, dist='uniform')

Generate random events.

Parameters:
  • n_events (int) – num of events

  • height (int) – height of the camera

  • width (int) – width of the camera

  • tmin (float) – timestamp min

  • tmax (float) – timestamp max

  • dist (str) – distribution of generated events. currently only “uniform” is supported.

Returns:

[n_events x 4] numpy array.

(y (height), x (width), t: [tmin, tmax], p: {0, 1})

Return type:

events (np.ndarray)

evlib.utils.basics.generate_random_optical_flow(image_size, max_val)

Generate random optical flow.

Parameters:
  • image_size (tuple) – (H, W)

  • max_val (float) – max value

Returns:

[2 x H x W] array.

Return type:

flow (np.ndarray)

evlib.utils.basics.generate_uniform_optical_flow(image_size, vertical, horizontal)

Generate uniform optical flow.

Parameters:
  • image_size (tuple) – (H, W)

  • vertical (float) – vertical direction component

  • horizontal (float) – horizontal direction component

Returns:

[2 x H x W] array.

Return type:

flow (np.ndarray)