AlexShkarin / pyLabLib

Python package for device control and experiment automation
http://pylablib.readthedocs.io
GNU General Public License v3.0
125 stars 28 forks source link

Thorlabs cam sensor type: monochrome or bayer color #52

Closed seb5g closed 8 months ago

seb5g commented 9 months ago

This PR allows to query and add the sensor type to the device info query. This is mandatory because otherwise there is no possibility to check if the camera is monochrome or bayer type color.

In case of bayer color, the newest frame is actually a raw bayer image and a demosaicification is needed to get back the RGB (or even monochrome) image output. I'm using for this the cvtColor function from OpenCV.

The change here is minimal as only in the returned device info. Could you please accept this PR, I really need this info!

Thanks

seb5g commented 8 months ago

Hello, could you have a look to this minimal modification please?

AlexShkarin commented 8 months ago

Hello! Sorry for the delay!

Thanks for bringing this up! The new version of pylablib (which was, conincedentally, published several days after your original pull request) added support for the sensor info in the Thorlabs scientific cameras via ThorlabsTLCamera.get_sensor_info method. It also now has support for color frames readout and de-bayering (it uses custom methods which seem to work identically to the one provided by Thorlabs), although you can still, of course, get the raw frames (you can enable it up by calling cam.set_color_format("raw")) and use an algorithm of your choice. Let me know if this solves your problem.

seb5g commented 8 months ago

I see, thanks. I'll have a look and I'm sure it solves the issue!