RectifierAffine.hpp
1.45 KB
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
/**
* @brief Line fitting to a set of 2D points
*
* @author Andrey Kudryavtsev (avkudr.github.io)
* @author Rahima Djahel (github:rahma24000)
* @date 27/03/2018
* @version 1.0
*/
#ifndef RECTIFIER_AFFINE_H
#define RECTIFIER_AFFINE_H
#include <opencv2/opencv.hpp>
class RectifierAffine
{
public:
RectifierAffine();
~RectifierAffine();
void init(cv::Mat *im1, cv::Mat *im2, cv::Mat *F, std::vector<cv::Point2d> *inliers1, std::vector<cv::Point2d> *inliers2);
bool isRectificationDone() {return !(imLrect.empty()) && !(imRrect.empty());}
cv::Mat imLrect;
cv::Mat imRrect;
double angleL = 0.0;
double angleR = 0.0;
int shift = 0;
void rectify();
bool isReady();
cv::Mat get2DRotationMatrixLeft();
cv::Mat get2DRotationMatrixRight();
cv::Mat get2DShiftMatrix();
cv::Mat get2DTransformationMatrixLeft() { return get2DRotationMatrixLeft() * get2DShiftMatrix(); }
cv::Mat get2DTransformationMatrixRight() { return get2DRotationMatrixRight() * get2DShiftMatrix(); }
void getResult(cv::Mat & resL, cv::Mat & resR,std::vector<cv::Point2d> *ptsL,std::vector<cv::Point2d> *ptsR){
resL = this->imLrect;
resR = this->imRrect;
ptsL=this->_inliers1;
ptsR=this->_inliers2;
}
private:
cv::Mat *_imL;
cv::Mat *_imR;
cv::Mat *_F;
std::vector<cv::Point2d> *_inliers1;
std::vector<cv::Point2d> *_inliers2;
};
#endif // RECTIFIER_AFFINE_H