diff options
| author | John Sun <jsun@sightmachine.com> | 2014-04-04 15:49:14 -0700 |
|---|---|---|
| committer | John Sun <jsun@sightmachine.com> | 2014-04-04 15:49:14 -0700 |
| commit | 3c1ca240eb7d90e7c7e925c06712a59a4063cb7e (patch) | |
| tree | a16466e168fd42f7f184fe5f96947e918c9a4c74 /pyvimba/tests/opencv_example.py | |
| parent | f71223d809af8cb749f6a3b37b3a29a022322d02 (diff) | |
| download | pymba-3c1ca240eb7d90e7c7e925c06712a59a4063cb7e.tar.gz pymba-3c1ca240eb7d90e7c7e925c06712a59a4063cb7e.zip | |
Rename directory to pymba instead of pyvimba.
Fix test_systemfeatures.py
Diffstat (limited to 'pyvimba/tests/opencv_example.py')
| -rw-r--r-- | pyvimba/tests/opencv_example.py | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/pyvimba/tests/opencv_example.py b/pyvimba/tests/opencv_example.py deleted file mode 100644 index a1d7269..0000000 --- a/pyvimba/tests/opencv_example.py +++ /dev/null @@ -1,80 +0,0 @@ -from pyvimba.vimba import * -import numpy as np -import cv2 -import time - -#very crude example, assumes your camera is PixelMode = BAYERRG8 - -# 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 - -# read info of a camera feature -#featureInfo = camera0.getFeatureInfo('AcquisitionMode') -#for field in featInfo.getFieldNames(): -# print field, '--', getattr(featInfo, field) - -# 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 -count = 0 -while count < 10: - camera0.startCapture() - frame0.queueFrameCapture() - camera0.runFeatureCommand('AcquisitionStart') - camera0.runFeatureCommand('AcquisitionStop') - frame0.waitFrameCapture() - - # get image data... - imgData = frame0.getBufferByteData() - - moreUsefulImgData = np.ndarray(buffer = frame0.getBufferByteData(), - dtype = np.uint8, - shape = (frame0.height, - frame0.width, - 1)) - rgb = cv2.cvtColor(moreUsefulImgData, cv2.COLOR_BAYER_RG2RGB) - cv2.imwrite('foo{}.png'.format(count), rgb) - print "image {} saved".format(count) - count += 1 - camera0.endCapture() -# clean up after capture -camera0.revokeAllFrames() - -# close camera -camera0.closeCamera() - -# shutdown Vimba -vimba.shutdown() - |
