From 193a223b4ea29150db5f2b44b415669520b1e080 Mon Sep 17 00:00:00 2001 From: morefigs Date: Wed, 30 Jan 2019 14:25:20 +1100 Subject: Update README.md --- README.md | 172 ++++++++++++-------------------------------------------------- 1 file changed, 32 insertions(+), 140 deletions(-) diff --git a/README.md b/README.md index 90cfee1..3e1fe2d 100644 --- a/README.md +++ b/README.md @@ -1,155 +1,47 @@ -# pymba - -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. +# Pymba + +Pymba is a Python wrapper for Allied Vision's Vimba C API. It wraps the VimbaC library file included in the Vimba installation to provide a simple Python interface for Allied Vision cameras. It currently supports most of the functionality provided by Vimba. + +## Requirements + +### Vimba SDK + +* Download and run the Vimba SDK installer from Allied Vision from https://www.alliedvision.com/en/products/software.html. +* Select "Custom Selection". +* Select (at least) the following options: + * A transport layer that matches your hardware (e.g. "Vimba USB Transport Layer" for USB cameras) + * Core components + * Register GenICam Path variable + * Vimba SDK + * Core components + * Register environment variables + * C API runtime components + * C API development components + * Driver Installer + * Vimba Viewer +* Run `VimbaDriverInstaller.exe` and install the relevant driver. +* Test the driver installation by running `VimbaViewer.exe`. ## Installation -Install the Vimba SDK from AVT to the default directory. - -Run the AVTDriverInstaller tool and install the AVT Vimba SDK drivers. - -Install pymba. +Install Pymba via PIP: -## Usage + pip install pymba -### Testing installation +## Testing installation If Vimba and pymba are installed correctly, then the following code examples should give the installed Vimba version. No camera is needed. -Checking the version using a context manager: - - from pymba import * - - with Vimba() as vimba: - print(vimba.getVersion()) - -Or without using a context manager: - - from pymba import * - - vimba = Vimba() - vimba.startup() - print(vimba.getVersion()) - vimba.shutdown() - -### Interacting with cameras - -Discover, open, manipulate, and capture frames from a camera. - - from pymba import * - import time - - # start Vimba - with Vimba() as vimba: - # 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(cameraId) - - # get and open a camera - camera0 = vimba.getCamera(cameraIds[0]) - camera0.openCamera() - - # list camera features - cameraFeatureNames = camera0.getFeatureNames() - for name in cameraFeatureNames: - print(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 - -### Interacting with the Vimba system - -Get a reference to the Vimba system object and list available system features. - - from pymba import * - - with Vimba() as vimba: - # get system object - system = vimba.getSystem() - - # list system features - for featureName in system.getFeatureNames(): - print(featureName) - -### Interacting with transport layer interfaces + from pymba import Vimba -Get a reference to an interface object and list available interface features. + print(Vimba.version()) - from pymba import * +## Usage examples - with Vimba() as vimba: - # get list of available interfaces - interfaceIds = vimba.getInterfaceIds() - for interfaceId in interfaceIds: - print(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(name) - - # close interface - interface0.closeInterface() - - - -### Handling Vimba exceptions - - from pymba import * - - try: - with Vimba() as vimba: - except VimbaException as e: - print(e.message) - - +Usage examples can be found in the [examples/](examples/) directory. ## Known issues -* Not all API functions are wrapped (most are). For full list see vimbadll.py. +* Not all API functions are supported. +* Not all camera pixel formats are currently supported. -- cgit v1.2.3