visualize_patches

menpowidgets.base.visualize_patches(patches, patch_centers, figure_size=(10, 8), style='coloured', browser_style='buttons', custom_info_callback=None)[source]

Widget that allows browsing through a list of patch-based images.

The patches argument can have any of the two formats that are returned from the extract_patches() and extract_patches_around_landmarks() methods of menpo.image.Image. Specifically it can be:

  1. (n_center, n_offset, self.n_channels, patch_shape) ndarray
  2. list of n_center * n_offset menpo.image.Image objects

The patches can have a combination of different attributes, e.g. number of centers, number of offsets, number of channels etc. The widget has options tabs regarding the visualized patches, channels, the renderer (lines, markers, numbering, figure, axes, image) and saving the figure to file.

Parameters:
  • patches (list) – The list of patch-based images to be visualized. It can consist of objects with any of the two formats that are returned from the extract_patches() and extract_patches_around_landmarks() methods. Specifically, it can either be an (n_center, n_offset, self.n_channels, patch_shape) ndarray or a list of n_center * n_offset menpo.image.Image objects.
  • patch_centers (list of menpo.shape.PointCloud) – The centers to set the patches around. If the list has only one menpo.shape.PointCloud then this will be used for all patches members. Otherwise, it needs to have the same length as patches.
  • figure_size ((int, int), optional) – The initial size of the rendered figure.
  • style ({'coloured', 'minimal'}, optional) – If 'coloured', then the style of the widget will be coloured. If minimal, then the style is simple using black and white colours.
  • browser_style ({'buttons', 'slider'}, optional) – It defines whether the selector of the objects will have the form of plus/minus buttons or a slider.
  • custom_info_callback (function or None, optional) – If not None, it should be a function that accepts an image and returns a list of custom messages to be printed per image. Each custom message will be printed in a separate line.