zzangyeah 2021. 5. 11. 20:21
728x90

비디오 불러오려는데 환경변수 설정 안 해서 계속 실행이 안 됐다ㅂㄷ

프로젝트 속성에 들어가서 디버깅-환경 에 PATH=C:\Users\cat78\Downloads\opencv\build\x64\vc15\bin;%PATH% 를 넣어주자 그럼 돌아감

1.비디오 불러오기

#include <stdio.h>
#include<iostream>
#include<opencv2/imgcodecs.hpp>
#include<opencv2/videoio.hpp>
#include<opencv2/highgui.hpp>
using namespace cv;

int main(void) {
	VideoCapture cap("Sample.mp4");
	while (1) {
		Mat frame;
		cap >> frame;
		if (frame.empty()) {
			break;
		}
		imshow("asdf", frame);
		char key = waitKey(100);
		if (key == 'q') {
			break;
		}
	}
	return 0;
}