Cooler_

snapshot opencv

Jul 24th, 2012
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. //func with opencv shot with webcam
  2. void webcam(const char* file)
  3. {
  4.  CvCapture *capture = cvCreateCameraCapture(0);
  5.    if(capture==NULL)
  6.     puts( "nao he possivel pegar foto!\n");
  7.  
  8.   IplImage* frame = cvQueryFrame( capture );
  9.    if(!frame)
  10.     puts( "erro na foto!\n");
  11.  
  12.   int imageParams[3] = {CV_IMWRITE_JPEG_QUALITY, 100, 0};
  13.   cvSaveImage(file , frame,imageParams);
  14.   cvReleaseCapture( &capture );
  15. }
Advertisement
Add Comment
Please, Sign In to add comment