How to enumerate camera devices in C# using DirectShow and MSMF to match OpenCV index

873 Views Asked by At

I'm working on a C# program that uses OpenCV to record videos. The user is able to select the camera index and API (DirectShow or Microsoft Media Foundation) before recording a video.

As I understand, OpenCV does not support enumerating camera device labels. So the user has to try each index to find the correct camera.

It is also noted that OpenCV has a different order of camera indices for different APIs (DirectShow or Microsoft Media Foundation).

How can I generate lists of camera device labels using C#, that corresponds to the OpenCV camera device indices for DirectShow and Microsoft Media Foundation APIs?

I was able to enumerate the camera devices list that corresponds to the OpenCV camera devices index (DirectShow) using this tool. https://www.nuget.org/packages/DirectShowLib.Standard

However, I struggle to produce an index for Microsoft Media Foundation API.

0

There are 0 best solutions below