Merge pull request #16827 from alalek:update_buffer_area
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Tue, 17 Mar 2020 10:12:47 +0000 (10:12 +0000)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Tue, 17 Mar 2020 10:12:47 +0000 (10:12 +0000)
modules/features2d/src/kaze/AKAZEFeatures.cpp
modules/objdetect/src/qrcode.cpp
modules/objdetect/test/test_qrcode.cpp

index 9b0d831..89cf66b 100644 (file)
@@ -1323,6 +1323,7 @@ void quantized_counting_sort(const float a[], const int n,
                              const float quantum, const int nkeys,
                              int idx[/*n*/], int cum[/*nkeys + 1*/])
 {
+  CV_Assert(nkeys > 0);
   memset(cum, 0, sizeof(cum[0]) * (nkeys + 1));
 
   // Count up the quantized values
index f99a46c..4990dfd 100644 (file)
@@ -1608,6 +1608,8 @@ bool QRDetectMulti::checkPoints(const vector<Point2f>& quadrangle_points)
             li2++;
         }
     }
+    if (count_w == 0)
+        return false;
 
     double frac = double(count_b) / double(count_w);
     double bottom_bound = 0.76;
index cda5a02..79a060d 100644 (file)
@@ -284,7 +284,7 @@ TEST_P(Objdetect_QRCode_Close, regression)
     ASSERT_FALSE(corners.empty());
     ASSERT_FALSE(decoded_info.empty());
 #else
-    ASSERT_TRUE(qrcode.detect(src, corners));
+    ASSERT_TRUE(qrcode.detect(barcode, corners));
 #endif
 
     const std::string dataset_config = findDataFile(root + "dataset_config.json");
@@ -349,7 +349,7 @@ TEST_P(Objdetect_QRCode_Monitor, regression)
     ASSERT_FALSE(corners.empty());
     ASSERT_FALSE(decoded_info.empty());
 #else
-    ASSERT_TRUE(qrcode.detect(src, corners));
+    ASSERT_TRUE(qrcode.detect(barcode, corners));
 #endif
 
     const std::string dataset_config = findDataFile(root + "dataset_config.json");