build opencv with qt to make debugging easier
最近发现使用自己编译的opencv,可以增强opencv的imshow函数功能。从哪里得到的线索已经忘记了。可能是无意中发现的某一张截图吧。
要实现cv::imshow函数功能增强,需要在cmake中配置使用qt。
编译及使用,见视频:
# testProj.pro QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target INCLUDEPATH += D:/data/playGround/install_opencv_from_source/opencv-4.5.0-build/install/include LIBS += D:/data/playGround/install_opencv_from_source/opencv-4.5.0-build/install/x64/vc15/lib/opencv_world450d.lib
// main.cpp #include "mainwindow.h" #include <QApplication> #include "opencv2/opencv.hpp" int main(int argc, char *argv[]) { // QApplication a(argc, argv); // MainWindow w; // w.show(); // return a.exec(); cv::Mat image = cv::imread("D:/dog.jfif"); cv::namedWindow("img", cv::WINDOW_NORMAL); cv::imshow("img", image); cv::waitKey(); cv::destroyAllWindows(); return 0; }
building detail
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具