-
Notifications
You must be signed in to change notification settings - Fork 2
/
camera.cpp
52 lines (48 loc) · 1.13 KB
/
camera.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
42
43
44
45
46
47
48
49
50
51
52
#include "camera.h"
camera::camera(int ID)
{
this->m_ID=ID;
}
void camera::OpenCamera()
{
// VideoCapture vedeo;
// vedeo.open(0);
// Mat img;
// vedeo>>img;
// imshow("img:",img);
// waitKey(0);
// return;
// this->m_Capture.release();
this->m_Capture.open(this->m_ID);
this->m_Capture.set(cv::CAP_PROP_FRAME_WIDTH,352);
this->m_Capture.set(cv::CAP_PROP_FRAME_HEIGHT,288);
//Mat edge
// int i=0;
// while(i<100)
// {
// Mat frame;
// this->m_Capture.grab();
// this->m_Capture.retrieve(frame);
// // this->m_Capture>>frame;
// imshow("frame:",frame);
// string str_img="//home//pi//Desktop/underwaterSwarm//img_cal//image"+std::to_string(i)+".jpg";
// imwrite(str_img,frame);
// cv::waitKey(0);
// i++;
//
}
Mat camera::CapturePicture()
{
Mat frame;
this->m_Capture.grab();
this->m_Capture.retrieve(frame);
return frame;
}
void camera::CloseCamera()
{
this->m_Capture.release();
// this->m_Capture.
this->m_Capture.~VideoCapture();
//cvReleaseCapture(this->m_Capture);
// this->m_Capture.release();
}