video capture card (webcam like) with OpenCV

末鹿安然 提交于 2021-01-29 05:31:10

问题


I want to use video capture card to capture my screen display, and process the image by OpenCV/C++.

I have heard that there's some video capture card which is webcam like.(i.e. I can get the screen display by VideoCapture in OpenCV.)

Can someone tell me which video capture card should I buy?

Thanks !!!


回答1:


I do not know if there some way to achieve that directly using OpenCV. However, a simple workaround could be like this:

  1. Using this software you can create new webcam that stream your screen: https://sparkosoft.com/how-to-stream-desktop-as-webcam-video
  2. Using OpenCV you can start capture the stream using this code:

    cv::VideoCapture cap;
    if(!cap.open(0)) // Use the new webcam Id instead of 0
        return 0;
    while(true){
          cv::Mat frame;
          cap >> frame;
          if(frame.empty()) break;
          cv::imshow("Screen", frame);
          if( waitKey(10) == 27 ) break;
    }
    return 0;
    



回答2:


I don't know if this helps now. But i found a way using opencv. In linux and python, we achieve this using the following piece of code.

import cv2
cap = cv2.VideoCapture('/dev/video0')


来源:https://stackoverflow.com/questions/43133203/video-capture-card-webcam-like-with-opencv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!