目前我正在尝试使用代码时访问外部相机。我尝试将VideoCapture cap(0)编辑为VideoCapture cap(1)以尝试访问,但仍然可以访问deault网络摄像头。有人能帮助我吗?
#include <iostream>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
VideoCapture cap(0); //capture the video from web cam
if ( !cap.isOpened() ) // if not success, exit program
{
cout << "Cannot open the web cam" << endl;
return -1;
}