forked from andybarry/makerscanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cameras.h
109 lines (78 loc) · 2.75 KB
/
Cameras.h
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
* Copyright 2009-2010, Andrew Barry
*
* This file is part of MakerScanner.
*
* MakerScanner is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (Version 2, June 1991) as published by
* the Free Software Foundation.
*
* MakerScanner is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CAMERAS_H
#define CAMERAS_H
#include <wx/wx.h>
#ifndef OPENCV_INCLUDES
#define OPENCV_INCLUDES
#include "cv.h"
#include "highgui.h"
#endif // OPENCV_INCLUDES
#include "ScanThread.h"
#include "CaptureThread.h"
#include "ScanStatus.h"
#include "DistanceToReferenceDialog.h"
/*
* Init camera capture and starts scanning thread which also supports image preview.
*/
class Cameras
{
public:
// pMemo is the text box to output strings to, frame gets events sent to it.
Cameras(wxTextCtrl *pMemo, wxFrame *windowIn, ScanStatus *scanStatusIn, int cameraNumIn);
virtual ~Cameras();
// Attempt to connect to the camera
bool InitializeCamera();
// Get a frame
IplImage* FrameGrab();
IplImage* GetLastFrame() { return m_LastFrame; }
void SaveSingleFrame();
wxString GetLastCapturedFrameFilename();
// Get a reference to the scan thread
ScanThread* GetScanThread() { return myScanThread; }
void SetThresholdPixelValue(int val) { thresholdPixelValue = val; }
void SetBrightnessFilterValue(float val) { brightnessFilterValue = val; }
// Start the scan thread
void StartScan();
void StopCaptureThread();
bool GetInitialData();
private:
// window to send events to (Cameras doesn't, but ScanThread does send events)
wxFrame *window;
// text control to send log events to
wxTextCtrl *m_pMemo;
// OpenCV camera capture object
CvCapture * m_MyCapture;
// contains the last frame captured
IplImage *m_LastFrame;
// contains the object we are scanning without the laser
IplImage *noLaserImage;
// contains the laser centered image
IplImage *laserCenteredImage;
// ScanThread that does most of the work
ScanThread *myScanThread;
CaptureThread *captureThread;
ScanStatus *scanStatus;
float distanceToReferenceWall;
float brightnessFilterValue;
wxString m_filename, m_CamSpacer, m_fileformat, m_FilenameIndex, m_LastCapturedFrameFilename;
int m_NumberOfCapturedFrames, m_FrameHeight, m_FrameWidth, m_FrameRate, thresholdPixelValue, cameraNum;
bool m_CamPaused, m_CamPlaying, m_Camped;
bool CaptureExists();
};
#endif // CAMERAS_H