Commit 35972a1e authored by Alexander Alekhin's avatar Alexander Alekhin

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

parents 64961f37 d1fc1c64
...@@ -100,19 +100,7 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest ...@@ -100,19 +100,7 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest
curMaxDist = dist; curMaxDist = dist;
} }
std::stringstream ss; EXPECT_LT(curMaxDist, maxDist) << "Max distance between valid and computed descriptors";
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() );
} }
Mat readDescriptors() Mat readDescriptors()
...@@ -286,25 +274,11 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest ...@@ -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", ts->printf( cvtest::TS::LOG, "\nAverage time of computing one descriptor = %g ms.\n",
t / ( (double) getTickFrequency() * 1000. ) / calcDescriptors.rows ); t / ( (double) getTickFrequency() * 1000. ) / calcDescriptors.rows );
if( calcDescriptors.rows != (int) keylines.size() ) ASSERT_EQ((int)keylines.size(), calcDescriptors.rows)
{ << "Count of computed descriptors and keylines count must be equal";
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;
}
if( calcDescriptors.cols != bd->descriptorSize() / 8 || calcDescriptors.type() != bd->descriptorType() ) ASSERT_EQ(bd->descriptorSize() / 8, calcDescriptors.cols);
{ ASSERT_EQ(bd->descriptorType(), calcDescriptors.type());
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;
}
// TODO read and write descriptor extractor parameters and check them // TODO read and write descriptor extractor parameters and check them
Mat validDescriptors = readDescriptors(); Mat validDescriptors = readDescriptors();
......
...@@ -135,13 +135,6 @@ struct GPCTrainingParams ...@@ -135,13 +135,6 @@ struct GPCTrainingParams
CV_Assert( check() ); CV_Assert( check() );
} }
GPCTrainingParams( const GPCTrainingParams &params )
: maxTreeDepth( params.maxTreeDepth ), minNumberOfSamples( params.minNumberOfSamples ), descriptorType( params.descriptorType ),
printProgress( params.printProgress )
{
CV_Assert( check() );
}
bool check() const { return maxTreeDepth > 1 && minNumberOfSamples > 1; } bool check() const { return maxTreeDepth > 1 && minNumberOfSamples > 1; }
}; };
......
...@@ -7,5 +7,8 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS -Winconsistent-missing-override -Wsuggest-o ...@@ -7,5 +7,8 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS -Winconsistent-missing-override -Wsuggest-o
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0) if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wclass-memaccess) ocv_warnings_disable(CMAKE_CXX_FLAGS -Wclass-memaccess)
endif() endif()
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wdeprecated-copy)
endif()
add_subdirectory(libmv) add_subdirectory(libmv)
\ No newline at end of file
...@@ -82,10 +82,10 @@ static KeyType hashPPF(const Vec4d& f, const double AngleStep, const double Dist ...@@ -82,10 +82,10 @@ static KeyType hashPPF(const Vec4d& f, const double AngleStep, const double Dist
(int)(f[1] / AngleStep), (int)(f[1] / AngleStep),
(int)(f[2] / AngleStep), (int)(f[2] / AngleStep),
(int)(f[3] / DistanceStep)); (int)(f[3] / DistanceStep));
KeyType hashKey = 0; KeyType hashKey[2] = {0, 0}; // hashMurmurx64() fills two values
murmurHash(key.val, 4*sizeof(int), 42, &hashKey); murmurHash(key.val, 4*sizeof(int), 42, &hashKey[0]);
return hashKey; return hashKey[0];
} }
/*static size_t hashMurmur(uint key) /*static size_t hashMurmur(uint key)
......
...@@ -37,10 +37,10 @@ CV_GMSMatcherTest::CV_GMSMatcherTest() ...@@ -37,10 +37,10 @@ CV_GMSMatcherTest::CV_GMSMatcherTest()
eps[1][2] = 0.80; eps[1][2] = 0.80;
eps[1][3] = 0.78; eps[1][3] = 0.78;
eps[2][0] = 0.70; eps[2][0] = 0.6;
eps[2][1] = 0.66; eps[2][1] = 0.6;
eps[2][2] = 0.68; eps[2][2] = 0.6;
eps[2][3] = 0.63; eps[2][3] = 0.6;
correctMatchDistThreshold = 5.0; correctMatchDistThreshold = 5.0;
} }
......
...@@ -33,7 +33,7 @@ INSTANTIATE_TEST_CASE_P(SIFT, DescriptorRotationInvariance, Values( ...@@ -33,7 +33,7 @@ INSTANTIATE_TEST_CASE_P(SIFT, DescriptorRotationInvariance, Values(
)); ));
INSTANTIATE_TEST_CASE_P(LATCH, DescriptorRotationInvariance, Values( INSTANTIATE_TEST_CASE_P(LATCH, DescriptorRotationInvariance, Values(
make_tuple(IMAGE_TSUKUBA, SIFT::create(), LATCH::create(), 0.9999f) make_tuple(IMAGE_TSUKUBA, SIFT::create(), LATCH::create(), 0.98f)
)); ));
#endif // NONFREE #endif // NONFREE
...@@ -154,7 +154,6 @@ INSTANTIATE_TEST_CASE_P(BoostDesc_BINBOOST_256, DescriptorRotationInvariance, Va ...@@ -154,7 +154,6 @@ INSTANTIATE_TEST_CASE_P(BoostDesc_BINBOOST_256, DescriptorRotationInvariance, Va
// ============================ SCALE INVARIANCE ============================== // ============================ SCALE INVARIANCE ==============================
#ifdef OPENCV_ENABLE_NONFREE #ifdef OPENCV_ENABLE_NONFREE
INSTANTIATE_TEST_CASE_P(SURF, DetectorScaleInvariance, Values( INSTANTIATE_TEST_CASE_P(SURF, DetectorScaleInvariance, Values(
make_tuple(IMAGE_BIKES, SURF::create(), 0.64f, 0.84f) make_tuple(IMAGE_BIKES, SURF::create(), 0.64f, 0.84f)
...@@ -284,6 +283,7 @@ TEST(Features2d_RotationInvariance2_Detector_SURF, regression) ...@@ -284,6 +283,7 @@ TEST(Features2d_RotationInvariance2_Detector_SURF, regression)
ASSERT_LT(fabs(keypoints[i1].response - keypoints[i].response) / keypoints[i1].response, 1e-6); ASSERT_LT(fabs(keypoints[i1].response - keypoints[i].response) / keypoints[i1].response, 1e-6);
} }
} }
#endif // NONFREE #endif // NONFREE
}} // namespace }} // namespace
...@@ -37,16 +37,24 @@ ...@@ -37,16 +37,24 @@
// //
//M*/ //M*/
#include "precomp.hpp"
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include <iostream> #include <iostream>
#include <cmath> #include <cmath>
#include "precomp.hpp"
#include "advanced_types.hpp" #include "advanced_types.hpp"
#ifdef CV_CXX11
#define CV_USE_PARALLEL_PREDICT_EDGES_1 1
#define CV_USE_PARALLEL_PREDICT_EDGES_2 0 //1, see https://github.com/opencv/opencv_contrib/issues/2346
#else
#define CV_USE_PARALLEL_PREDICT_EDGES_1 0
#define CV_USE_PARALLEL_PREDICT_EDGES_2 0
#endif
/********************* Helper functions *********************/ /********************* Helper functions *********************/
/*! /*!
...@@ -730,7 +738,7 @@ protected: ...@@ -730,7 +738,7 @@ protected:
} }
// lookup tables for mapping linear index to offset pairs // lookup tables for mapping linear index to offset pairs
#ifdef CV_CXX11 #if CV_USE_PARALLEL_PREDICT_EDGES_1
parallel_for_(cv::Range(0, height), [&](const cv::Range& range) parallel_for_(cv::Range(0, height), [&](const cv::Range& range)
#else #else
const cv::Range range(0, height); const cv::Range range(0, height);
...@@ -779,7 +787,7 @@ protected: ...@@ -779,7 +787,7 @@ protected:
} }
} }
} }
#ifdef CV_CXX11 #if CV_USE_PARALLEL_PREDICT_EDGES_1
); );
#endif #endif
...@@ -788,8 +796,10 @@ protected: ...@@ -788,8 +796,10 @@ protected:
dstM.setTo(0); dstM.setTo(0);
float step = 2.0f * CV_SQR(stride) / CV_SQR(ipSize) / nTreesEval; float step = 2.0f * CV_SQR(stride) / CV_SQR(ipSize) / nTreesEval;
#ifdef CV_CXX11 #if CV_USE_PARALLEL_PREDICT_EDGES_2
parallel_for_(cv::Range(0, height), [&](const cv::Range& range) parallel_for_(cv::Range(0, height), [&](const cv::Range& range)
#elif CV_USE_PARALLEL_PREDICT_EDGES_1
const cv::Range range(0, height);
#endif #endif
{ {
for(int i = range.start; i < range.end; ++i) for(int i = range.start; i < range.end; ++i)
...@@ -816,7 +826,7 @@ protected: ...@@ -816,7 +826,7 @@ protected:
} }
} }
} }
#ifdef CV_CXX11 #if CV_USE_PARALLEL_PREDICT_EDGES_2
); );
#endif #endif
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
namespace opencv_test { namespace { namespace opencv_test { namespace {
TEST(ximpgroc_Edgeboxes, DISABLED_regression) TEST(ximgproc_Edgeboxes, regression)
{ {
//Testing Edgeboxes implementation by asking for one proposal //Testing Edgeboxes implementation by asking for one proposal
//on a simple test image from the PASCAL VOC 2012 dataset. //on a simple test image from the PASCAL VOC 2012 dataset.
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace opencv_test { namespace { namespace opencv_test { namespace {
TEST(ximpgroc_fourierdescriptors,test_FD_AND_FIT) TEST(ximgproc_fourierdescriptors,test_FD_AND_FIT)
{ {
Mat fd; Mat fd;
vector<Point2f> ctr(16); vector<Point2f> ctr(16);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace opencv_test { namespace { namespace opencv_test { namespace {
TEST(ximpgroc_matchcolortemplate,test_QFFT) TEST(ximgproc_matchcolortemplate,test_QFFT)
{ {
String openCVExtraDir = cvtest::TS::ptr()->get_data_path(); String openCVExtraDir = cvtest::TS::ptr()->get_data_path();
String dataPath = openCVExtraDir; String dataPath = openCVExtraDir;
...@@ -58,7 +58,7 @@ TEST(ximpgroc_matchcolortemplate,test_QFFT) ...@@ -58,7 +58,7 @@ TEST(ximpgroc_matchcolortemplate,test_QFFT)
} }
} }
TEST(ximpgroc_matchcolortemplate, test_COLORMATCHTEMPLATE) TEST(ximgproc_matchcolortemplate, test_COLORMATCHTEMPLATE)
{ {
String openCVExtraDir = cvtest::TS::ptr()->get_data_path(); String openCVExtraDir = cvtest::TS::ptr()->get_data_path();
String dataPath = openCVExtraDir + "cv/ximgproc/corr.yml.gz"; String dataPath = openCVExtraDir + "cv/ximgproc/corr.yml.gz";
......
...@@ -20,10 +20,8 @@ TEST(ximgproc_ridgedetectionfilter, ReferenceAccuracy) ...@@ -20,10 +20,8 @@ TEST(ximgproc_ridgedetectionfilter, ReferenceAccuracy)
rdf->getRidgeFilteredImage(src, out); rdf->getRidgeFilteredImage(src, out);
Mat out_cmp; Mat out_cmp;
out.convertTo(out_cmp, CV_8UC1); out.convertTo(out_cmp, CV_8UC1);
Mat sb; EXPECT_LE(cvtest::norm(out, ref, NORM_INF), 0.0f);
subtract(out_cmp, n_ref, sb); EXPECT_LE(cvtest::norm(out, ref, NORM_L2 | NORM_RELATIVE), .0f);
int zeros = countNonZero(sb);
EXPECT_EQ(zeros, 0);
} }
}} // namespace }} // namespace
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
namespace opencv_test { namespace { namespace opencv_test { namespace {
TEST(ximpgroc_StructuredEdgeDetection, regression) TEST(ximgproc_StructuredEdgeDetection, regression)
{ {
cv::String subfolder = "cv/ximgproc/"; cv::String subfolder = "cv/ximgproc/";
cv::String dir = cvtest::TS::ptr()->get_data_path() + subfolder; cv::String dir = cvtest::TS::ptr()->get_data_path() + subfolder;
......
...@@ -18,7 +18,7 @@ static int createTestImage(Mat& src) ...@@ -18,7 +18,7 @@ static int createTestImage(Mat& src)
return src_pixels; return src_pixels;
} }
TEST(ximpgroc_Thinning, simple_ZHANGSUEN) TEST(ximgproc_Thinning, simple_ZHANGSUEN)
{ {
Mat src; Mat src;
int src_pixels = createTestImage(src); int src_pixels = createTestImage(src);
...@@ -33,7 +33,7 @@ TEST(ximpgroc_Thinning, simple_ZHANGSUEN) ...@@ -33,7 +33,7 @@ TEST(ximpgroc_Thinning, simple_ZHANGSUEN)
#endif #endif
} }
TEST(ximpgroc_Thinning, simple_GUOHALL) TEST(ximgproc_Thinning, simple_GUOHALL)
{ {
Mat src; Mat src;
int src_pixels = createTestImage(src); int src_pixels = createTestImage(src);
......
...@@ -103,7 +103,7 @@ Training pipeline ...@@ -103,7 +103,7 @@ Training pipeline
-# The final step is converting trained model from Matlab binary format to YAML which you can use -# The final step is converting trained model from Matlab binary format to YAML which you can use
with our ocv::StructuredEdgeDetection. For this purpose run with our ocv::StructuredEdgeDetection. For this purpose run
opencv_contrib/ximpgroc/tutorials/scripts/modelConvert(model, "model.yml") opencv_contrib/ximgproc/tutorials/scripts/modelConvert(model, "model.yml")
How to use your model How to use your model
--------------------- ---------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment