Skip to content
Snippets Groups Projects
Commit 8baba607 authored by Sebastian Hahta's avatar Sebastian Hahta
Browse files

comments

parent 8ea899e2
No related branches found
No related tags found
1 merge request!44Feature/calibapp improvements
Pipeline #11733 passed
......@@ -55,6 +55,8 @@ void ftl::calibration::stereo(map<string, string> &opt) {
vector<Grid> grids;
int grid_i = 0;
// grid parameters, 3x3 grid; one small grid and one large grid. Grids are cycled until
// iter reaches zero
grids.push_back(Grid(3, 3,
(3.0f/4.0f) * image_size.width, (3.0f/4.0f) * image_size.height,
((1.0f/4.0f) * image_size.width) / 2, ((1.0f/4.0f) * image_size.height) / 2));
......@@ -80,9 +82,12 @@ void ftl::calibration::stereo(map<string, string> &opt) {
camera.set(cv::CAP_PROP_FRAME_HEIGHT, image_size.height);
}
// image points to calculate the parameters after all input data is captured
vector<vector<vector<Vec2f>>> image_points(2);
vector<vector<Vec3f>> object_points;
// image points for each grid, updated to image_points and object_points
// after is grid complete
vector<vector<vector<Vec2f>>> image_points_grid(9, vector<vector<Vec2f>>(2));
vector<vector<Vec3f>> object_points_grid(9);
......@@ -125,6 +130,7 @@ void ftl::calibration::stereo(map<string, string> &opt) {
auto &img = new_img[i];
auto &points = new_points[i];
// TODO move to "findPoints"-thread
if (calib.findPoints(img, points)) {
calib.drawPoints(img, points);
res++;
......@@ -152,6 +158,7 @@ void ftl::calibration::stereo(map<string, string> &opt) {
// reject it if RMS reprojection error too high
int flags = stereocalibrate_flags;
// TODO move to "findPoints"-thread
double rms_iter = stereoCalibrate(
vector<vector<Vec3f>> { points_ref },
vector<vector<Vec2f>> { new_points[0] },
......@@ -232,7 +239,6 @@ void ftl::calibration::stereo(map<string, string> &opt) {
saveExtrinsics(FTL_LOCAL_CONFIG_ROOT "/extrinsics.yml", R, T, R1, R2, P1, P2, Q);
LOG(INFO) << "Stereo camera extrinsics saved to: " << FTL_LOCAL_CONFIG_ROOT "/extrinsics.yml";
for (size_t i = 0; i < 2; i++) { cv::destroyWindow("Camera " + std::to_string(i)); }
// Visualize results
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment