summaryrefslogtreecommitdiffhomepage
path: root/cv/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cv/init.cpp')
-rw-r--r--cv/init.cpp23
1 files changed, 23 insertions, 0 deletions
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 <type_traits>
+#include <opencv2/core.hpp>
+
+[[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
+}