NI Vision Python wrappers

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!


  • 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:

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.


So, does this mean that the best way to process images (finding targets and such) with RobotPy is to send the images to the driver’s station, process them there, and then send the result back to the bot?

At the moment, yes, but I do plan on getting the wrappers working on the robot eventually. With the 2012 game rules, many teams did image processing on the driver station anyway. The robot is limited in processing power; using the full power of a fast laptop it’s possible to do a lot more/faster processing on the driver station.