From 6aebd5c04313f3250c7b0b2b93410034220e7330 Mon Sep 17 00:00:00 2001 From: Derric Williams Date: Wed, 6 Aug 2014 15:58:40 -0700 Subject: Now supports all image formats found on AVT cameras. --- pymba/vimbaframe.py | 16 +++++++++++++--- 1 file 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 -- cgit v1.2.3