This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

About

NI Vision is a National Instruments image/vision processing library. It is available for multiple platforms including Windows and the CompactRIO. This project makes the functionality of NI Vision available in the Python programming language.

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 (see Documentation).
  • Automatic memory management of Image and other data types (see Documentation).

Usage

Read a JPEG file and print its dimensions (width and height):

import nivision
img = nivision.imaqCreateImage(nivision.IMAQ_IMAGE_RGB)
nivision.Priv_ReadJPEGString(img, open('example.jpg', 'rb').read())
print(nivision.imaqGetImageSize(img))

Requirements

An installed and licensed version of NI Vision. Only the 2011 version has been tested.

The wrappers currently require ctypes, so this library is currently not usable on platforms that don’t have ctypes. Unfortunately this includes RobotPy as of this writing, but this is being worked on.

The wrappers have only been tested on Python 3.x.

Installation

On the robot, this will be installed automatically as of RobotPy 2015.0.1. Otherwise, you can install it via pip:

pip install pynivision

Run install.bat or python setup.py install.

Documentation

The “NI Vision for LabWindows/CVI Function Reference” help file (NIVisionCVI.chm) is currently the best “complete” reference. However, the Python wrappers deviate from the C library in several important ways (see Features).

A few helper functions are provided due to the use of in/out parameters.

  • imaqGetCores(): Returns the number of cores available to NI Vision.
  • imaqSetCores(customNumCores): Sets the number of cores available to NI Vision.
  • imaqUseMaxAvailableCores(): Configures NI Vision to use the maximum number of available processor cores.

imaqDispose() is automatically called when the corresponding Python object is garbage collected for Image and all other structures/arrays returned by imaq functions. It is still ok to explicitly call imaqDispose() on these objects (but be careful, as the underlying object will be immediately freed even though the Python object is still accessible).

Implementation

Most of the wrapper code is generated by the gen_wrap.py script. Hand-written Python code in ctypes_core_prefix.py and ctypes_core_suffix.py complements the automatically generated code. The gen_wrap.py script creates nivision/core.py which includes the contents of the prefix and suffix Python files.

The gen_wrap.py script reads an .ini file for Pythonic customizations to the wrappers such as automatic disposal and handling of sized values as arrays. The .ini file used is automatically determined by the nivision version in use (or can alternatively be specified on the command line).

As Priv_ReadJPEGString_C is not exported on current Windows distributions of nivissvc.dll, a custom implementation that uses GDI+ has been written in nivision/private.py and nivision/gdiplus.py.

License

Copyright © 2012 Peter Johnson.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Release History

Release History

2015.0.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

master

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pynivision-2015.0.0.tar.gz (58.0 kB) Copy SHA256 Checksum SHA256 Source Jan 6, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting