Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build against latest MRPT #15

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 3rdparty/line_descriptor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

include_directories( include ${OpenCV_INCLUDE_DIRS} )
list(APPEND LINK_LIBS ${OpenCV_LIBS} )
file(GLOB_RECURSE all_include_files RELATIVE "${CMAKE_SOURCE_DIR}" *.h *.hpp)
file(GLOB_RECURSE all_include_files RELATIVE "${PROJECT_SOURCE_DIR}" *.h *.hpp)

link_directories(${CMAKE_SOURCE_DIR}/src/)
file(GLOB_RECURSE all_source_files RELATIVE "${CMAKE_SOURCE_DIR}src/" *.cpp )
file(GLOB_RECURSE all_source_files RELATIVE "${PROJECT_SOURCE_DIR}src/" *.cpp )

add_custom_target( linedesc_includes DEPENDS ${all_include_files} SOURCES ${all_source_files} )

Expand Down
32 changes: 14 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ project( stvo-pl )

cmake_minimum_required(VERSION 2.7)
find_package(OpenCV 3 REQUIRED)
find_package(Boost REQUIRED COMPONENTS regex thread system filesystem)
find_package(Boost REQUIRED COMPONENTS regex thread system filesystem)

if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
link_directories(${OpenCV_LIBS_DIR})
include_directories(${OpenCV2_INCLUDE_DIRS})

# Include line_descriptor as project:
add_subdirectory(3rdparty/line_descriptor)

set(DEFAULT_HAS_MRPT ON)
set(HAS_MRPT ${DEFAULT_HAS_MRPT} CACHE BOOL "Build the PointGrey Bumblebee2 SVO application that employs the MRPT library")

Expand All @@ -24,10 +27,9 @@ set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

# MRPT library (optional, only with representation purposes)
if(HAS_MRPT)
find_package(MRPT REQUIRED base opengl gui hwdrivers)
set(MRPT_DONT_USE_DBG_LIBS 1) #use release libraries for linking even if "Debug" CMake build
add_definitions(-DHAS_MRPT)
endif(HAS_MRPT)
find_package(MRPT 1.9.9 REQUIRED opengl gui hwdrivers)
add_definitions(-DHAS_MRPT)
endif()

# YAML library
FIND_PACKAGE(yaml-cpp REQUIRED CONFIG PATHS ${YAML_PATHS})
Expand All @@ -43,14 +45,14 @@ include_directories(
)

# Set link libraries
list(APPEND LINK_LIBS
list(APPEND LINK_LIBS
${OpenCV_LIBS}
${Boost_LIBRARIES}
${YAML_CPP_LIBRARIES}
${PROJECT_SOURCE_DIR}/3rdparty/line_descriptor/lib/liblinedesc.so
linedesc
)

# Set source files
# Set source files
if(HAS_MRPT)
list(APPEND SOURCEFILES
src/sceneRepresentation.cpp
Expand Down Expand Up @@ -80,18 +82,12 @@ add_custom_target( stvo_includes DEPENDS ${all_include_files} SOURCES ${all_incl
# Create StVO-PL library
add_library(stvo SHARED ${SOURCEFILES})

if(HAS_MRPT)
target_link_libraries(stvo ${LINK_LIBS} ${MRPT_LIBS})
else()
target_link_libraries(stvo ${LINK_LIBS})

if(HAS_MRPT)
target_link_libraries(stvo ${MRPT_LIBS} ${MRPT_LIBRARIES})
endif()

# Applications
add_executable ( imagesStVO app/imagesStVO.cpp )
target_link_libraries( imagesStVO stvo )






71 changes: 13 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This code contains an algorithm to compute stereo visual odometry by using both point and line segment features.

**Authors:** [Ruben Gomez-Ojeda](http://mapir.isa.uma.es/mapirwebsite/index.php/people/164-ruben-gomez)
**Authors:** [Ruben Gomez-Ojeda](http://mapir.isa.uma.es/mapirwebsite/index.php/people/164-ruben-gomez)
and [David Zuñiga-Noël](http://mapir.isa.uma.es/mapirwebsite/index.php/people/270)
and [Javier Gonzalez-Jimenez](http://mapir.isa.uma.es/mapirwebsite/index.php/people/95-javier-gonzalez-jimenez)

Expand All @@ -26,7 +26,7 @@ Please do not hesitate to contact the authors if you have any further questions.
## 1. Prerequisites and dependencies

### OpenCV 3.x.x
It can be easily found at http://opencv.org.
It can be easily found at http://opencv.org.

### Eigen3
http://eigen.tuxfamily.org
Expand All @@ -43,26 +43,28 @@ Installation on Ubuntu 16.04:
sudo apt install libyaml-cpp-dev
```

### MRPT
In case of using the provided representation class.
Download and install instructions can be found at: http://www.mrpt.org/
### MRPT (>=v1.9.9)
Optional: Enables the provided visualization class.

#### Known Issues:
If working with the most recent versions of the MRPT library you might find some issues due to hard refactoring, for which we recommend to use this version instead (the last one we tested):
1) Only for Ubuntu 16.04 Xenial: upgrade gcc. Instructions [here](https://gist.github.com/jlblancoc/99521194aba975286c80f93e47966dc5).
2) For any Ubuntu version older than 20.04 Focal:
```
https://github.com/MRPT/mrpt/tree/0c3d605c3cbf5f2ffb8137089e43ebdae5a55de3
sudo add-apt-repository ppa:joseluisblancoc/mrpt
sudo apt-get update
```
3) Everyone: Install mrpt libraries:
```
sudo apt-get install libmrpt-dev
```

### Line Descriptor
We have modified the [*line_descriptor*](https://github.com/opencv/opencv_contrib/tree/master/modules/line_descriptor) module from the [OpenCV/contrib](https://github.com/opencv/opencv_contrib) library (both BSD) which is included in the *3rdparty* folder.




## 2. Configuration and generation
A CMakeLists.txt file is included to detect external dependencies and generate the project.

The project builds "imagesStVO", a customizable application where the user must introduce the inputs to the SVO algorithm, and then process the provided output.
The project builds "imagesStVO", a customizable application where the user must introduce the inputs to the SVO algorithm, and then process the provided output.



Expand All @@ -87,50 +89,3 @@ A full command would be:
./imagesStVO kitti/00 -c ../config/config_kitti.yaml -o 100 -s 2 -n 1000

where we are processing the sequence 00 from the KITTI dataset (in our dataset folders) with the custom config file, with an offset *-c* allowing to skip the first 100 images, a parameter *-s* to consider only one every 2 images, and a parameter *-n* to only consider 1000 input pairs.















































31 changes: 17 additions & 14 deletions include/sceneRepresentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,21 @@ using namespace std;

#include <mrpt/opengl.h>
#include <mrpt/gui.h>
#include <mrpt/utils/CConfigFile.h>
#include <mrpt/utils/CConfigFileBase.h>
#include <mrpt/config/CConfigFile.h>
#include <mrpt/config/CConfigFileBase.h>
#include <mrpt/maps/CPointsMap.h>
#include <mrpt/maps/CColouredPointsMap.h>
#include <mrpt/maps/CSimplePointsMap.h>
#include <mrpt/img/CImage.h>
#include <list>
using namespace mrpt;
using namespace mrpt::gui;
using namespace mrpt::poses;
using namespace mrpt::utils;
using namespace mrpt::config;
using namespace mrpt::math;
using namespace mrpt::opengl;
using namespace mrpt::maps;
using mrpt::img::CImage;

#include <opencv/cv.h>
using namespace cv;
Expand All @@ -65,8 +68,8 @@ class sceneRepresentation{
void initializeScene(Matrix4d x_0, bool has_gt);
// void initializeScene(Matrix4d x_0, Matrix4d x_0gt);

bool updateScene();
bool updateScene(list<PointFeature *> matched_pt, list<LineFeature *> matched_ls);
bool updateScene();
bool updateScene(std::list<PointFeature *> matched_pt, list<LineFeature *> matched_ls);
void plotPointsCovariances();
void plotLinesCovariances();

Expand Down Expand Up @@ -97,21 +100,21 @@ class sceneRepresentation{
CPose3D getPoseXYZ(VectorXd x);

CDisplayWindow3D* win;
COpenGLScenePtr theScene;
COpenGLViewportPtr image, legend, help;
opengl::CSetOfObjectsPtr bbObj, bbObj1, srefObj, srefObj1, gtObj, srefObjGT, elliObjL, elliObjP;
opengl::CEllipsoidPtr elliObj;
opengl::CSetOfLinesPtr lineObj;
opengl::CPointCloudPtr pointObj;
COpenGLScene::Ptr theScene;
COpenGLViewport::Ptr image, legend, help;
opengl::CSetOfObjects::Ptr bbObj, bbObj1, srefObj, srefObj1, gtObj, srefObjGT, elliObjL, elliObjP;
opengl::CEllipsoid::Ptr elliObj;
opengl::CSetOfLines::Ptr lineObj;
opengl::CPointCloud::Ptr pointObj;

//CPointsMapPtr pointsObj;

opengl::CFrustumPtr frustObj, frustObj1;
opengl::CAxisPtr axesObj;
opengl::CFrustum::Ptr frustObj, frustObj1;
opengl::CAxis::Ptr axesObj;


float sbb, saxis, srad, sref, sline, sfreq, szoom, selli, selev, sazim, sfrust, slinef;
CVectorDouble v_aux, v_aux_, v_aux1, v_aux1_, v_auxgt, gt_aux_, v_auxgt_;
CVectorFixedDouble<6> v_aux, v_aux_, v_aux1, v_aux1_, v_auxgt, gt_aux_, v_auxgt_;
CPose3D pose, pose_0, pose_gt, pose_ini, ellPose, pose1, change, frustumL_, frustumR_;
Matrix4d x_ini;
mrptKeyModifier kmods;
Expand Down
Loading