OpenCV-网络摄像头显示不显示实时Feed,而是显示灰屏 [英] OpenCV - Webcam imshow not displaying live feed, gray screen instead

查看:284
本文介绍了OpenCV-网络摄像头显示不显示实时Feed,而是显示灰屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2015中的OpenCV 3.2.0版,并且能够访问我的网络摄像头,直到今天早晨我正在使用它时突然之间.我不知道这个问题是从哪里来的.我现在得到:

I am working with OpenCV version 3.2.0 in Visual Studio 2015 and have been able to access my webcam until all of a sudden when I was working on it this morning. I can't figure out where this problem is coming from. I now get:

它不会引发任何错误,但也不会显示通过网络摄像头输入的任何信息

It doesn't throw any errors but it also doesn't show any input through the webcam

#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>

using namespace std;
using namespace cv;    

int main(int argc, char** argv)
{
    VideoCapture cap;
    cap.open(0);
    if (!cap.isOpened())
    {
        printf("--(!)Error opening video capture\n");
        return -3;
    }


    Mat image;
    namedWindow("Image", CV_WINDOW_AUTOSIZE);
    while (1)
    {
        cap.read(image);

        imshow("Image", image);
        waitKey(30);
    }


    return 0;
}

以前有人遇到过此错误吗?

Has anyone encountered this error before?

我看过的东西:

我的网络摄像头可用于Google Hangouts之类的事情,所以我认为这不是网络摄像头的问题.

My webcams that I have work in things like Google Hangouts so I don't think it's a webcam issue.

此外,我卸载了Visual Studio 2015,并安装了Visual Studio 2017,以查看重新安装是否可行,并且仍然获得相同的结果.

Also, I uninstalled Visual Studio 2015 and installed Visual Studio 2017 to see if reinstalling would work and still get the same results.

当我创建一个新的VideoCapture对象时,出现错误<information not available, no symboles loaded for opencv_world320d.dll>.我很确定我正确地包含了所有内容.

I am getting the error <information not available, no symboles loaded for opencv_world320d.dll> when I create a new VideoCapture object. I am pretty sure I have everything included correctly.

配置属性-> C/C ++->其他包含目录: $(OPENCV_BUILD)\include

Configuration Properties -> C/C++ -> Additional Include Directories: $(OPENCV_BUILD)\include

配置属性->链接器->常规: $(OPENCV_BUILD)\x64\vc14\lib

Configuration Properties -> Linker -> General: $(OPENCV_BUILD)\x64\vc14\lib

配置属性->链接器->输入: opencv_world320d.lib

Configuration Properties -> Linker -> Input: opencv_world320d.lib

推荐答案

@michael scolfield 所建议我的防病毒软件阻止了我的网络摄像头.我不知道如何排除我的Visual Studio目录,所以我只是尝试将其卸载并成功运行.拥有防病毒软件并使其正常运行将是很好的,所以我需要弄清楚这一点.但是对于临时而言,这将起作用.

As suggested by @michael scolfield, it was a problem with my antivirus blocking my webcam. I couldn't figure out how to exclude my Visual Studio directory so I just tried uninstalling it and it worked. It would be nice to have antivirus and have this working so I'll need to figure that out. But for temps this will work.

这篇关于OpenCV-网络摄像头显示不显示实时Feed,而是显示灰屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆