Ask Your Question

happycoder's profile - activity

2017-05-06 12:26:38 -0600 received badge  Famous Question (source)
2017-02-06 07:20:46 -0600 received badge  Notable Question (source)
2016-12-12 04:29:52 -0600 received badge  Popular Question (source)
2015-12-29 02:05:45 -0600 received badge  Editor (source)
2015-12-29 02:01:34 -0600 asked a question 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 ...
(more)
2015-12-29 01:49:45 -0600 received badge  Enthusiast
2015-12-24 01:52:07 -0600 asked a question How OpenCV identify different cameras?

I have a machine on which there are 3 cameras installed. The first is a high resolution camera, the second is a low resolution camera, and the last is infrared camera. How does OpenCV know which is which? I know pklab has a traversing way to list all the cameras on this page. But it seems it just list all the camera id-s. How to tell which one is infrared camera and which one is high resolution camera?

2015-12-23 02:46:01 -0600 commented question Can OpenCV manipulate camera?

When I said "controlling the camera", I referred to "get/set properties of the camera, e.g. get the resolution". I guess the "set method" you mentioned can achieve this goal, e.g. with CAP_PROP_FRAME_WIDTH and CAP_PROP_FRAME_HEIGHT, we can get the resolution, right?

2015-12-21 19:24:51 -0600 commented question Can OpenCV manipulate camera?

Yeah. I see. VideoCapture and even OpenCV may only focus on image/frame processing, not on controlling the camera, or get/set properties of the camera, right?

2015-12-21 08:13:57 -0600 asked a question Can OpenCV manipulate camera?

I'm not clear if OpenCV can or need to manipulate camera, e.g. turn on/off camera, or setting something, or getting some basic properties of the camera (e.g. resolution). Maybe OpenCV is just for computer vision or video processing, thus it does not need to control camera? The class VideoCapture has one method called get(). I want to know if CAP_PROP_FRAME_WIDTH and CAP_PROP_FRAME_HEIGHT can stand for the resolution of the camera.

2015-12-21 03:49:00 -0600 commented question How to get camera id for VideoCapture?

Thanks for your code. It seems a traversing way. It is good! I want to know if there is some other way, e.g. utilize Windows SDK (e.g. DirectShow API or MS Media Foundation API) to get the camera id-s in integer type? (As far as I know, it seems DirectShow API or MF API cannot do this. I'm new to OpenCV or video processing. I may be wrong.) Anyway, you can paste the above code here as an answer if you want.

2015-12-21 01:04:48 -0600 commented answer How to get camera id for VideoCapture?

Yeah, the machine has several cameras. So, the id-s are the same as the USB port numbers? Thanks! I will do some checking and get back.

2015-12-21 00:36:27 -0600 commented question How to get camera id for VideoCapture?

B.T.W, My Operating System is Windows.

2015-12-21 00:00:40 -0600 asked a question How to get camera id for VideoCapture?

From the specification page of "VideoCapture" , we know there is one constuctor "VideoCapture (int index);", and "index" here is the camera id which is provided by operating systems. In my computer, there are several cameros, so, how to get their id-s for feeding VideoCapture?

2015-12-20 23:40:21 -0600 asked a question Can OpenCV operates camera?

I'm new to OpenCV. Can OpenCV operates camera? For example, open/close camera, have camera to take a picture/frame? If the answer is yes, how to do it? Thanks.