@@ -287,8 +287,8 @@ void FREAK_Impl::buildPattern()
287
287
const float dx = patternLookup[orientationPairs[m].i ].x -patternLookup[orientationPairs[m].j ].x ;
288
288
const float dy = patternLookup[orientationPairs[m].i ].y -patternLookup[orientationPairs[m].j ].y ;
289
289
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 = cvRound ((dx/(norm_sq))*4096.0 );
291
+ orientationPairs[m].weight_dy = cvRound ((dy/(norm_sq))*4096.0 );
292
292
}
293
293
294
294
// build the list of description pairs
@@ -486,7 +486,7 @@ void FREAK_Impl::computeDescriptors( InputArray _image, std::vector<KeyPoint>& k
486
486
}
487
487
else
488
488
{
489
- const int scIdx = std::max ( ( int )( 1.0986122886681 *sizeCst+ 0.5 ) ,0 );
489
+ const int scIdx = std::max ( cvRound ( 1.0986122886681 *sizeCst) ,0 );
490
490
for ( size_t k = keypoints.size (); k--; )
491
491
{
492
492
kpScaleIdx[k] = scIdx; // equivalent to the formule when the scale is normalized with a constant size of keypoints[k].size=3*SMALLEST_KP_SIZE
@@ -543,10 +543,7 @@ void FREAK_Impl::computeDescriptors( InputArray _image, std::vector<KeyPoint>& k
543
543
544
544
keypoints[k].angle = static_cast <float >(atan2 ((float )direction1,(float )direction0)*(180.0 /CV_PI));// estimate orientation
545
545
546
- if (keypoints[k].angle < 0 .f )
547
- thetaIdx = int (FREAK_NB_ORIENTATION*keypoints[k].angle *(1 /360.0 )-0.5 );
548
- else
549
- thetaIdx = int (FREAK_NB_ORIENTATION*keypoints[k].angle *(1 /360.0 )+0.5 );
546
+ thetaIdx = cvRound (FREAK_NB_ORIENTATION*keypoints[k].angle *(1 /360.0 ));
550
547
551
548
if ( thetaIdx < 0 )
552
549
thetaIdx += FREAK_NB_ORIENTATION;
@@ -600,10 +597,7 @@ void FREAK_Impl::computeDescriptors( InputArray _image, std::vector<KeyPoint>& k
600
597
601
598
keypoints[k].angle = static_cast <float >(atan2 ((float )direction1,(float )direction0)*(180.0 /CV_PI)); // estimate orientation
602
599
603
- if (keypoints[k].angle < 0 .f )
604
- thetaIdx = int (FREAK_NB_ORIENTATION*keypoints[k].angle *(1 /360.0 )-0.5 );
605
- else
606
- thetaIdx = int (FREAK_NB_ORIENTATION*keypoints[k].angle *(1 /360.0 )+0.5 );
600
+ thetaIdx = cvRound (FREAK_NB_ORIENTATION*keypoints[k].angle *(1 /360.0 ));
607
601
608
602
if ( thetaIdx < 0 )
609
603
thetaIdx += FREAK_NB_ORIENTATION;
@@ -675,10 +669,10 @@ imgType FREAK_Impl::meanIntensity( InputArray _image, InputArray _integral,
675
669
// expected case:
676
670
677
671
// calculate borders
678
- const int x_left = int (xf-radius+ 0.5 );
679
- const int y_top = int (yf-radius+ 0.5 );
680
- const int x_right = int (xf+radius+1.5 );// integral image is 1px wider
681
- const int y_bottom = int (yf+radius+1.5 );// integral image is 1px higher
672
+ const int x_left = cvRound (xf-radius);
673
+ const int y_top = cvRound (yf-radius);
674
+ const int x_right = cvRound (xf+radius+1 );// integral image is 1px wider
675
+ const int y_bottom = cvRound (yf+radius+1 );// integral image is 1px higher
682
676
iiType ret_val;
683
677
684
678
ret_val = integral.at <iiType>(y_bottom,x_right);// bottom right corner
0 commit comments