refactoring Point, added point normal as member

This commit is contained in:
Christian Forster
2014-04-03 10:08:18 +02:00
parent 0b0a9a51b0
commit a1e014c77c
8 changed files with 27 additions and 24 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ InitResult KltHomographyInit::addSecondFrame(FramePtr frame_cur)
if(frame_ref_->cam_->isInFrame(px_cur.cast<int>(), 10) && frame_ref_->cam_->isInFrame(px_ref.cast<int>(), 10) && xyz_in_cur_[*it].z() > 0)
{
Vector3d pos = T_world_cur * (xyz_in_cur_[*it]*scale);
Point* new_point = new Point(pos, Point::TRIANGULATION);
Point* new_point = new Point(pos);
Feature* ftr_cur(new Feature(frame_cur.get(), new_point, px_cur, f_cur_[*it], 0));
frame_cur->addFeature(ftr_cur);
+6 -6
View File
@@ -94,7 +94,7 @@ void Map::safeDeletePoint(Point* pt)
void Map::deletePoint(Point* pt)
{
pt->type_ = Point::DELETED;
pt->type_ = Point::TYPE_DELETED;
trash_points_.push_back(pt);
}
@@ -196,9 +196,9 @@ MapPointCandidates::~MapPointCandidates()
void MapPointCandidates::newCandidatePoint(const Seed& seed, const Vector3d& xyz_world)
{
// initalize a new point
Point* point = new Point(xyz_world, Point::VOGIATZIS);
Point* point = new Point(xyz_world);
point->addFrameRef(seed.ftr);
point->type_ = Point::CANDIDATE;
point->type_ = Point::TYPE_CANDIDATE;
seed.ftr->point = point;
// add candidate to list
@@ -215,7 +215,7 @@ void MapPointCandidates::addCandidatePointToFrame(FramePtr frame)
if(it->first->obs_.front()->frame == frame.get())
{
// insert feature in the frame
it->first->type_ = Point::UNKNOWN_QUALITY;
it->first->type_ = Point::TYPE_UNKNOWN;
it->first->n_failed_reproj_ = 0;
it->second->frame->addFeature(it->second);
it = candidates_.erase(it);
@@ -271,7 +271,7 @@ void MapPointCandidates::deleteCandidate(PointCandidate& c)
// camera-rig: another frame might still be pointing to the candidate point
// therefore, we can't delete it right now.
delete c.second; c.second=NULL;
c.first->type_ = Point::DELETED;
c.first->type_ = Point::TYPE_DELETED;
trash_points_.push_back(c.first);
}
@@ -298,7 +298,7 @@ void frameValidation(Frame* frame, int id)
if((*it)->point==NULL)
continue;
if((*it)->point->type_ == Point::DELETED)
if((*it)->point->type_ == Point::TYPE_DELETED)
printf("ERROR DataValidation %i: Referenced point was deleted.\n", id);
if(!(*it)->point->findFrameRef(frame))
+3 -3
View File
@@ -24,15 +24,15 @@ namespace svo {
int Point::point_counter_ = 0;
Point::Point(Vector3d pos, PointOrigin origin) :
Point::Point(Vector3d pos) :
id_(point_counter_++),
pos_(pos),
normal_(Vector3d::Zero()),
n_obs_(0),
v_pt_(NULL),
last_published_ts_(0),
last_projected_kf_id_(-1),
type_(UNKNOWN_QUALITY),
origin_(origin),
type_(TYPE_UNKNOWN),
n_failed_reproj_(0),
n_succeeded_reproj_(0),
last_structure_optim_(0)
+5 -5
View File
@@ -158,7 +158,7 @@ bool reprojectCell(
{
++n_trials;
if(it->pt->type_ == Point::DELETED)
if(it->pt->type_ == Point::TYPE_DELETED)
{
it = cell.erase(it);
continue;
@@ -169,16 +169,16 @@ bool reprojectCell(
if(!found_match)
{
it->pt->n_failed_reproj_++;
if(it->pt->type_ == Point::UNKNOWN_QUALITY && it->pt->n_failed_reproj_ > 15)
if(it->pt->type_ == Point::TYPE_UNKNOWN && it->pt->n_failed_reproj_ > 15)
map.safeDeletePoint(it->pt);
if(it->pt->type_ == Point::CANDIDATE && it->pt->n_failed_reproj_ > 30)
if(it->pt->type_ == Point::TYPE_CANDIDATE && it->pt->n_failed_reproj_ > 30)
candidate_points.deleteCandidatePoint(it->pt);
it = cell.erase(it);
continue;
}
it->pt->n_succeeded_reproj_++;
if(it->pt->type_ == Point::UNKNOWN_QUALITY && it->pt->n_succeeded_reproj_ > 10)
it->pt->type_ = Point::GOOD_QUALITY;
if(it->pt->type_ == Point::TYPE_UNKNOWN && it->pt->n_succeeded_reproj_ > 10)
it->pt->type_ = Point::TYPE_GOOD;
Feature* new_feature = new Feature(frame.get(), it->px, feature_level);
frame->addFeature(new_feature);