aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Sun <jsun@sightmachine.com>2014-04-04 15:56:30 -0700
committerJohn Sun <jsun@sightmachine.com>2014-04-04 15:56:30 -0700
commit09f39b9ac2b9c93979c8ea949c753982cbf2f206 (patch)
tree12ca69aa4869638e22d6e2ae3e5c5fc64abb5599
parent3c1ca240eb7d90e7c7e925c06712a59a4063cb7e (diff)
downloadpymba-09f39b9ac2b9c93979c8ea949c753982cbf2f206.tar.gz
pymba-09f39b9ac2b9c93979c8ea949c753982cbf2f206.zip
re-format code to fixup whitespace
-rw-r--r--pymba/tests/opencv_example.py24
-rw-r--r--pymba/tests/test_cameras.py44
-rw-r--r--pymba/tests/test_installation.py1
-rw-r--r--pymba/tests/test_interfaces.py7
-rw-r--r--pymba/tests/test_systemfeature.py5
-rw-r--r--setup.py48
6 files changed, 67 insertions, 62 deletions
diff --git a/pymba/tests/opencv_example.py b/pymba/tests/opencv_example.py
index ddd0c8d..43faefb 100644
--- a/pymba/tests/opencv_example.py
+++ b/pymba/tests/opencv_example.py
@@ -31,11 +31,11 @@ camera0.openCamera()
cameraFeatureNames = camera0.getFeatureNames()
for name in cameraFeatureNames:
try:
- print 'Camera feature:%s=%s' % (name, camera0.__getattr__(name))
- pass
+ print 'Camera feature:%s=%s' % (name, camera0.__getattr__(name))
+ pass
except VimbaException:
- print "%s Not yet implemented" % name
- pass
+ print "%s Not yet implemented" % name
+ pass
# read info of a camera feature
#featureInfo = camera0.getFeatureInfo('AcquisitionMode')
@@ -61,8 +61,8 @@ print camera0.AcquisitionMode
# create new frames for the camera
-frame0 = camera0.getFrame() # creates a frame
-frame1 = camera0.getFrame() # creates a second frame
+frame0 = camera0.getFrame() # creates a frame
+frame1 = camera0.getFrame() # creates a second frame
# announce frame
frame0.announceFrame()
@@ -80,12 +80,12 @@ while count < 10:
# get image data...
imgData = frame0.getBufferByteData()
-
- moreUsefulImgData = np.ndarray(buffer = frame0.getBufferByteData(),
- dtype = np.uint8,
- shape = (frame0.height,
- frame0.width,
- 1))
+
+ 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)
diff --git a/pymba/tests/test_cameras.py b/pymba/tests/test_cameras.py
index 527109f..e51a042 100644
--- a/pymba/tests/test_cameras.py
+++ b/pymba/tests/test_cameras.py
@@ -3,14 +3,15 @@
from pymba import *
import time
+
def test_cameras():
# 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")
@@ -18,53 +19,54 @@ def test_cameras():
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
-
+ 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))
-
+
+ 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()
diff --git a/pymba/tests/test_installation.py b/pymba/tests/test_installation.py
index 782bc56..3b6b90d 100644
--- a/pymba/tests/test_installation.py
+++ b/pymba/tests/test_installation.py
@@ -2,6 +2,7 @@
from pymba import Vimba
+
def test_installation():
vimba = Vimba()
version = vimba.getVersion()
diff --git a/pymba/tests/test_interfaces.py b/pymba/tests/test_interfaces.py
index 3294715..63deceb 100644
--- a/pymba/tests/test_interfaces.py
+++ b/pymba/tests/test_interfaces.py
@@ -3,6 +3,7 @@
from pymba import *
import time
+
def test_interfaces():
# start Vimba
vimba = Vimba()
@@ -12,16 +13,16 @@ def test_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()
diff --git a/pymba/tests/test_systemfeature.py b/pymba/tests/test_systemfeature.py
index 0f926d4..3c63b71 100644
--- a/pymba/tests/test_systemfeature.py
+++ b/pymba/tests/test_systemfeature.py
@@ -2,6 +2,7 @@
from pymba import *
+
def test_systemfeature():
# get system object
vimba = Vimba()
@@ -12,8 +13,8 @@ def test_systemfeature():
# list system features
for featureName in system.getFeatureNames():
print 'System feature:', featureName
- fInfo = system.getFeatureInfo(featureName)
- for field in fInfo.getFieldNames():
+ fInfo = system.getFeatureInfo(featureName)
+ for field in fInfo.getFieldNames():
print "\t", featureName, ":", field, getattr(fInfo, field)
# shutdown Vimba
diff --git a/setup.py b/setup.py
index 8875240..1bb1bff 100644
--- a/setup.py
+++ b/setup.py
@@ -2,28 +2,28 @@ from setuptools import setup, find_packages
import os, sys, glob, fnmatch
setup(name="pymba",
- version=0.1,
- description="pymba is a Python wrapper for the Allied Vision Technologies (AVT) Vimba C API.",
- long_description="""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.""",
- classifiers=[
- 'Development Status :: 5 - Production/Stable',
- 'Intended Audience :: Developers',
- 'Intended Audience :: Science/Research',
- 'Intended Audience :: Manufacturing',
- 'License :: OSI Approved :: BSD License',
- 'Operating System :: OS Independent',
- 'Programming Language :: Python',
- 'Topic :: Multimedia :: Graphics :: Capture :: Digital Camera',
- 'Topic :: Multimedia :: Graphics :: Graphics Conversion',
- 'Topic :: Scientific/Engineering :: Image Recognition',
- 'Topic :: Software Development :: Libraries :: Python Modules'],
- keywords='opencv, cv, machine vision, computer vision, image recognition, vimba, allied vision technologies',
- author='Sight Machine Inc',
- author_email='support@sightmachine.com',
- url='http://simplecv.org',
- license='BSD',
- packages = ['pymba', 'pymba.tests'],
- zip_safe = False,
- requires=['cv2','cv', 'numpy', 'scipy', 'pygame', 'pil', 'svgwrite'],
+ version=0.1,
+ description="pymba is a Python wrapper for the Allied Vision Technologies (AVT) Vimba C API.",
+ long_description="""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.""",
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Intended Audience :: Developers',
+ 'Intended Audience :: Science/Research',
+ 'Intended Audience :: Manufacturing',
+ 'License :: OSI Approved :: BSD License',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Topic :: Multimedia :: Graphics :: Capture :: Digital Camera',
+ 'Topic :: Multimedia :: Graphics :: Graphics Conversion',
+ 'Topic :: Scientific/Engineering :: Image Recognition',
+ 'Topic :: Software Development :: Libraries :: Python Modules'],
+ keywords='opencv, cv, machine vision, computer vision, image recognition, vimba, allied vision technologies',
+ author='Sight Machine Inc',
+ author_email='support@sightmachine.com',
+ url='http://simplecv.org',
+ license='BSD',
+ packages=['pymba', 'pymba.tests'],
+ zip_safe=False,
+ requires=['cv2', 'cv', 'numpy', 'scipy', 'pygame', 'pil', 'svgwrite'],
- )
+)