From 8baba607faeaa15887460862e498c3d748c91bae Mon Sep 17 00:00:00 2001
From: Sebastian Hahta <joseha@utu.fi>
Date: Thu, 20 Jun 2019 08:39:26 +0300
Subject: [PATCH] comments

---
 applications/calibration/src/stereo.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/applications/calibration/src/stereo.cpp b/applications/calibration/src/stereo.cpp
index f6ecb594e..aedb19715 100644
--- a/applications/calibration/src/stereo.cpp
+++ b/applications/calibration/src/stereo.cpp
@@ -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);
 	
@@ -124,7 +129,8 @@ void ftl::calibration::stereo(map<string, string> &opt) {
 		for (size_t i = 0; i < 2; i++) {
 			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
-- 
GitLab