opencv2 on kinetic
I moved from indigo to kinetic, and I am trying to make my code from indigo work here on kinetic. now i have encountered a problem that opencv have changed to opencv3. and some functions i used to have are now gone, or working some other way. Is there any way to make kinetic work with both opencv3 and opencv2? (i have opencv 2.4.13.4 installed) i tried some things but it didnt work:
- adding
find_package(OpenCV 2.4.9.1 EXACT REQUIRED)
to the cmake file - adding
find_package(OpenCV 2)
to the cmake file - adding
find_package(OpenCV 2 REQUIRED)
to the cmake file - followed that answer https://answers.ros.org/question/2619... none of the above seems to work, do you have any idea?
the error while catkin_make:
/home/armadillo2/catkin_ws/src/armadillo_bgu_bundle/find_obj_temp/src/find_object.cpp: In function ‘void find(std::__cxx11::string, objrec, unsigned char)’:
/home/armadillo2/catkin_ws/src/armadillo_bgu_bundle/find_obj_temp/src/find_object.cpp:246:46: error: no matching function for call to ‘cv::SimpleBlobDetector::SimpleBlobDetector(cv::SimpleBlobDetector::Params&)’
cv::SimpleBlobDetector detector(bd_params);
^
In file included from /opt/ros/kinetic/include/opencv-3.3.1/opencv2/features2d/features2d.hpp:48:0,
from /home/armadillo2/catkin_ws/src/armadillo_bgu_bundle/find_obj_temp/src/find_object.cpp:8:
/opt/ros/kinetic/include/opencv-3.3.1/opencv2/features2d.hpp:587:20: note: candidate: cv::SimpleBlobDetector::SimpleBlobDetector()
class CV_EXPORTS_W SimpleBlobDetector : public Feature2D
^
/opt/ros/kinetic/include/opencv-3.3.1/opencv2/features2d.hpp:587:20: note: candidate expects 0 arguments, 1 provided
/opt/ros/kinetic/include/opencv-3.3.1/opencv2/features2d.hpp:587:20: note: candidate: cv::SimpleBlobDetector::SimpleBlobDetector(const cv::SimpleBlobDetector&)
/opt/ros/kinetic/include/opencv-3.3.1/opencv2/features2d.hpp:587:20: note: no known conversion for argument 1 from ‘cv::SimpleBlobDetector::Params’ to ‘const cv::SimpleBlobDetector&’
/opt/ros/kinetic/include/opencv-3.3.1/opencv2/features2d.hpp:587:20: note: candidate: cv::SimpleBlobDetector::SimpleBlobDetector(cv::SimpleBlobDetector&&)
/opt/ros/kinetic/include/opencv-3.3.1/opencv2/features2d.hpp:587:20: note: no known conversion for argument 1 from ‘cv::SimpleBlobDetector::Params’ to ‘cv::SimpleBlobDetector&&’
cmake file:
cmake_minimum_required(VERSION 2.8.3)
project(find_obj_temp)
add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
cv_bridge
tf
pcl_ros
object_identification
message_generation
)
find_package(OpenCV 2.4.9.1 EXACT REQUIRED)
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES find_obj_temp
# CATKIN_DEPENDS roscpp std_msgs
# DEPENDS system_lib
)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
add_executable(find_obj_temp src/find_object.cpp src/tinyxml2.cpp)
target_link_libraries(find_obj_temp ${catkin_LIBRARIES})