menpo.io.export_landmark_file(pointcloud, fp, extension=None, overwrite=False)[source]

Exports a given shape. The fp argument can be either or a str or any Python type that acts like a file. If a file is provided, the extension kwarg must be provided. If no extension is provided and a str filepath is provided, then the export type is calculated based on the filepath extension.

Due to the mix in string and file types, an explicit overwrite argument is used which is False by default.

  • pointcloud (PointCloud or subclass) – The landmarks to export. It can be any of PointCloud, PointUndirectedGraph, PointDirectedGraph, PointTree or LabelledPointUndirectedGraph.
  • fp (Path or file-like object) – The Path or file-like object to save the object at/into.
  • extension (str or None, optional) – The extension to use, this must match the file path if the file path is a string. Determines the type of exporter that is used.
  • overwrite (bool, optional) – Whether or not to overwrite a file if it already exists.
  • ValueError – File already exists and overwrite != True
  • ValueErrorfp is a str and the extension is not None and the two extensions do not match
  • ValueErrorfp is a file-like object and extension is None
  • ValueError – The provided extension does not match to an existing exporter type (the output type is not supported).