From ce79d1556bf8d43665694d7dd75571a79d175615 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 29 Apr 2019 18:34:46 +0200 Subject: cv: gather common init code --- cv/init.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 cv/init.cpp (limited to 'cv/init.cpp') diff --git a/cv/init.cpp b/cv/init.cpp new file mode 100644 index 00000000..c9c4650f --- /dev/null +++ b/cv/init.cpp @@ -0,0 +1,23 @@ +#include "init.hpp" +#include +#include + +[[noreturn]] +static +int error_handler(int, const char* fn, const char* msg, const char* filename, int line, void*) +{ + fprintf(stderr, "[%s:%d] opencv: %s at %s\n", filename, line, msg, fn); + fflush(stderr); + std::abort(); +} + +void opencv_init() +{ + cv::redirectError(error_handler); + cv::setBreakOnError(false); + cv::setNumThreads(1); +#ifdef OTR_HAS_CV_IPP + cv::ipp::setUseIPP(true); + cv::ipp::setUseIPP_NotExact(true); +#endif +} -- cgit v1.2.3