本文整理汇总了Python中vimbadll.VimbaDLL类的典型用法代码示例。如果您正苦于以下问题:Python VimbaDLL类的具体用法?Python VimbaDLL怎么用?Python VimbaDLL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VimbaDLL类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: queueFrameCapture
def queueFrameCapture(self, frameCallback = None):
"""
Queue frames that may be filled during frame capturing.
Runs VmbCaptureFrameQueue
Call after announceFrame and startCapture
Callback must accept argument of type frame. Remember to requeue the
frame by calling frame.queueFrameCapture(frameCallback) at the end of
your callback function.
"""
# remember the given callback function
self._frameCallback = frameCallback
# define a callback wrapper here so it doesn't bind self
def frameCallbackWrapper(p_frame):
# call the user's callback with the self bound outside the wrapper
# ignore the frame pointer since we already know the callback
# refers to this frame
self._frameCallback(self)
if self._frameCallback is None:
self._frameCallbackWrapper_C = None
else:
# keep a reference to prevent gc issues
self._frameCallbackWrapper_C = \
VimbaDLL.frameDoneCallback(frameCallbackWrapper)
errorCode = VimbaDLL.captureFrameQueue(self._handle,
byref(self._frame),
self._frameCallbackWrapper_C)
if errorCode != 0:
raise VimbaException(errorCode)
示例2: _getCameraInfos
def _getCameraInfos(self):
"""
Gets camera info of all attached cameras.
:returns: list -- camera info for available cameras.
"""
# args
dummyCameraInfo = structs.VimbaCameraInfo()
numFound = c_uint32(-1)
# call once just to get the number of cameras
# Vimba DLL will return an error code
errorCode = VimbaDLL.camerasList(byref(dummyCameraInfo),
0,
byref(numFound),
sizeof(dummyCameraInfo))
if errorCode != 0 and errorCode != -9:
raise VimbaException(errorCode)
numCameras = numFound.value
# args
cameraInfoArray = (structs.VimbaCameraInfo * numCameras)()
# call again to get the features
# Vimba DLL will return an error code
errorCode = VimbaDLL.camerasList(cameraInfoArray,
numCameras,
byref(numFound),
sizeof(dummyCameraInfo))
if errorCode != 0:
raise VimbaException(errorCode)
return list(camInfo for camInfo in cameraInfoArray)
示例3: startCapture
def startCapture(self):
"""
Prepare the API for incoming frames.
"""
errorCode = VimbaDLL.captureStart(self._handle)
if errorCode != 0:
raise VimbaException(errorCode)
示例4: announceFrame
def announceFrame(self):
"""
Announce frames to the API that may be queued for frame capturing later.
Runs VmbFrameAnnounce
Should be called after the frame is created. Call startCapture
after this method.
"""
# size of expected frame
sizeOfFrame = self.payloadSize
# keep this reference to keep block alive for life of frame
self._cMem = VimbaC_MemoryBlock(sizeOfFrame)
# set buffer to have length of expected payload size
self._frame.buffer = self._cMem.block
# set buffer size to expected payload size
self._frame.bufferSize = sizeOfFrame
errorCode = VimbaDLL.frameAnnounce(self._handle,
byref(self._frame),
sizeof(self._frame))
if errorCode != 0:
raise VimbaException(errorCode)
示例5: closeCamera
def closeCamera(self):
"""
Close the camera.
"""
errorCode = VimbaDLL.cameraClose(self._handle)
if errorCode != 0:
raise VimbaException(errorCode)
示例6: readRegister
def readRegister(self, address):
# note that the underlying Vimba function allows reading of an array
# of registers, but only one address/value at a time is implemented
# here
"""
Read from a register of the module (camera).
:param address: the address of the register to read.
:returns: int -- value of register.
"""
readCount = 1
# check address validity
try:
regAddress = c_uint64(int(address, 16))
except:
raise VimbaException(-52)
regData = c_uint64()
numCompleteReads = c_uint32()
errorCode = VimbaDLL.registersRead(self.handle,
readCount,
byref(regAddress),
byref(regData),
byref(numCompleteReads))
if errorCode != 0:
raise VimbaException(errorCode)
return regData.value
示例7: flushCaptureQueue
def flushCaptureQueue(self):
"""
Flush the capture queue.
"""
errorCode = VimbaDLL.captureQueueFlush(self._handle)
if errorCode != 0:
raise VimbaException(errorCode)
示例8: closeInterface
def closeInterface(self):
"""
Close the interface.
"""
errorCode = VimbaDLL.interfaceClose(self._handle)
if errorCode != 0:
raise VimbaException(errorCode)
示例9: writeRegister
def writeRegister(self, address, value):
# note that the underlying Vimba function allows writing of an array
# of registers, but only one address/value at a time is implemented
# here
"""
Read from a register of the module (camera).
:param address: the address of the register to read.
:param value: the value to set in hex.
"""
writeCount = 1
# check address validity
try:
regAddress = c_uint64(int(address, 16))
except:
raise VimbaException(-52)
# check value validity
try:
regData = c_uint64(int(value, 16))
except:
raise VimbaException(-52)
numCompleteWrites = c_uint32()
errorCode = VimbaDLL.registersWrite(self.handle,
writeCount,
byref(regAddress),
byref(regData),
byref(numCompleteWrites))
if errorCode != 0:
raise VimbaException(errorCode)
示例10: revokeAllFrames
def revokeAllFrames(self):
"""
Revoke all frames assigned to the camera.
"""
errorCode = VimbaDLL.frameRevokeAll(self._handle)
if errorCode != 0:
raise VimbaException(errorCode)
示例11: endCapture
def endCapture(self):
"""
Stop the API from being able to receive frames.
"""
errorCode = VimbaDLL.captureEnd(self._handle)
if errorCode != 0:
raise VimbaException(errorCode)
示例12: openInterface
def openInterface(self):
"""
Open the interface.
"""
errorCode = VimbaDLL.interfaceOpen(self._interfaceIdString,
byref(self._handle))
if errorCode != 0:
raise VimbaException(errorCode)
示例13: startup
def startup(self):
"""
Initialize the VimbaC API.
"""
# Vimba DLL will return an error code
errorCode = VimbaDLL.startup()
if errorCode != 0:
raise VimbaException(errorCode)
示例14: revokeFrame
def revokeFrame(self):
"""
Revoke a frame from the API.
"""
errorCode = VimbaDLL.frameRevoke(self._handle,
byref(self._frame))
if errorCode != 0:
raise VimbaException(errorCode)
示例15: waitFrameCapture
def waitFrameCapture(self, timeout = 2000):
"""
Wait for a queued frame to be filled (or dequeued).
"""
errorCode = VimbaDLL.captureFrameWait(self._handle,
byref(self._frame),
timeout)
if errorCode != 0:
raise VimbaException(errorCode)