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

Problem with opencv2

asked 2011-07-08 04:58:47 -0500

lakshmen gravatar image

i need to include the following files:

#include "opencv2\opencv.hpp"
#include "opencv2\highgui\highgui.hpp"
#include "opencv2\imgproc\imgproc.hpp"

but i always get this error. Opencv2\opencv.hpp: No such file or directory

what shld i do?

will adding this line <depend package="opencv2"/> solve the problem?

edit retag flag offensive close merge delete

Comments

From @arebgun below: Are you using ROS Diamondback? How did you install it? I just created a small test packages that depends on opencv2 and roscpp packages these includes work fine. Remember to try to post enough for others to reproduce your problem. http://www.ros.org/wiki/Support#Guidelines_for_asking_a_question
tfoote gravatar image tfoote  ( 2011-07-09 08:42:27 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2011-07-08 05:08:16 -0500

arebgun gravatar image

updated 2011-07-08 05:39:01 -0500

Whenever you want to use code from packages other than the one you are developing in, you need to add dependency on that package to your manifest.xml (see manifest documentation for full description). And to answer your question adding <depend package="opencv2"/> to the manifest should solve the problem. Also your slashes are wrong, change all \ to /:

#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
edit flag offensive delete link more

Comments

Hi thanks for replying.. I did add <depend package="opencv2"/>, but it still shows me this opencv2\opencv.hpp: No such file or directory
lakshmen gravatar image lakshmen  ( 2011-07-08 05:10:12 -0500 )edit
same error... i tried a few times..
lakshmen gravatar image lakshmen  ( 2011-07-08 05:20:32 -0500 )edit
Are you using ROS Diamondback? How did you install it? I just created a small test packages that depends on opencv2 and roscpp packages these includes work fine.
arebgun gravatar image arebgun  ( 2011-07-08 05:21:24 -0500 )edit
yup.. i wrote a code. it is on this link : http://answers.ros.org/question/1477/publishing-data-using-openni
lakshmen gravatar image lakshmen  ( 2011-07-08 05:25:32 -0500 )edit
trying to execute this code...
lakshmen gravatar image lakshmen  ( 2011-07-08 05:27:37 -0500 )edit
Try changing slashes in your includes (see updated answer).
arebgun gravatar image arebgun  ( 2011-07-08 05:50:17 -0500 )edit
Thanks arebgun, problem solved.
lakshmen gravatar image lakshmen  ( 2011-07-09 15:18:07 -0500 )edit
Great! Mark the answer as accepted if it solved your problem.
arebgun gravatar image arebgun  ( 2011-07-09 15:29:24 -0500 )edit
2

answered 2011-07-08 05:46:02 -0500

seanarm gravatar image

updated 2011-07-08 05:48:56 -0500

The simple answer to what's happening is that there is no opencv.hpp at that path. I admit I'm lazy and didn't try your code out, but try these two things:

1) Remove #include "opencv2/opencv.hpp". Recompile.
2) Do (1), then add #include "opencv2/core/core.hpp". Recompile.

edit flag offensive delete link more

Comments

If he's on Diamondback with OpenCV 2.2 that header file is there.
arebgun gravatar image arebgun  ( 2011-07-08 05:47:03 -0500 )edit
Ah, ok. That's just a problem with cturtle then?
seanarm gravatar image seanarm  ( 2011-07-08 05:50:16 -0500 )edit
Cturtle has an older version of OpenCV, it might be that this particular header did not exist back then.
arebgun gravatar image arebgun  ( 2011-07-08 05:55:14 -0500 )edit

Thanks! It worked!

brunohjs gravatar image brunohjs  ( 2018-05-06 17:54:54 -0500 )edit

Question Tools

Stats

Asked: 2011-07-08 04:58:47 -0500

Seen: 5,725 times

Last updated: Jul 08 '11