Skip to content

Commit 8aed68e

Browse files
committed
FREAK : better rounding off for weighted dx and dy of orientation pairs
1 parent a0d9138 commit 8aed68e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/xfeatures2d/src/freak.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ void FREAK_Impl::buildPattern()
283283
const float dx = patternLookup[orientationPairs[m].i].x-patternLookup[orientationPairs[m].j].x;
284284
const float dy = patternLookup[orientationPairs[m].i].y-patternLookup[orientationPairs[m].j].y;
285285
const float norm_sq = (dx*dx+dy*dy);
286-
orientationPairs[m].weight_dx = int((dx/(norm_sq))*4096.0+0.5);
287-
orientationPairs[m].weight_dy = int((dy/(norm_sq))*4096.0+0.5);
286+
orientationPairs[m].weight_dx = int((dx/(norm_sq))*4096.0+0.5*((dx>0)-(dx<0)));
287+
orientationPairs[m].weight_dy = int((dy/(norm_sq))*4096.0+0.5*((dy>0)-(dy<0)));
288288
}
289289

290290
// build the list of description pairs

0 commit comments

Comments
 (0)