/////
void main() { VideoCapture stream1(0); //0 is the id of video device.0 if you have only one camera VideoCapture stream2(1); //0 is the id of video device.0 if you have only one camera if (!stream1.isOpened()) { //check if video device has been initialised cout << "cannot open camera 1"; } if (!stream2.isOpened()) { //check if video device has been initialised cout << "cannot open camera 2"; } namedWindow("Processing"); namedWindow("CAM1"); namedWindow("CAM2"); //unconditional loop while (true) { Mat cameraFrame1; stream1.read(cameraFrame1); //get one frame form video imshow("CAM1", cameraFrame1); Mat cameraFrame2; stream2.read(cameraFrame2); //get one frame form video imshow("CAM2", cameraFrame2); if (waitKey(30) >= 0) break; } destroyAllWindows(); }/////
No comments:
Post a Comment