简体   繁体   中英

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)

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. If you can't see this toolbars you should re-build OpenCV with Qt support . To do so, build OpenCV from source (by using CMAKE) and make sure the option WITH_QT is set.

If you build OpenCV with CMAKE GUI you can find this option in the configuration menu:

在此处输入图片说明

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.

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. The Problem is the installation in brew. To see the toolbar you have to install -- with qt.

write in terminal (with brew) to install opencv (uninstall if opencv is already installed)

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:

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

QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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