Skip to content

Commit cebb49d

Browse files
committed
FREAK : better rounding off for weighted dx and dy of orientation pairs
1 parent 6e96bb2 commit cebb49d

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
@@ -287,8 +287,8 @@ void FREAK_Impl::buildPattern()
287287
const float dx = patternLookup[orientationPairs[m].i].x-patternLookup[orientationPairs[m].j].x;
288288
const float dy = patternLookup[orientationPairs[m].i].y-patternLookup[orientationPairs[m].j].y;
289289
const float norm_sq = (dx*dx+dy*dy);
290-
orientationPairs[m].weight_dx = int((dx/(norm_sq))*4096.0+0.5);
291-
orientationPairs[m].weight_dy = int((dy/(norm_sq))*4096.0+0.5);
290+
orientationPairs[m].weight_dx = int((dx/(norm_sq))*4096.0+0.5*((dx>0)-(dx<0)));
291+
orientationPairs[m].weight_dy = int((dy/(norm_sq))*4096.0+0.5*((dy>0)-(dy<0)));
292292
}
293293

294294
// build the list of description pairs

0 commit comments

Comments
 (0)