Ask Your Question
1

GTK or QT when build OpenCV

asked 2019-07-02 01:19:51 -0500

opencvddddd gravatar image

I think HighGui should call some GUI library to draw windows when build OpenCV, there are some 3rd party libraries we could choose, should we choose GTK or QT? Which one is more appropriate, efficient.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2019-07-02 05:27:24 -0500

kbarni gravatar image

I recommend to use the QT library which is much more efficient.

The GTK window is very basic, it displays only a window containing the image. You get the different window modes; trackbars and the mouse callback, and that's all.

With QT you have many useful extra functions, like window toolbar and menu; status bar with mouse coordinates and pixel value; display overlay; and a control panel - a small window where you can add your own custom controls (buttons, check boxes, etc).

So the GTK interface is OK if you only need to display an image, and you don't need any interactions. The QT bindings provide a real user interface. So unless you have some serious limitations or a strong reason for GTK, I suggest to use QT.

Note that the OpenCV - QT bindings are still quite basic; so for a serious product I suggest to develop your own interface. You will find in the forum several posts about transforming OpenCV Mat variables to QImage and integrate them into a custom QT interface.

edit flag offensive delete link more

Comments

You also avoid protobuf version issues when opting for Qt over gtk.

Der Luftmensch gravatar imageDer Luftmensch ( 2019-07-02 06:47:59 -0500 )edit

I am also wondering since both GTK and QT are optional when build, if we turn off both MACRO, what would highgui use?

opencvddddd gravatar imageopencvddddd ( 2019-07-02 11:54:39 -0500 )edit

I had a build that I didn't enable gtk or qt. When I tried to use cv::imshow, it still compiled but it threw an error saying I needed to build with gtk or some other options. It'd be nice if at least gtk was enabled by default so that you didn't forget such a simple thing.

warpstar22 gravatar imagewarpstar22 ( 2020-08-06 15:52:05 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-07-02 01:19:51 -0500

Seen: 905 times

Last updated: Jul 02 '19