Ask Your Question
0

VideoCapture issue on windows

asked 2018-11-21 15:52:25 -0600

bjku_15 gravatar image

Hello, I wrote a little program in c++ that uses opencv`s VideoCapture class to read an image from my webcam and writes it to a file.

It is working great on my windows 7 laptop and another windows 10 machine. Unfortunately it fails on the computer where it has to work on(win10, same camera). I always get a popup window that is asking me to choose the capture source. So I think that there is an issue with the VFW-API on Windows

In my code I have something like this: VideoCapture cap(id);

I tried different values for id (according to cv::VideoCaptureAPIs enum values) like -1,0,200, 300,... but none worked. I either get a popup window or cap.isOpened() fails.

I use opencv 3.0.0 (prebuild binaries).

Can someone please tell me what I forgot?

Thank You

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-11-21 17:13:12 -0600

berak gravatar image

I use opencv 3.0.0

quite outdated (support for VFW has been entirely removed in current 4.0.0)

try to use:

 VideoCapture(0 + CAP_DSHOW);

instead (not magic numbers)

edit flag offensive delete link more

Comments

The magic numbers were the equal representation of the APIs (e.g. CAP_ANY=0, CAP_VFW=200, CAP_DSHOW=700) but to make sure that this wasn't the mistake I tried "VideoCapture(0 + CAP_DSHOW);" . Now it is only working on my win7 machine. I think that DirectShow is not installed on both win10 computers. How can I install it?

bjku_15 gravatar imagebjku_15 ( 2018-11-22 09:48:10 -0600 )edit

dshow libs are installed by default on any win10 machine (though they're deprecating it in favour of msmf (which your outdated 3.0.0 opencv won't have)

can't you just try a more recent opencv version, like 3.4.4 ?

also, please don't use -1 for the id, because that will FORCE it to use vfw, and give you that window, again.

berak gravatar imageberak ( 2018-11-22 09:51:00 -0600 )edit

I tried out opencv 3.4.4. In Debug mode I got the following output: [ INFO:0 ] VIDEOIO: Enabled backends(5, sorted by priority): FFMPEG(1000); MSMF(990); DSHOW(980); CV_IMAGES(970); CV_MJPEG(960) and it is still not working. According to windows, the webcam is installed properly, but VLC Media Player was not able to open it. :-(

I ordered a new camera. maybe this will fix it.

bjku_15 gravatar imagebjku_15 ( 2018-11-23 07:29:15 -0600 )edit

So, the new camera is here now and nothing changed. But I found out that the real problem has something to do with the drivers of both cams. It is a common windows 10 issue and it tells me that "device is not migrated"? error code 0xC0000719. After hours of fails I think that it's not possible to solve this....

bjku_15 gravatar imagebjku_15 ( 2018-11-26 06:59:15 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-11-21 15:52:25 -0600

Seen: 4,442 times

Last updated: Nov 21 '18