-
Notifications
You must be signed in to change notification settings - Fork 0
/
stereovision.h
61 lines (44 loc) · 1.49 KB
/
stereovision.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
#ifndef STEREOVISION_H
#define STEREOVISION_H
#include "cv.h"
#include "cxmisc.h"
#include "cvaux.h"
#include "highgui.h"
using namespace std;
#include <vector>
#define RESULT_OK 0
#define RESULT_FAIL 1
class StereoVision
{
private:
//chesboard board corners X,Y, N = X*Y , number of corners = (number of cells - 1)
int cornersX,cornersY,cornersN;
int sampleCount;
bool calibrationStarted;
bool calibrationDone;
CvSize imageSize;
int imageWidth;
int imageHeight;
vector<CvPoint2D32f> ponintsTemp[2];
vector<CvPoint3D32f> objectPoints;
vector<CvPoint2D32f> points[2];
vector<int> npoints;
public:
StereoVision(int imageWidth,int imageHeight);
~StereoVision();
//matrices resulting from calibration (used for cvRemap to rectify images)
CvMat *mx1,*my1,*mx2,*my2;
CvMat* imagesRectified[2];
CvMat *imageDepth,*imageDepthNormalized;
void calibrationStart(int cornersX,int cornersY);
int calibrationAddSample(IplImage* imageLeft,IplImage* imageRight);
int calibrationEnd();
int calibrationSave(const char* filename);
int calibrationLoad(const char* filename);
int stereoProcess(CvArr* imageSrcLeft,CvArr* imageSrcRight);
CvSize getImageSize(){return imageSize;}
bool getCalibrationStarted(){return calibrationStarted;}
bool getCalibrationDone(){return calibrationDone;}
int getSampleCount(){return sampleCount;}
};
#endif // STEREOVISION_H