-
Notifications
You must be signed in to change notification settings - Fork 0
/
cap_test.cpp
41 lines (36 loc) · 858 Bytes
/
cap_test.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
36
37
38
39
40
41
#include <list>
#include <limits>
#include <string>
#include <fstream>
#include <cmath>
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <climits>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <time.h>
#include <ctime>
using namespace std;
using namespace cv;
VideoCapture vidCap(0);
void* imageTakingThread(void* parameters) {
vidCap.set(CV_CAP_PROP_FRAME_WIDTH, 160);
vidCap.set(CV_CAP_PROP_FRAME_HEIGHT, 120);
while(1)
{
vidCap.grab();
}
}
int main(){
pthread_t thread;
int threadSuccess = pthread_create(&thread, NULL, imageTakingThread, NULL);
cout << "got one photo\n";
imwrite("1st.jpg",mat);
int a;
cin >> a;
Mat matToProcess;
vidCap.retrieve(matToProcess);
imwrite("2nd.jpg",matToProcess);
cout<<"done"<<endl;
}