Skip to content

Commit

Permalink
Fixes uzh-rpg#44, bug in KeyPoint selection
Browse files Browse the repository at this point in the history
  • Loading branch information
cfo committed Sep 1, 2014
1 parent 6f6c4c9 commit 3ba0993
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions svo/src/frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,40 +87,40 @@ void Frame::checkKeyPoints(Feature* ftr)
// center pixel
if(key_pts_[0] == NULL)
key_pts_[0] = ftr;
else if(max(abs(ftr->px[0]-cu), abs(ftr->px[1]-cv))
< max(abs(key_pts_[0]->px[0]-cu), abs(key_pts_[0]->px[1]-cv)))
else if(std::max(std::fabs(ftr->px[0]-cu), std::fabs(ftr->px[1]-cv))
< std::max(std::fabs(key_pts_[0]->px[0]-cu), std::fabs(key_pts_[0]->px[1]-cv)))
key_pts_[0] = ftr;

if(ftr->px[0] >= cu && ftr->px[1] >= cv)
{
if(key_pts_[1] == NULL)
key_pts_[1] = ftr;
else if((ftr->px[0]-cu) * (ftr->px[1]-cv)
> (key_pts_[1]->px[0]-cu) * (key_pts_[1]->px[0]-cv))
> (key_pts_[1]->px[0]-cu) * (key_pts_[1]->px[1]-cv))
key_pts_[1] = ftr;
}
if(ftr->px[0] >= cu && ftr->px[1] < cv)
{
if(key_pts_[2] == NULL)
key_pts_[2] = ftr;
else if((ftr->px[0]-cu) * (ftr->px[1]-cv)
< (key_pts_[2]->px[0]-cu) * (key_pts_[2]->px[0]-cv))
> (key_pts_[2]->px[0]-cu) * (key_pts_[2]->px[1]-cv))
key_pts_[2] = ftr;
}
if(ftr->px[0] < cv && ftr->px[1] < cv)
{
if(key_pts_[3] == NULL)
key_pts_[3] = ftr;
else if((ftr->px[0]-cu) * (ftr->px[1]-cv)
> (key_pts_[3]->px[0]-cu) * (key_pts_[3]->px[0]-cv))
> (key_pts_[3]->px[0]-cu) * (key_pts_[3]->px[1]-cv))
key_pts_[3] = ftr;
}
if(ftr->px[0] < cv && ftr->px[1] >= cv)
{
if(key_pts_[4] == NULL)
key_pts_[4] = ftr;
else if((ftr->px[0]-cu) * (ftr->px[1]-cv)
< (key_pts_[4]->px[0]-cu) * (key_pts_[4]->px[0]-cv))
> (key_pts_[4]->px[0]-cu) * (key_pts_[4]->px[1]-cv))
key_pts_[4] = ftr;
}
}
Expand Down

0 comments on commit 3ba0993

Please sign in to comment.