From aafda8fa665ae5d11c10c0977ba16f0958eb6566 Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Wed, 22 Jul 2015 16:00:38 +0300 Subject: [PATCH] Fixing GCC 4.9 warning --- modules/xfeatures2d/src/stardetector.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/xfeatures2d/src/stardetector.cpp b/modules/xfeatures2d/src/stardetector.cpp index 91df25f67..13d80de09 100644 --- a/modules/xfeatures2d/src/stardetector.cpp +++ b/modules/xfeatures2d/src/stardetector.cpp @@ -144,8 +144,9 @@ StarDetectorComputeResponses( const Mat& img, Mat& responses, Mat& sizes, { const int MAX_PATTERN = 17; static const int sizes0[] = {1, 2, 3, 4, 6, 8, 11, 12, 16, 22, 23, 32, 45, 46, 64, 90, 128, -1}; - static const int pairs[][2] = {{1, 0}, {3, 1}, {4, 2}, {5, 3}, {7, 4}, {8, 5}, {9, 6}, - {11, 8}, {13, 10}, {14, 11}, {15, 12}, {16, 14}, {-1, -1}}; + static const int pairs[12][2] = {{1, 0}, {3, 1}, {4, 2}, {5, 3}, {7, 4}, {8, 5}, {9, 6}, + {11, 8}, {13, 10}, {14, 11}, {15, 12}, {16, 14}}; + const int MAX_PAIR = sizeof(pairs)/sizeof(pairs[0]); float invSizes[MAX_PATTERN][2]; int sizes1[MAX_PATTERN]; @@ -172,14 +173,15 @@ StarDetectorComputeResponses( const Mat& img, Mat& responses, Mat& sizes, responses.create( img.size(), CV_32F ); sizes.create( img.size(), CV_16S ); - while( pairs[npatterns][0] >= 0 && ! + while( npatterns < MAX_PAIR && ! ( sizes0[pairs[npatterns][0]] >= maxSize || sizes0[pairs[npatterns+1][0]] + sizes0[pairs[npatterns+1][0]]/2 >= std::min(rows, cols) ) ) { ++npatterns; } - npatterns += (pairs[npatterns-1][0] >= 0); + if (npatterns-1 < MAX_PAIR) + ++npatterns; maxIdx = pairs[npatterns-1][0]; // Create the integral image appropriate for our type & usage