#include2,生成可执行程序test#include using namespace std; using namespace cv; int main(int argc,char **argv) { VideoCapture capture(0); namedWindow("myCamera",CV_WINDOW_AUTOSIZE); while(true) { Mat frame; capture>>frame; imshow("myCamera",frame); waitKey(30); } return 0; }
g++ `pkg-config opencv --cflags` test.cpp -o test `pkg-config opencv --libs`3,运行test,即可调用摄像头
./test



