先上代码

成功图片如下:

opencv3.3+vs2015调用笔记本摄像头成功

#include <opencv2/highgui/highgui.hpp>  
#include <opencv2/imgproc/imgproc.hpp>  
#include <opencv2/core/core.hpp>  
using namespace cv;
int main()
{
    VideoCapture cap(0);
    if (!cap.isOpened())
    {
        return -1;
    }
    Mat frame;
    Mat edges;
    bool stop = false;
    while (!stop)
    {
        cap >> frame;
        cvtColor(frame, edges, CV_BGR2GRAY);
        GaussianBlur(edges, edges, Size(7, 7), 1.5, 1.5);
        Canny(edges, edges, 0, 30, 3);
        imshow("当前视频", edges);
        if (waitKey(30) >= 0)
            stop = true;
    }
    return 0;
}

前提是你已经正确配置了opencv和vs2015

相关文章:

  • 2022-02-05
  • 2022-12-23
  • 2022-01-21
  • 2021-12-04
  • 2022-12-23
  • 2022-01-15
  • 2021-09-17
猜你喜欢
  • 2021-07-10
  • 2021-12-04
  • 2021-09-09
  • 2021-09-01
  • 2021-12-04
  • 2021-08-25
  • 2021-12-13
相关资源
相似解决方案