VisionBox Interface Library  1.7.10.0 (2024-04-16)
Python

How to use the Python bindings

Note
Please take a look at the Linux / Windows SDK documentation on how to install the Python bindings.

The C++ classes and methods for this library are implemented by the Python module vib.

The Pyton documentation for the module briefly describes the function arguments and return values. The documentation is also available on the device, for example:

~# pydoc3 vib.DigitalOutput
...

API Differences:

  • C++ API:
    • All functions return a bool value to indicate success of each function.
    • Additional function results are returned by passing arguments by reference.
  • Python API:
    • Functions will raise a Python exception in case of an error.
    • Function results are regular return values of the function. Mupltiple result values are returned as a tuple.
    • Enumerations are implemented by enum.Enum objects. The enum members can be found int the enum documentation.
      Example:
      >>> import vib
      >>> help(vib.DigitalOutput.SOURCE)
      ...
      >>> digOut.SetSource(0, vib.DigitalOutput.SOURCE.MUX_OUT0, False)

Example:

~# python3
>>> import vib
>>> help(vib)
...
>>> help(vib.Service)
...
>>> service = vib.Service()
>>> service.Open()
>>> print("Serial number: " + service.GetSerialNumber())
Serial number: LMNS1608000011
>>> digOut = vib.DigitalOutput()
>>> digOut.Open(0)
>>> digOut.Set(0x55)

More Python examples can be found in the SDK folder:

  • Windows: <SDK installation folder>\python\examples
  • Linux: /opt/ImagoTechnologies/SDK/python/examples