Ask Your Question

Problem with using Qt Functions '"createButton" of OpenCV2

asked 2012-09-28 04:01:40 -0600

mikegao88 gravatar image

Hello, I use the integrated OpenCV of ROS (installed directly through ROS). The problem I encounter is that when I try to add a button to the image window using "cv::createButton" function, the build process always fails:

undefined reference to `cv::createButton(std::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&, void ()(int, void), void*, int, bool)'

It seems that I should specify the parameter "WITH_QT:BOOL=ON", but how could I do this in the "CMakeLists.txt", as the rosmake system may not support the run time parameter specification? Or how should I configure my OpenCV?

I use ROS-Fuerte with Ubuntu 12.04 32bit, the version of OpenCV is

Version: 2.4.2-0precise-20120908-1632-+0000

Thanks for any help!!!!

edit retag flag offensive close merge delete


Any update on this yet? How to work around it, if not?

2ros0 gravatar image2ros0 ( 2017-04-21 16:00:55 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2012-09-28 06:25:59 -0600

mikegao88 gravatar image

Finally, I have found a temporary "way-around" solution:

The cause of this problem is that the current highgui lib used by ROS does not have the Qt support, so with such libs, the programmer could not use those new Qt functions in OpenCV.

So my way to solve it is to download the newest OpenCV 2.4.2 source from the official site, then compile it by myself, and then use the compiled new highgui libs to replace the old ones in ROS, then everything goes fine~

The compile procedure of OpenCV 2.4.2 on Ubuntu 12.04 can be easily found through Google.

edit flag offensive delete link more


Just a small update - this is STILL the case. I guess the OpenCV module for ROS is compiled in the same way as the OpenCV packages in the official Ubuntu repositories - only basic functionality enabled. For all who read this I advice you to compile OpenCV yourself with the features you want enabled (OpenGL support, Qt support etc.), build a custom ROS package and install it. This of course forces you to do this over and over again but I guess if you stick to only major version changes in OpenCV you won't be bothered that often. I'm quite surprised that the ROS team does that. I can understand why for example OpenCL or CUDA support is not enabled but Qt support? Especially when we consider how much of the ROS UI is actually implemented in Qt.

rbaleksandar gravatar imagerbaleksandar ( 2014-04-27 18:34:19 -0600 )edit

Question Tools


Asked: 2012-09-28 04:01:40 -0600

Seen: 2,191 times

Last updated: Sep 28 '12