HeYijia / svo_edgelet

A more robust SVO with edgelet feature
GNU General Public License v2.0
434 stars 175 forks source link

深度滤波器中更新小边特征方向 #5

Open djw8899 opened 6 years ago

djw8899 commented 6 years ago
if(it->ftr->type == Feature::EDGELET)
{
  it->ftr->grad_cur_ = (matcher_.A_cur_ref_ * it->ftr->grad).normalized();
}

........ ........ if(it->ftr->type == Feature::EDGELET) { it->ftr->grad = it->ftr->gradcur; // edgelete in newkeyframe, it's direction should change; }

在我的理解中,it->ftr应该是一直储存这个特征被第一次检测到的feature。

深度滤波器这边极线搜索匹配到的edgelet的ftr变量,没有看到被关联到newkeyframe的代码。

不知道是否是我理解有误,还请赐教一下^^

HeYijia commented 6 years ago

不好意思,没看明白你的问题?

djw8899 commented 6 years ago

depthfilter中,matcher.findEpipolarMatchDirect,在feature被detect的帧,和当前帧内进行匹配。 匹配成功之后,seed->ftr这个成员变量的含义,应该还是指最初被detect到的那个ftr。 所以grad不应该被A_curref 更新。

HeYijia commented 6 years ago

我当时的理解是,无论是point还是edgelet,他虽然在之前的帧被detect。但是当他收敛的时候,他们会被立马挂到最新的观测帧上,而不是挂到之前detect他们的帧上。在frame_handler_mono.cpp代码的356-360行。所以我这里不断修改他们的方向,当收敛的时候,直接挂到新的帧上去。不过你可以再仔细看看,一起讨论讨论。目前的代码,edgelet在快速旋转的时候,edgelet从三维空间重投影到新图像里的直线方向跟实际的边缘方向有点匹配不上,当然大部分时候,edgelet的方向还是投影的比较准的。

djw8899 commented 6 years ago

frame_handler_mono.cpp的360行, addCandidatePointToFrame函数中,也就是map.cpp的233行 it->second->frame->addFeature(it->second); 我认为这边的it->second(Feature类型)还是挂在detect的帧上的,没有看到有把这个feature挂到新的帧上的代码。

HeYijia commented 6 years ago

刚刚重新读了下,确实是挂在detect的帧上。之前被.addCandidatePointToFrame(newframe)这句误解了。下面整理代码过程: it->second->frame->addFeature(it->second); 这句的关键是it->second,it是candidates_的迭代器,是pair类型,it->second它是个fts,也就是要找到fts->frame的这个frame指向的是啥?那就得看candidates_的初始化。candidates_的初始化是在depth_filter.cpp中,每当seed收敛以后,会调用seed_convergedcb(point, it->sigma2);这个seed_converged_cb实际上对应函数MapPointCandidates::newCandidatePoint。这个函数里对收敛的seed将其初始化成candidates,candidates.pushback(PointCandidate(point, point->obs.front())); 也就是说 point->obs_.front()就是前面的it->second。这时候 point刚刚在depthfilter.cpp里完成初始化,这个point->obs_里还只有一个观测量, Point* point = new Point(xyzworld, it->ftr);他的obs.front对应的就是detect时候的图像帧。所以point是挂在detect帧上。frame_handler_mono.cpp中的357-359行只是在point已经成为point后,将新的关键帧帧上的观测量fts连到point上。

kongan commented 6 years ago

有个奇怪的问题,根据分析在 addCandidatePointToFrame 函数中 it->first->obs.front()->frame 与 it->second->frame 是同一个 frame (因为 PointCandidate(point, point->obs.front()) ), 那么候选点就是挂在当前帧了,因为 if(it->first->obs.front()->frame == frame.get()) 。 奇怪的是在那个 if 中加入printf("addCandidatePointToFrame: %d,%d\n", it->first->obs.front()->frame, it->second->frame);输出结果,它们绝大多数情况是一样的,但偶尔有不同。

Stephanie-ustc commented 6 years ago

@kongan 您好请问这个问题您弄明白了吗 我运行程序有时候会在map函数里的addCandidatePointToFrame这出错,直接返回的是Segment fault

xuankuzcr commented 3 years ago

@kongan 这里的it->first->obs_.front()->frame此时是该candidate点最近的观测帧了,而it->second->frame还是detect帧,是有可能不一样的,如果一样的话这个if永远进不去