2

I'm trying to do basic video capture from a webcam. I got this very basic code from this opencv blog and I'm compiling it with

 g++ `pkg-config --cflags opencv` test2.cpp `pkg-config --libs opencv`

And when I run it, it shows me these messages

VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument

but it does run. However, the program is supposed to exit when the esc key is pressed. Because of this line

if(waitKey(30) == 27)

But it does not. I tried changing it in the program, to some other key, like 'q', but it still doesn't work when I run the program.

if(waitKey(30) == 'q')

While running, it seems that waitkey() just isn't responding.

EDIT : waitKey() works. When I copied it, for some reason it became waitkey(). However, the invalid argument messages are still being shown

4

1 回答 1

-1

OpenCV 有时不适用于某些相机。该博客中的代码在我的网络摄像头上运行良好,没有任何警告消息

于 2013-07-01T16:16:17.990 回答