ivapylibs / camera

Encapsulation of typical camera functionality.
GNU General Public License v3.0
1 stars 1 forks source link

Update tabletop plane for matplotlib fallback #8

Open acmiyaguchi opened 1 year ago

acmiyaguchi commented 1 year ago

Fixes #7.

This adds in a fallback to matplotlib in case mayavi fails for some reason (ui backend not installed, VTK error, etc). While matplotlib is slow, it should work on pretty much any machine. I hesitate on adding pptk back, mostly because it's has such specific requirements (python 3.7). I tested this on my ubuntu 20.04 wsl2 instance which comes with python 3.8.10, after intalling PyQt5 manually via pip.

$ python3 -m venv venv
$ source venv/bin/activate
$ pip install --upgrade pip
$ pip install -e .[viz]
$ python scripts/test_tabletop_estimator.py
...
ImportError: Could not import backend for traitsui.  Make sure you
        have a suitable UI toolkit like PyQt/PySide or wxPython
        installed.
WARNING: Cannot import mayavi. Falling back to matplotlib (slow).
...

image

$ pip install PyQt5
$ python scripts/test_tabletop_estimator.py

image

We can test the matplotlib backend at anytime by forcing it.

$ python scripts/test_tabletop_estimator.py --force-matplotlib