Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to get the friendly names of the cameras? (see my code)

I wrote a small paragraph of code. See below.


#include <opencv2 core.hpp="">
#include <opencv2 imgcodecs.hpp="">
#include <opencv2 highgui.hpp="">
#include <opencv2 videoio.hpp="">
#include <iostream>
using namespace cv;
using namespace std;

void SimpleEnumerateDirectShowCameras()
{
    struct CapDriver{
        int enumValue; 
        string enumName; 
        string comment;
    };

    int maxID = 100; 
    for (int idx = 0; idx smaller_than maxID; idx++)
    {
        VideoCapture cap(CV_CAP_DSHOW + idx);  // open the camera
        // cap.release();
    }
}

int main()
{
    SimpleEnumerateDirectShowCameras();
    return 0;
}

The output of the code above is as below, as my machine has several cameras installed on.


***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****

SETUP: Setting up device 0
SETUP: USB Camera-OV580
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 1104x828
SETUP: trying specified format RGB24 @ 640x480
SETUP: trying format RGB24 @ 640x480
SETUP: trying format RGB32 @ 640x480
SETUP: trying format RGB555 @ 640x480
SETUP: trying format RGB565 @ 640x480
SETUP: trying format YUY2 @ 640x480
SETUP: trying format YVYU @ 640x480
SETUP: trying format YUYV @ 640x480
SETUP: trying format IYUV @ 640x480
SETUP: trying format UYVY @ 640x480
SETUP: trying format YV12 @ 640x480
SETUP: trying format YVU9 @ 640x480
SETUP: trying format Y411 @ 640x480
SETUP: trying format Y41P @ 640x480
SETUP: trying format Y211 @ 640x480
SETUP: trying format AYUV @ 640x480
SETUP: trying format MJPG @ 640x480
SETUP: trying format Y800 @ 640x480
SETUP: trying format Y800 @ 640x480
SETUP: trying format Y800 @ 640x480
SETUP: trying format I420 @ 640x480
SETUP: couldn't find requested size - searching for closest matching size
SETUP: closest supported size is YUY2 @ 1104 828
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.


SETUP: Disconnecting device 0
SETUP: freeing Grabber Callback
SETUP: freeing Grabber
SETUP: freeing Control
SETUP: freeing Media Type
SETUP: removing filter NullRenderer...
SETUP: filter removed NullRenderer
SETUP: removing filter Sample Grabber...
SETUP: filter removed Sample Grabber
SETUP: removing filter AVI Decompressor...
SETUP: filter removed AVI Decompressor
SETUP: removing filter Smart Tee...
SETUP: filter removed Smart Tee
SETUP: removing filter USB Camera-OV580...
SETUP: filter removed USB Camera-OV580
SETUP: freeing Capture Graph
SETUP: freeing Main Graph
SETUP: Device 0 disconnected and freed

SETUP: Setting up device 1
SETUP: Forward Facing camera
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 320x240
SETUP: trying specified format RGB24 @ 640x480
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.


SETUP: Disconnecting device 1
SETUP: freeing Grabber Callback
SETUP: freeing Grabber
SETUP: freeing Control
SETUP: freeing Media Type
SETUP: removing filter NullRenderer...
SETUP: filter removed NullRenderer
SETUP: removing filter Sample Grabber...
SETUP: filter removed Sample Grabber
SETUP: removing filter Smart Tee...
SETUP: filter removed Smart Tee
SETUP: removing filter Forward Facing camera...
SETUP: filter removed Forward Facing camera
SETUP: freeing Capture Graph
SETUP: freeing Main Graph
SETUP: Device 1 disconnected and freed

SETUP: Setting up device 2
SETUP: Downward Facing camera
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 320x240
SETUP: trying specified format RGB24 @ 640x480
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.


SETUP: Disconnecting device 2
SETUP: freeing Grabber Callback
SETUP: freeing Grabber
SETUP: freeing Control
SETUP: freeing Media Type
SETUP: removing filter NullRenderer...
SETUP: filter removed NullRenderer
SETUP: removing filter Sample Grabber...
SETUP: filter removed Sample Grabber
SETUP: removing filter Smart Tee...
SETUP: filter removed Smart Tee
SETUP: removing filter Downward Facing camera...
SETUP: filter removed Downward Facing camera
SETUP: freeing Capture Graph
SETUP: freeing Main Graph
SETUP: Device 2 disconnected and freed

SETUP: Setting up device 3
SETUP: Intel(R) RealSense(TM) 3D Camera (Front F200) RGB
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 320x180
SETUP: trying specified format RGB24 @ 640x480
SETUP: trying format RGB24 @ 640x480
SETUP: trying format RGB32 @ 640x480
SETUP: trying format RGB555 @ 640x480
SETUP: trying format RGB565 @ 640x480
SETUP: trying format YUY2 @ 640x480
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.

So, my questions are as below: 1. So many "SETUP:" statements are printed out by the constructor of VideoCapture. In one of them, we can see the friendly name of the camera, e.g. "USB Camera-OV580". But how can I get this friendly name? Which method of VideoCapture can return this friendly name? I didn't find it.

  1. On my machine, with CV_CAP_DSHOW I can get 3 cameras above. But with CV_CAP_MSMF, I get nothing. What does it mean? Does it mean the 3 cameras' drivers are only DirectShow related, not Media Foundation related? But as I know, DirectShow or Media Foundation only means one sort of Windows SDK, not driver. Is my understanding wrong?

Thanks.

How to get the friendly names of the cameras? (see my code)

I wrote a small paragraph of code. See below.


#include <opencv2 core.hpp="">
#include <opencv2 imgcodecs.hpp="">
#include <opencv2 highgui.hpp="">
#include <opencv2 videoio.hpp="">
#include <iostream>
using namespace cv;
using namespace std;

void SimpleEnumerateDirectShowCameras()
{
    struct CapDriver{
        int enumValue; 
        string enumName; 
        string comment;
    };
{    
    int maxID = 100; 
    for (int idx = 0; idx smaller_than maxID; idx++)
    {
        VideoCapture cap(CV_CAP_DSHOW + idx);  // open the camera
        // cap.release();
    }
}

int main()
{
    SimpleEnumerateDirectShowCameras();
    return 0;
}

The output of the code above is as below, as my machine has several cameras installed on.


***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****

SETUP: Setting up device 0
SETUP: USB Camera-OV580
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 1104x828
SETUP: trying specified format RGB24 @ 640x480
SETUP: trying format RGB24 @ 640x480
SETUP: trying format RGB32 @ 640x480
SETUP: trying format RGB555 @ 640x480
SETUP: trying format RGB565 @ 640x480
SETUP: trying format YUY2 @ 640x480
SETUP: trying format YVYU @ 640x480
SETUP: trying format YUYV @ 640x480
SETUP: trying format IYUV @ 640x480
SETUP: trying format UYVY @ 640x480
SETUP: trying format YV12 @ 640x480
SETUP: trying format YVU9 @ 640x480
SETUP: trying format Y411 @ 640x480
SETUP: trying format Y41P @ 640x480
SETUP: trying format Y211 @ 640x480
SETUP: trying format AYUV @ 640x480
SETUP: trying format MJPG @ 640x480
SETUP: trying format Y800 @ 640x480
SETUP: trying format Y800 @ 640x480
SETUP: trying format Y800 @ 640x480
SETUP: trying format I420 @ 640x480
SETUP: couldn't find requested size - searching for closest matching size
SETUP: closest supported size is YUY2 @ 1104 828
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.


SETUP: Disconnecting device 0
SETUP: freeing Grabber Callback
SETUP: freeing Grabber
SETUP: freeing Control
SETUP: freeing Media Type
SETUP: removing filter NullRenderer...
SETUP: filter removed NullRenderer
SETUP: removing filter Sample Grabber...
SETUP: filter removed Sample Grabber
SETUP: removing filter AVI Decompressor...
SETUP: filter removed AVI Decompressor
SETUP: removing filter Smart Tee...
SETUP: filter removed Smart Tee
SETUP: removing filter USB Camera-OV580...
SETUP: filter removed USB Camera-OV580
SETUP: freeing Capture Graph
SETUP: freeing Main Graph
SETUP: Device 0 disconnected and freed

SETUP: Setting up device 1
SETUP: Forward Facing camera
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 320x240
SETUP: trying specified format RGB24 @ 640x480
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.


SETUP: Disconnecting device 1
SETUP: freeing Grabber Callback
SETUP: freeing Grabber
SETUP: freeing Control
SETUP: freeing Media Type
SETUP: removing filter NullRenderer...
SETUP: filter removed NullRenderer
SETUP: removing filter Sample Grabber...
SETUP: filter removed Sample Grabber
SETUP: removing filter Smart Tee...
SETUP: filter removed Smart Tee
SETUP: removing filter Forward Facing camera...
SETUP: filter removed Forward Facing camera
SETUP: freeing Capture Graph
SETUP: freeing Main Graph
SETUP: Device 1 disconnected and freed

SETUP: Setting up device 2
SETUP: Downward Facing camera
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 320x240
SETUP: trying specified format RGB24 @ 640x480
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.


SETUP: Disconnecting device 2
SETUP: freeing Grabber Callback
SETUP: freeing Grabber
SETUP: freeing Control
SETUP: freeing Media Type
SETUP: removing filter NullRenderer...
SETUP: filter removed NullRenderer
SETUP: removing filter Sample Grabber...
SETUP: filter removed Sample Grabber
SETUP: removing filter Smart Tee...
SETUP: filter removed Smart Tee
SETUP: removing filter Downward Facing camera...
SETUP: filter removed Downward Facing camera
SETUP: freeing Capture Graph
SETUP: freeing Main Graph
SETUP: Device 2 disconnected and freed

SETUP: Setting up device 3
SETUP: Intel(R) RealSense(TM) 3D Camera (Front F200) RGB
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 320x180
SETUP: trying specified format RGB24 @ 640x480
SETUP: trying format RGB24 @ 640x480
SETUP: trying format RGB32 @ 640x480
SETUP: trying format RGB555 @ 640x480
SETUP: trying format RGB565 @ 640x480
SETUP: trying format YUY2 @ 640x480
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.

So, my questions are as below: 1. So many "SETUP:" statements are printed out by the constructor of VideoCapture. In one of them, we can see the friendly name of the camera, e.g. "USB Camera-OV580". But how can I get this friendly name? Which method of VideoCapture can return this friendly name? I didn't find it.

  1. On my machine, with CV_CAP_DSHOW I can get 3 cameras above. But with CV_CAP_MSMF, I get nothing. What does it mean? Does it mean the 3 cameras' drivers are only DirectShow related, not Media Foundation related? But as I know, DirectShow or Media Foundation only means one sort of Windows SDK, not driver. Is my understanding wrong?

Thanks.

How to get the friendly names of the cameras? (see my code)

I wrote a small paragraph of code. See below.


#include <opencv2 core.hpp="">
#include <opencv2 imgcodecs.hpp="">
#include <opencv2 highgui.hpp="">
#include <opencv2 videoio.hpp="">
#include <iostream>
using namespace cv;
using namespace std;

void SimpleEnumerateDirectShowCameras()
{    
    int maxID = 100; 
    for (int idx = 0; idx smaller_than maxID; idx++)
    {
        VideoCapture cap(CV_CAP_DSHOW + idx);  // open the camera
        // cap.release();
    }
}

int main()
{
    SimpleEnumerateDirectShowCameras();
    return 0;
}

The output of the code above is as below, as my machine has several cameras installed on.


***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****

SETUP: Setting up device 0
SETUP: USB Camera-OV580
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 1104x828
SETUP: trying specified format RGB24 @ 640x480
SETUP: trying format RGB24 @ 640x480
SETUP: trying format RGB32 @ 640x480
SETUP: trying format RGB555 @ 640x480
SETUP: trying format RGB565 @ 640x480
SETUP: trying format YUY2 @ 640x480
SETUP: trying format YVYU @ 640x480
SETUP: trying format YUYV @ 640x480
SETUP: trying format IYUV @ 640x480
SETUP: trying format UYVY @ 640x480
SETUP: trying format YV12 @ 640x480
SETUP: trying format YVU9 @ 640x480
SETUP: trying format Y411 @ 640x480
SETUP: trying format Y41P @ 640x480
SETUP: trying format Y211 @ 640x480
SETUP: trying format AYUV @ 640x480
SETUP: trying format MJPG @ 640x480
SETUP: trying format Y800 @ 640x480
SETUP: trying format Y800 @ 640x480
SETUP: trying format Y800 @ 640x480
SETUP: trying format I420 @ 640x480
SETUP: couldn't find requested size - searching for closest matching size
SETUP: closest supported size is YUY2 @ 1104 828
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.


SETUP: Disconnecting device 0
SETUP: freeing Grabber Callback
SETUP: freeing Grabber
SETUP: freeing Control
SETUP: freeing Media Type
SETUP: removing filter NullRenderer...
SETUP: filter removed NullRenderer
SETUP: removing filter Sample Grabber...
SETUP: filter removed Sample Grabber
SETUP: removing filter AVI Decompressor...
SETUP: filter removed AVI Decompressor
SETUP: removing filter Smart Tee...
SETUP: filter removed Smart Tee
SETUP: removing filter USB Camera-OV580...
SETUP: filter removed USB Camera-OV580
SETUP: freeing Capture Graph
SETUP: freeing Main Graph
SETUP: Device 0 disconnected and freed

SETUP: Setting up device 1
SETUP: Forward Facing camera
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 320x240
SETUP: trying specified format RGB24 @ 640x480
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.


SETUP: Disconnecting device 1
SETUP: freeing Grabber Callback
SETUP: freeing Grabber
SETUP: freeing Control
SETUP: freeing Media Type
SETUP: removing filter NullRenderer...
SETUP: filter removed NullRenderer
SETUP: removing filter Sample Grabber...
SETUP: filter removed Sample Grabber
SETUP: removing filter Smart Tee...
SETUP: filter removed Smart Tee
SETUP: removing filter Forward Facing camera...
SETUP: filter removed Forward Facing camera
SETUP: freeing Capture Graph
SETUP: freeing Main Graph
SETUP: Device 1 disconnected and freed

SETUP: Setting up device 2
SETUP: Downward Facing camera
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 320x240
SETUP: trying specified format RGB24 @ 640x480
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.


SETUP: Disconnecting device 2
SETUP: freeing Grabber Callback
SETUP: freeing Grabber
SETUP: freeing Control
SETUP: freeing Media Type
SETUP: removing filter NullRenderer...
SETUP: filter removed NullRenderer
SETUP: removing filter Sample Grabber...
SETUP: filter removed Sample Grabber
SETUP: removing filter Smart Tee...
SETUP: filter removed Smart Tee
SETUP: removing filter Downward Facing camera...
SETUP: filter removed Downward Facing camera
SETUP: freeing Capture Graph
SETUP: freeing Main Graph
SETUP: Device 2 disconnected and freed

SETUP: Setting up device 3
SETUP: Intel(R) RealSense(TM) 3D Camera (Front F200) RGB
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 320x180
SETUP: trying specified format RGB24 @ 640x480
SETUP: trying format RGB24 @ 640x480
SETUP: trying format RGB32 @ 640x480
SETUP: trying format RGB555 @ 640x480
SETUP: trying format RGB565 @ 640x480
SETUP: trying format YUY2 @ 640x480
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.

So, my questions are as below: below:
1. So many "SETUP:" statements are printed out by the constructor of VideoCapture. In one of them, we can see the friendly name of the camera, e.g. "USB Camera-OV580". But how can I get this friendly name? Which method of VideoCapture can return this friendly name? I didn't find it.


  1. 2.
    On my machine, with CV_CAP_DSHOW I can get 3 cameras above. But with CV_CAP_MSMF, I get nothing. What does it mean? Does it mean the 3 cameras' drivers are only DirectShow related, not Media Foundation related? But as I know, DirectShow or Media Foundation only means one sort of Windows SDK, not driver. Is my understanding wrong?

Thanks.