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

Help in making node with OpenCV/cv_bridge and ROS Indigo

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

Juan gravatar image

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

lucasw gravatar image


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
/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:



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

cmake_minimum_required(VERSION 2.8.3)

find_package(catkin_simple REQUIRED)

find_package(OpenCV REQUIRED)

find_package(PCL 1.7 REQUIRED)


# 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})


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: ( ) but still not sure how to fix this. Any help is appreciated.

edit retag flag offensive close merge delete


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 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

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

Juan gravatar image

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

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


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

Seen: 2,450 times

Last updated: Jan 19 '16