Permalink
Browse files

changed to catkin_simple, compiles with opencv3 on 16.04

  • Loading branch information...
1 parent a81cc56 commit fdbbcc488f163e0badb7a53541d9eff4831fe6cc @eliasm eliasm committed Jan 13, 2017
@@ -1,76 +1,26 @@
cmake_minimum_required(VERSION 2.8.3)
project(davis_ros_driver)
-# search for everything we need to build the package
-find_package(catkin REQUIRED COMPONENTS
- roscpp
- libcaer_catkin
- dvs_msgs
- std_msgs
- sensor_msgs
- dynamic_reconfigure
- camera_info_manager
- nodelet
-)
+find_package(catkin_simple REQUIRED)
-generate_dynamic_reconfigure_options(
- cfg/DAVIS_ROS_Driver.cfg
-)
+catkin_simple()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3")
-# since we need eigen and boost search them as well
-# find_package makes the ${..._INCLUDE_DIRS} ${..._LIBRARIES} variables we use later
find_package(Boost REQUIRED COMPONENTS system thread)
-# export the dependencis of this package for who ever depends on us
-catkin_package(
- INCLUDE_DIRS
- include
- CATKIN_DEPENDS
- roscpp
- libcaer_catkin
- dvs_msgs
- std_msgs
- sensor_msgs
- dynamic_reconfigure
- camera_info_manager
- nodelet
- DEPENDS
- boost
-)
-
-# tell catkin where to find the headers for this project
-include_directories(
- include
- ${catkin_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
-
# make the executable
-add_executable(davis_ros_driver
+cs_add_executable(davis_ros_driver
src/driver_node.cpp
src/driver.cpp
)
# make the nodelet into a library
-add_library(davis_ros_driver_nodelet
+cs_add_library(davis_ros_driver_nodelet
src/driver_nodelet.cpp
src/driver.cpp
)
-# to build the executable we depend on other packets,
-# they need to be build beforehand, especially the messages
-add_dependencies(davis_ros_driver
- ${catkin_EXPORTED_TARGETS}
- ${PROJECT_NAME}_gencfg
-)
-
-add_dependencies(davis_ros_driver_nodelet
- ${catkin_EXPORTED_TARGETS}
- ${PROJECT_NAME}_gencfg
-)
-
# link the executable to the necesarry libs
target_link_libraries(davis_ros_driver
${catkin_LIBRARIES}
@@ -86,11 +36,7 @@ target_link_libraries(davis_ros_driver_nodelet
)
# Install the nodelet library
-install(TARGETS davis_ros_driver_nodelet
- ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
-)
+cs_install()
# Install other support files for installation
install(FILES davis_ros_driver_nodelet.xml
@@ -7,6 +7,7 @@
<license>GNU GPL</license>
<buildtool_depend>catkin</buildtool_depend>
+ <buildtool_depend>catkin_simple</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>libcaer_catkin</build_depend>
@@ -1,64 +1,29 @@
cmake_minimum_required(VERSION 2.8.3)
project(dvs_calibration)
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3")
-
-# search for everything we need to build the package
-find_package(catkin REQUIRED COMPONENTS
- roscpp
- image_transport
- cv_bridge
- dvs_msgs
- geometry_msgs
- sensor_msgs
- cmake_modules
-)
+find_package(catkin_simple REQUIRED)
-# since we need boost search it as well
-# find_package makes the ${..._INCLUDE_DIRS} ${..._LIBRARIES} variables we use later
-find_package(OpenCV 2 REQUIRED)
-find_package(Boost REQUIRED)
+catkin_simple()
-# export the dependencis of this package for who ever depends on us
-catkin_package(
- INCLUDE_DIRS include
- CATKIN_DEPENDS
- roscpp
- image_transport
- cv_bridge
- dvs_msgs
- geometry_msgs
- sensor_msgs
- DEPENDS
- OpenCV
- boost
-)
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3")
-# tell catkin where to find the headers for this project
-include_directories(
- include
- ${catkin_INCLUDE_DIRS}
- ${OpenCV_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
-)
+find_package(OpenCV REQUIRED)
+find_package(Boost REQUIRED)
#########################
# make the executable for MONO
#########################
-add_executable(mono
+cs_add_executable(mono
src/mono_node.cpp
src/mono_dvs_calibration.cpp
src/dvs_calibration.cpp
+ src/circlesgrid.cpp
src/board_detection.cpp
src/transition_map.cpp
)
-# to build the executable we depend on other packets,
-# they need to be build beforehand, especially the messages
-add_dependencies(mono ${catkin_EXPORTED_TARGETS})
-
# link the executable to the necesarry libs
target_link_libraries(mono
${catkin_LIBRARIES}
@@ -70,18 +35,15 @@ target_link_libraries(mono
# make the executable for STEREO
#########################
-add_executable(stereo
+cs_add_executable(stereo
src/stereo_node.cpp
src/stereo_dvs_calibration.cpp
src/dvs_calibration.cpp
+ src/circlesgrid.cpp
src/board_detection.cpp
src/transition_map.cpp
)
-# to build the executable we depend on other packets,
-# they need to be build beforehand, especially the messages
-add_dependencies(stereo ${catkin_EXPORTED_TARGETS})
-
# link the executable to the necesarry libs
target_link_libraries(stereo
${catkin_LIBRARIES}
@@ -93,18 +55,15 @@ target_link_libraries(stereo
# make the executable for Camera-DVS
#########################
-add_executable(camera_dvs
+cs_add_executable(camera_dvs
src/camera_dvs_node.cpp
src/camera_dvs_calibration.cpp
src/dvs_calibration.cpp
+ src/circlesgrid.cpp
src/board_detection.cpp
src/transition_map.cpp
)
-# to build the executable we depend on other packets,
-# they need to be build beforehand, especially the messages
-add_dependencies(camera_dvs ${catkin_EXPORTED_TARGETS})
-
# link the executable to the necesarry libs
target_link_libraries(camera_dvs
${catkin_LIBRARIES}
@@ -30,6 +30,7 @@
#include <sensor_msgs/SetCameraInfo.h>
#include <sensor_msgs/image_encodings.h>
+#include <opencv2/core/version.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/imgproc/imgproc.hpp>
@@ -65,10 +65,10 @@ class CirclesGridClusterFinder
squareSize = 1.0f;
maxRectifiedDistance = (float)(squareSize / 2.0);
}
- void findGrid(const std::vector<cv::Point2f> points, cv::Size patternSize, std::vector<cv::Point2f>& centers);
+ void findGrid(const std::vector<cv::Point2f> &points, cv::Size patternSize, std::vector<cv::Point2f>& centers);
//cluster 2d points by geometric coordinates
- void hierarchicalClustering(const std::vector<cv::Point2f> points, const cv::Size &patternSize, std::vector<cv::Point2f> &patternPoints);
+ void hierarchicalClustering(const std::vector<cv::Point2f> &points, const cv::Size &patternSize, std::vector<cv::Point2f> &patternPoints);
private:
void findCorners(const std::vector<cv::Point2f> &hull2f, std::vector<cv::Point2f> &corners);
void findOutsideCorners(const std::vector<cv::Point2f> &corners, std::vector<cv::Point2f> &outsideCorners);
@@ -7,6 +7,7 @@
<license>GNU GPL</license>
<buildtool_depend>catkin</buildtool_depend>
+ <buildtool_depend>catkin_simple</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>image_transport</build_depend>
@@ -15,14 +16,14 @@
<build_depend>geometry_msgs</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>cmake_modules</build_depend>
-
+
<run_depend>roscpp</run_depend>
<run_depend>image_transport</run_depend>
<run_depend>cv_bridge</run_depend>
<run_depend>dvs_msgs</run_depend>
<run_depend>geometry_msgs</run_depend>
<run_depend>sensor_msgs</run_depend>
-
+
<export>
</export>
</package>
@@ -83,11 +83,17 @@ void CameraDvsCalibration::calibrate()
int flags = fix_intrinsics_ ? CV_CALIB_FIX_INTRINSIC : CV_CALIB_USE_INTRINSIC_GUESS;
cv::TermCriteria term_crit = cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, 30, 1e-6);
+#if CV_MAJOR_VERSION == 2
double reproj_error = cv::stereoCalibrate(object_points_, image_points_camera_, image_points_dvs_,
camera_matrix_camera, dist_coeffs_camera, camera_matrix_dvs, dist_coeffs_dvs,
cv::Size(standard_camera_info_.width, standard_camera_info_.height),
R, T, E, F, term_crit, flags);
-
+#elif CV_MAJOR_VERSION == 3
+double reproj_error = cv::stereoCalibrate(object_points_, image_points_camera_, image_points_dvs_,
+ camera_matrix_camera, dist_coeffs_camera, camera_matrix_dvs, dist_coeffs_dvs,
+ cv::Size(standard_camera_info_.width, standard_camera_info_.height),
+ R, T, E, F, flags, term_crit);
+#endif
cv::Mat R1, R2, P1, P2, Q;
cv::stereoRectify(camera_matrix_camera, dist_coeffs_camera, camera_matrix_dvs, dist_coeffs_dvs,
cv::Size(standard_camera_info_.width, standard_camera_info_.height), R, T, R1, R2, P1, P2, Q);
Oops, something went wrong.

0 comments on commit fdbbcc4

Please sign in to comment.