简体   繁体   English

如何使用Qt在Opencv 2.4.9中创建工具栏

[英]How to create a Toolbar in Opencv 2.4.9 with Qt

I'm trying to follow this exemple but I'm stuck where the documentation don't show how to actually create the toolbar they're showing ... 我正在尝试遵循这个示例,但是我陷在文档未显示如何实际创建它们所显示的工具栏的地方。

(I'm working on Visual Studio 2013 with OpenCV 2.4.9 on a 64bit based aplication) (我正在基于64位的应用程序上使用带有OpenCV 2.4.9的Visual Studio 2013)

Am I missing something ? 我想念什么吗?

EDIT : Here's a picture of the Toolbar(left), next to a Trackbar. 编辑:这是跟踪栏旁边的工具栏(左)的图片。 Please, if there is still confusion, tell me before downvoting so I can explain more. 请,如果仍然有混淆,请在投票之前告诉我,以便我进一步解释。 <-工具栏|轨迹栏->

You can't create a toolbar. 您无法创建工具栏。 The toolbar is created automatically by the OpenCV highgui module in every "NamedWindow" if OpenCV is compiled with Qt support. 如果OpenCV是在Qt支持下编译的,则工具栏是由OpenCV highgui模块在每个“ NamedWindow”中自动创建的。 If you can't see this toolbars you should re-build OpenCV with Qt support . 如果看不到此工具栏,则应使用Qt support重新构建OpenCV。 To do so, build OpenCV from source (by using CMAKE) and make sure the option WITH_QT is set. 为此,请从源代码构建OpenCV(使用CMAKE),并确保设置了选项WITH_QT。

If you build OpenCV with CMAKE GUI you can find this option in the configuration menu: 如果您使用CMAKE GUI构建OpenCV,则可以在配置菜单中找到此选项:

在此处输入图片说明

One thing you should have in mind is that OpenCV won't allow you to modify the toolbars as it does with the TrackBar or the NamedWindow. 您应该记住的一件事是,OpenCV不允许您像使用TrackBar或NamedWindow一样修改工具栏。

I had the same problem and now solved it after 2 days :D I'm using OSX 10.9 with opencv 2.4.9 installed with brew and Qt Creator. 我遇到了同样的问题,现在两天后就解决了:D我正在将OSX 10.9与带有brew和Qt Creator的opencv 2.4.9一起使用。 The Problem is the installation in brew. 问题是在brew中安装。 To see the toolbar you have to install -- with qt. 要查看工具栏,您必须使用qt进行安装。

write in terminal (with brew) to install opencv (uninstall if opencv is already installed) 在终端中写入(带有brew)以安装opencv(如果已经安装了opencv,则卸载)

brew install opencv --with-qt brew install opencv --with-qt

Now you can use the toolbar in Xcode or in QT Creator, create for instants QT widget App and add in the *.pro file: 现在,您可以使用Xcode或QT Creator中的工具栏,立即创建QT小部件应用程序并添加* .pro文件:

QMAKE_CXXFLAGS += -std=c++11 -stdlib=libc++ QMAKE_CXXFLAGS + = -std = c ++ 11 -stdlib = libc ++

QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9

LIBS += -L/usr/local/lib LIBS + = -L / usr / local / lib

LIBS += \\ -lopencv_calib3d \\ -lopencv_contrib \\ -lopencv_core \\ -lopencv_flann \\ -lopencv_gpu \\ -lopencv_highgui \\ -lopencv_imgproc \\ -lopencv_legacy \\ -lopencv_ml \\ -lopencv_objdetect \\ -lopencv_ocl \\ -lopencv_photo \\ -lopencv_stitching \\ -lopencv_superres \\ -lopencv_ts \\ -lopencv_video \\ -lopencv_videostab -lopencv_nonfree LIBS + = \\ -lopencv_calib3d \\ -lopencv_contrib \\ -lopencv_core \\ -lopencv_flann \\ -lopencv_gpu \\ -lopencv_highgui \\ -lopencv_imgproc \\ -lopencv_legacy \\ -lopencv_ml \\ -lopencv_objdetect \\ -lopencv_st-\\ lopencv_res lopencv_video \\ -lopencv_videostab -lopencv_nonfree

INCLUDEPATH += /usr/local/include/opencv \\ /usr/include/opencv \\ /usr/local/include INCLUDEPATH + = / usr / local / include / opencv \\ / usr / include / opencv \\ / usr / local / include

DEPENDPATH += /usr/local/include/opencv/include DEPENDPATH + = / usr / local / include / opencv / include

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM