discopat.display

Functions

frame_to_pil(frame, tracks[, ...])

Make a PIL image from a frame.

get_center_path(track)

Get the trajectory of the center of the boxes corresponding to one track.

make_movie(movie, persistence, cmap, ...)

plot_annotation(ax, annotation, color)

plot_box(ax, box, color)

plot_frame(frame[, cmap, annotation_color, ...])

plot_keypoint(ax, keypoint, color)

to_int(image_array[, eps])

Convert array to int [0, 255].

discopat.display.frame_to_pil(frame, tracks, max_track_length=0, persistence=10, cmap='gray', track_color='red')[source]

Make a PIL image from a frame.

Parameters:
  • frame (Frame)

  • tracks (np.array)

  • max_track_length (int)

  • persistence (int)

  • cmap (str)

  • track_color (str)

Return type:

Image

discopat.display.get_center_path(track)[source]

Get the trajectory of the center of the boxes corresponding to one track.

Parameters:

track (array) – Array of shape (num_frames, 5) where each line corresponds to a box: - track[:, 0] = id of the frame, - track[:, 1] = xmin, - track[:, 2] = ymin, - track[:, 3] = xmax, - track[:, 4] = ymax.

Returns:

Array of shape (num_frame, 2), where each line corresponds to the (x, y) coordinates of the center of the box.

Return type:

array

discopat.display.make_movie(movie, persistence, cmap, track_color, fps, output_format)[source]
Parameters:
  • movie (Movie)

  • persistence (int)

  • cmap (str)

  • track_color (str)

  • fps (int)

  • output_format (str)

discopat.display.plot_annotation(ax, annotation, color)[source]
Parameters:
discopat.display.plot_box(ax, box, color)[source]
Parameters:
  • ax (Axes)

  • box (Box)

  • color (str)

discopat.display.plot_frame(frame, cmap='gray', annotation_color='tab:red', show_figure=True, return_figure=False, figure_size=None, figure_dpi=None)[source]
Parameters:
  • frame (Frame)

  • cmap (str)

  • annotation_color (str)

  • show_figure (bool)

  • return_figure (bool)

  • figure_size (tuple[float, float] or None)

  • figure_dpi (int or None)

discopat.display.plot_keypoint(ax, keypoint, color)[source]
Parameters:
  • ax (Axes)

  • keypoint (Keypoint)

  • color (str)

discopat.display.to_int(image_array, eps=1e-10)[source]

Convert array to int [0, 255].

Warning: values will be scaled even if the input array is already of type int.

Parameters:
  • image_array (array)

  • eps (float)

Return type:

array