diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-04-29 18:34:46 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-04-29 18:34:55 +0200 |
commit | ce79d1556bf8d43665694d7dd75571a79d175615 (patch) | |
tree | af2863d3dd863e1d4ff598f9c9dd70c86bb1bcd3 /cv/init.cpp | |
parent | f8e54403c3c30bf87491d310afd827a2d7cb7f16 (diff) |
cv: gather common init code
Diffstat (limited to 'cv/init.cpp')
-rw-r--r-- | cv/init.cpp | 23 |
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 +} |