Skip to content

Commit 9bea717

Browse files
committed
Merge pull request #703 from MartinNowak:fix_sift_overflow
2 parents 30f718d + d4df727 commit 9bea717

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/xfeatures2d/src/sift.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ static void calcSIFTDescriptor( const Mat& img, Point2f ptf, float ori, float sc
579579
float hist_width = SIFT_DESCR_SCL_FCTR * scl;
580580
int radius = cvRound(hist_width * 1.4142135623730951f * (d + 1) * 0.5f);
581581
// Clip the radius to the diagonal of the image to avoid autobuffer too large exception
582-
radius = std::min(radius, (int) sqrt((double) img.cols*img.cols + img.rows*img.rows));
582+
radius = std::min(radius, (int) sqrt(((double) img.cols)*img.cols + ((double) img.rows)*img.rows));
583583
cos_t /= hist_width;
584584
sin_t /= hist_width;
585585

0 commit comments

Comments
 (0)