Problems accessing web camera under Windows 10 / OpenCV - c++

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
OpenCV 2.4.9 with Evgeny Pereguda's VideoInput
library(http://www.codeproject.com/Articles/776058/Capturing-Live-video-from-Web-camera-on-Windows-an)
for accessing the camera through Windows Media Foundation, or
OpenCV 3.0 without any additional libraries
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?

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

Related

How to display a Video stream from Camera on Raspberry pi with Win iot with some image processing

I am trying to build a webcam based face detector using Raspberry pi as the base and Win 10 IOT as the OS
the image i'm trying to capture will come from a webcam having its own API
OpenCV is required for me to detect the object as any Haar classifier can be used
I am not able to port my Console appln onto the ARM base
Xaml required for the Universal Windows APP does not support the video capture as an output type im using the Image constructor
NEW POINT
When using Videocapture with our code , when writing the image to mat type , weather we used cap>>MAt or cap.retrive(mat,0) wew got the same exception error
this->_M_dispatcher._Ptr was a nullptr .
help with any of these points is appreciated
I am trying to build a webcam based face detector using Raspberry pi as the base and Win 10 IOT as the OS.
Windows IoT has full support for some USB web camera, make sure your device is supported in the compatible list.
The image i'm trying to capture will come from a webcam having its own API
Does the own API support Windows ARM platform? If not, you may need to compile it targeting ARM, if it's not open-sourced, request from the webcam manufacture.
OpenCV is required for me to detect the object as any Haar classifier can be used.
Windows IoT has full support for OpenCV thanks for Microsoft's porting. You can follow the tutorial here to compile it for Windows ARM.
If you're developing UWP app using C#, you may need to create a wrapper class around the OpenCV dlls. Alternatively, the latest release of Emgu CV introduces support for UWP.
I am not able to port my Console appln onto the ARM base
Xaml required for the Universal Windows APP does not support the video capture as an output type
Could you please provide some code sample?

Can OpenCV capture image from Microsoft Surface Pro camera?

Basically, I have a prototype ready with OpenCV that captures images from connected webcams. We need to ship it to customers and they include Surface Pro users, which has an integrated rear camera.
I am not sure whether it would work on that device or not i.e. whether my code would detect the integrated Surface Pro camera or not. We currently do not have access to such a machine.
So, is there a way validate this? I can think of two options:
Is there any emulator available for Surface Pro camera?
Does OpenCV provide a list of cameras which it supports?
Would really appreciate any form of assistance here!
OpenCV works via the OS camera drivers. If the Surface Pro camera appears as a normal camera to Windows OpenCV should see it as just another camera.
For record's sake - This Stack Overflow answer gives the code for iterating available devices.
And personally I can verify that OpenCV works with the Surface Pro cameras (front and rear). We are using the EMGU port of it.

How to use external HD video camera as input for a Visual Studio, OpenCV project?

I am doing a project regarding image processing and multiple person counting and was wondering, how exactly can I plug my ION AIR PRO PLUS video recording device (similar to a goPro), and use it as my 'webcam'? Basically, I want to plug it in and then access it via a live feed using Microsoft Visual Studio 2010 and OpenCV, and then do real time tracking of people walking.
What I am struggling with is accessing the external camera from my program. Anyone know how to do this?
The video camera has no wifi, only an hdmi output, RGB cable output and a USB.
Attach the USB cable and instantiate cv::VideoCaputre(0). In Linux local cameras have number indices I think in Windows should be the same.
Peter, In the past I have worked on camera products on Windows XP & 7. On windows usb cameras can be accessed using directshow.
You can implement a directshow filter for people tracking algorithm and fit it in the direct show pipeline soon after your camera plugin.
Here is a link to an application stack that may suit your use case(to give you an idea):
http://www.e-consystems.com/blog/camera/?p=1302
The recent windows operating systems that run WinRT, use a latest framework called MediaFoundation. As its very new there are some limitations we found when we tried to build similar applications.
To quickly see a preview out of your camera, pls google for "graphedit" and install it on a Windows 7 pc. Its a fairly simple tool. You can drag and drop your camera, if directshow is supported, then render its output pin and play for preview.
I do not think this is a standard webcam, it appears to work only as a mass storage device. One thing you can try is removing the micro sd card and connect it to the computer. This works on some cameras.
Assuming this does not work, one option would be to purchase an HDMI capture card. The YK762H PCI-E card costs around $40, and will allow you to use the camera with OpenCV, the videoInput library, or DirectShow.
The other option is to use the WiFi live preview. You would have to figure out the commands sent to the camera. This has already been done with the SJCam wifi cameras, the GoPro models, and Sony cameras such as the QX-10 and HDR-AS100V.

Depth frame acquisition with Openni + Qt + Asus Xtion Pro Live

For several days now, I encounter a problem regarding depth frame acquisition with my Asus Xtion Pro Live, Openni 2 and Qt. My application works fine when the camera is connected to a USB 2.0 port, but when I try to connect the camera to a USB 3.0 port, I cannot display images from the depth stream.
I wrote a very basic console application in order to solve the problem, that just acquire color and depth frames and for each frame, write the timestamp and the index in a file. It appears that the number of depth frames received become very small compared to color frames (1784 color frames against 464 depth frames, for an acquisition of 1 mn). Connecting the camera to USB 2.0 port, I get well 1784 color frames and 1784 depth frames.
I noticed that using QApplication instead of a QCoreApplication, the number of depth frame images decrease in number (44 depth frames for an acquisition of 1 mn).
Do you think that the problem come from Qt or from the camera and its drivers ? I red on Asus support that there were some problems with Asus Xtion Pro live and USB 3.0. I downloaded a patch from http://reconstructme.net/2012/10/13/asus-xtion-usb-3-0-hotfix-2/ but it doesn't correct my problem.
Thanks !
Last week, i decided to take my courage in both hands and tried to solve my problem regarding my Asus Xtion Pro Live and Qt. I am sorry to resurrect this topic, but i have recently come across a website that solves my problem http://www.qimaging.com/support/chipset.php. As they say, the problem comes from the USB controller :
"Intel released a new version of their mother board chipsets (Series 7/C216, Series 8/C220 and later) with a native Intel based USB 3.0 host controller (USB3 extensible host controller, xHCI in the Device Manager). On these newer PCs, the Intel USB 3.0 host controller does not communicate properly with some traditional USB 2.0 chipsets to the extent where data is not properly delivered"
I followed their advice and bought a StarTech 2 Port PCI Express Card Adapter and now i can acquire depth stream and color stream from camera without any problem.

Setting video capture properties no longer works in OpenCV 2.2?

Prior OpenCV 2.2, I was able to do
VideoCapture capture(0);
capture.set(CV_CAP_PROP_FRAME_WIDTH, 640);
capture.set(CV_CAP_PROP_FRAME_HEIGHT, 480);
in order to modify the frame size. But after when I compiled my application against OpenCV 2.2, setting the properties no longer works (the video is displayed correctly though). If I do a get of these values, 0 is returned. And if I look at the size of the captured frame, it is 160 x 120.
I searched online but most of the posts were about the problem in Linux whereas I am running Windows 7 64-bit. My webcam is a Logitech QuickCam Ultra Vision.
Is there anyone experiencing the same problem? Or no problem at all?
Thanks in advance!
This problem has been solved in OpenCV 2.3, even with my old Logitech QuickCam Ultra Vision webcam.
May be you should try with VideoInput, which is also supported by OpenCV, and included in OpenCV 2.0.3.
See an example at http://opencv.willowgarage.com/wiki/CameraCapture