通过OpenCV的类VideoCapture如何将PCIe采集卡的摄像头跟USB摄像头区别开来,打开指定的摄像头。
1条回答
- Mr_White01 2018-03-14 05:05关注
按照如下代码打开即可!
5.int main()
6.{
7.
8. VideoCapture cap(0);
9. VideoCapture capcap(1);
10. Mat frame;
11. Mat frame2;
12. if (!capcap.isOpened())return 0;
13. if (!cap.isOpened())return 0;
14. while (waitKey(30) != 27)
15. {
16. capcap >> frame2;
17. imshow("摄像头2", frame2);
18. cap >> frame;
19. imshow("摄像头1", frame);
20. }
21. return 0;
22.}解决 无用评论 打赏 举报