1

I'm working on a project requiring real-time access to the webcam, and have problems with getting a suitable camera stream under Windows 10 for processing the frames with OpenCV.

I'm able to access the camera just fine under Windows 8.1. using either

These allow for capturing the webcam stream with high frame rate (~30fps), and setting the webcam resolution with e.g.

cvCapture.set(CV_CAP_PROP_FRAME_WIDTH, 640);

cvCapture.set(CV_CAP_PROP_FRAME_HEIGHT, 480);

Under Windows 10, however, both solutions above result in problems:

  • the solution using OpenCV 2.4.9, and the VideoInput library allow setting the resolution to 640x480, but the frame rate is around 1FPS (or worse?!), and the picture is very dark
  • the solution using OpenCV 3.0 gives me a nice 1920x1080 image on a good frame rate, but I'm unable to set the resolution for the stream

I even tried opening the camera stream with:

cv::VideoCapture cvCapture( CV_CAP_DSHOW + camnum );

cv::VideoCapture cvCapture ( CV_CAP_MSMF + camnum );

The first one works (as far as opening the stream, but with the same problems as above), the MSMF (Microsoft Media Foundation) results in cvCapture.isOpened() returning false;

Handling the FullHD stream real-time isn't feasible for the image processing algorithms, nor is resizing down the resulting frame with OpenCV.

The Windows 8.1 version is running on a Surface Pro 3 (Core i7), and the Windows 10 version on a Surface Pro 4 (Core i7). Could this be a hardware / camera driver problem? I tried finding updated drivers for the Surface 4, but to no avail.

Has anyone had similar problems? Is there an obvious solution I'm overlooking?

k_ride
  • 68
  • 1
  • 7
  • I found and plugged in an external USB camera, and turns out the code works fine with it on the Surface Pro 4. So the problem is definitely with the drivers for the SP4 camera, which does not play nice with OpenCV. – k_ride Dec 18 '15 at 12:31

1 Answers1

1

I think that your problem with videoInput on Windows 10 is related with selecting of the correct mediaType of web cameras. The fact is that OpenCV uses DirectShow by default and videoInput on Media Foundation is only optional. I advise you correct check variables:

float MF_MT_FRAME_RATE_RANGE_MAX;
float MF_MT_FRAME_RATE;
float MF_MT_FRAME_RATE_RANGE_MIN;

in

// Structure of info MediaType 
struct MediaType

Also I can advise to visit on site Capture Manager Topology Editor - this a free software for working with web cameras via Media Foundation. It allows verify accessible features of Media Foundation on your Surface Pro 4 (Core i7).

With best regards, Evgeny Pereguda

Evgeny Pereguda
  • 553
  • 1
  • 4
  • 9