Cannot Converting between ROS images and OpenCV images - Python
Hi,
My name is Junifer. And I am a newbie. I am going to learn ROS and OpenCV. And I trying to convert ROS Image to OpenCV Image with Python language. But when i make follow the guide, it is not working. The guide link: http://wiki.ros.org/cv_bridge/Tutoria...
After make follow the guide. I add a file name ros_1_node.py in catkin_ws/package_name/src, and of course have code inside as the guide. Then i edit the CMakeList:
find_package(catkin REQUIRED COMPONENTS cv_bridge rospy sensor_msgs std_msgs )
find_package( OpenCV REQUIRED )
include_directories( ${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} )
add_executable(${PROJECT_NAME}_node src/ros_1_node.py)
target_link_libraries(${PROJECT_NAME}_node ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} )
But when i build it error:
(.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status
make[2]: * [/home/junifer/catkin_ws/devel/lib/ros_1/ros_1_node] Error 1
make[1]: * [ros_1/CMakeFiles/ros_1_node.dir/all] Error 2 make: * [all] Error 2 Invoking "make -j8 -l8" failed
Any recommend for my case, thank you so much !
It looks like you're trying to compile Python with a C++ compiler. You don't need to compile Python...
Hi Ahendrix, thank for your response. So what do i need to do now ? Can you show me, what step i make wrong ?
i was edit again the CMakeList:
Then I build successfully. Then:
$ roscore
$ rosrun ros_1 ros_1.py
but i show another error.
i dont know manifest file?
And I am using python 3.4 to binding with OpenCV not Python 2.7.
My computer running on Unbutu 14.04 Indigo and install with full option in ROS, to make sure opencv-contrib and opencv-python was install.
So may you give me any advise ?
Thank you so much !
If you open a new terminal and run "import cv2" is it imported successfully?