Skip to content

Commit

Permalink
Merge pull request opencv#703 from MartinNowak:fix_sift_overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
alalek committed Jul 5, 2016
2 parents 30f718d + d4df727 commit 9bea717
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/xfeatures2d/src/sift.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ static void calcSIFTDescriptor( const Mat& img, Point2f ptf, float ori, float sc
float hist_width = SIFT_DESCR_SCL_FCTR * scl;
int radius = cvRound(hist_width * 1.4142135623730951f * (d + 1) * 0.5f);
// Clip the radius to the diagonal of the image to avoid autobuffer too large exception
radius = std::min(radius, (int) sqrt((double) img.cols*img.cols + img.rows*img.rows));
radius = std::min(radius, (int) sqrt(((double) img.cols)*img.cols + ((double) img.rows)*img.rows));
cos_t /= hist_width;
sin_t /= hist_width;

Expand Down

0 comments on commit 9bea717

Please sign in to comment.