Skip to content
Snippets Groups Projects
Commit 0c8b1423 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Correction to variance

parent 542eba09
No related branches found
No related tags found
1 merge request!43Partial completion of #95
......@@ -61,13 +61,15 @@ static void averageDepth(vector<Mat> &in, Mat &out, float varThresh) {
for (int i_in = 0; i_in < in.size(); ++i_in) {
float d = in[i_in].at<float>(i);
if (d < 40.0f) {
float delta = d - sum;
float delta = (d*1000.0f - sum*1000.0f);
var += delta*delta;
}
}
if (good_values > 1) var /= (good_values-1);
else var = 0.0f;
//LOG(INFO) << "VAR " << var;
if (var < varThresh) {
out.at<float>(i) = sum;
} else {
......@@ -121,8 +123,8 @@ bool Correspondances::capture(cv::Mat &rgb1, cv::Mat &rgb2) {
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
averageDepth(buffer[0], d1, 1.0f);
averageDepth(buffer[1], d2, 1.0f);
averageDepth(buffer[0], d1, 0.00000005f);
averageDepth(buffer[1], d2, 0.00000005f);
Mat d1_v, d2_v;
d1.convertTo(d1_v, CV_8U, 255.0f / 10.0f);
d2.convertTo(d2_v, CV_8U, 255.0f / 10.0f);
......
......@@ -184,10 +184,6 @@ void ftl::registration::manual(ftl::Configurable *root) {
bool insearch = false;
Correspondances *current = corrs[sources[curtarget]->getURI()];
// Features for current frame...
vector<tuple<int,int,int,int>> feat;
vector<std::pair<pcl::PointXYZ, pcl::PointXYZ>> pclfeat;
while (ftl::running) {
if (!freeze) {
......@@ -299,7 +295,6 @@ void ftl::registration::manual(ftl::Configurable *root) {
} else if (key == 'g') {
if (!insearch) {
insearch = true;
LOG(INFO) << "Features matched = " << feat.size();
ftl::pool.push([&lastScore,&insearch,current](int id) {
LOG(INFO) << "START";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment