Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I access my laptop's built-in infrared webcam using python?

I'm trying to access my laptop's built-in infrared webcam (intended for windows hello) in a python project. I can access the normal RGB camera quite easily using the VideoCapture class from OpenCV, however can't find a way to access the infrared camera. I tried passing different indices to the VideoCapture class, however only "0" works, which is the normal webcam.

There are ways to do this using the Windows API, however I can't find a way to access this in Python.

Some people have been able to access the windows hello camera on Ubuntu using fswebcam.

Is there anyway to access the infrared camera using python? Maybe some way of interfacing with the Windows API using pywin32? Any help getting started with this would be appreciated. Alternatively, is there anything similar to fswebcam for Windows that would let me do the same?

like image 694
Mohamad Zeina Avatar asked Apr 03 '21 15:04

Mohamad Zeina


1 Answers

That example you provided, doesn't seem to use the win32 api, but rather the dotnet framework, specifically the Windows.Media.Capture.Frames.MediaFrameSourceGroup class.

It looks like you'll be able to access the dotnet framework using http://pythonnet.github.io/ . After that it should be a case of porting that C# code over to Python.

like image 65
Rory Browne Avatar answered Sep 20 '22 13:09

Rory Browne