LJMUAstroecology / flirpy

Python library to interact with FLIR camera cores
Other
191 stars 54 forks source link

RAW-16 Not Working on OS X #7

Open amirgholami opened 4 years ago

amirgholami commented 4 years ago

Hi,

First let me thank you for creating this repository. It is very useful and the code is very clean. I am trying to get the RAW pre AGC 16-bit data, but using the provided instructions I am only getting uint8:

camera = Boson() camera.setup_video(device_id=2) image = camera.grab() print(image.dtype) uint8

I did check that the following lines return 0 so I am not sure why this is happening:

The order of these calls matters!

self.cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*"Y16 ")) self.cap.set(cv2.CAP_PROP_CONVERT_RGB, False)

P.S: I am running this on MAC

jveitchmichaelis commented 4 years ago

I am running this on MAC

Unfortunately this is the problem - 16 bit video support is not great on OS X unfortunately. You might have some luck with a generic UVC driver, but you can't use OpenCV.

Take a look at https://github.com/groupgets/libuvc for example. It should support Y16. Maybe also you could try gstreamer? That may be a good route actually, I'll have a look into that (though it would require compiling everything from scratch).

I added 16 bit video support to OpenCV for Linux and Windows some time ago; I looked into doing the same for OS X but I think AVFoundation is quite limited in terms of supported codecs.

In theory there should be no problem, because the most recent builds of iOS can deal with the disparity map streams from newer iPhones, and that's almost certainly 16-bit data.

I'd be interested if you can get gstreamer to work, using eg GRAY16_LE as the format spec.

amirgholami commented 4 years ago

That is right, it seems the problem is OSX. I tested it on Linux and the 16-bit works correctly.

shinya-ohtani commented 2 years ago

You might have some luck with a generic UVC driver,

On macOS before macOS 12 (macOS 11.6.2 or earlier to be exact), libuvc works. However, on macOS 12, libuvc does not work at all. When trying to open the camera device, uvc_open() results in "uvc err: Access denied (-3)".

more details in this Issue: https://github.com/groupgets/purethermal1-uvc-capture/issues/56