summaryrefslogtreecommitdiffhomepage
path: root/cv/init.cpp
blob: c9c4650f12a8b79c3fddd6a45cc3fbfed4b6d652 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
}