diff options
| author | John Sun <jsun@sightmachine.com> | 2014-04-02 16:22:14 -0700 |
|---|---|---|
| committer | John Sun <jsun@sightmachine.com> | 2014-04-02 16:22:14 -0700 |
| commit | 01e24424971ffa9faa5dabf2e6724cea997a2afb (patch) | |
| tree | 8882d0e2c93e2a1f74178c21b6bffa02a2edee16 /README.txt | |
| parent | 54bec3f39dc7915593a29c22ed1aac0e29ab53b6 (diff) | |
| download | pymba-01e24424971ffa9faa5dabf2e6724cea997a2afb.tar.gz pymba-01e24424971ffa9faa5dabf2e6724cea997a2afb.zip | |
First pass at making pymba a pip installable module.
1) Moved all the source-code under a new folder "pyvimba". Yes I changed the name. Feel free to change it back
2) Added initial CHANGES.txt, MANIFEST.in, LICENSE, README.txt
3) Move opencv_example.py to "tests" directory
Diffstat (limited to 'README.txt')
| -rw-r--r-- | README.txt | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..49a0ed1 --- /dev/null +++ b/README.txt @@ -0,0 +1,161 @@ +======= +pyvimba +======= + +pyvimba is a Python wrapper for the Allied Vision Technologies (AVT) Vimba C API. It wraps the VimbaC.dll file included in the AVT Vimba installation to provide a simple Python interface for AVT cameras. It currently supports most of the functionality provided by VimbaC.dll. + +Installation +============ + +* Install the Vimba SDK from AVT to the default directory. + +* Run the AVTDriverInstaller tool and install the AVT Vimba SDK drivers. + +* Install pyvimba. + +Usage +===== + +Testing installation +-------------------- + +If Vimba and pyvimba are installed correctly, then the following code should give the installed Vimba version. No camera is needed. + + from vimba import * + + vimba = Vimba() + print vimba.getVersion() + +Interacting with cameras +------------------------ + +Discover, open, manipulate, and capture frames from a camera. + + from vimba import * + import time + + # start Vimba + vimba = Vimba() + vimba.startup() + + # get system object + system = vimba.getSystem() + + # list available cameras (after enabling discovery for GigE cameras) + if system.GeVTLIsPresent: + system.runFeatureCommand("GeVDiscoveryAllOnce") + time.sleep(0.2) + cameraIds = vimba.getCameraIds() + for cameraId in cameraIds: + print 'Camera ID:', cameraId + + # get and open a camera + camera0 = vimba.getCamera(cameraIds[0]) + camera0.openCamera() + + # list camera features + cameraFeatureNames = camera0.getFeatureNames() + for name in cameraFeatureNames: + print 'Camera feature:', name + + # get the value of a feature + print camera0.AcquisitionMode + + # set the value of a feature + camera0.AcquisitionMode = 'SingleFrame' + + # create new frames for the camera + frame0 = camera0.getFrame() # creates a frame + frame1 = camera0.getFrame() # creates a second frame + + # announce frame + frame0.announceFrame() + + # capture a camera image + camera0.startCapture() + frame0.queueFrameCapture() + camera0.runFeatureCommand('AcquisitionStart') + camera0.runFeatureCommand('AcquisitionStop') + frame0.waitFrameCapture() + + # get image data... + imgData = frame0.getBufferByteData() + + # ...or use NumPy for fast image display (for use with OpenCV, etc) + import numpy as np + moreUsefulImgData = np.ndarray(buffer = frame0.getBufferByteData(), + dtype = np.uint8, + shape = (frame0.height, + frame0.width, + 1)) + + # clean up after capture + camera0.endCapture() + camera0.revokeAllFrames() + + # close camera + camera0.closeCamera() + + # shutdown Vimba + vimba.shutdown() + +Interacting with the Vimba system +--------------------------------- + +Get a reference to the Vimba system object and list available system features. + + from vimba import * + + # get system object + system = vimba.getSystem() + + # list system features + for featureName in system.getFeatureNames(): + print 'System feature:', featureName + + # shutdown Vimba + vimba.shutdown() + +Interacting with transport layer interfaces +------------------------------------------- + +Get a reference to an interface object and list available interface features. + + from vimba import * + + # get list of available interfaces + interfaceIds = vimba.getInterfaceIds() + for interfaceId in interfaceIds: + print 'Interface ID:', interfaceId + + # get interface object and open it + interface0 = vimba.getInterface(interfaceIds[0]) + interface0.openInterface() + + # list interface features + interfaceFeatureNames = interface0.getFeatureNames() + for name in interfaceFeatureNames: + print 'Interface feature:', name + + # close interface + interface0.closeInterface() + +Handling Vimba exceptions +------------------------- + + from vimba import * + + try: + vimba = Vimba() + vimba.startup() + except VimbaException as e: + print e.message + +Known issues +============ + +* Not all API functions are wrapped (most are). For full list see vimbadll.py. +* Only 32-bit VimbaC.dll (version 1.2.1) under Windows has been tested. +* Colour cameras and GigE cameras have not been tested. +* The VimbaC.dll file location has been hardcoded in vimbadll.py. It should be easy to change if needed. + |
