영상처리

OpenCV 3.2를 이용한 웸캡 입출력 코드

GR_Wyatt 2019. 2. 11. 13:40
반응형

#include <opencv2/opencv.hpp>

#include <iostream>


using namespace std;

using namespace cv;


int main()

{

VideoCapture cap(0);

if (!cap.isOpened())

{

cout << "error" << endl;

return 0;

}


Mat frame,GRAY;


while (1)

{

cap.read(frame);

cvtColor(frame, GRAY, COLOR_BGR2GRAY);

imshow("video", GRAY);

if (waitKey(10) == 27) break;

}



return 0;

} 


반응형