Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hanmekim committed Oct 10, 2012
0 parents commit c803419
Show file tree
Hide file tree
Showing 49 changed files with 8,887 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
CMakeLists.txt.user
BUILD/
_doc/
16 changes: 16 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,16 @@
PROJECT("SceneLib2")

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/CMakeModules/")

# Overide with cmake -DCMAKE_BUILD_TYPE=Release {dir}
IF(NOT CMAKE_BUILD_TYPE)
MESSAGE("Build type not set (defaults to debug)")
MESSAGE("-DCMAKE_BUILD_TYPE=Release for release")
SET(CMAKE_BUILD_TYPE Debug)
ENDIF()

STRING(TOLOWER ${PROJECT_NAME} LIBRARY_NAME)

ADD_SUBDIRECTORY(${LIBRARY_NAME})
ADD_SUBDIRECTORY(examples)
81 changes: 81 additions & 0 deletions CMakeModules/FindEigen3.cmake
@@ -0,0 +1,81 @@
# - Try to find Eigen3 lib
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(Eigen3 3.1.2)
# to require version 3.1.2 or newer of Eigen3.
#
# Once done this will define
#
# EIGEN3_FOUND - system has eigen lib with correct version
# EIGEN3_INCLUDE_DIR - the eigen include directory
# EIGEN3_VERSION - eigen version

# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.

if(NOT Eigen3_FIND_VERSION)
if(NOT Eigen3_FIND_VERSION_MAJOR)
set(Eigen3_FIND_VERSION_MAJOR 2)
endif(NOT Eigen3_FIND_VERSION_MAJOR)
if(NOT Eigen3_FIND_VERSION_MINOR)
set(Eigen3_FIND_VERSION_MINOR 91)
endif(NOT Eigen3_FIND_VERSION_MINOR)
if(NOT Eigen3_FIND_VERSION_PATCH)
set(Eigen3_FIND_VERSION_PATCH 0)
endif(NOT Eigen3_FIND_VERSION_PATCH)

set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
endif(NOT Eigen3_FIND_VERSION)

macro(_eigen3_check_version)
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)

string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")

set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK FALSE)
else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK TRUE)
endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})

if(NOT EIGEN3_VERSION_OK)

message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
"but at least version ${Eigen3_FIND_VERSION} is required")
endif(NOT EIGEN3_VERSION_OK)
endmacro(_eigen3_check_version)

if (EIGEN3_INCLUDE_DIR)

# in cache already
_eigen3_check_version()
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})

else (EIGEN3_INCLUDE_DIR)

find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
PATHS
${CMAKE_INSTALL_PREFIX}/include
${KDE4_INCLUDE_DIR}
PATH_SUFFIXES eigen3 eigen
)

if(EIGEN3_INCLUDE_DIR)
_eigen3_check_version()
endif(EIGEN3_INCLUDE_DIR)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)

mark_as_advanced(EIGEN3_INCLUDE_DIR)

endif(EIGEN3_INCLUDE_DIR)

34 changes: 34 additions & 0 deletions LICENCE
@@ -0,0 +1,34 @@
This file is part of the SceneLib2 Project.
http://hanmekim.blogspot.com/2012/10/scenelib2-monoslam-open-source-library.html
https://github.com/hanmekim/SceneLib2

Copyright (c) 2012 Hanme Kim (hanme.kim@gmail.com)

SceneLib2 is an open-source C++ library for SLAM originally designed and implemented
by Professor Andrew Davison (http://www.doc.ic.ac.uk/~ajd/) at Imperial College London.

I reimplemented his version with the following objectives;
1. Understand his MonoSLAM algorithm in code level.
2. Replace older libraries (i.e. VW34, GLOW, VNL, Pthread) with newer ones
(Pangolin, Eigen3, Boost).
3. Support USB camera instead of IEEE1394.
4. Make it more portable and convenient by using CMake and git repository.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

169 changes: 169 additions & 0 deletions README
@@ -0,0 +1,169 @@
==========================================
SceneLib2 - MonoSLAM open-source library
==========================================
Please also refer to the following links;
http://hanmekim.blogspot.com/2012/10/scenelib2-monoslam-open-source-library.html
https://github.com/hanmekim/SceneLib2

**********************
* What is SceneLib2? *
**********************
SceneLib2 is an open-source C++ library for SLAM originally designed and
implemented by Professor Andrew Davison (http://www.doc.ic.ac.uk/~ajd/) at
Imperial College London.

******************************
* Why is it named SceneLib2? *
******************************
His version, SceneLib 1.0, was released with full source code under the LGPL,
and as SceneLib2 is a reimplemented version of it, I gave the same name with a
new version number to this library.

****************************
* Why is it reimplemented? *
****************************
I reimplemented his version with the following objectives;
1. Understand his MonoSLAM algorithm in code level.
2. Replace older libraries (i.e. VW34, GLOW, VNL, Pthread) with newer ones
(Pangolin, Eigen3, Boost).
3. Support USB camera instead of IEEE1394.
4. Make it more portable and convenient by using CMake and git repository.

******************
* Implementation *
******************
I tried to make it as same as the original version, so that I can easily find
any problems that I might have introduced to it by accident (I didn't even
change most of functions' and variables' name). But, at the same time, I also
tried to make it easier to understand by using different class architectures
and various changes.

To give you the same executable example program like MonoSLAMGlow in
SceneLib 1.0, I implemented a very similar one called MonoSlamSenceLib1, and
again I tried to make it as same as the original version.

**********************
* Notes and Warnings *
**********************
Even though my intention is to make it as a cross-platform library, I only
added and tested it for the following platforms, but, of course, I will
increase its portability continuously (you can check the following platforms
list later on).
* Ubuntu 12.04 LTS - 32bits

This library is a research-level software which is still in development. It
will be frequently changed without notification to fix bugs, to add more
features and to make it better.

****************
* Installation *
****************
1. Install various development related packages
$ sudo apt-get install build-essential
$ sudo apt-get install git cmake
$ sudo apt-get install freeglut3-dev libglu-dev libglew-dev
$ sudo apt-get install ffmpeg libavcodec-dev libavutil-dev libavformat-dev libswscale-dev

2. Install Engen3
$ sudo apt-get install libeigen3-dev

3. Install Boost
$ sudo apt-get install libboost-all-dev

4. Install OpenCV
$ cd MY_EXTERNAL_LIBRARIES_DIRECTORY
$ wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.2/OpenCV-2.4.2.tar.bz2
$ tar xvf OpenCV-2.4.2.tar.bz2
$ cd OpenCV-2.4.2
$ mkdir BUILD
$ cd BUILD
$ cmake ..
$ make -j4
$ sudo make install

5. Install Pangolin
$ cd MY_EXTERNAL_LIBRARIES_DIRECTORY
$ git clone git://github.com/stevenlovegrove/Pangolin.git
$ cd Pangolin
$ mkdir BUILD
$ cd BUILD
$ cmake ..
$ make -j4
$ sudo make install

6. Install SceneLib2
$ cd MY_WORK_DIRECTORY
$ git clone git://github.com/hanmekim/SceneLib2.git SceneLib2
$ cd SceneLib2
$ mkdir BUILD
$ cd BUILD
$ cmake ..
$ make -j4

7. Download an example image sequence
$ cd MY_IMAGE_DIRECTORY
$ wget www.doc.ic.ac.uk/~ajd/Scene/Release/testseqmonoslam.tar.gz
$ tar xvf testseqmonoslam.tar.gz

**************
* How to use *
**************
1-1. Modify the configuration file to use the example image sequence
$ gedit MY_WORK_DIRECTORY/SceneLib2/data/SceneLib2.cfg

> input.mode = 0;
> input.name = MY_IMAGE_DIRECTORY/TestSeqMonoSLAM;

# these are default camera parameters for the example image sequence
> cam.width = 320;
> cam.height = 240;
> cam.fku = 195;
> cam.fkv = 195;
> cam.u0 = 162;
> cam.v0 = 125;
> cam.kd1 = 9e-06;
> cam.sd = 1;

1-2. Modify the configuration file to use a USB camera
$ gedit MY_WORK_DIRECTORY/SceneLib2/data/SceneLib2.cfg

> input.mode = 1;
# change [number] to your camera (e.g. mine is video0)
> input.name = convert:[fmt=RGB24]//v4l:///dev/video[number];

# these are default camera parameters for (Logitech V-U0009),
# not calibrated properly, but it works for now
> cam.width = 320;
> cam.height = 240;
> cam.fku = 195;
> cam.fkv = 195;
> cam.u0 = 162;
> cam.v0 = 125;
> cam.kd1 = 1e-12;
> cam.sd = 1;

2. Run MonoSlamSceneLib1
$ cd MY_WORK_DIRECTORY/SceneLib2/BUILD/examples
$ ./MonoSlamSceneLib1

****************
* Known issues *
****************
There are known issues, and they will be resolved as soon as possible.
* Detected features are slightly different to the original version's.
* The following functionalities are not supported yet
- Initialise Manual Feature button
- Initialise Auto Feature button
- Delete Feature button
- Save Patch button
* Most of member functions and variables are currently public for convenient
debugging, and they will be properly encapsulated later.

*************
* Thanks to *
*************
I really appreciate Professor Andrew Davison for sharing his great achievement,
and I promise him that I will share every findings based on this to help others
who are interested in this field as he is doing continuously in various ways.
Thank you.

0 comments on commit c803419

Please sign in to comment.