Python Quickstart

Overview

Mirrorcle’s Python API is wrapped from C++ to Python using the Simplified Wrapper and Interface Generator (SWIG).

This means that all classes, structs, and methods that are available in Mirrorcle’s C++ library are also available in Python!

The key difference is that the Python API uses NumPy for handling arrays instead of C++’s pointers to float arrays (float*).

Installation

Mirrorcle’s Python SDK comes as a folder labeled “SDK-Python”.

The folder contains a setup.py file to allow for installation of the mtidevice module to your Python site-packages.

To install to your Python installation’s site-packages, run the following:

python setup.py install

Alternatively, to integrate in your project without installing to site-packages, place the mtidevice folder in your project folder (i.e. in the same folder as your source.py). Then see the “Importing the Module” section below.

Dependencies

Mirrorcle’s Python API requires only NumPy, which will be installed automatically upon python setup.py install

To run the examples, OpenCV-Python is required. This will also be downloaded upon running the setup.py.

Alternatively, both packages can be installed using pip:

python -m pip install numpy
python -m pip install opencv-python

Importing the Module

Independent of the chosen installation method.

import mtidevice
from mtidevice import MTIError, MTIAxes, MTIParam, MTIDataMode, MTISync