728x90
반응형
오랜만에 올리는 OpenCV 포스팅
사실 기록용이다
동영상 저장 및 파일명 지정하기 (video(1), video(2), ...)
소스코드는 일부 입니다.
VideoWriter leftWriter, rightWriter; int codec = CV_FOURCC('P', 'I', 'M', '1'); // select desired codec (must be available at runtime) double fps = cam.camera_capture[0]->get(CAP_PROP_FPS); // frame rate of the created video stream //cout << "get frame= " << fps << endl; int videonum = 1; string leftFilename = "Left (" + to_string(videonum) + ").avi"; // name of the output video file string rightFilename = "Right (" + to_string(videonum) + ").avi"; // name of the output video file leftWriter.open(leftFilename, codec, fps, Size(800,450) , true); rightWriter.open(rightFilename, codec, fps, Size(800, 450), true); // check if we succeeded if (!leftWriter.isOpened()) { cerr << "Could not open the output video file for write\n"; return -1; } if (!rightWriter.isOpened()) { cerr << "Could not open the output video file for write\n"; return -1; } while (waitKey(1) != 27) { if (cam.frame_queue[0]->try_pop(limage)) { leftWriter.write(limage); } if (cam.frame_queue[1]->try_pop(rimage)) { rightWriter.write(rimage); } } }
728x90
반응형
'Programming > OpenCV' 카테고리의 다른 글
[OpenCV] 특정 픽셀 값 접근하기 (0) | 2018.09.07 |
---|---|
[OpenCV] image inpaint 함수 (object removal or region filling) (0) | 2018.09.05 |
[OpenCV] Image Denoising (0) | 2017.02.16 |
[OpenCV] Bilateral Filter 적용하기 (0) | 2017.02.15 |
[OpenCV] SimpleBlobDetector 을 이용한 Blob Detection (0) | 2017.02.08 |