diff options
| author | Derric Williams <derricw@alleninstitute.org> | 2014-07-11 14:28:21 -0700 |
|---|---|---|
| committer | Derric Williams <derricw@alleninstitute.org> | 2014-07-11 14:28:21 -0700 |
| commit | f5b5cd23c31f7e60af168df86c4ac71fc1ea66a1 (patch) | |
| tree | 4140970ef1677b39128731be45d9f9ebde24792d | |
| parent | ec7e44c7f2820962cd3942b6a59d32fd58b7d5ed (diff) | |
| download | pymba-f5b5cd23c31f7e60af168df86c4ac71fc1ea66a1.tar.gz pymba-f5b5cd23c31f7e60af168df86c4ac71fc1ea66a1.zip | |
Support for Mono14 PixelFormat
| -rw-r--r-- | pymba/vimba.py | 4 | ||||
| -rw-r--r-- | pymba/vimbaframe.py | 41 |
2 files changed, 23 insertions, 22 deletions
diff --git a/pymba/vimba.py b/pymba/vimba.py index 678e7b0..ffb3a91 100644 --- a/pymba/vimba.py +++ b/pymba/vimba.py @@ -173,7 +173,7 @@ class Vimba(object): :param interfaceId: the ID of the interface. - :returns: VimbaInterface object -- the interface object specified. + :returns: VimbaInterface object -- the interface object specified. """ # check ID is valid if interfaceId in self.getInterfaceIds(): @@ -190,7 +190,7 @@ class Vimba(object): :param cameraId: the ID of the camera. - :returns: VimbaCamera object -- the camera object specified. + :returns: VimbaCamera object -- the camera object specified. """ # check ID is valid if cameraId in self.getCameraIds(): diff --git a/pymba/vimbaframe.py b/pymba/vimbaframe.py index 9e2a22d..b01dc2a 100644 --- a/pymba/vimbaframe.py +++ b/pymba/vimbaframe.py @@ -5,10 +5,11 @@ from vimbadll import VimbaDLL from vimbadll import VimbaC_MemoryBlock from ctypes import * -#map formats to bytes per pixel +#map formats to bytes per pixel. TODO: packed formats? color? PIXEL_FORMATS = { "Mono8": 1, "Mono12": 2, + "Mono14": 2, "Mono16": 2, } @@ -33,74 +34,74 @@ class VimbaFrame(object): 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 + + 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) - + def revokeFrame(self): """ Revoke a frame from the API. """ errorCode = VimbaDLL.frameRevoke(self._handle, byref(self._frame)) - + if errorCode != 0: raise VimbaException(errorCode) - + def queueFrameCapture(self): """ Queue frames that may be filled during frame capturing. Runs VmbCaptureFrameQueue - + Call after announceFrame and startCapture """ errorCode = VimbaDLL.captureFrameQueue(self._handle, byref(self._frame), - None) # callback not implemented, callback example in pico? + None) # callback not implemented, callback example in pico? if errorCode != 0: raise VimbaException(errorCode) - + def waitFrameCapture(self, timeout=2000): """ Wait for a queued frame to be filled (or dequeued). Returns Errorcode upon completion. Runs VmbCaptureFrameWait - - timeout - int, milliseconds default(timeout, 2000) - + + timeout - int, milliseconds default(timeout, 2000) + Call after an acquisition command """ errorCode = VimbaDLL.captureFrameWait(self._handle, byref(self._frame), timeout) - + # errorCode to be processed by the end user for this function. # Prevents system for breaking for example on a hardware trigger # timeout #if errorCode != 0: #raise VimbaException(errorCode) return errorCode - + # custom method for simplified usage def getBufferByteData(self): """ |
