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









posted on   yusisc  阅读(25)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示