morefigs / pymba

Python wrapper for Allied Vision's Vimba C API
MIT License
105 stars 84 forks source link

Included pixel format description like in VmbCommonTypes.h and extended numpy array export for most pixel formats #102

Closed honkomonk closed 5 years ago

honkomonk commented 5 years ago

I needed more than UInt8 image formats for my projects, so I extended Pymba to support most of the pixel formats from the Vimba driver.

It's done by translating VmbCommonTypes.h to Python (vimba_pixelformat.py). This provides an easy way to check the "PixelType" bitfield in each frame and get the necessary dtype and number of channels for a corresponding numpy array. For now, this only works with the non-packed formats!

I tested it with 2 different cameras (monochrome and color) with the example in opencv_acquire_streaming_images.py by setting "camera.PixelFormat = 'Mono12' # test format".

Please note: The cameras don't accept all pixel modes. Use the vimba Viewer and check the available values under ImageFormat -> Pixel Format to see what modes are supported by your camera!

morefigs commented 5 years ago

Thanks very much :)