How do I use SIFT in ROS project
How to set everything in my project, so that I can use some existing solution for SIFT?
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
How to set everything in my project, so that I can use some existing solution for SIFT?
If you have a ROS project and you want to use SIFT algorithm, there is an implementation in OpenCV library.
If you choose the OpenCV 3, you will need to download an external modul opencv_contrib and give it as a flag to the cmake while installing the OpenCV 3 library. I haven't manage to make this solution work, since other packages in my project requested OpenCV 2.
I used OpenCV 2.4.8.
Commands:
the '/usr/include/' is the path where the OpenCV will be installed.
'..' tells the cmake where to find the source code for the OpenCV (that means one folder up).
When you have the OpenCV installed, you have to link it with your ROS project. In the 'CMakeLists.txt' of your project add following lines:
find_package(OpenCV 2.4.8 EXACT REQUIRED)
SET(OpenCV_LIBRARIES opencv_core opencv_highgui opencv_imgproc opencv_nonfree opencv_features2d)
catkin_package(
DEPENDS system_lib opencv2
...
)
include_directories(
${OpenCV_INCLUDE_DIRS}
...
)
target_link_libraries( ${PROJECT_NAME}_my_node ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
When you set 'OpenCV_LIBRARIES' you can only set those that you actually need. I left there all the other libraries because I think you will use then in your project anyway.
You have to include the header files into your project source file.
#include <opencv2/opencv.hpp>
#include <opencv2/nonfree/nonfree.hpp>
Now you can use one of the many examples to use SIFT in your project. For example here, here or here.
Asked: 2018-03-15 11:29:36 -0600
Seen: 745 times
Last updated: Mar 15 '18
error compiling visual_feature_detectors packages -- opencv don't match
services with sensor_msgs::Image response in diamondback ubuntu10.10
Problem with sensor_msgs::Image::ConstPtr conversion to IplImage
OpenCV GUI applications (beyond highgui)
OpenCV 2.3 RC Python SVM: TypeError: <unknown> is not a numpy array
Why opencv2 has two kinds of programming styles?
Is this the right approach for modelling a simple scene in 3d out of 2 images?