Point Grey USB3 camera pixel color format
I have a PointGrey BlackFly USB3 2MP camera that reads as three 8-bit channels in Python's Numpy array of shape (rows, cols, 3). However, each cell (pixel) has the same value, so I end up with a gray-scale image-like by default. The size of the image is correct, though.
I tried several conversions of color, but Bayer cannot go from 3 channels to anything else. Does anyone know which property to set for this VideoCapture object or any other suggestion? I'm not sure which Video Data Output it's using, perhaps it's 24-bit digital data it's giving 24-bits per pixel as (8,8,8), but maybe not.
How to find out the video format within OpenCV? If I ask for
my_capture_device.get(cv2.CAP_PVAPI_PIXELFORMAT_RGB24)
it says 15.0,
my_capture_device.get(cv2.get(CAP_PVAPI_PIXELFORMAT_BAYER16)
, I get 480.0, and
my_capture_device.get(cv2.get(CAP_PVAPI_PIXELFORMAT_BAYER8)
I get 640.0.
Any other PIXELFORMAT
option gives -1.
I don't understand what these values mean. Please, help if you know how to set the color space for these PointGrey cameras. I know that OpenCV is wrapping around libdc1394
to interface the camera since PointGray doesn't provide drivers for OS X.
Thanks in advance!
I have found these links:
@Eduardo: the problem is that these documents don't apply to the use of OpenCV alone (without grabbing the images from the FlyCapture API). I'm grabbing the images directly from OpenCV's back-end to libdc1394 in Mac OS X.
It does not work directly from OpenCV. You will need the FlyCapture API ...
I got my BlackFly USB 3 camera working in OpenCV after reinstalling (upgrading) libusb via homebrew, and then rebuilding libdc1394 from source (The color conversion in the answer below changes a little for the BlackFly, specifically the conversion is cv2.COLOR_BAYER_BG2BGR).