diff --git a/modules/datasets/CMakeLists.txt b/modules/datasets/CMakeLists.txt index 621e1600c..aea8eb2d0 100644 --- a/modules/datasets/CMakeLists.txt +++ b/modules/datasets/CMakeLists.txt @@ -1,4 +1,4 @@ set(the_description "datasets framework") -ocv_define_module(datasets opencv_core opencv_imgcodecs opencv_ml opencv_flann opencv_text WRAP python) +ocv_define_module(datasets opencv_core opencv_imgcodecs opencv_ml opencv_flann OPTIONAL opencv_text WRAP python) ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4267) # flann, Win64 diff --git a/modules/datasets/samples/tr_chars_benchmark.cpp b/modules/datasets/samples/tr_chars_benchmark.cpp index 034a1d4ee..ecddf839e 100644 --- a/modules/datasets/samples/tr_chars_benchmark.cpp +++ b/modules/datasets/samples/tr_chars_benchmark.cpp @@ -39,10 +39,13 @@ // //M*/ -#include "opencv2/datasets/tr_chars.hpp" +#include +#include -#include +#ifdef HAVE_OPENCV_TEXT +#include "opencv2/datasets/tr_chars.hpp" +#include #include "opencv2/text.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" @@ -127,3 +130,13 @@ int main(int argc, char *argv[]) return 0; } + +#else + +int main() +{ + std::cerr << "OpenCV was built without text module" << std::endl; + return 0; +} + +#endif // HAVE_OPENCV_TEXT diff --git a/modules/datasets/samples/tr_icdar_benchmark.cpp b/modules/datasets/samples/tr_icdar_benchmark.cpp index a8db5335d..32d9a89ff 100644 --- a/modules/datasets/samples/tr_icdar_benchmark.cpp +++ b/modules/datasets/samples/tr_icdar_benchmark.cpp @@ -39,10 +39,13 @@ // //M*/ -#include "opencv2/datasets/tr_icdar.hpp" +#include +#include -#include +#ifdef HAVE_OPENCV_TEXT +#include "opencv2/datasets/tr_icdar.hpp" +#include #include "opencv2/text.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" @@ -50,8 +53,6 @@ #include #include // atoi -#include - #include #include @@ -509,3 +510,13 @@ int main(int argc, char *argv[]) return 0; } + +#else + +int main() +{ + std::cerr << "OpenCV was built without text module" << std::endl; + return 0; +} + +#endif // HAVE_OPENCV_TEXT diff --git a/modules/datasets/samples/tr_svt_benchmark.cpp b/modules/datasets/samples/tr_svt_benchmark.cpp index 2f93c845d..c108249f6 100644 --- a/modules/datasets/samples/tr_svt_benchmark.cpp +++ b/modules/datasets/samples/tr_svt_benchmark.cpp @@ -39,10 +39,13 @@ // //M*/ -#include "opencv2/datasets/tr_svt.hpp" +#include +#include -#include +#ifdef HAVE_OPENCV_TEXT +#include "opencv2/datasets/tr_svt.hpp" +#include #include "opencv2/text.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" @@ -50,8 +53,6 @@ #include #include // atoi -#include - #include #include @@ -309,3 +310,13 @@ int main(int argc, char *argv[]) return 0; } + +#else + +int main() +{ + std::cerr << "OpenCV was built without text module" << std::endl; + return 0; +} + +#endif // HAVE_OPENCV_TEXT