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

Help in making node with OpenCV/cv_bridge and ROS Indigo

asked 2015-02-10 02:59:49 -0600

Juan gravatar image

updated 2016-01-19 16:29:43 -0600

lucasw gravatar image

Greetings,

Running ROS Indigo, Ubuntu 14.04 and catkin_simple. My system has downloaded: libopencv-dev and ros-indigo-cv-bridge

I am trying to make a package that uses opencv's mouse button events. After making the package, I got the following errors related to opencv:

home/menon/juan/ros_workspace/hku_drc_class_sysu/catkin/src/vision_stack/steer_fitting/src/patch_select.cpp: In function \u2018void mouse_callback(int, int, int, int, void*)\u2019:
/home/menon/juan/ros_workspace/hku_drc_class_sysu/catkin/src/vision_stack/steer_fitting/src/patch_select.cpp:188:14: error: \u2018CV_EVENT_LBUTTONDOWN\u2019 was not declared in this scope
         case CV_EVENT_LBUTTONDOWN:
              ^
/home/menon/juan/ros_workspace/hku_drc_class_sysu/catkin/src/vision_stack/steer_fitting/src/patch_select.cpp:197:14: error: \u2018CV_EVENT_LBUTTONUP\u2019 was not declared in this scope
         case CV_EVENT_LBUTTONUP:
              ^
/home/menon/juan/ros_workspace/hku_drc_class_sysu/catkin/src/vision_stack/steer_fitting/src/patch_select.cpp: In function \u2018void onMouse(int, int, int, int, void*)\u2019:
/home/menon/juan/ros_workspace/hku_drc_class_sysu/catkin/src/vision_stack/steer_fitting/src/patch_select.cpp:489:18: error: \u2018CV_EVENT_LBUTTONDOWN\u2019 was not declared in this scope
     if (event == CV_EVENT_LBUTTONDOWN)
                  ^
/home/menon/juan/ros_workspace/hku_drc_class_sysu/catkin/src/vision_stack/steer_fitting/src/patch_select.cpp: In function \u2018int main(int, char**)\u2019:
/home/menon/juan/ros_workspace/hku_drc_class_sysu/catkin/src/vision_stack/steer_fitting/src/patch_select.cpp:613:36: error: \u2018CV_WINDOW_NORMAL\u2019 was not declared in this scope
         namedWindow("image_window",CV_WINDOW_NORMAL); //window for openCV displays
                                    ^
make[2]: *** [vision_stack/steer_fitting/CMakeFiles/patch_select.dir/src/patch_select.cpp.o] Error 1
make[1]: *** [vision_stack/steer_fitting/CMakeFiles/patch_select.dir/all] Error 2
make: *** [all] Error 2

Invoking "make -j20 -l20" failed
Failed to build catkin packages!

My package.xml contains the following opencv related dependencies:

  <build_depend>opencv2</build_depend>
  <build_depend>cv_bridge</build_depend>
  <build_depend>image_transport</build_depend>

  <run_depend>opencv2</run_depend>
  <run_depend>cv_bridge</run_depend>
  <run_depend>image_transport</run_depend>

And my CMakeLists.txt looks as follows (patch_select is the node that uses opencv):

cmake_minimum_required(VERSION 2.8.3)
project(steer_fitting)

find_package(catkin_simple REQUIRED)

find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

find_package(PCL 1.7 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})

catkin_simple()

# Executables
cs_add_executable(valve_fitting src/valve_fitting.cpp)
cs_add_executable(patch_select src/patch_select.cpp)

target_link_libraries(valve_fitting ${PCL_LIBRARIES})
target_link_libraries(patch_select ${OpenCV_LIBS})

cs_install()
cs_export()

And finally, these are the #includes in my code:

// OpenCV includes
#include <image_transport/image_transport.h> // don't need the transport headers for this routine; 
#include <image_transport/subscriber_filter.h>

#include <cv_bridge/cv_bridge.h>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
...
using namespace cv;

I have read the migration guide and looked for others online, including this post: ( http://answers.ros.org/question/18510... ) but still not sure how to fix this. Any help is appreciated.

edit retag flag offensive close merge delete

Comments

Are those all of the errors? I would either expect that you are unable to find a particular header (it would be the first error) or that you haven't included a header that you need. Either way I don't see anything catkin or catkin_simple related that would cause these compile errors.

William gravatar image William  ( 2015-02-10 13:40:19 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-02-10 20:39:45 -0600

Juan gravatar image

updated 2015-02-10 23:21:54 -0600

I realized that the definition of the events had been modified/updated.

Instead of being: CV_EVENT_LBUTTONDOWN, they are now defined as: EVENT_LBUTTONDOWN.

After making these modifications, everything built and compiled fine.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-02-10 02:59:49 -0600

Seen: 2,487 times

Last updated: Jan 19 '16