6 /*-------------------------------------------------------------------
9 -I/usr/include/opencv -I/usr/include/opencv2/highgui -L/usr/lib -lopencv_highgui -lopencv_core -lopencv_ml -lopencv_imgproc
11 --------------------------------------------------------------------*/
13 int storeFrame( CvCapture* capture)
18 p[0] = CV_IMWRITE_JPEG_QUALITY;
19 p[1] = 50; //quality value. 0-100
22 frame = cvQueryFrame(capture);
25 cvSaveImage("../web/images/test.JPG",frame,p);
26 cvReleaseImageHeader(&frame);
30 int main (int argc, char** argv)
34 //Get capture structure for camera, -1 refers to any camera device.
35 //If multiple cameras used, need to use specific camera ID
36 capture = cvCreateCameraCapture(-1);
37 //If cvCreateCameraCapture returns NULL there is an error with the camera
43 if( !storeFrame( capture))
45 //sleep(1); //for now just to make the camera take 1 shot a second, as that's all my camera seems to be able to take/save (camera or function causing this? is 1 second per frame enough?)
48 //Need to determine how the function is called in respect to system. just leave it running with a while loop? will something turn it on and off? will the function be called once from elsewhere?
50 cvReleaseCapture( &capture);