-
Notifications
You must be signed in to change notification settings - Fork 0
/
escapi.h
120 lines (101 loc) · 4.2 KB
/
escapi.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
/* Extremely Simple Capture API */
struct SimpleCapParams
{
/* Target buffer.
* Must be at least mWidth * mHeight * sizeof(int) of size!
*/
int * mTargetBuf;
/* Buffer width */
int mWidth;
/* Buffer height */
int mHeight;
};
enum CAPTURE_PROPETIES
{
CAPTURE_BRIGHTNESS,
CAPTURE_CONTRAST,
CAPTURE_HUE,
CAPTURE_SATURATION,
CAPTURE_SHARPNESS,
CAPTURE_GAMMA,
CAPTURE_COLORENABLE,
CAPTURE_WHITEBALANCE,
CAPTURE_BACKLIGHTCOMPENSATION,
CAPTURE_GAIN,
CAPTURE_PAN,
CAPTURE_TILT,
CAPTURE_ROLL,
CAPTURE_ZOOM,
CAPTURE_EXPOSURE,
CAPTURE_IRIS,
CAPTURE_FOCUS,
CAPTURE_PROP_MAX
};
/* Sets up the ESCAPI DLL and the function pointers below. Call this first! */
/* Returns number of capture devices found (same as countCaptureDevices, below) */
extern int setupESCAPI();
/* return the number of capture devices found */
typedef int (*countCaptureDevicesProc)();
/* initCapture tries to open the video capture device.
* Returns 0 on failure, 1 on success.
* Note: Capture parameter values must not change while capture device
* is in use (i.e. between initCapture and deinitCapture).
* Do *not* free the target buffer, or change its pointer!
*/
typedef int (*initCaptureProc)(unsigned int deviceno, struct SimpleCapParams *aParams);
/* deinitCapture closes the video capture device. */
typedef void (*deinitCaptureProc)(unsigned int deviceno);
/* doCapture requests video frame to be captured. */
typedef void (*doCaptureProc)(unsigned int deviceno);
/* isCaptureDone returns 1 when the requested frame has been captured.*/
typedef int (*isCaptureDoneProc)(unsigned int deviceno);
/* Get the user-friendly name of a capture device. */
typedef void (*getCaptureDeviceNameProc)(unsigned int deviceno, char *namebuffer, int bufferlength);
/* Returns the ESCAPI DLL version. 0x200 for 2.0 */
typedef int (*ESCAPIVersionProc)();
/*
On properties -
- Not all cameras support properties at all.
- Not all properties can be set to auto.
- Not all cameras support all properties.
- Messing around with camera properties may lead to weird results, so YMMV.
*/
/* Gets value (0..1) of a camera property (see CAPTURE_PROPERTIES, above) */
typedef float (*getCapturePropertyValueProc)(unsigned int deviceno, int prop);
/* Gets whether the property is set to automatic (see CAPTURE_PROPERTIES, above) */
typedef int(*getCapturePropertyAutoProc)(unsigned int deviceno, int prop);
/* Set camera property to a value (0..1) and whether it should be set to auto. */
typedef int (*setCapturePropertyProc)(unsigned int deviceno, int prop, float value, int autoval);
/*
All error situations in ESCAPI are considered catastrophic. If such should
occur, the following functions can be used to check which line reported the
error, and what the HRESULT of the error was. These may help figure out
what the problem is.
*/
/* Return line number of error, or 0 if no catastrophic error has occurred. */
typedef int (*getCaptureErrorLineProc)(unsigned int deviceno);
/* Return HRESULT of the catastrophic error, or 0 if none. */
typedef int (*getCaptureErrorCodeProc)(unsigned int deviceno);
/* initCaptureWithOptions allows additional options to be given. Otherwise it's identical with initCapture
*/
typedef int (*initCaptureWithOptionsProc)(unsigned int deviceno, struct SimpleCapParams *aParams, unsigned int aOptions);
// Options accepted by above:
// Return raw data instead of converted rgb. Using this option assumes you know what you're doing.
#define CAPTURE_OPTION_RAWDATA 1
// Mask to check for valid options - all options OR:ed together.
#define CAPTURE_OPTIONS_MASK (CAPTURE_OPTION_RAWDATA)
#ifndef ESCAPI_DEFINITIONS_ONLY
extern countCaptureDevicesProc countCaptureDevices;
extern initCaptureProc initCapture;
extern deinitCaptureProc deinitCapture;
extern doCaptureProc doCapture;
extern isCaptureDoneProc isCaptureDone;
extern getCaptureDeviceNameProc getCaptureDeviceName;
extern ESCAPIVersionProc ESCAPIVersion;
extern getCapturePropertyValueProc getCapturePropertyValue;
extern getCapturePropertyAutoProc getCapturePropertyAuto;
extern setCapturePropertyProc setCaptureProperty;
extern getCaptureErrorLineProc getCaptureErrorLine;
extern getCaptureErrorCodeProc getCaptureErrorCode;
extern initCaptureWithOptionsProc initCaptureWithOptions;
#endif