From c5b1f8f6d37f2b38b2013a870721b50a3750cb5c Mon Sep 17 00:00:00 2001 From: Austin Deric Date: Tue, 2 Jun 2020 16:50:55 -0500 Subject: [PATCH 1/2] fix cmakelists and includes for use by external pacakges --- .gitmodules | 6 --- CMakeLists.txt | 43 +++++++++------------ OpticalFlowConfig.cmake.in | 8 ---- external/klt_feature_tracker | 1 - include/{ => OpticalFlow}/constants.hpp | 0 include/{ => OpticalFlow}/flow_opencv.hpp | 4 +- include/{ => OpticalFlow}/flow_px4.hpp | 6 +-- include/{ => OpticalFlow}/optical_flow.hpp | 2 +- include/{ => OpticalFlow}/px4flow.hpp | 0 package.xml | 44 ++-------------------- src/flow_opencv.cpp | 2 +- src/flow_px4.cpp | 2 +- src/optical_flow.cpp | 2 +- src/px4flow.cpp | 2 +- 14 files changed, 31 insertions(+), 91 deletions(-) delete mode 100644 .gitmodules delete mode 100644 OpticalFlowConfig.cmake.in delete mode 160000 external/klt_feature_tracker rename include/{ => OpticalFlow}/constants.hpp (100%) rename include/{ => OpticalFlow}/flow_opencv.hpp (97%) rename include/{ => OpticalFlow}/flow_px4.hpp (95%) rename include/{ => OpticalFlow}/optical_flow.hpp (98%) rename include/{ => OpticalFlow}/px4flow.hpp (100%) diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 44b22bf..0000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "external/klt_feature_tracker"] - path = external/klt_feature_tracker - url = https://github.com/Maidbot/klt_feature_tracker.git - branch = master - shallow = true - diff --git a/CMakeLists.txt b/CMakeLists.txt index 86d2c6e..5634cad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,20 @@ if( POLICY CMP0042 ) cmake_policy(SET CMP0042 NEW) endif() project( OpticalFlow ) + +find_package(catkin REQUIRED COMPONENTS + klt_feature_tracker) + +catkin_package( + INCLUDE_DIRS include + CATKIN_DEPENDS klt_feature_tracker +) + +include_directories( + include + ${catkin_INCLUDE_DIRS} +) + set(version_major 0) set(version_minor 1) set(version_patch 0) @@ -55,15 +69,13 @@ set(${PROJECT_NAME}_INCLUDE_DIRS find_package( OpenCV REQUIRED ) OPTION(OPENCV "ON for OpenCV" ON) # -DOPENCV=OFF -add_subdirectory( external/klt_feature_tracker klt_feature_tracker ) -set( klt_feature_tracker_LIBS "klt_feature_tracker" ) - if(OpenCV_FOUND AND OPENCV) message(STATUS "Building ${PROJECT_NAME} with OpenCV") set(OpticalFlow_INCLUDE_DIRS + ${catkin_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include - ${klt_feature_tracker_INCLUDE_DIRS} + ${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} ) @@ -78,7 +90,7 @@ if(OpenCV_FOUND AND OPENCV) target_link_libraries( OpticalFlow ${OpenCV_LIBS} - ${klt_feature_tracker_LIBS} + ${catkin_LIBRARIES} ) else() message(STATUS "Building ${PROJECT_NAME} without OpenCV") @@ -98,24 +110,3 @@ else() endif() target_include_directories(OpticalFlow PUBLIC include) - -# Generate the Config file from the .in file, doing @VAR@ substitution only -configure_file(OpticalFlowConfig.cmake.in FindOpticalFlow.cmake @ONLY) - -# INSTALL STEPS -INSTALL( - TARGETS OpticalFlow - RUNTIME DESTINATION lib - LIBRARY DESTINATION lib) - -INSTALL( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/external/klt_feature_tracker/include/ - DESTINATION include) - -INSTALL( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ - DESTINATION include) - -INSTALL( - FILES ${CMAKE_CURRENT_BINARY_DIR}/FindOpticalFlow.cmake - DESTINATION ${CMAKE_INSTALL_PREFIX}) diff --git a/OpticalFlowConfig.cmake.in b/OpticalFlowConfig.cmake.in deleted file mode 100644 index 77b2636..0000000 --- a/OpticalFlowConfig.cmake.in +++ /dev/null @@ -1,8 +0,0 @@ -# - Config file for the OpticalFlow package -# It defines the following variables -# OpticalFlow_INCLUDE_DIRS - include directories -# OpticalFlow_LIBRARIES - libraries to link against - -set(OpticalFlow_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include") -#set(OpticalFlow_LIBRARY_DIR "@CMAKE_INSTALL_PREFIX@/lib") -FIND_LIBRARY(OpticalFlow_LIBRARIES OpticalFlow PATHS "@CMAKE_INSTALL_PREFIX@/lib" NO_DEFAULT_PATH) \ No newline at end of file diff --git a/external/klt_feature_tracker b/external/klt_feature_tracker deleted file mode 160000 index 9b5b567..0000000 --- a/external/klt_feature_tracker +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9b5b567ae77f93d1ef4d36151529ba2506a46e7a diff --git a/include/constants.hpp b/include/OpticalFlow/constants.hpp similarity index 100% rename from include/constants.hpp rename to include/OpticalFlow/constants.hpp diff --git a/include/flow_opencv.hpp b/include/OpticalFlow/flow_opencv.hpp similarity index 97% rename from include/flow_opencv.hpp rename to include/OpticalFlow/flow_opencv.hpp index df33915..85b6cd4 100644 --- a/include/flow_opencv.hpp +++ b/include/OpticalFlow/flow_opencv.hpp @@ -44,8 +44,8 @@ #include #include -#include "optical_flow.hpp" -#include "trackFeatures.h" +#include "OpticalFlow/optical_flow.hpp" +#include "klt_feature_tracker/trackFeatures.h" #define DEFAULT_NUMBER_OF_FEATURES 20 #define DEFAULT_CONFIDENCE_MULTIPLIER 1.645f //90% confidence interval diff --git a/include/flow_px4.hpp b/include/OpticalFlow/flow_px4.hpp similarity index 95% rename from include/flow_px4.hpp rename to include/OpticalFlow/flow_px4.hpp index 961ef03..0d9d805 100644 --- a/include/flow_px4.hpp +++ b/include/OpticalFlow/flow_px4.hpp @@ -40,10 +40,10 @@ #pragma once -#include "optical_flow.hpp" -#include "px4flow.hpp" +#include "OpticalFlow/optical_flow.hpp" +#include "OpticalFlow/px4flow.hpp" #include -#include "constants.hpp" +#include "OpticalFlow/constants.hpp" class OpticalFlowPX4 : public OpticalFlow { diff --git a/include/optical_flow.hpp b/include/OpticalFlow/optical_flow.hpp similarity index 98% rename from include/optical_flow.hpp rename to include/OpticalFlow/optical_flow.hpp index cac25d7..6437347 100644 --- a/include/optical_flow.hpp +++ b/include/OpticalFlow/optical_flow.hpp @@ -43,7 +43,7 @@ #include #include #include -#include "constants.hpp" +#include "OpticalFlow/constants.hpp" class OpticalFlow { diff --git a/include/px4flow.hpp b/include/OpticalFlow/px4flow.hpp similarity index 100% rename from include/px4flow.hpp rename to include/OpticalFlow/px4flow.hpp diff --git a/package.xml b/package.xml index 102b0b5..5d40fc8 100644 --- a/package.xml +++ b/package.xml @@ -31,57 +31,21 @@ - POSSIBILITY OF SUCH DAMAGE. - --> - + OpticalFlow 0.0.0 Optical flow package - - - christoph - - - - BSD + catkin - - - - - - - - - - - - - - - - - - - - - - - - - libopencv-dev - libopencv-dev - - klt_feature_tracker - klt_feature_tracker - + libopencv-dev + klt_feature_tracker - - diff --git a/src/flow_opencv.cpp b/src/flow_opencv.cpp index 9f3c8e0..1521aff 100644 --- a/src/flow_opencv.cpp +++ b/src/flow_opencv.cpp @@ -38,7 +38,7 @@ * Author: Christoph */ -#include "flow_opencv.hpp" +#include "OpticalFlow/flow_opencv.hpp" /**************************************************************************** * OpenCV optical flow calculation diff --git a/src/flow_px4.cpp b/src/flow_px4.cpp index 452064d..cb15b97 100644 --- a/src/flow_px4.cpp +++ b/src/flow_px4.cpp @@ -41,7 +41,7 @@ * PX4Flow flow calculation ****************************************************************************/ -#include "flow_px4.hpp" +#include "OpticalFlow/flow_px4.hpp" #include OpticalFlowPX4::OpticalFlowPX4(float f_length_x, float f_length_y, int ouput_rate, int img_width, int img_height, diff --git a/src/optical_flow.cpp b/src/optical_flow.cpp index 4167836..e3b8874 100644 --- a/src/optical_flow.cpp +++ b/src/optical_flow.cpp @@ -38,7 +38,7 @@ * Author: Christoph */ -#include "optical_flow.hpp" +#include "OpticalFlow/optical_flow.hpp" void OpticalFlow::initLimitRate() { diff --git a/src/px4flow.cpp b/src/px4flow.cpp index fe75049..f495c0d 100644 --- a/src/px4flow.cpp +++ b/src/px4flow.cpp @@ -41,7 +41,7 @@ #include #include #include -#include "px4flow.hpp" +#include "OpticalFlow/px4flow.hpp" PX4Flow::PX4Flow(uint32_t image_width_, uint32_t search_size_, uint32_t flow_feature_threshold_, uint32_t flow_value_threshold_, From dbb7514ff9ff7e2089d1e8c91b1368679322c8f8 Mon Sep 17 00:00:00 2001 From: Austin Deric Date: Mon, 8 Jun 2020 14:03:42 -0500 Subject: [PATCH 2/2] remove duplicate catkin_INCLUDE_DIRS --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5634cad..bc75d23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,8 +73,6 @@ if(OpenCV_FOUND AND OPENCV) message(STATUS "Building ${PROJECT_NAME} with OpenCV") set(OpticalFlow_INCLUDE_DIRS - ${catkin_INCLUDE_DIRS} - ${CMAKE_CURRENT_SOURCE_DIR}/include ${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} )