6 #include <opencv2/calib3d/calib3d_c.h>
7 #include <opencv2/calib3d.hpp>
8 #include <opencv2/core/core_c.h>
9 #include <opencv2/core/types_c.h>
10 #include <opencv2/imgcodecs.hpp>
14 #include <yarp/os/all.h>
15 #include <yarp/dev/all.h>
16 #include <yarp/sig/all.h>
17 #include <yarp/math/Math.h>
23 using namespace yarp::os;
25 using namespace yarp::sig;
26 using namespace yarp::math;
37 ImageOf<PixelRgb> *imageL;
38 ImageOf<PixelRgb> *imageR;
60 yarp::dev::PolyDriver polyHead;
61 yarp::dev::IEncoders *posHead;
63 yarp::dev::PolyDriver polyTorso;
64 yarp::dev::IEncoders *posTorso;
69 string inputLeftPortName;
70 string inputRightPortName;
74 string currentPathDir;
75 std::vector<string> imageListR;
76 std::vector<string> imageListL;
77 std::vector<string> imageListLR;
79 BufferedPort<ImageOf<PixelRgb> > imagePortInLeft;
80 BufferedPort<ImageOf<PixelRgb> > imagePortInRight;
81 BufferedPort<ImageOf<PixelRgb> > outPortRight;
82 BufferedPort<ImageOf<PixelRgb> > outPortLeft;
94 bool checkTS(
double TSLeft,
double TSRight,
double th=0.08);
95 void preparePath(
const char * imageDir,
char* pathL,
char* pathR,
int num);
96 void saveStereoImage(
const char * imageDir,
const Mat& left,
const Mat& right,
int num);
97 void monoCalibration(
const vector<string>& imageList,
int boardWidth,
int boardHeight, Mat &K, Mat &Dist);
98 void stereoCalibration(
const vector<string>& imagelist,
int boardWidth,
int boardHeight,
float sqsizee);
99 void saveCalibration(
const string& extrinsicFilePath,
const string& intrinsicFilePath);
100 void calcChessboardCorners(Size boardSize,
float squareSize, vector<Point3f>& corners);
101 bool updateIntrinsics(
int width,
int height,
double fx,
double fy,
double cx,
double cy,
double k1,
double k2,
double p1,
double p2,
const string& groupname);
102 bool updateExtrinsics(Mat Rot, Mat Tr,
const string& groupname);
103 void saveImage(
const char * imageDir,
const Mat& left,
int num);
104 void stereoCalibRun();
114 void threadRelease();
void printMatrix(const string &s, const Matrix &m)