diff --git a/applications/registration/src/correspondances.cpp b/applications/registration/src/correspondances.cpp index d3b52e85677ac43fbac471b09c98ffe94fd63176..7cae10a166d037973e510724f6371ffcc7b0a2b4 100644 --- a/applications/registration/src/correspondances.cpp +++ b/applications/registration/src/correspondances.cpp @@ -181,6 +181,7 @@ bool Correspondances::capture(cv::Mat &rgb1, cv::Mat &rgb2) { } bool Correspondances::add(int tx, int ty, int sx, int sy) { + LOG(INFO) << "Adding..."; int tix = targ_index_.at<int>(ty,tx); int six = src_index_.at<int>(sy,sx); @@ -197,6 +198,7 @@ bool Correspondances::add(int tx, int ty, int sx, int sy) { targ_feat_.push_back(tix); uptodate_ = false; + LOG(INFO) << "Point added: " << tx << "," << ty << " and " << sx << "," << sy; return true; } diff --git a/applications/registration/src/manual.cpp b/applications/registration/src/manual.cpp index aa86e1f0edd4e1c8142dc1bcc2c7514522ea492c..f8182d5a3a4dc989e2509985e4b675b7abaff91d 100644 --- a/applications/registration/src/manual.cpp +++ b/applications/registration/src/manual.cpp @@ -182,6 +182,7 @@ void ftl::registration::manual(ftl::Configurable *root) { bool depthtoggle = false; double lastScore = 0.0; bool insearch = false; + int point_n = -1; Correspondances *current = corrs[sources[curtarget]->getURI()]; @@ -225,8 +226,17 @@ void ftl::registration::manual(ftl::Configurable *root) { // Apply points and labels... auto &points = current->screenPoints(); - for (auto &p : points) { - auto [tx,ty,sx,sy] = p; + if (point_n == -1) { + for (int i=0; i<points.size(); i++) { + //for (auto &p : points) { + auto [tx,ty,sx,sy] = points[i]; + drawMarker(srgb, Point(sx,sy), Scalar(0,255,0), MARKER_TILTED_CROSS); + drawMarker(sdepth, Point(sx,sy), Scalar(0,255,0), MARKER_TILTED_CROSS); + drawMarker(trgb, Point(tx,ty), Scalar(0,255,0), MARKER_TILTED_CROSS); + drawMarker(tdepth, Point(tx,ty), Scalar(0,255,0), MARKER_TILTED_CROSS); + } + } else if(point_n < points.size()) { + auto [tx,ty,sx,sy] = points[point_n]; drawMarker(srgb, Point(sx,sy), Scalar(0,255,0), MARKER_TILTED_CROSS); drawMarker(sdepth, Point(sx,sy), Scalar(0,255,0), MARKER_TILTED_CROSS); drawMarker(trgb, Point(tx,ty), Scalar(0,255,0), MARKER_TILTED_CROSS); @@ -262,6 +272,13 @@ void ftl::registration::manual(ftl::Configurable *root) { } else if (key == 'c') { current->clear(); lastScore = 1000.0; + } else if (key == 'n') { + point_n++; + } else if (key == 'p') { + LOG(INFO) << "Captured.."; + lastScore = 1000.0; + Mat f1,f2; + current->capture(f1,f2); }else if (key == 'a') { Eigen::Matrix4f t; if (current->add(lastTX,lastTY,lastSX,lastSY)) { @@ -301,7 +318,7 @@ void ftl::registration::manual(ftl::Configurable *root) { lastScore = 1000.0; do { Eigen::Matrix4f tr; - float s = current->findBestSubset(tr, 20, 10); + float s = current->findBestSubset(tr, 6, 10); LOG(INFO) << "SCORE = " << s; if (s < lastScore) { lastScore = s; @@ -316,7 +333,7 @@ void ftl::registration::manual(ftl::Configurable *root) { auto [sx,sy,tx,ty] = feat[i]; current->add(tx,ty,sx,sy); } - lastScore = current->estimateTransform();*/ + lastsScore = current->estimateTransform();*/ } else { insearch = false; }