25 lines
602 B
C++
25 lines
602 B
C++
|
#include "opencv2/opencv.hpp"
|
||
|
|
||
|
int main(int, char**)
|
||
|
{
|
||
|
cv::VideoCapture cap(0); // open the default camera
|
||
|
if(!cap.isOpened()) // check if we succeeded
|
||
|
return -1;
|
||
|
|
||
|
cv::Mat edges;
|
||
|
cv::namedWindow("edges",1);
|
||
|
while(1){
|
||
|
cv::Mat frame;
|
||
|
cap >> frame; // get a new frame from camera
|
||
|
//cv::cvtColor(frame, edges, CV_BGR2GRAY);
|
||
|
//cv::GaussianBlur(edges, edges, cv::Size(7,7), 1.5, 1.5);
|
||
|
//cv::Canny(edges, edges, 0, 30, 3);
|
||
|
cv::imshow("edges", frame);
|
||
|
if(cv::waitKey(30) == 27) {
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
// the camera will be deinitialized automatically in VideoCapture destructor
|
||
|
return 0;
|
||
|
}
|