1. OpenCV:VideoCapture同时打开两个摄像头
#include
#include
using namespace cv;
using namespace std;
int main()
{
//initialize and allocate memory to load the video stream from camera
VideoCapture camera0(1);
camera0.set(CAP_PROP_FRAME_WIDTH,320);
camera0.set(CAP_PROP_FRAME_HEIGHT,240);
VideoCapture camera1(0);
camera1.set(CAP_PROP_FRAME_WIDTH,320);
camera1.set(CAP_PROP_FRAME_HEIGHT,240);
if( !camera0.isOpened() ) return 1;
if( !camera1.isOpened() ) return 1;
while(true) {
//grab and retrieve each frames of the video sequentially
Mat3b frame0;
camera0 >> frame0;
Mat3b frame1;
camera1 >> frame1;
imshow("Video0", frame0);
imshow("Video1", frame1);
//std::cout |