diff options
| author | morefigs <morefigs@gmail.com> | 2013-12-22 17:12:58 -0800 |
|---|---|---|
| committer | morefigs <morefigs@gmail.com> | 2013-12-22 17:12:58 -0800 |
| commit | 6ffbd77c72bfc29087980a065dc200710bbe97c6 (patch) | |
| tree | b3371f8a17c0effa7e9bd4a977a17b2aefd41f83 | |
| parent | e7fb52520743c8acd48d5cb0f750bd5c4b59748f (diff) | |
| download | pymba-6ffbd77c72bfc29087980a065dc200710bbe97c6.tar.gz pymba-6ffbd77c72bfc29087980a065dc200710bbe97c6.zip | |
Update README.md
| -rw-r--r-- | README.md | 74 |
1 files changed, 43 insertions, 31 deletions
@@ -1,6 +1,6 @@ # pymba -pymba is a Python wrapper for the Allied Vision Technologies (AVT) Vimba C API. It wraps (and requires) the VimbaC.dll file included in the AVT Vimba installation. It currently supports most of the functionality provided by VimbaC.dll for 1394 cameras. +pymba 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 for 1394 cameras. ## Installation @@ -19,83 +19,86 @@ Install pymba. ## Usage -### Typical usage +### Testing installation -The following code gives a good example of basic pymba usage. For clarity exceptions are not dealt with. +If Vimba and pymba are installed correctly, then the following code should give the installed Vimba version. No camera is needed. from vimba import * - # start Vimba + vimba = Vimba() + vimba.getVersion() + +### Basic usage + +The following code gives an example of basic usage. For clarity exceptions are not dealt with here. + + from vimba import * + + #### start Vimba vimba = Vimba() vimba.startup() - # show Vimba version - print '\nVimba API version\n------' + #### show Vimba version print vimba.getVersion() - # list available camera IDs + #### list available camera IDs camIds = vimba.getCameraIds() - print '\nAvailable cameras\n------' for cam in camIds: print cam - # create and open a camera + #### create and open a camera cam0 = vimba.getCamera(camIds[0]) cam0.openCamera() - # list features of a camera + #### list features of a camera featNames = cam0.getFeatureNames() - print '\nAvailable features for camera', cam0.cameraIdString, '\n------' for fn in featNames: print fn - # read info of a camera feature + #### read info of a camera feature featInfo = cam0.getFeatureInfo('AcquisitionMode') - print '\nProperties for feature', featInfo.name, 'on camera', cam0.cameraIdString, '\n------' for field in featInfo.getFieldNames(): print field, '--', getattr(featInfo, field) - # get the value of a feature - print '\nValue of feature', featInfo.name, 'on camera', cam0.cameraIdString, '\n------' + #### get the value of a feature print cam0.AcquisitionMode - # set the value of a feature + #### set the value of a feature cam0.AcquisitionMode = 'SingleFrame' - # create new frames for the camera + #### create new frames for the camera frame0 = cam0.getFrame() # creates a frame frame1 = cam0.getFrame() # creates a second frame - # announce frame + #### announce frame frame0.announceFrame() - # capture a camera image + #### capture a camera image cam0.startCapture() frame0.queueFrameCapture() cam0.runFeatureCommand('AcquisitionStart') cam0.runFeatureCommand('AcquisitionStop') frame0.waitFrameCapture() - # get image data + #### get image data... imgData = frame0.getBufferByteData() - # can use NumPy and OpenCV for faster image display - #import numpy as np - #import cv2 - #moreUsefulImgData = np.ndarray(buffer = cam0.frame0.getBufferByteData(), - # dtype = np.uint8, - # shape = (cam0.frame0.height, - # cam0.frame0.width, - # 1)) + #### ...or use NumPy for fast image display (for use with OpenCV, etc) + import numpy as np + moreUsefulImgData = np.ndarray(buffer = cam0.frame0.getBufferByteData(), + dtype = np.uint8, + shape = (cam0.frame0.height, + cam0.frame0.width, + 1)) - # clean up after capture + #### clean up after capture cam0.endCapture() cam0.revokeAllFrames() - # close camera + #### close camera cam0.closeCamera() - # shutdown Vimba + #### shutdown Vimba vimba.shutdown() @@ -115,3 +118,12 @@ Handling exceptions can be done as shown below. vimba.startup() except VimbaException as e: print e.message + + + +## Known issues + +* Not all SDK functions are wrapped (most are). For full list see vimbadll.py. +* Colour cameras have not been tested. B&W 1394 cameras have been tested under Windows with Vimba version 1.2.1. +* The VimbaC.dll file location has been hardcoded in vimbadll.py. It should be easy to change if needed. + |
