From 43ab2d8f39eea84de7961aad7aee6941a5947f2a Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 9 Nov 2018 18:57:34 +0300 Subject: [PATCH] cuda: disable code using obsolete objdetect API --- modules/cudalegacy/src/cuda/NCVHaarObjectDetection.cu | 8 +++----- modules/cudalegacy/test/test_nvidia.cpp | 4 ++-- modules/cudaobjdetect/src/cascadeclassifier.cpp | 2 +- modules/cudaobjdetect/test/test_objdetect.cpp | 10 +++++----- modules/cudaoptflow/CMakeLists.txt | 2 +- modules/cudaoptflow/perf/perf_optflow.cpp | 2 +- modules/cudaoptflow/perf/perf_precomp.hpp | 1 + modules/cudaoptflow/test/test_optflow.cpp | 2 +- modules/cudaoptflow/test/test_precomp.hpp | 1 + 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/cudalegacy/src/cuda/NCVHaarObjectDetection.cu b/modules/cudalegacy/src/cuda/NCVHaarObjectDetection.cu index cba425bb2c1..eb63472ccaf 100644 --- a/modules/cudalegacy/src/cuda/NCVHaarObjectDetection.cu +++ b/modules/cudalegacy/src/cuda/NCVHaarObjectDetection.cu @@ -66,7 +66,7 @@ #ifdef HAVE_OPENCV_OBJDETECT # include "opencv2/objdetect.hpp" -# include "opencv2/objdetect/objdetect_c.h" +//# include "opencv2/objdetect/objdetect_c.h" #endif #include "opencv2/cudalegacy/NCV.hpp" @@ -2112,15 +2112,13 @@ static NCVStatus loadFromXML(const cv::String &filename, std::vector &haarClassifierNodes, std::vector &haarFeatures) { -#ifndef HAVE_OPENCV_OBJDETECT CV_UNUSED(filename); CV_UNUSED(haar); CV_UNUSED(haarStages); CV_UNUSED(haarClassifierNodes); CV_UNUSED(haarFeatures); - CV_Error(cv::Error::StsNotImplemented, "This functionality requires objdetect module"); - return NCV_HAAR_XML_LOADING_EXCEPTION; -#else + CV_Error(cv::Error::StsNotImplemented, "Loading from XML file is not available"); +#if 0 // CvLoad is not available since OpenCV 4.0 NCVStatus ncvStat; haar.NumStages = 0; diff --git a/modules/cudalegacy/test/test_nvidia.cpp b/modules/cudalegacy/test/test_nvidia.cpp index f1df44e1ada..b1305bec48e 100644 --- a/modules/cudalegacy/test/test_nvidia.cpp +++ b/modules/cudalegacy/test/test_nvidia.cpp @@ -116,14 +116,14 @@ CUDA_TEST_P(NCV, VectorOperations) ASSERT_TRUE(res); } -CUDA_TEST_P(NCV, HaarCascadeLoader) +CUDA_TEST_P(NCV, DISABLED_HaarCascadeLoader) { bool res = nvidia_NCV_Haar_Cascade_Loader(_path, nvidiaTestOutputLevel); ASSERT_TRUE(res); } -CUDA_TEST_P(NCV, HaarCascadeApplication) +CUDA_TEST_P(NCV, DISABLED_HaarCascadeApplication) { bool res = nvidia_NCV_Haar_Cascade_Application(_path, nvidiaTestOutputLevel); diff --git a/modules/cudaobjdetect/src/cascadeclassifier.cpp b/modules/cudaobjdetect/src/cascadeclassifier.cpp index c264e182f3b..d15a09fdacb 100644 --- a/modules/cudaobjdetect/src/cascadeclassifier.cpp +++ b/modules/cudaobjdetect/src/cascadeclassifier.cpp @@ -41,7 +41,7 @@ //M*/ #include "precomp.hpp" -#include "opencv2/objdetect/objdetect_c.h" +#define CUDA_DISABLER //#include "opencv2/objdetect/objdetect_c.h" using namespace cv; using namespace cv::cuda; diff --git a/modules/cudaobjdetect/test/test_objdetect.cpp b/modules/cudaobjdetect/test/test_objdetect.cpp index 724be942ba0..e9ba15a2115 100644 --- a/modules/cudaobjdetect/test/test_objdetect.cpp +++ b/modules/cudaobjdetect/test/test_objdetect.cpp @@ -263,7 +263,7 @@ CUDA_TEST_P(CalTech, HOG) #endif } -INSTANTIATE_TEST_CASE_P(detect, CalTech, testing::Combine(ALL_DEVICES, +INSTANTIATE_TEST_CASE_P(DISABLED_detect, CalTech, testing::Combine(ALL_DEVICES, ::testing::Values("caltech/image_00000009_0.png", "caltech/image_00000032_0.png", "caltech/image_00000165_0.png", "caltech/image_00000261_0.png", "caltech/image_00000469_0.png", "caltech/image_00000527_0.png", "caltech/image_00000574_0.png"))); @@ -325,7 +325,7 @@ CUDA_TEST_P(Hog_var, HOG) cpu_hog.compute(c_img, cpu_desc_vec, win_stride, Size(0,0)); } -INSTANTIATE_TEST_CASE_P(detect, Hog_var, testing::Combine(ALL_DEVICES, +INSTANTIATE_TEST_CASE_P(DISABLED_detect, Hog_var, testing::Combine(ALL_DEVICES, ::testing::Values("/hog/road.png"))); struct Hog_var_cell : public ::testing::TestWithParam > @@ -465,7 +465,7 @@ CUDA_TEST_P(Hog_var_cell, HOG) //------------------------------------------------------------------------------ } -INSTANTIATE_TEST_CASE_P(detect, Hog_var_cell, testing::Combine(ALL_DEVICES, +INSTANTIATE_TEST_CASE_P(DISABLED_detect, Hog_var_cell, testing::Combine(ALL_DEVICES, ::testing::Values("/hog/road.png"))); ////////////////////////////////////////////////////////////////////////////////////////// /// LBP classifier @@ -494,7 +494,7 @@ CUDA_TEST_P(LBP_Read_classifier, Accuracy) ASSERT_FALSE(d_cascade.empty()); } -INSTANTIATE_TEST_CASE_P(CUDA_ObjDetect, LBP_Read_classifier, +INSTANTIATE_TEST_CASE_P(DISABLED_CUDA_ObjDetect, LBP_Read_classifier, testing::Combine(ALL_DEVICES, testing::Values(0))); @@ -555,7 +555,7 @@ CUDA_TEST_P(LBP_classify, Accuracy) #endif } -INSTANTIATE_TEST_CASE_P(CUDA_ObjDetect, LBP_classify, +INSTANTIATE_TEST_CASE_P(DISABLED_CUDA_ObjDetect, LBP_classify, testing::Combine(ALL_DEVICES, testing::Values(0))); diff --git a/modules/cudaoptflow/CMakeLists.txt b/modules/cudaoptflow/CMakeLists.txt index d40dc97e9b9..88c98b044d4 100644 --- a/modules/cudaoptflow/CMakeLists.txt +++ b/modules/cudaoptflow/CMakeLists.txt @@ -6,4 +6,4 @@ set(the_description "CUDA-accelerated Optical Flow") ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow) -ocv_define_module(cudaoptflow opencv_video opencv_cudaarithm opencv_cudawarping opencv_cudaimgproc OPTIONAL opencv_cudalegacy WRAP python) +ocv_define_module(cudaoptflow opencv_video opencv_optflow opencv_cudaarithm opencv_cudawarping opencv_cudaimgproc OPTIONAL opencv_cudalegacy WRAP python) diff --git a/modules/cudaoptflow/perf/perf_optflow.cpp b/modules/cudaoptflow/perf/perf_optflow.cpp index a17083e14ce..f4edf763ecd 100644 --- a/modules/cudaoptflow/perf/perf_optflow.cpp +++ b/modules/cudaoptflow/perf/perf_optflow.cpp @@ -316,7 +316,7 @@ PERF_TEST_P(ImagePair, OpticalFlowDual_TVL1, { cv::Mat flow; - cv::Ptr alg = cv::createOptFlow_DualTVL1(); + cv::Ptr alg = cv::optflow::createOptFlow_DualTVL1(); alg->setMedianFiltering(1); alg->setInnerIterations(1); alg->setOuterIterations(300); diff --git a/modules/cudaoptflow/perf/perf_precomp.hpp b/modules/cudaoptflow/perf/perf_precomp.hpp index 5816c98583c..2561e930edf 100644 --- a/modules/cudaoptflow/perf/perf_precomp.hpp +++ b/modules/cudaoptflow/perf/perf_precomp.hpp @@ -48,6 +48,7 @@ #include "opencv2/cudaoptflow.hpp" #include "opencv2/cudaarithm.hpp" #include "opencv2/video.hpp" +#include "opencv2/optflow.hpp" namespace opencv_test { using namespace perf; diff --git a/modules/cudaoptflow/test/test_optflow.cpp b/modules/cudaoptflow/test/test_optflow.cpp index c8564743634..f22bdc2765c 100644 --- a/modules/cudaoptflow/test/test_optflow.cpp +++ b/modules/cudaoptflow/test/test_optflow.cpp @@ -385,7 +385,7 @@ CUDA_TEST_P(OpticalFlowDual_TVL1, Accuracy) cv::cuda::GpuMat d_flow; d_alg->calc(loadMat(frame0), loadMat(frame1), d_flow); - cv::Ptr alg = cv::createOptFlow_DualTVL1(); + cv::Ptr alg = cv::optflow::createOptFlow_DualTVL1(); alg->setMedianFiltering(1); alg->setInnerIterations(1); alg->setOuterIterations(d_alg->getNumIterations()); diff --git a/modules/cudaoptflow/test/test_precomp.hpp b/modules/cudaoptflow/test/test_precomp.hpp index ccfff0680ff..415a067cd44 100644 --- a/modules/cudaoptflow/test/test_precomp.hpp +++ b/modules/cudaoptflow/test/test_precomp.hpp @@ -48,6 +48,7 @@ #include "opencv2/cudaoptflow.hpp" #include "opencv2/cudaarithm.hpp" #include "opencv2/video.hpp" +#include "opencv2/optflow.hpp" #include "cvconfig.h"