Class MetashapeFileStorage

Class Documentation

class MetashapeFileStorage

Class to read Agisoft Metashape projects and formats into lib3D types.

Example

In this short example an object of a OpenCV camera model is read from a Metashape export.

...

// create camera object
lib3d::Camera cam;

// initialize metashape storage
lib3d::io::MetashapeFileStorage metashapeFS("/path/to/cameras.xml");

// get list of files of specified camera model
std::vector<std::string> fileList = metashapeFS.getFileNameList();

// read camera data
metashapeFS.readCameraModel("image_file.jpg", cam);

...

Public Functions

inline explicit MetashapeFileStorage()

Default constructor performing zero initialization.

inline explicit MetashapeFileStorage(const std::string &iCameraXmlFilePath)

Initialization constructor.

Parameters:

iCameraXmlFilePath[in] Path to cameras.xml file from Metashape

inline virtual ~MetashapeFileStorage()
inline std::string cameraXmlFilePath() const

Returns path to cameras.xml file from Metashape.

inline void setCameraXmlFile(const std::string &iCameraXmlFilePath)

Set cameras.xml file.

Parameters:

iCameraXmlFilePath[in] Path to cameras.xml file from Metashape

inline std::vector<std::string> getFileNameList() const

Get list of file names for which camera data is available.

inline bool readCameraModel(const std::string &iFileName, lib3d::Camera &oCamera)

Read camera data from map.

Parameters:
  • iFileName[in] File name for which the data is to be extracted. Note that in the camera.xml file from metashape only the basename (without extension) is stored. This function will strip an extension if available.

  • oCamera[out] output camera

Returns:

Returns false if there exists no such camera model to given file name