为了尝试Opencv4.5的contrib中新增的微信扫码功能(wechat_qrcode),在编译好新的Opencv库之后,发现新版的Opencv写的程序会自动输出一堆log日志,如果是有用的信息还用,主要是大部分都是没用的信息,如下图所示,身患强迫症的我真正忍不了。
输出日志
后来在网上查阅了很多资料之后,才找到了隐藏日志的方法
首先包含头文件

#include <opencv2/core/utils/logger.hpp>

然后调用setLogLevel函数

cv::utils::logging::setLogLevel(utils::logging::LOG_LEVEL_SILENT);

完成这两步,程序就不会再输出日志

如果想要输入特定级别的日志,可以这样设置

utils::logging::setLogLevel(utils::logging::LOG_LEVEL_ERROR);

设置为LOG_LEVEL_ERROR,程序就只会输出error级别的日志信息

GitHub 加速计划 / opencv31 / opencv
159
15
下载
OpenCV: 开源计算机视觉库
最近提交(Master分支:4 个月前 )
fc994a6a Feature: weighted Hough Transform #21407 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV - [x] The PR is proposed to proper branch - [x] There is reference to original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake 15 小时前
2aee9475 Fix for png durations and memory leak #26714 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake 17 小时前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐