-
Notifications
You must be signed in to change notification settings - Fork 120
Python API
A simple python binding is provided by wrapping some public interfaces of the estimator via pybind11. Check out pybind11/pyxivo.cpp
for the available interfaces in python. With pybind11, it is relatively easy if you want to expose more interfaces of the C++ implementation to python.
An example of using the Python binding is available in scripts/pyxivo.py
, which demonstrates estimator creation, data loading, and visualization in python.
After building, the built pyxivo libraries will be in xivo/lib. In order to let python use this library, you will need to add xibo/lib to your PYTHONPATH environment variable. In order to let PyCharm to include this environment variable as well, please refer to this guide.
To run the demo, execute:
python scripts/pyxivo.py -cfg cfg/phab.json -root $DATAROOT -seq data9_workbench -dataset xivo -use_viewer
in the project root directory. The command-line options are more or less the same as the C++ executable. For detailed usage, you can look at the options defined at the beginning of the script scripts/pyxivo.py
. Note you might need to install some python dependencies by executing the following in the project root directory:
pip install -r requirements.txt
Note: Since Python 2 is no longer being supported, we are only supporting Python 3. If your default Python version (output of which python
) is below Python 3, then in build.sh
, you will need to change the line
cmake .. -DBUILD_G2O=$BUILD_G2O -DUSE_GPERFTOOLS=$USE_GPERFTOOLS
to
cmake .. -DBUILD_G2O=$BUILD_G2O -DUSE_GPERFTOOLS=$USE_GPERFTOOLS -DPYTHON_EXECUTABLE=/usr/bin/python3