-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmycam.cpp
35 lines (32 loc) · 844 Bytes
/
mycam.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/video/background_segm.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/legacy/legacy.hpp"
#include "opencv2/video/tracking.hpp"
#include "opencv2/photo/photo.hpp"
using namespace std;
extern "C" void take_photo(char *str);
void take_photo(char *str)
{
IplImage *frame = NULL;
int num = 0;
int key;
CvCapture *input_camera = cvCaptureFromCAM(0);
frame = cvQueryFrame(input_camera);
while(frame != NULL)
{
num++;
// cout<<"i see you" <<endl;
frame = cvQueryFrame(input_camera);
if(num == 20)
{
cvSaveImage(str,frame);
break;
}
}
cvReleaseCapture(&input_camera);
}