ifm / nexxT

Hybrid python/c++ framework for developing computer vision algorithms and more.
Apache License 2.0
6 stars 1 forks source link
computer-vision cplusplus framework multithreaded pyside2 python

nexxT

nexxT is a hybrid python/c++ framework targeted mainly at computer vision algorithm developers. Developers can build a graph of plugins interacting via data-driven ports.

Design Principles

We used Enterprise Architect for the initial design, and most of the design decisions are still somewhat valid, especially the part about data transport. The design can be found here: https://github.com/ifm/nexxT/blob/master/design/NeXT.eap

Documentation

The documentation is hosted on readthedocs.

Installation

It is highly recommended to use the binary packages from pypi in a virtual environment.

Linux

Assuming that you have a python3.7+ interpreter in your path, the installation can be done with

python3 -m venv venv_nexxT
source venv_nexxT/bin/activate
python3 -m pip install pip -U
pip install nexxT

Windows

Assuming that you have a python3.7+ interpreter in your path, the installation is very similar

python -m venv venv_nexxT
.\venv_nexxT\Scripts\activate
python -m pip install pip -U
pip install nexxT

Porting from nexxT 0.x to nexxT 1.x (aka PySide2 to PySide6)

Python

The main change for nexxT 1.x is the update from QT5/PySide2 to QT6/PySide6. For flexibility reasons, nexxT now provides a meta package nexxT.Qt, which can be used instead of PySide6. So it is now recommended to replace

from PySide2 import xyz
from PySide2.QtWidgets import uvw

with

from nexxT.Qt import xyz
from nexxT.Qt.QtWidgets import uvw

In the future, this approach might be also used to support PyQt6, so using nexxT.Qt is recommended over the also possible direct usage of PySide6. Note that the implementation of nexxT.Qt imports the PySide moduels on demand using sys.meta_path, so unused QT modules are not loaded.

Note the porting guide of PySide6: https://doc.qt.io/qtforpython/porting_from2.html: QAction and QShortcut have been moved from QtWidgets to QtGui.

C++

For c++, nexxT includes shall be prefixed with nexxT/, for example

#include "Filters.hpp"

has to be replaced with

#include "nexxT/Filters.hpp"

Building from source

Building from source requires a QT6 installation suited to the PySide6 version used for the build. It is ok to use 6.4.0 to build against all versions 6.4.x of PySide6 because of QT's binary compatibility. You have to set the environment variable QTDIR to the installation directory of QT. Note that this installation is only used during build time, at runtime, nexxT always uses the QT version shipped with PySide6.

On linux, you will also need llvm and clang installed (because of the shiboken6 dependency). You might need to set the environment variable LLVM_INSTALL_DIR.

The following commands build nexxT from source using the non-recommended pip package of shiboken6-generator.

git clone https://github.com/ifm/nexxT.git
cd nexxT/workspace
python3 -m venv venv
source venv/bin/activate
python3 -m pip install pip -U
pip install -r requirements.txt --find-links https://download.qt.io/official_releases/QtForPython/shiboken6-generator/
export QTDIR=<path>/<to>/<qt>
export LLVM_INSTALL_DIR=<path>/<to>/<llvm>
scons -j 8 ..

When using setup.py to install nexxT, the above requirements shall be also fulfilled and scons is called implicitely from setup.py. Installation from source without using the wheel package is not supported.

History

Originally we started with a commercial product from the automotive industry in our development, due to the requirements of a project at that time. That product had become more and more outdated and the management was not very keen on paying maintainance costs for updates. After very long discussions about the way forward, we finally got the go for developing an own framework. We have decided to apply an open-source license to it such that it might be useful to other people having the same pain than us as well. During the discussion phase we discussed also other alternatives, and here especially the use of ROS2, which claimed to fulfill many of our requirements. We decided against it because of the following reasons: