-
Notifications
You must be signed in to change notification settings - Fork 0
/
equirec2perspec.h
51 lines (38 loc) · 1.26 KB
/
equirec2perspec.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
#ifndef EQUIRECTANGULAR2PERSPECECTIVE_EQUIREC2PERSPEC_H
#define EQUIRECTANGULAR2PERSPECECTIVE_EQUIREC2PERSPEC_H
#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#ifdef OPENCV_VER_4
#include <opencv2/imgproc/imgproc_c.h>
#endif
class Equirec2Perspec
{
public:
Equirec2Perspec();
~Equirec2Perspec();
void setParams(const cv::Mat &inputImg, float FOV, int height, int width);
void convert(const cv::Mat &inputImg, cv::Mat &outputImg, float FOV,
float theta, float phi, int height, int width);
void convert(const cv::Mat &inputImg, cv::Mat &outputImg,
float theta, float phi);
private:
void updateParams();
float calcRadian(float degree) {return degree/180*PI_;}
void equi2per(const cv::Mat &inputImage, cv::Mat &outputImage);
int perHeight_, perWidth_;
int equHeight_, equWidth_;
float equCenterX_, equCenterY_;
float theta_, phi_;
float FOV_, wFOV_, hFOV_;
float wAngle_, hAngle_;
float wLen_, hLen_;
float wInterval_, hInterval_;
cv::Mat xMap_, yMap_, zMap_, dMap_;
cv::Mat xyz_;
float zAxisArray_[3] = {0.0f, 0.0f, 1.0f};
cv::Mat zAxis_ = cv::Mat(cv::Size(3,1),CV_32F, zAxisArray_);
bool isSetParam_;
int radius_;
float PI_;
};
#endif //EQUIRECTANGULAR2PERSPECECTIVE_EQUIREC2PERSPEC_H