-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCameraParameters.h
136 lines (111 loc) · 3.42 KB
/
CameraParameters.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#ifndef CAMERA_PARAMETERS_H
#define CAMERA_PARAMETERS_H
#include <QObject>
#include <QMutex>
#include <QString>
#include <QPoint>
#include <QVariant>
/* The requested state of the camera. All communication between the UI
* and the camera control thread passes through a single instance of
* this class, which is owned by the camera control thread.
*
* The user interface reads this to display appropriate labels, and
* modifies it when a mode is changed, or if you're in a manual mode
* and sliders or other adjustment widgets are moved.
*
* The camera thread reads this to guide its behavior, and updates the
* values when in an automatic mode.
*/
class CameraParameters : public QObject {
Q_OBJECT
public:
CameraParameters();
~CameraParameters();
struct Exposure {
enum {AUTO = 0, MANUAL, HIGHLIGHTS, SHADOWS, AUTO_HDR};
int mode;
// exposure time in seconds
float value;
// If in HDR mode, how many shots to take
int hdrShots;
float compensation;
QString toString(float val);
} exposure;
struct Gain {
enum {AUTO = 0, MANUAL};
// Gain as a float from 1.0 to 32 (equivalent to ISO 100-3200)
int mode;
float value;
QString toString(float val);
} gain;
struct Focus {
enum {AUTO = 0, MANUAL, SPOT};
int mode;
// Focus in diopters
float value;
// pixel position in viewfinder frame for spot auto focus
QPoint spot;
QString toString(float val);
} focus;
struct WhiteBalance {
enum {AUTO = 0, MANUAL, POINT};
int mode;
// White balance in kelvin
float value;
QString toString(float val);
} whiteBalance;
struct Burst {
// burst mode
enum {SINGLE = 0, CONTINUOUS, SHARPEST};
int mode;
} burst;
struct Flash {
// burst mode
enum {OFF = 0, HALF, FULL};
int mode;
bool backCurtain;
} flash;
QString lastPicture;
// Emit the changed signal to notify other concerned objects that
// the camera parameters have changed.
void notify() {emit changed();}
QMutex mutex;
int static getExposureValue(float);
public slots:
void setExposureMode(int);
void setExposureModeAuto();
void setExposureModeMan();
void setExposureValue(float);
void setExposureValue(int);
void setExposureCompensation(float);
void setGainMode(int);
void setGainModeAuto();
void setGainModeMan();
void setGainValue(int);
void setGainValue(float);
void setFocusMode(int);
void setFocusModeAuto();
void setFocusModeMan();
void setFocusModeSpot();
void setFocusValue(float);
void setFocusValue(int);
void setFocusSpot(int, int);
void setWhiteBalance(int);
void setWhiteBalanceMode(int);
void setFlashOff();
void setFlashHalf();
void setFlashFull();
void setBackCurtain(bool);
void openLastPicture();
void setLastPicture(QString);
QVariant getSetting(QString, QVariant);
void setSetting(QString, QVariant);
signals:
// A signal signifying that the camera parameters have changed.
// The camera thread could connect to change it's behavior through
// interrupts rather than polling as it does now. The viewfinder
// connects to this signal to update the setting labels on the
// parameter buttons appropriately.
void changed();
};
#endif