Clion+vcpkg配置opencv+zbar实现C++条码检测( 二 )

<< "num_symbols = " < location;for (int i = 0; i < symbol->get_location_size(); ++i) {location.emplace_back(symbol->get_location_x(i), symbol->get_location_y(i));}cv::polylines(image, location, true, cv::Scalar(0, 255, 0), 2);}}}catch (cv::Exception& e) {std::cerr << "Error: " << e.msg << std::endl;}cv::imshow("Image", image);cv::waitKey(0);}
结果就出来了 。命令行会有很多日志,这些是有些内置的库没装上,没有任何问题 。当然如果不想看到这些,可以更改的日志等级,
[ INFO:0@0.138] global registry.impl.hpp:114 cv::highgui_backend::UIBackendRegistry::UIBackendRegistry UI: Enabled backends(4, sorted by priority): GTK(1000); GTK3(990); GTK2(980); WIN32(970) + BUILTIN(WIN32UI)[ INFO:0@0.138] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load C:\Users\62359\Desktop\study\cmake-build-debug\opencv_highgui_gtk470_64.dll => FAILED[ INFO:0@0.140] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_highgui_gtk470_64.dll => FAILED[ INFO:0@0.140] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load C:\Users\62359\Desktop\study\cmake-build-debug\opencv_highgui_gtk3470_64.dll => FAILED[ INFO:0@0.141] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_highgui_gtk3470_64.dll => FAILED[ INFO:0@0.142] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load C:\Users\62359\Desktop\study\cmake-build-debug\opencv_highgui_gtk2470_64.dll => FAILED[ INFO:0@0.143] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_highgui_gtk2470_64.dll => FAILED[ INFO:0@0.143] global backend.cpp:90 cv::highgui_backend::createUIBackend UI: using backend: WIN32 (priority=970)[ INFO:0@0.144] global window_w32.cpp:3008 cv::impl::Win32BackendUI::createWindow OpenCV/UI: Creating Win32UI window: Image (1)[ INFO:0@0.193] global registry_parallel.impl.hpp:96 cv::parallel::ParallelBackendRegistry::ParallelBackendRegistry core(parallel): Enabled backends(3, sorted by priority): ONETBB(1000); TBB(990); OPENMP(980)[ INFO:0@0.194] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load C:\Users\62359\Desktop\study\cmake-build-debug\opencv_core_parallel_onetbb470_64d.dll => FAILED[ INFO:0@0.195] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_core_parallel_onetbb470_64d.dll => FAILED[ INFO:0@0.196] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load C:\Users\62359\Desktop\study\cmake-build-debug\opencv_core_parallel_tbb470_64d.dll => FAILED[ INFO:0@0.197] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_core_parallel_tbb470_64d.dll => FAILED[ INFO:0@0.197] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load C:\Users\62359\Desktop\study\cmake-build-debug\opencv_core_parallel_openmp470_64d.dll => FAILED[ INFO:0@0.199] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_core_parallel_openmp470_64d.dll => FAILED
日志等级(用偷懒一下):
cv::LOG_LEVEL_SILENT:不输出任何日志信息cv::LOG_LEVEL_FATAL:只输出致命错误信息cv::LOG_LEVEL_ERROR:输出错误信息和致命错误信息cv::LOG_LEVEL_WARNING:输出警告、错误和致命错误信息cv::LOG_LEVEL_INFO:输出一般信息、警告、错误和致命错误信息cv::LOG_LEVEL_DEBUG:输出所有信息,包括调试信息默认情况下,OpenCV的日志级别为cv::LOG_LEVEL_INFO,会输出一般信息、警告、错误和致命错误信息 。如果您想屏蔽警告信息,可以将日志级别设置为cv::LOG_LEVEL_ERROR或cv::LOG_LEVEL_FATAL 。具体来说,您可以在程序的入口处添加以下代码:cv::utils::logging::setLogLevel(cv::utils::logging::LOG_LEVEL_ERROR);这样就可以将日志级别设置为cv::LOG_LEVEL_ERROR,只输出错误和致命错误信息,而不会输出警告信息 。