menpo is a Python package designed from the ground up to make importing, manipulating and visualizing image and mesh data as simple as possible.
Beyond it's elegant design,
menpo has some unique characteristics that make it particlarly well suited to working with annotated or landmarked data:
import menpo.io as mio img = mio.import_image('foo.png') if img.n_channels != 1: img = img.as_greyscale() img.landmarks['face'] = mio.import_landmark_file('face.pts') # objects return copies rather than mutating self, so we can chain calls img = (img.crop_to_landmarks(group='face', boundary=10) .rescale_landmarks_to_diagonal_range(100, group='face')) # now lets take an image feature... from menpo.feature import fast_dsift img = fast_dsift(img) # ...and extract the vector of pixels contained in the # convex hull of the face... vector = img.as_masked().constrain_mask_to_landmarks(group='face').as_vector() print(type(vector), vector.shape) # output: <class 'numpy.ndarray'> (3801,)
menpo is the standard library of the Menpo Project, but due to it's simple dependencies and generic types and routines, is well suited as a preprocessing library for many computer vision tasks.
The following user guide is a general introduction to
menpo, aiming to provide a bird's eye of
It is also very helpful for understanding the main philosophy behind all the packages of the Menpo Project.
The contents of this user guide are: