Posts Tagged With ‘opencv&8217


Disable OpenCV Logging

When we use OpenCV from command line process, sometimes OpenCV will print internal logging messages such as:

[ INFO:0] global .\opencv-master\sources\modules\core\src\parallel\registry_parallel.impl.hpp (90) cv::parallel::ParallelBackendRegistry::ParallelBackendRegistry core(parallel): Enabled backends(2, sorted by priority): TBB(1000); OPENMP(990)
[ INFO:0] global .\opencv-master\sources\modules\core\include\opencv2/core/parallel/backend/parallel_for.tbb.hpp (54) cv::parallel::tbb::ParallelForBackend::ParallelForBackend Initializing TBB parallel backend: TBB_INTERFACE_VERSION=12010
[ INFO:0] global .\opencv-master\sources\modules\core\src\parallel\parallel.cpp (73) cv::parallel::createParallelForAPI core(parallel): using backend: TBB (priority=1000)

This might be useful while debugging OpenCV problems but it is a noise if we want to print our own messages to the console. In this case, it is desirable to disable the internal OpenCV logging using the following code:

#include "opencv2/core/utils/logger.hpp"

int main()
{
    cv::utils::logging::setLogLevel(cv::utils::logging::LogLevel::LOG_LEVEL_SILENT);

    return 1;
}