aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerric Williams <derricw@alleninstitute.org>2014-08-06 15:58:40 -0700
committerDerric Williams <derricw@alleninstitute.org>2014-08-06 15:58:40 -0700
commit6aebd5c04313f3250c7b0b2b93410034220e7330 (patch)
tree51ceb394ba096a399278eb6d968c2f3a4507044f
parent51b885759ea258362de649be28af16a5fec9b35f (diff)
downloadpymba-6aebd5c04313f3250c7b0b2b93410034220e7330.tar.gz
pymba-6aebd5c04313f3250c7b0b2b93410034220e7330.zip
Now supports all image formats found on AVT cameras.
-rw-r--r--pymba/vimbaframe.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/pymba/vimbaframe.py b/pymba/vimbaframe.py
index 9e92285..964917b 100644
--- a/pymba/vimbaframe.py
+++ b/pymba/vimbaframe.py
@@ -5,14 +5,23 @@ from vimbadll import VimbaDLL
from vimbadll import VimbaC_MemoryBlock
from ctypes import *
-#map pixel formats to bytes per pixel. TODO: packed mono formats?
+#map pixel formats to bytes per pixel.
PIXEL_FORMATS = {
"Mono8": 1,
"Mono12": 2,
+ "Mono12Packed": 1.5,
"Mono14": 2,
"Mono16": 2,
"RGB8Packed": 3,
"BGR8Packed": 3,
+ "RGBA8Packed": 4,
+ "BGRA8Packed": 4,
+ "YUV411Packed": 4/3.0,
+ "YUV422Packed": 2,
+ "YUV444Packed": 3,
+ "BayerRG8": 1,
+ "BayerRG12": 2,
+ "BayerGR12Packed": 1.5,
}
@@ -117,7 +126,8 @@ class VimbaFrame(object):
POINTER(c_ubyte * self.payloadSize))
# make array of c_ubytes from buffer
- array = (c_ubyte * (self.height*self.pixel_bytes) *
- (self.width*self.pixel_bytes)).from_address(addressof(data.contents))
+ array = (c_ubyte * int(self.height*self.pixel_bytes) *
+ int(self.width*self.pixel_bytes)).from_address(addressof(
+ data.contents))
return array