import_image, landmark_resolver=<function same_name>, normalize=None, normalise=None)[source]

Single image (and associated landmarks) importer.

If an image file is found at filepath, returns an Image or subclass representing it. By default, landmark files sharing the same filename stem will be imported and attached with a group name based on the extension of the landmark file, although this behavior can be customised (see landmark_resolver). If the image defines a mask, this mask will be imported.

  • filepath (pathlib.Path or str) – A relative or absolute filepath to an image file.

  • landmark_resolver (function or None, optional) – This function will be used to find landmarks for the image. The function should take one argument (the path to the image) and return a dictionary of the form {'group_name': 'landmark_filepath'} Default finds landmarks with the same name as the image file. If None, landmark importing will be skipped.

  • normalize (bool, optional) – If True, normalize the image pixels between 0 and 1 and convert to floating point. If false, the native datatype of the image will be maintained (commonly uint8). Note that in general Menpo assumes Image instances contain floating point data - if you disable this flag you will have to manually convert the images you import to floating point before doing most Menpo operations. This however can be useful to save on memory usage if you only wish to view or crop images.

  • normalise (bool, optional) – Deprecated version of normalize. Please use the normalize arg.


images (Image or list of) – An instantiated Image or subclass thereof or a list of images.