-
Notifications
You must be signed in to change notification settings - Fork 4
/
orf.h
119 lines (99 loc) · 2.71 KB
/
orf.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
/*!
* \file orf.h
* \author Gabriel Urbain <[email protected]> - Visiting student at MIT SSL
* \date July 2014
* \version 0.1
* \brief Headers for optical range finder class
*
* License: The MIT License (MIT)
* Copyright (c) 2014, Massachussets Institute of Technology
*/
#ifndef ORF_HH
#define ORF_HH
// OpenCV libs
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/contrib/contrib.hpp"
// ORF libs
#include <libMesaSR.h>
#include <definesSR.h>
// Common libs
#include <stdint.h>
#include <iomanip>
#include <limits>
#include <stdio.h>
#include <iostream>
#include <string>
#include <time.h>
#include <sys/types.h>
#include <unistd.h>
#include <fstream>
#include <sys/stat.h>
// Project libs
#include "defines.h"
#include "utils.h"
#include "calibration.h"
#include "visualization.h"
using namespace std;
using namespace cv;
class ORF : virtual public Calibration {
public:
// Common variables
string device_id_;
string lib_version_;
// Calibration matrices
Mat intrinsicMatrix, distorsionCoeffs;
double f, cx, cy;
// Public functions
ORF ();
~ORF ();
int init(string directory);
int init();
int close();
int captureOrf(Mat& depthNewImageFrame, Mat& visualNewImageFrame, Mat& confidenceNewImageFrame, TimeStamp& ts, int num=0);
int captureRectifiedOrf(Mat& depthNewImageFrame, Mat& visualNewImageFrame, Mat& confidenceNewImageFrame, TimeStamp& ts, int num=0, string filename="ORF_calib.xml");
int saveRectifiedOrf();
int saveOrf();
int capture3Dcloud(vector<Point3d>& pointcloud, vector<Vec3b>& rgbcloud, int num=0, int downsampling=4, string filename="ORF_calib.xml");
int calib(string filename="ORF_calib.xml");
int setAutoExposure (bool on);
int setIntegrationTime (int time);
int setAmplitudeThreshold (int thresh);
int setModulationFrequency (int freq);
int getIntegrationTime ();
double getModulationFrequency ();
int getAmplitudeThreshold ();
private:
// Camera parameters
int imgWidth;
int imgHeight;
Size imageSize;
bool auto_exposure;
int integration_time, modulation_freq, amp_threshold;
string ether_addr;
// Camera variables
CMesaDevice* orfCam_;
ImgEntry* imgEntryArray_;
float *buffer_, *xp_, *yp_, *zp_;
int integration_time_, modulation_freq_;
bool use_filter_;
// Rectification variables
Mat mapx;
Mat mapy;
// File save parameters
string save_dir;
ofstream tsfile;
string timestamps;
int imgNum;
int tslast;
// File load parameters
string load_dir;
bool load_image;
// Private functions
void SafeCleanup();
string getDeviceString ();
string getLibraryVersion ();
};
#endif