1 |
jakw |
1 |
#ifndef CAMERA_H
|
|
|
2 |
#define CAMERA_H
|
|
|
3 |
|
|
|
4 |
//header files included in the two camera APIs for XIMEA and IDS (possibly recursively)
|
|
|
5 |
//#ifdef __unix__ /* __unix__ is usually defined by compilers targeting Unix systems */
|
|
|
6 |
// #include <unistd.h>
|
|
|
7 |
// #include <stdint.h>
|
|
|
8 |
// //#include "wintypedefs.h"
|
|
|
9 |
//#elif defined(_WIN32) || defined(WIN32) /* _Win32 is usually defined by compilers targeting 32 or 64 bit Windows systems */
|
|
|
10 |
// #include <windows.h>
|
|
|
11 |
// //#include <WinNT.h>
|
|
|
12 |
//#endif
|
|
|
13 |
|
|
|
14 |
#include <iostream>
|
|
|
15 |
#include <vector>
|
|
|
16 |
|
|
|
17 |
struct CameraFrame {
|
|
|
18 |
unsigned char *memory;
|
|
|
19 |
unsigned int width;
|
|
|
20 |
unsigned int height;
|
|
|
21 |
unsigned int sizeBytes;
|
|
|
22 |
unsigned int timeStamp;
|
|
|
23 |
CameraFrame(): memory(NULL), width(0), height(0), sizeBytes(0), timeStamp(0){}
|
|
|
24 |
};
|
|
|
25 |
|
|
|
26 |
struct CameraSettings {
|
|
|
27 |
float gain;
|
|
|
28 |
float shutter; // [ms]
|
|
|
29 |
CameraSettings(): gain(0.0), shutter(0.0) {}
|
|
|
30 |
};
|
|
|
31 |
|
|
|
32 |
struct CameraInfo {
|
|
|
33 |
std::string vendor;
|
|
|
34 |
std::string model;
|
|
|
35 |
unsigned int busID;
|
|
|
36 |
};
|
|
|
37 |
|
|
|
38 |
// Abstract base class for camera implementations
|
|
|
39 |
class Camera {
|
|
|
40 |
public:
|
|
|
41 |
// Static "camera factory" methods
|
|
|
42 |
static std::vector< std::vector<CameraInfo> > GetInterfaceCameraList();
|
|
|
43 |
static Camera* NewCamera(unsigned int interfaceNum, unsigned int camNum);
|
|
|
44 |
// Interface function
|
|
|
45 |
Camera() : capturing(false){}
|
|
|
46 |
virtual CameraSettings getCameraSettings() = 0;
|
|
|
47 |
virtual void setCameraSettings(CameraSettings) = 0;
|
|
|
48 |
virtual void startCapture() = 0;
|
|
|
49 |
virtual void stopCapture() = 0;
|
|
|
50 |
virtual CameraFrame lockFrame() = 0;
|
|
|
51 |
virtual void unlockFrame() = 0;
|
|
|
52 |
virtual CameraFrame getSingleFrame() = 0;
|
|
|
53 |
virtual size_t getFrameSizeBytes() = 0;
|
|
|
54 |
virtual void getFrameWidthHeight(unsigned int *width, unsigned int *height) = 0;
|
|
|
55 |
bool isCapturing(){return capturing;}
|
|
|
56 |
virtual ~Camera(){}
|
|
|
57 |
protected:
|
|
|
58 |
bool capturing;
|
|
|
59 |
};
|
|
|
60 |
|
|
|
61 |
#endif
|