Visualizing Objects

In the Menpo Project, we take an opinionated stance that visualization is a key part of working with visual data. Therefore, we tried to make the mental overhead of visualizing objects as low as possible. As a matter of fact, we made visualization a key concept directly on our data containers, rather than requiring extra imports in order to view your data.

We also took a strong step towards simple visualization by integrating some of our objects with visualization widgets for the Jupyter notebook. Remember that our widgets live on their own repository - menpowidgets.

  1. Visualizing 2D Images
  2. Visualizing A List Of 2D Images
  3. Visualizing A 2D PointCloud
  4. Visualizing In 3D

We highly recommend that you render all matplotlib figures inline the Jupyter notebook for the best menpowidgets experience. This can be done by running
%matplotlib inline
in a cell. Note that you only have to run it once and not in every rendering cell.

1. Visualizing 2D Images

Without further ado, a quick example of viewing a 2D image:

%matplotlib inline
import menpo.io as mio
image = mio.import_builtin_asset.lenna_png()
image.view()
view_image

Viewing the image landmarks:

image.view_landmarks()
view_landmarks

Viewing the image with a native IPython widget:

image.view_widget()

2. Visualizing A List Of 2D Images

Visualizing a list of images is also incredibly simple if you are using the Jupyter notebook and have the menpowidgets package installed:

from menpowidgets import visualize_images
images = list(mio.import_images('/path/to/images/'))
visualize_images(images)

3. Visualizing A 2D PointCloud

Visualizing PointCloud objects and subclasses is a very familiar experience:

pcloud = mio.import_builtin_asset.breakingbad_pts().lms
pcloud.view()
view_pointcloud

4. Visualizing In 3D

menpo natively supports 3D objects, such as triangulated meshes, as our base classes are n-dimensional. However, as viewing in 3D is a much more complicated experience, we have segregated the 3D viewing package into one of our sub-packages: menpo3d.

If you try to view a 3D PointCloud without having menpo3d installed, you will receive an exception asking you to install it.

menpo3d also comes with many other complicated pieces of functionality for 3D meshes such as a rasterizer. We recommend you look at menpo3d if you want to use menpo for 3D mesh manipulation.

results matching ""

    No results matching ""