Hello there i am newbie in opencv. i am doing with camera capturing nd got the code from some google source. i understood the code.
#include "opencv2/opencv.hpp"
using namespace cv;
int main(int, char**) { VideoCapture cap(0); // open the default camera if(!cap.isOpened()) // check if we succeeded return -1;
for(;;)
{
Mat frame;
cap >> frame; // get a new frame from camera
// do any processing
imwrite("/home/sachin/Desktop/a.jpg", frame);
if(waitKey(1) >= 0) break; // you can increase delay to 2 seconds here
}
// the camera will be deinitialized automatically in VideoCapture destructor
return 0;
} here camera capture the image while I press ctrl+c. but i want to do it as automatically close the camera in 2 second. i don't how to close camera . please help me anticipation of your help.