ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to set up OpenCV(which is part of ROS) in Qt creator in Ubuntu12.04

asked 2013-04-14 04:14:43 -0500

KarthikMurugan gravatar image

updated 2014-01-28 17:16:10 -0500

ngrennan gravatar image

I have OpenCV2.4.2 installed as part of ROS(Fuerte) in my computer. I want to use an IDE for my projects, I already have installed Qt creator from Ubuntu Software center.

Is it possible to use ROS opencv in an IDE and work. If yes,can somebody help me with how to set up/configure Qt creator with the ROS opencv ?

Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-04-14 14:35:02 -0500

Hi!

Here is a little trick that I used (if anyone knows a "cleaner" way to do this, please let us know):

1- Create a symbolic link to /opt/ros/fuerte/lib/pkgconfig/opencv.pc inside the directory /user/local/lib/pkgconfig.

cd /usr/local/lib/pkgconfig
ln -s /opt/ros/fuerte/lib/pkgconfig/opencv.pc opencv.pc

2- Create the appropriate .pro file for your Qt project

TARGET= MyQtProject
TEMPLATE = APP

SOURCES += main.cpp

CONFIG += link_pkgconfig
PKGCONFIG += opencv

If the file /usr/local/lib/pkgconfig/opencv.pc already exists you can copy ROS's file with another name, for instance: /usr/local/lib/pkgconfig/opencv_fuerte.pc and then use PKGCONFIG += opencv_fuerte

edit flag offensive delete link more

Comments

Thank you for the answer....but when I do cd /usr/local/lib/pkgconfig , I get bash: cd: /usr/local/lib/pkgconfig: No such file or directory .... am I supposed to create a new directory there ??

KarthikMurugan gravatar image KarthikMurugan  ( 2013-04-14 17:10:40 -0500 )edit
1

Yes, if it does not exist you should create it. Remember to do it as root (sudo)

Martin Peris gravatar image Martin Peris  ( 2013-04-14 20:08:31 -0500 )edit

I did exactly as you said... earlier when I tried to run the program it would say opencv2/opencv.hpp : No such file or directory... Now it s fine but doesnt display the output image... a terminal opens and stays as such... nothing happens......

KarthikMurugan gravatar image KarthikMurugan  ( 2013-04-15 02:54:32 -0500 )edit

Do i need to take care of some other settings in Qt creator such as build/Release configuration, etc this is the progam (http://i.imgur.com/tD8nWzY.png) I tried and .pro file (http://i.imgur.com/sprITVF.png)

KarthikMurugan gravatar image KarthikMurugan  ( 2013-04-15 03:10:06 -0500 )edit
1

I tested your code, when I launch it from within Qt environment (using the green "Play" button) a terminal appears and nothing else happens, as you mentioned.But, if I execute the program from a console (find the folder where the project is built and execute ./Hello_World), then it works!

Martin Peris gravatar image Martin Peris  ( 2013-04-15 14:47:21 -0500 )edit

Thank u.....yes it works fine if I do as u said.....Am I supposed to always do this way??? The motive of going for an IDE is quicker access through the GUI...am I right? Any idea where I might hav missed some setting or something ?? did you get any similar problem??

KarthikMurugan gravatar image KarthikMurugan  ( 2013-04-15 16:43:19 -0500 )edit
1

Finally I got it working... I changed some settings in Qt creator.... In Projects tab -> Run settings -> unselect Run in terminal option... Now the code works as I click the green "Play" button !

KarthikMurugan gravatar image KarthikMurugan  ( 2013-04-15 22:44:22 -0500 )edit

Question Tools

Stats

Asked: 2013-04-14 04:14:43 -0500

Seen: 1,418 times

Last updated: Apr 14 '13