Unverified Commit d1fc1c64 authored by Alexander Alekhin's avatar Alexander Alekhin Committed by GitHub
Browse files

Merge pull request #2342 from alalek:issue_9863

parents 62c969dd f452bd49
Loading
Loading
Loading
Loading
+5 −31
Original line number Diff line number Diff line
@@ -100,19 +100,7 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest
        curMaxDist = dist;
    }

    std::stringstream ss;
    ss << "Max distance between valid and computed descriptors " << curMaxDist;

    if( curMaxDist < maxDist )
      ss << "." << std::endl;

    else
    {
      ss << ">" << maxDist << " - bad accuracy!" << "\n";
      ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
    }

    ts->printf( cvtest::TS::LOG, ss.str().c_str() );
    EXPECT_LT(curMaxDist, maxDist) << "Max distance between valid and computed descriptors";
  }

  Mat readDescriptors()
@@ -286,25 +274,11 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest
      ts->printf( cvtest::TS::LOG, "\nAverage time of computing one descriptor = %g ms.\n",
                  t / ( (double) getTickFrequency() * 1000. ) / calcDescriptors.rows );

      if( calcDescriptors.rows != (int) keylines.size() )
      {
        ts->printf( cvtest::TS::LOG, "Count of computed descriptors and keylines count must be equal.\n" );
        ts->printf( cvtest::TS::LOG, "Count of keylines is            %d.\n", (int) keylines.size() );
        ts->printf( cvtest::TS::LOG, "Count of computed descriptors is %d.\n", calcDescriptors.rows );
        ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
        return;
      }
      ASSERT_EQ((int)keylines.size(), calcDescriptors.rows)
          << "Count of computed descriptors and keylines count must be equal";

      if( calcDescriptors.cols != bd->descriptorSize() / 8 || calcDescriptors.type() != bd->descriptorType() )
      {
        ts->printf( cvtest::TS::LOG, "Incorrect descriptor size or descriptor type.\n" );
        ts->printf( cvtest::TS::LOG, "Expected size is   %d.\n", bd->descriptorSize() );
        ts->printf( cvtest::TS::LOG, "Calculated size is %d.\n", calcDescriptors.cols );
        ts->printf( cvtest::TS::LOG, "Expected type is   %d.\n", bd->descriptorType() );
        ts->printf( cvtest::TS::LOG, "Calculated type is %d.\n", calcDescriptors.type() );
        ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
        return;
      }
      ASSERT_EQ(bd->descriptorSize() / 8, calcDescriptors.cols);
      ASSERT_EQ(bd->descriptorType(), calcDescriptors.type());

      // TODO read and write descriptor extractor parameters and check them
      Mat validDescriptors = readDescriptors();
+6 −6
Original line number Diff line number Diff line
@@ -29,19 +29,19 @@ CV_GMSMatcherTest::CV_GMSMatcherTest()

    //Threshold = truncate(min(acc_win32, acc_win64))
    eps[0][0] = 0.9313;
    eps[0][1] = 0.9223;
    eps[0][1] = 0.92;
    eps[0][2] = 0.9313;
    eps[0][3] = 0.9223;
    eps[0][3] = 0.92;

    eps[1][0] = 0.8199;
    eps[1][1] = 0.7964;
    eps[1][2] = 0.8199;
    eps[1][3] = 0.7964;

    eps[2][0] = 0.7098;
    eps[2][1] = 0.6659;
    eps[2][2] = 0.6939;
    eps[2][3] = 0.6457;
    eps[2][0] = 0.6;
    eps[2][1] = 0.6;
    eps[2][2] = 0.6;
    eps[2][3] = 0.6;

    correctMatchDistThreshold = 5.0;
}
+19 −28
Original line number Diff line number Diff line
@@ -352,6 +352,8 @@ protected:
        const int maxAngle = 360, angleStep = 15;
        for(int angle = 0; angle < maxAngle; angle += angleStep)
        {
            SCOPED_TRACE(cv::format("angle=%d", angle));

            Mat H = rotateImage(image0, static_cast<float>(angle), image1, mask1);

            vector<KeyPoint> keypoints1;
@@ -374,16 +376,10 @@ protected:
                }
            }

            float descInliersRatio = static_cast<float>(descInliersCount) / keypoints0.size();
            if(descInliersRatio < minDescInliersRatio)
            {
                ts->printf(cvtest::TS::LOG, "Incorrect descInliersRatio: curr = %f, min = %f.\n",
                           descInliersRatio, minDescInliersRatio);
                ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
                return;
            }
            EXPECT_GE(descInliersCount, keypoints0.size() * minDescInliersRatio)
                << "minDescInliersRatio=" << minDescInliersRatio << " keypoints0.size()=" << keypoints0.size();
#if SHOW_DEBUG_LOG
            std::cout << "descInliersRatio " << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl;
            std::cout << "angle=" << angle << " descInliersRatio=" << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl;
#endif
        }
        ts->set_failed_test_info( cvtest::TS::OK );
@@ -558,6 +554,7 @@ protected:
        for(int scaleIdx = 1; scaleIdx <= 3; scaleIdx++)
        {
            float scale = 1.f + scaleIdx * 0.5f;
            SCOPED_TRACE(cv::format("scale=%g", scale));

            Mat image1;
            resize(image0, image1, Size(), 1./scale, 1./scale, INTER_LINEAR_EXACT);
@@ -583,16 +580,10 @@ protected:
                }
            }

            float descInliersRatio = static_cast<float>(descInliersCount) / keypoints0.size();
            if(descInliersRatio < minDescInliersRatio)
            {
                ts->printf(cvtest::TS::LOG, "Incorrect descInliersRatio: curr = %f, min = %f.\n",
                           descInliersRatio, minDescInliersRatio);
                ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
                return;
            }
            EXPECT_GE(descInliersCount, keypoints0.size() * minDescInliersRatio)
                << "minDescInliersRatio=" << minDescInliersRatio << " keypoints0.size()=" << keypoints0.size();
#if SHOW_DEBUG_LOG
            std::cout << "descInliersRatio " << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl;
            std::cout << "scale=" << scale << " descInliersRatio=" << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl;
#endif
        }
        ts->set_failed_test_info( cvtest::TS::OK );
@@ -653,7 +644,7 @@ TEST(Features2d_RotationInvariance_Descriptor_LATCH, regression)
    DescriptorRotationInvarianceTest test(SIFT::create(),
                                          LATCH::create(),
                                          NORM_HAMMING,
                                          0.9999f);
                                          0.98f);
    test.safe_run();
}
#endif // NONFREE
@@ -672,7 +663,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG120, regression)
    DescriptorRotationInvarianceTest test(KAZE::create(),
                                          VGG::create(VGG::VGG_120, 1.4f, true, true, 48.0f, false),
                                          NORM_L1,
                                          1.00f);
                                          0.98f);
    test.safe_run();
}

@@ -681,7 +672,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG80, regression)
    DescriptorRotationInvarianceTest test(KAZE::create(),
                                          VGG::create(VGG::VGG_80, 1.4f, true, true, 48.0f, false),
                                          NORM_L1,
                                          1.00f);
                                          0.98f);
    test.safe_run();
}

@@ -690,7 +681,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG64, regression)
    DescriptorRotationInvarianceTest test(KAZE::create(),
                                          VGG::create(VGG::VGG_64, 1.4f, true, true, 48.0f, false),
                                          NORM_L1,
                                          1.00f);
                                          0.98f);
    test.safe_run();
}

@@ -699,7 +690,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG48, regression)
    DescriptorRotationInvarianceTest test(KAZE::create(),
                                          VGG::create(VGG::VGG_48, 1.4f, true, true, 48.0f, false),
                                          NORM_L1,
                                          1.00f);
                                          0.98f);
    test.safe_run();
}

@@ -746,7 +737,7 @@ TEST(Features2d_RotationInvariance_Descriptor_BoostDesc_BGM, regression)
    DescriptorRotationInvarianceTest test(SURF::create(),
                                          BoostDesc::create(BoostDesc::BGM,true,6.25f),
                                          NORM_HAMMING,
                                          0.999f);
                                          0.98f);
    test.safe_run();
}

@@ -773,7 +764,7 @@ TEST(Features2d_RotationInvariance_Descriptor_BoostDesc_LBGM, regression)
    DescriptorRotationInvarianceTest test(SURF::create(),
                                          BoostDesc::create(BoostDesc::LBGM,true,6.25f),
                                          NORM_L1,
                                          0.999f);
                                          0.98f);
    test.safe_run();
}

@@ -800,7 +791,7 @@ TEST(Features2d_RotationInvariance_Descriptor_BoostDesc_BINBOOST_256, regression
    DescriptorRotationInvarianceTest test(SURF::create(),
                                          BoostDesc::create(BoostDesc::BINBOOST_256,true,6.25f),
                                          NORM_HAMMING,
                                          0.999f);
                                          0.98f);
    test.safe_run();
}

@@ -819,7 +810,7 @@ TEST(Features2d_ScaleInvariance_Detector_SIFT, regression)
{
    DetectorScaleInvarianceTest test(SIFT::create(),
                                     0.69f,
                                     0.99f);
                                     0.98f);
    test.safe_run();
}

@@ -889,7 +880,7 @@ TEST(Features2d_ScaleInvariance_Descriptor_VGG120, regression)
    DescriptorScaleInvarianceTest test(KAZE::create(),
                                       VGG::create(VGG::VGG_120, 1.4f, true, true, 48.0f, false),
                                       NORM_L1,
                                       0.99f);
                                       0.98f);
    test.safe_run();
}

+2 −4
Original line number Diff line number Diff line
@@ -20,10 +20,8 @@ TEST(ximgproc_ridgedetectionfilter, ReferenceAccuracy)
    rdf->getRidgeFilteredImage(src, out);
    Mat out_cmp;
    out.convertTo(out_cmp, CV_8UC1);
    Mat sb;
    subtract(out_cmp, n_ref, sb);
    int zeros = countNonZero(sb);
    EXPECT_EQ(zeros, 0);
    EXPECT_LE(cvtest::norm(out, ref, NORM_INF), 0.0f);
    EXPECT_LE(cvtest::norm(out, ref, NORM_L2 | NORM_RELATIVE), .0f);
}

}} // namespace