I’m happy to announce that I’ve completed a full set of Python wrappers for NI Vision (the National Instruments visual processing / machine vision library). Unfortunately, they’re only usable on Windows at the moment, not on RobotPy, due to the use of Python’s ctypes module (which has not yet been ported to the robot). I’ll work on porting ctypes to the robot soon, but in the meantime you can experiment on Windows!
Features:
- Full wrapping of all structures, enumerations, and functions.
- All functions raise a nivision.ImaqError exception if an error occurs, rather than relying on nonzero or NULL return values.
- Output parameters are returned as a tuple (in parameter order). If the function additionally returns a value, this is returned as the first element of the tuple, followed by the output parameters.
- Count/size/length parameters that specify the length of an array are handled implicitly by using Python’s len() function. This includes return values (which are returned as a sized array).
- Additional Pythonic helper functions.
- Automatic memory management of Image and other data types.
github page: https://github.com/robotpy/pynivision
The Downloads page has a Windows installer if you want to get started quickly. I’ve only tested on Python 3.x with NI Vision 2011 so far.