├── ptam
├── src
│ ├── ptam
│ │ └── cfg
│ │ │ └── __init__.py
│ ├── Map.cc
│ ├── ShiTomasi.cc
│ ├── main.cc
│ ├── MapPoint.cc
│ ├── Relocaliser.cc
│ ├── Params.cpp
│ ├── MiniPatch.cc
│ ├── OctomapInterface.cc
│ ├── RemotePtam.cpp
│ ├── MapViewer.cc
│ ├── CalibCornerPatch.cc
│ └── SmallBlurryImage.cc
├── thirdparty
│ ├── TooN
│ │ ├── version.txt
│ │ ├── Authors
│ │ ├── Makefile
│ │ └── COPYING
│ ├── agast
│ │ ├── Makefile
│ │ ├── getIncludePaths.cmake
│ │ ├── CMakeLists.txt
│ │ ├── installfiles
│ │ │ ├── Makefile_orig
│ │ │ ├── Makefile
│ │ │ └── README
│ │ ├── include
│ │ │ └── agast
│ │ │ │ ├── cvWrapper.h
│ │ │ │ ├── agast5_8.h
│ │ │ │ ├── AstDetector.h
│ │ │ │ ├── agast7_12d.h
│ │ │ │ ├── agast7_12s.h
│ │ │ │ ├── oast9_16.h
│ │ │ │ └── agast_corner_detect.h
│ │ └── src
│ │ │ ├── AstDetector.cc
│ │ │ └── nonMaximumSuppression.cc
│ ├── libcvd
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── gvars3
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── rosdep.yaml
│ └── Makefile
├── Makefile_ptam
├── calib_pattern.pdf
├── .gitignore
├── Makefile
├── launch
│ ├── ptam.launch
│ └── cameracalibrator.launch
├── include
│ └── ptam
│ │ ├── ShiTomasi.h
│ │ ├── OpenGL.h
│ │ ├── OctomapInterface.h
│ │ ├── Relocaliser.h
│ │ ├── SmallMatrixOpts.h
│ │ ├── MapViewer.h
│ │ ├── SmallBlurryImage.h
│ │ ├── Map.h
│ │ ├── CalibCornerPatch.h
│ │ ├── MiniPatch.h
│ │ ├── CameraCalibrator.h
│ │ ├── CalibImage.h
│ │ ├── LevelHelpers.h
│ │ ├── HomographyInit.h
│ │ ├── GLWindowMenu.h
│ │ ├── GLWindow2.h
│ │ ├── Params.h
│ │ ├── MapPoint.h
│ │ ├── System.h
│ │ ├── TrackerData.h
│ │ ├── AxesArray.h
│ │ ├── KeyFrame.h
│ │ ├── Bundle.h
│ │ ├── MapMaker.h
│ │ ├── MEstimator.h
│ │ ├── Tracker.h
│ │ ├── PatchFinder.h
│ │ └── ATANCamera.h
├── mainpage.dox
├── PtamFixParams.yaml
├── package.xml
├── cfg
│ ├── PTAMVisualizerParams.cfg
│ └── PtamParams.cfg
├── rvizconf.vcg
├── license.txt
└── CMakeLists.txt
├── ptam_com
├── Makefile
├── msg
│ ├── OctoMapPointArray.msg
│ ├── Vector3Array.msg
│ ├── KeyFrame_msg.msg
│ ├── OctoMapScan.msg
│ ├── OctoMapPointStamped.msg
│ └── ptam_info.msg
├── srv
│ ├── PointCloud.srv
│ └── KeyFrame_srv.srv
├── mainpage.dox
├── CMakeLists.txt
└── package.xml
├── rqt_ptam
├── Makefile
├── mainpage.dox
├── plugin.xml
├── CMakeLists.txt
├── package.xml
├── include
│ └── rqt_ptam
│ │ ├── ratio_layouted_frame.h
│ │ └── remote_ptam.h
└── src
│ └── rqt_ptam
│ ├── ratio_layouted_frame.cpp
│ └── remote_ptam.ui
├── ethzasl_ptam
├── CMakeLists.txt
└── package.xml
├── README.md
├── Makefile
└── .gitignore
/ptam/src/ptam/cfg/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ptam/thirdparty/TooN/version.txt:
--------------------------------------------------------------------------------
1 | 2.0.0-beta7
2 |
--------------------------------------------------------------------------------
/ptam_com/Makefile:
--------------------------------------------------------------------------------
1 | include $(shell rospack find mk)/cmake.mk
--------------------------------------------------------------------------------
/rqt_ptam/Makefile:
--------------------------------------------------------------------------------
1 | include $(shell rospack find mk)/cmake.mk
--------------------------------------------------------------------------------
/ptam/Makefile_ptam:
--------------------------------------------------------------------------------
1 | include $(shell rospack find mk)/cmake.mk
2 |
--------------------------------------------------------------------------------
/ptam/thirdparty/agast/Makefile:
--------------------------------------------------------------------------------
1 | include $(shell rospack find mk)/cmake.mk
--------------------------------------------------------------------------------
/ptam/thirdparty/libcvd/.gitignore:
--------------------------------------------------------------------------------
1 | /include
2 | /lib
3 | /libcvd_built
4 |
--------------------------------------------------------------------------------
/ptam_com/msg/OctoMapPointArray.msg:
--------------------------------------------------------------------------------
1 | OctoMapPointStamped[] mapPoints
2 |
--------------------------------------------------------------------------------
/ptam_com/msg/Vector3Array.msg:
--------------------------------------------------------------------------------
1 | Header header
2 | geometry_msgs/Vector3[] vector3
--------------------------------------------------------------------------------
/ptam/thirdparty/gvars3/.gitignore:
--------------------------------------------------------------------------------
1 | /include
2 | /installfiles
3 | /lib
4 | /gvars_built
5 |
--------------------------------------------------------------------------------
/ptam_com/srv/PointCloud.srv:
--------------------------------------------------------------------------------
1 | uint32 flags
2 | ---
3 | sensor_msgs/PointCloud2 pointcloud
4 |
--------------------------------------------------------------------------------
/ptam/calib_pattern.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ethz-asl/ethzasl_ptam/HEAD/ptam/calib_pattern.pdf
--------------------------------------------------------------------------------
/ptam_com/msg/KeyFrame_msg.msg:
--------------------------------------------------------------------------------
1 | uint32[] KFids
2 | geometry_msgs/PoseWithCovarianceStamped[] KFs
3 |
--------------------------------------------------------------------------------
/ptam_com/msg/OctoMapScan.msg:
--------------------------------------------------------------------------------
1 | OctoMapPointArray mapPoints
2 | geometry_msgs/PoseWithCovarianceStamped keyFramePose
3 |
4 |
--------------------------------------------------------------------------------
/ptam_com/srv/KeyFrame_srv.srv:
--------------------------------------------------------------------------------
1 | int32 flags
2 | ---
3 | uint32[] KFids
4 | geometry_msgs/PoseWithCovarianceStamped[] KFs
5 |
--------------------------------------------------------------------------------
/ethzasl_ptam/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.3)
2 | project(ethzasl_ptam)
3 | find_package(catkin REQUIRED)
4 | catkin_metapackage()
--------------------------------------------------------------------------------
/ptam/thirdparty/TooN/Authors:
--------------------------------------------------------------------------------
1 | Created by Tom Drummond
2 |
3 | Contributions from Ethan Eade, Edward Rosten, Chris Kemp, Georg Klein,
4 | Timothy Gann, Paul Smith
5 |
6 |
--------------------------------------------------------------------------------
/ptam_com/msg/OctoMapPointStamped.msg:
--------------------------------------------------------------------------------
1 | Header header
2 | uint8 INSERT = 0
3 | uint8 UPDATE = 1
4 | uint8 DELETE = 2
5 |
6 | uint8 action
7 | geometry_msgs/Vector3 position
8 |
--------------------------------------------------------------------------------
/rqt_ptam/mainpage.dox:
--------------------------------------------------------------------------------
1 | /**
2 | \mainpage
3 | \htmlinclude manifest.html
4 |
5 | \b rqt_image_view provides a GUI plugin for displaying images using image_transport.
6 | */
7 |
--------------------------------------------------------------------------------
/ptam/.gitignore:
--------------------------------------------------------------------------------
1 | /cmake
2 | /lib
3 | *~
4 | build
5 | bin
6 | thirdparty/TooN/toon_built
7 | thirdparty/TooN/include
8 | src/ptam/__init__.py
9 | .project
10 | .cproject
11 |
--------------------------------------------------------------------------------
/ptam/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | cd thirdparty && make
3 | make -j8 -f Makefile_ptam
4 |
5 | .DEFAULT:
6 | cd thirdparty && make $@
7 | make -j8 -f Makefile_ptam $@
8 |
9 |
10 |
--------------------------------------------------------------------------------
/ptam_com/msg/ptam_info.msg:
--------------------------------------------------------------------------------
1 | Header header
2 | float32 fps
3 | int32 keyframes
4 | int32 trackingQuality
5 | bool mapQuality
6 | string mapViewerMessage
7 | string trackerMessage
--------------------------------------------------------------------------------
/ptam/thirdparty/rosdep.yaml:
--------------------------------------------------------------------------------
1 | atlas-sse2:
2 | ubuntu:
3 | 10.04: libatlas-sse2-dev
4 | 10.10: libatlas-sse2-dev
5 | 11.04: libatlas-base-dev
6 | 11.10: libatlas-base-dev
7 |
8 | lapack:
9 | ubuntu: liblapack-dev
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ethzasl_ptam
2 | ============
3 |
4 | Modified version of Parallel Tracking and Mapping (PTAM) by George Klein. See http://wiki.ros.org/ethzasl_ptam for a detailed overview.
5 |
6 | [](http://129.132.38.183:8080/job/ethzasl_ptam/)
7 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | cd ptam_com && make -j8
3 | cd ..
4 | cd ptam && make -j8
5 | cd ..
6 |
7 | clean:
8 | cd ptam && make clean
9 | cd ..
10 | cd ptam_com && make clean
11 | cd ..
12 |
13 |
14 | distclean:
15 | cd ptam && make distclean
16 | cd ..
17 | cd ptam_com && make distclean
18 | cd ..
19 |
--------------------------------------------------------------------------------
/ptam/launch/ptam.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ptam/thirdparty/TooN/Makefile:
--------------------------------------------------------------------------------
1 | all: toon_built
2 |
3 | toon_built:
4 | mkdir -p include/
5 | git clone https://github.com/edrosten/TooN.git include/TooN
6 | cd include/TooN && git checkout 35bb77741e7e2b7de5d75d0605f104f2ad728708
7 | touch toon_built
8 |
9 | clean:
10 | rm -rf include
11 | rm -f toon_built
12 |
13 |
--------------------------------------------------------------------------------
/ptam/launch/cameracalibrator.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ptam/thirdparty/agast/getIncludePaths.cmake:
--------------------------------------------------------------------------------
1 | get_directory_property(inc_dirs INCLUDE_DIRECTORIES)
2 |
3 | set(filename includepaths.txt)
4 | file(WRITE ${filename} "copy this to .cproject\n\n")
5 |
6 | foreach(includeLine ${inc_dirs})
7 | file(APPEND ${filename} "\n")
8 | endforeach(includeLine ${inc_dirs})
--------------------------------------------------------------------------------
/ptam/include/ptam/ShiTomasi.h:
--------------------------------------------------------------------------------
1 | // Copyright 2008 Isis Innovation Limited
2 | #ifndef __SHI_TOMASI__H
3 | #define __SHI_TOMASI__H
4 |
5 | #include
6 | #include
7 |
8 |
9 | double FindShiTomasiScoreAtPoint(CVD::BasicImage &image,
10 | int nHalfBoxSize,
11 | CVD::ImageRef irCenter);
12 |
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/ptam/include/ptam/OpenGL.h:
--------------------------------------------------------------------------------
1 | // Copyright 2008 Isis Innovation Limited
2 | #ifndef __OPENGL_INCLUDES_H
3 | #define __OPENGL_INCLUDES_H
4 |
5 | #ifdef _LINUX
6 | #include
7 | #include
8 | #endif
9 |
10 | #ifdef _OSX
11 | #include
12 | #include
13 | #endif
14 |
15 | #ifdef WIN32
16 | #define WIN32_LEAN_AND_MEAN
17 | #include
18 | #endif
19 |
20 | #include
21 | #endif
22 |
--------------------------------------------------------------------------------
/rqt_ptam/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | A GUI plugin to remote control PTAM.
5 |
6 |
7 |
8 | image-x-generic
9 | A GUI plugin to remote control ptam.
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ptam/thirdparty/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | @echo "making third party libs"
3 | cd TooN && make
4 | cd libcvd && make
5 | cd gvars3 && make
6 | cd agast && make
7 |
8 |
9 | distclean:
10 | @echo "cleaning up third party libs and doing a fresh checkout"
11 | cd TooN && make clean
12 | cd libcvd && make distclean
13 | cd gvars3 && make distclean
14 | cd agast && make distclean
15 |
16 | clean:
17 | @echo "cleaning up third party libs without doing a fresh checkout"
18 | #cd TooN && make clean #TooN is header only
19 | cd libcvd && make clean
20 | cd gvars3 && make clean
21 | cd agast && make clean
22 |
23 |
24 |
--------------------------------------------------------------------------------
/ptam/src/Map.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2008 Isis Innovation Limited
2 | #include "ptam/Map.h"
3 | #include "ptam/MapPoint.h"
4 |
5 | Map::Map()
6 | {
7 | Reset();
8 | }
9 |
10 | void Map::Reset()
11 | {
12 | vpPoints.clear();
13 | bGood = false;
14 | EmptyTrash();
15 | }
16 |
17 | void Map::MoveBadPointsToTrash()
18 | {
19 | int nBad = 0;
20 | for(int i = vpPoints.size()-1; i>=0; i--)
21 | {
22 | if(vpPoints[i]->bBad)
23 | {
24 | vpPointsTrash.push_back(vpPoints[i]);
25 | vpPoints.erase(vpPoints.begin() + i);
26 | nBad++;
27 | }
28 | };
29 | };
30 |
31 | void Map::EmptyTrash()
32 | {
33 | vpPointsTrash.clear();
34 | };
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/ptam/mainpage.dox:
--------------------------------------------------------------------------------
1 | /**
2 | \mainpage
3 | \htmlinclude manifest.html
4 |
5 | \b ptam is ...
6 |
7 |
10 |
11 |
12 | \section codeapi Code API
13 |
14 |
24 |
25 |
26 | */
27 |
--------------------------------------------------------------------------------
/ptam_com/mainpage.dox:
--------------------------------------------------------------------------------
1 | /**
2 | \mainpage
3 | \htmlinclude manifest.html
4 |
5 | \b sfly_srvs is ...
6 |
7 |
10 |
11 |
12 | \section codeapi Code API
13 |
14 |
24 |
25 |
26 | */
27 |
--------------------------------------------------------------------------------
/ptam/thirdparty/agast/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.4.6)
2 |
3 | add_definitions(-D_REENTRANT -Wall -O3 -Wextra -Winit-self -Woverloaded-virtual -Wnon-virtual-dtor -Wsign-promo -Wno-long-long )
4 |
5 | #where the demo will be placed
6 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/installfiles)
7 | #where the libs will be placed
8 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
9 |
10 | file(GLOB AGAST_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc")
11 |
12 | file(GLOB AGAST_HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/agast/*.h")
13 |
14 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/agast)
15 |
16 | #build the library dynamic and static versions
17 | add_library(agast ${AGAST_SOURCE_FILES} ${AGAST_HEADER_FILES})
18 |
19 |
20 | find_package(OpenCV REQUIRED)
21 | target_link_libraries(agast ${OpenCV_LIBRARIES})
22 |
23 |
24 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | dependencies/TooN/build/
2 | dependencies/TooN/html/
3 | dependencies/gvars3/build/
4 | dependencies/gvars3/include/
5 | dependencies/gvars3/installfiles/config.status
6 | dependencies/gvars3/lib/
7 | dependencies/libcvd/bin/
8 | dependencies/libcvd/build/
9 | dependencies/libcvd/include/
10 | dependencies/libcvd/lib/
11 | ptam/.cproject
12 | ptam/.project
13 | ptam/bin/
14 | ptam/build/
15 | ptam/cfg/PTAMVisualizerParams.cfgc
16 | ptam/cfg/PtamParams.cfgc
17 | ptam/cfg/cpp/
18 | ptam/docs/
19 | ptam/src/ptam/cfg/PTAMVisualizerParamsConfig.py
20 | ptam/src/ptam/cfg/PtamParamsConfig.py
21 | ptam_com/build/
22 | ptam_com/msg_gen/
23 | ptam_com/src/
24 | ptam_com/srv_gen/
25 | ptam/thirdparty/agast/lib/
26 | ptam/thirdparty/gvars3/git_checkedout
27 | ptam/thirdparty/gvars3/sources/
28 | ptam/thirdparty/libcvd/git_checkedout
29 | ptam/thirdparty/libcvd/sources/
30 |
31 | /build
32 | /Debug
33 | *~
34 |
--------------------------------------------------------------------------------
/ptam_com/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.3)
2 | project(ptam_com)
3 |
4 | #List to make rest of code more readable
5 | set( MESSAGE_DEPENDENCIES
6 | std_msgs
7 | geometry_msgs
8 | sensor_msgs
9 | )
10 |
11 | #Declare build dependencies
12 | find_package(catkin REQUIRED
13 | COMPONENTS
14 | message_generation
15 | ${MESSAGE_DEPENDENCIES} )
16 |
17 | add_message_files(DIRECTORY msg
18 | FILES
19 | KeyFrame_msg.msg
20 | OctoMapPointArray.msg
21 | OctoMapPointStamped.msg
22 | OctoMapScan.msg
23 | Vector3Array.msg
24 | ptam_info.msg
25 | )
26 |
27 | add_service_files(DIRECTORY srv
28 | FILES
29 | KeyFrame_srv.srv
30 | PointCloud.srv
31 | )
32 |
33 | #And now generate the messages
34 | generate_messages(DEPENDENCIES ${MESSAGE_DEPENDENCIES})
35 |
36 | #Declare package run-time dependencies
37 | catkin_package( CATKIN_DEPENDS message_runtime ${MESSAGE_DEPENDENCIES})
38 |
--------------------------------------------------------------------------------
/ptam/thirdparty/gvars3/Makefile:
--------------------------------------------------------------------------------
1 | all: git_checkedout gvars_built
2 |
3 | git_checkedout:
4 | mkdir -p sources
5 | git clone https://github.com/edrosten/gvars.git sources
6 | cd sources && git checkout 1f325cead6117b4fbd8016e46dc2f654f0ab7f25
7 | touch git_checkedout
8 |
9 | gvars_built:
10 | cp -r sources build
11 | cd build && if [ "`arch`" = "armv7l" ]; then sed -i 's/CXX=@CXX@/CXX=@CXX@ -fPIC/g' Makefile.in; fi
12 | cd build && export CPATH=../../TooN/include && ./configure --without-ffmpeg --without-dc1394v1 --without-dc1394v2 --with-lapack --with-pic=no && make -j4 -l4
13 | mkdir -p include
14 | mkdir -p lib
15 | cp build/*.so* lib
16 | cp -r build/gvars3 include
17 | touch gvars_built
18 |
19 | distclean:
20 | rm -rf sources
21 | rm git_checkedout
22 | rm -rf include lib
23 | rm -rf build
24 | rm -f gvars_built
25 |
26 | clean:
27 | rm -rf include lib
28 | rm -rf build
29 | rm -f gvars_built
30 |
--------------------------------------------------------------------------------
/ptam/include/ptam/OctomapInterface.h:
--------------------------------------------------------------------------------
1 | /*
2 | * octomapinterface.h
3 | *
4 | * Created on: Dec 26, 2012
5 | * Author: slynen
6 | */
7 |
8 | #ifndef PCLINTERFACE_H_
9 | #define PCLINTERFACE_H_
10 | #include
11 | #include
12 | #include
13 |
14 | class OctoMapInterface
15 | {
16 | private:
17 | ros::NodeHandle& nh_;
18 | ros::Publisher pub_scan_;
19 | ros::Publisher pub_points_;
20 |
21 | std::set localUpdateQueue_; //to collect updates before publishing them all at once
22 |
23 | unsigned int kfseq_;
24 | unsigned int pointseq_;
25 | public:
26 | OctoMapInterface( ros::NodeHandle& nh);
27 | virtual ~OctoMapInterface();
28 |
29 | void addKeyFrame(KeyFrame::Ptr k);
30 | void updatePoint(MapPoint::Ptr p);
31 | void updatePoints(std::set& p);
32 | void deletePoint(MapPoint::Ptr p);
33 |
34 | protected:
35 | void publishPointUpdateFromQueue();
36 |
37 | };
38 |
39 | #endif /* PCLINTERFACE_H_ */
40 |
--------------------------------------------------------------------------------
/ptam/include/ptam/Relocaliser.h:
--------------------------------------------------------------------------------
1 | // -*- c++ -*-
2 | // Copyright 2008 Isis Innovation Limited
3 | //
4 | // SmallBlurryImage-based relocaliser
5 | //
6 | // Each KF stores a small, blurred version of itself;
7 | // Just compare a small, blurred version of the input frame to all the KFs,
8 | // choose the closest match, and then estimate a camera rotation by direct image
9 | // minimisation.
10 |
11 | #ifndef __RELOCALISER_H
12 | #define __RELOCALISER_H
13 | #include
14 | #include "ATANCamera.h"
15 | #include "SmallBlurryImage.h"
16 |
17 | #include "Map.h"
18 |
19 |
20 | class Relocaliser
21 | {
22 | public:
23 | Relocaliser(Map &map, ATANCamera &camera);
24 | bool AttemptRecovery(KeyFrame& k);
25 | SE3<> BestPose();
26 |
27 | protected:
28 | void ScoreKFs(KeyFrame& kCurrentF);
29 | Map &mMap;
30 | ATANCamera mCamera;
31 | int mnBest;
32 | double mdBestScore;
33 | SE2<> mse2;
34 | SE3<> mse3Best;
35 |
36 | };
37 | #endif
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/ptam/include/ptam/SmallMatrixOpts.h:
--------------------------------------------------------------------------------
1 | // -*- c++ -*-
2 | // Copyright 2008 Isis Innovation Limited
3 | //
4 | // Inverse of 2-matrix
5 | // Must be invertible!
6 | #ifndef __SMALL_MATRIX_OPTS
7 | #define __SMALL_MATRIX_OPTS
8 | #include
9 |
10 | inline Matrix<2> M2Inverse(const Matrix<2> &m)
11 | {
12 | Matrix<2> m2Res;
13 | double dDet = m[0][0] * m[1][1] - m[1][0] * m[0][1];
14 | assert(dDet!=0.0);
15 | double dInverseDet = 1.0 / dDet;
16 | m2Res[0][0] = m[1][1] * dInverseDet;
17 | m2Res[1][1] = m[0][0] * dInverseDet;
18 | m2Res[1][0] = -m[1][0] * dInverseDet;
19 | m2Res[0][1] = -m[0][1] * dInverseDet;
20 | return m2Res;
21 | };
22 |
23 | // Determinant of 2x2
24 | inline double M2Det(Matrix<2> m)
25 | {
26 | return m[0][0] * m[1][1] - m[0][1] * m[1][0];
27 | }
28 |
29 | // Determinant of 3x3
30 | inline double M3Det(Matrix<3> m )
31 | {
32 | return
33 | m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) -
34 | m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0]) +
35 | m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]);
36 | }
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/ptam/thirdparty/libcvd/Makefile:
--------------------------------------------------------------------------------
1 | ifeq ("$(shell arch)", "armv7l")
2 | CXXFLAGS+= -mfpu=neon
3 | endif
4 | CXXFLAGS+= -fsee -funsafe-loop-optimizations -ffinite-math-only -fno-signed-zeros -fno-math-errno -funroll-loops
5 |
6 | all: git_checkedout libcvd_built
7 |
8 | git_checkedout:
9 | mkdir -p sources
10 | git clone https://github.com/edrosten/libcvd.git sources
11 | cd sources && git checkout 26bb46b9845383a4724a5e24db42dc27d41477d4
12 | touch git_checkedout
13 |
14 | libcvd_built:
15 | cp -r sources build
16 | cd build && export CPATH=../../TooN/include && export CXXFLAGS="$(CXXFLAGS)" && ./configure --without-ffmpeg --without-dc1394v1 --without-dc1394v2 --with-toon --with-lapack
17 | cd build && export CPATH=../../TooN/include && make -j4 -l4
18 | mkdir -p include
19 | mkdir -p lib
20 | cp build/*.so* lib
21 | cp -r build/cvd include
22 | touch libcvd_built
23 |
24 | distclean:
25 | rm -rf sources
26 | rm git_checkedout
27 | rm -rf include lib
28 | rm -rf build
29 | rm -f libcvd_built
30 |
31 | clean:
32 | rm -rf include lib
33 | rm -rf build
34 | rm -f libcvd_built
35 |
36 |
--------------------------------------------------------------------------------
/rqt_ptam/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.3)
2 | project(rqt_ptam)
3 |
4 | find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
5 | find_package(catkin REQUIRED)
6 |
7 |
8 | catkin_package()
9 |
10 | include(${QT_USE_FILE})
11 |
12 | set(rqt_ptam_SRCS
13 | src/rqt_ptam/remote_ptam.cpp
14 | src/rqt_ptam/ratio_layouted_frame.cpp
15 | )
16 |
17 | set(rqt_ptam_HDRS
18 | include/rqt_ptam/remote_ptam.h
19 | include/rqt_ptam/ratio_layouted_frame.h
20 | )
21 |
22 | set(rqt_ptam_UIS
23 | src/rqt_ptam/remote_ptam.ui
24 | )
25 |
26 | set(rqt_ptam_INCLUDE_DIRECTORIES
27 | # include
28 | ${CMAKE_CURRENT_BINARY_DIR}
29 | )
30 |
31 | qt4_wrap_cpp(rqt_ptam_MOCS ${rqt_ptam_HDRS} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
32 | qt4_wrap_ui(rqt_ptam_UIS_H ${rqt_ptam_UIS})
33 |
34 | include_directories(include ${rqt_ptam_INCLUDE_DIRECTORIES} ${catkin_INCLUDE_DIRS})
35 | add_library(rqt_ptam ${rqt_ptam_SRCS} ${rqt_ptam_MOCS} ${rqt_ptam_UIS_H})
36 | target_link_libraries(rqt_ptam ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${catkin_LIBRARIES})
37 |
38 |
39 |
--------------------------------------------------------------------------------
/ptam/PtamFixParams.yaml:
--------------------------------------------------------------------------------
1 | gui: True
2 | ImageSizeX: 752
3 | ImageSizeY: 480
4 | ARBuffer_width: 1200
5 | ARBuffer_height: 900
6 | WiggleScale: 0.1
7 | BundleMEstimator: Tukey
8 | TrackerMEstimator: Tukey
9 | MinTukeySigma: 0.4
10 | CandidateMinSTScore: 70
11 | Calibrator_BlurSigma: 1.0
12 | Calibrator_MeanGate: 10
13 | Calibrator_MinCornersForGrabbedImage: 20
14 | Calibrator_Optimize: 0
15 | Calibrator_Show: 0
16 | Calibrator_NoDistortion: 0
17 | CameraCalibrator_MaxStepDistFraction: 0.3
18 | CameraCalibrator_CornerPatchSize: 20
19 | GLWindowMenu_Enable: True
20 | GLWindowMenu_mgvnMenuItemWidth: 90
21 | GLWindowMenu_mgvnMenuTextOffset: 20
22 | InitLevel: 1
23 | MaxKFDistWiggleMult: 1
24 | MaxPatchesPerFrame: 300
25 | MaxKF: 15
26 | parent_frame: world
27 | TrackingQualityFoundPixels: 50
28 | UseKFPixelDist: True
29 | NoLevelZeroMapPoints: True
30 | FASTMethod: OAST16
31 | MaxStereoInitLoops: 4
32 | AutoInitPixel: 20
33 |
34 | # --- bluefox - low distort lens ---
35 | Cam_fx: 0.795574
36 | Cam_fy: 1.25149
37 | Cam_cx: 0.50417
38 | Cam_cy: 0.51687
39 | Cam_s: 0.482014
40 | # -----------------------------------
41 |
42 |
--------------------------------------------------------------------------------
/ptam/include/ptam/MapViewer.h:
--------------------------------------------------------------------------------
1 | // -*- c++ -*-
2 | // Copyright 2008 Isis Innovation Limited
3 | //
4 | // MapViewer.h
5 | //
6 | // Defines the MapViewer class
7 | //
8 | // This defines a simple map viewer widget, which can draw the
9 | // current map and the camera/keyframe poses within it.
10 | //
11 | #ifndef __MAP_VIEWER_H
12 | #define __MAP_VIEWER_H
13 |
14 | #include "Map.h"
15 | #include
16 | using namespace TooN;
17 | #include
18 | #include
19 | #include "GLWindow2.h"
20 |
21 | struct Map;
22 |
23 | class MapViewer
24 | {
25 | public:
26 | MapViewer(Map &map, GLWindow2 &glw);
27 | void DrawMap(SE3<> se3CamFromWorld);
28 | std::string GetMessageForUser();
29 |
30 | protected:
31 | Map &mMap;
32 | GLWindow2 &mGLWindow;
33 |
34 | void DrawGrid();
35 | void DrawMapDots();
36 | void DrawCamera(SE3<> se3, bool bSmall=false);
37 | void SetupFrustum();
38 | void SetupModelView(SE3<> se3WorldFromCurrent = SE3<>());
39 |
40 | Vector<3> mv3MassCenter;
41 | SE3<> mse3ViewerFromWorld;
42 |
43 | std::ostringstream mMessageForUser;
44 | };
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/ethzasl_ptam/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ethzasl_ptam
4 | 0.0.1
5 |
6 |
7 | Stack for the modified version of the monocular SLAM framework PTAM
8 |
9 |
10 |
11 | Markus Achtelik
12 | Stephan Weiss
13 | Simon Lynen
14 |
15 |
16 | see http://www.robots.ox.ac.uk/~gk/PTAM/download.html
17 |
18 | http://ros.org/wiki/ethzasl_ptam
19 | https://github.com/ethz-asl/ethzasl_ptam
20 | https://github.com/ethz-asl/ethzasl_ptam/issues
21 |
22 | Markus Achtelik
23 | Stephan Weiss
24 | Simon Lynen
25 |
26 | catkin
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/ptam/include/ptam/SmallBlurryImage.h:
--------------------------------------------------------------------------------
1 | // -*- c++ -*-
2 | // Copyright 2008 Isis Innovation Limited
3 | //
4 | // SmallBlurryImage - A small and blurry representation of an image.
5 | // used by the relocaliser.
6 |
7 | #ifndef __SMALLBLURRYIMAGE_H
8 | #define __SMALLBLURRYIMAGE_H
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include "KeyFrame.h"
14 | #include "ATANCamera.h"
15 |
16 | class SmallBlurryImage
17 | {
18 | public:
19 | SmallBlurryImage();
20 | SmallBlurryImage(KeyFrame& kf, double dBlur = 2.5);
21 | void MakeFromKF(KeyFrame& kf, double dBlur = 2.5);
22 | void MakeJacs();
23 | double ZMSSD(SmallBlurryImage &other);
24 | std::pair,double> IteratePosRelToTarget(SmallBlurryImage &other, int nIterations = 10);
25 | static SE3<> SE3fromSE2(SE2<> se2, ATANCamera camera);
26 |
27 | protected:
28 | CVD::Image mimSmall;
29 | CVD::Image mimTemplate;
30 | CVD::Image > mimImageJacs;
31 | bool mbMadeJacs;
32 | static CVD::ImageRef mirSize;
33 | };
34 |
35 |
36 |
37 | #endif
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/ptam/thirdparty/agast/installfiles/Makefile_orig:
--------------------------------------------------------------------------------
1 | # Minimalistic Makefile for the AGAST demo package
2 | # author: Elmar Mair
3 | # date: 06/2010
4 | # license: GPL v3
5 |
6 | ####################################################
7 | # please adapt following lines to your environment #
8 | ####################################################
9 | OPENCV_INCLUDE_PATH = /usr/local/include/opencv
10 | OPENCV_LIBRARY_PATH = /usr/lib
11 |
12 | ########################################################
13 | # the following lines should not be edited by the user #
14 | ########################################################
15 | CXX = g++
16 | PROG = demo
17 | OBJ = agast5_8.o agast5_8_nms.o agast7_12s.o agast7_12s_nms.o agast7_12d.o agast7_12d_nms.o oast9_16.o oast9_16_nms.o nonMaximumSuppression.o
18 |
19 | CXXFLAGS += -DHAVE_OPENCV -I$(OPENCV_INCLUDE_PATH) -O3 -Wall -Wextra
20 | LDFLAGS += -L$(OPENCV_LIBRARY_PATH) -lcxcore -lcv -lhighgui
21 |
22 | all: $(PROG)
23 |
24 | $(PROG) : $(PROG).cc $(OBJ)
25 | $(CXX) $(CXXFLAGS) $(PROG).cc $(LDFLAGS) $(OBJ) -o $@
26 |
27 | %.o : %.c
28 | $(CXX) $(CXXFLAGS) -c $<
29 |
30 | clean:
31 | -@rm *.o $(PROG)
32 |
33 |
--------------------------------------------------------------------------------
/ptam/include/ptam/Map.h:
--------------------------------------------------------------------------------
1 | // -*- c++ -*-
2 | // Copyright 2008 Isis Innovation Limited
3 | //
4 | // This header declares the Map class.
5 | // This is pretty light-weight: All it contains is
6 | // a vector of MapPoints and a vector of KeyFrames.
7 | //
8 | // N.b. since I don't do proper thread safety,
9 | // everything is stored as lists of pointers,
10 | // and map points are not erased if they are bad:
11 | // they are moved to the trash list. That way
12 | // old pointers which other threads are using are not
13 | // invalidated!
14 |
15 | #ifndef __MAP_H
16 | #define __MAP_H
17 | #include
18 | #include
19 | #include
20 | #include
21 |
22 | struct MapPoint;
23 | struct KeyFrame;
24 |
25 | struct Map
26 | {
27 | Map();
28 | inline bool IsGood() {return bGood;}
29 | void Reset();
30 |
31 | void MoveBadPointsToTrash();
32 | void EmptyTrash();
33 |
34 | std::vector > vpPoints;
35 | std::vector > vpPointsTrash;
36 | std::vector > vpKeyFrames;
37 |
38 | bool bGood;
39 | };
40 |
41 |
42 |
43 |
44 | #endif
45 |
46 |
--------------------------------------------------------------------------------
/ptam/include/ptam/CalibCornerPatch.h:
--------------------------------------------------------------------------------
1 | // -*- c++ -*-
2 | // Copyright 2008 Isis Innovation Limited
3 |
4 | #ifndef __CALIB_CORNER_PATCH_H
5 | #define __CALIB_CORNER_PATCH_H
6 | #include
7 | using namespace TooN;
8 | #include
9 | #include
10 |
11 | class CalibCornerPatch
12 | {
13 | public:
14 | struct Params
15 | {
16 | Params();
17 | Matrix<2> m2Warp();
18 | Vector<2> v2Pos;
19 | Vector<2> v2Angles;
20 | double dMean;
21 | double dGain;
22 | };
23 |
24 | CalibCornerPatch(int nSideSize = 8);
25 | bool IterateOnImage(Params ¶ms, CVD::Image &im);
26 | bool IterateOnImageWithDrawing(Params ¶ms, CVD::Image &im);
27 |
28 | protected:
29 | void MakeTemplateWithCurrentParams();
30 | void FillTemplate(CVD::Image &im, Params params);
31 | double Iterate(CVD::Image &im);
32 | Params mParams;
33 | CVD::Image mimTemplate;
34 | CVD::Image > mimGradients;
35 | CVD::Image > mimAngleJacs;
36 |
37 | void MakeSharedTemplate();
38 | static CVD::Image mimSharedSourceTemplate;
39 |
40 | double mdLastError;
41 | };
42 |
43 |
44 |
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/ptam/thirdparty/agast/include/agast/cvWrapper.h:
--------------------------------------------------------------------------------
1 | //
2 | // cvWrapper - header file to define CvPoint in case openCV is not installed
3 | //
4 | // Copyright (C) 2010 Elmar Mair
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #ifndef CVWRAPPER_H_
20 | #define CVWRAPPER_H_
21 |
22 | #define HAVE_OPENCV //we normally do have opencv
23 |
24 | #ifdef HAVE_OPENCV
25 | #include
26 | #else
27 | typedef struct CvPoint
28 | {
29 | int x;
30 | int y;
31 | }
32 | CvPoint;
33 | #endif
34 |
35 | #endif /* CVWRAPPER_H_ */
36 |
--------------------------------------------------------------------------------
/ptam/src/ShiTomasi.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2008 Isis Innovation Limited
2 | #include "ptam/ShiTomasi.h"
3 | #include
4 |
5 | using namespace CVD;
6 |
7 | double FindShiTomasiScoreAtPoint(BasicImage &image,
8 | int nHalfBoxSize,
9 | ImageRef irCenter)
10 | {
11 | double dXX = 0;
12 | double dYY = 0;
13 | double dXY = 0;
14 |
15 | ImageRef irStart = irCenter - ImageRef(nHalfBoxSize, nHalfBoxSize);
16 | ImageRef irEnd = irCenter + ImageRef(nHalfBoxSize, nHalfBoxSize);
17 |
18 | ImageRef ir;
19 | for(ir.y = irStart.y; ir.y<=irEnd.y; ir.y++)
20 | for(ir.x = irStart.x; ir.x<=irEnd.x; ir.x++)
21 | {
22 | double dx = image[ir + ImageRef(1,0)] - image[ir - ImageRef(1,0)];
23 | double dy = image[ir + ImageRef(0,1)] - image[ir - ImageRef(0,1)];
24 | dXX += dx*dx;
25 | dYY += dy*dy;
26 | dXY += dx*dy;
27 | }
28 |
29 | int nPixels = (irEnd - irStart + ImageRef(1,1)).area();
30 | dXX = dXX / (2.0 * nPixels);
31 | dYY = dYY / (2.0 * nPixels);
32 | dXY = dXY / (2.0 * nPixels);
33 |
34 | // Find and return smaller eigenvalue:
35 | return 0.5 * (dXX + dYY - sqrt( (dXX + dYY) * (dXX + dYY) - 4 * (dXX * dYY - dXY * dXY) ));
36 | };
37 |
38 |
--------------------------------------------------------------------------------
/ptam/thirdparty/agast/installfiles/Makefile:
--------------------------------------------------------------------------------
1 | # Minimalistic Makefile for the AGAST demo package
2 | # author: Elmar Mair
3 | # date: 06/2010
4 | # license: GPL v3
5 |
6 | ####################################################
7 | # please adapt following lines to your environment #
8 | ####################################################
9 | #OPENCV_INCLUDE_PATH = /home/slynen/ros_cturtle/stacks/vision_opencv/opencv2/opencv/include
10 | #OPENCV_LIBRARY_PATH = /usr/lib
11 |
12 | ########################################################
13 | # the following lines should not be edited by the user #
14 | ########################################################
15 | CXX = g++
16 | PROG = demo
17 | OBJ = agast5_8.o agast5_8_nms.o agast7_12s.o agast7_12s_nms.o agast7_12d.o agast7_12d_nms.o oast9_16.o oast9_16_nms.o nonMaximumSuppression.o
18 | #-I$(OPENCV_INCLUDE_PATH)
19 | CXXFLAGS += -DHAVE_OPENCV -O3 -Wall -Wextra $(AGAST_INCLUDE) $(OPENCV_INCLUDE)
20 | #-L$(OPENCV_LIBRARY_PATH)
21 | LDFLAGS += -lcv -lhighgui -lcxcore
22 |
23 | all: $(PROG)
24 |
25 | $(PROG) : ../src/$(PROG).cc $(OBJ)
26 | $(CXX) $(CXXFLAGS) ../src/$(PROG).cc $(LDFLAGS) $(OBJ) -o $@
27 |
28 | %.o : ../src/%.c
29 | $(CXX) $(CXXFLAGS) -c $<
30 |
31 | clean:
32 | -@rm *.o $(PROG)
33 |
34 |
--------------------------------------------------------------------------------
/ptam/thirdparty/TooN/COPYING:
--------------------------------------------------------------------------------
1 | This library is free software; you can redistribute it and/or modify it under
2 | the terms of the GNU General Public License as published by the Free Software
3 | Foundation; either version 2, or (at your option) any later version.
4 |
5 | As a special exception, you may use these files as part of a free software
6 | library without restriction. Specifically, if other files instantiate
7 | templates or use macros or inline functions from this library, or you compile
8 | this library and link it with other files to produce an executable, this
9 | library does not by itself cause the resulting executable to be covered by the
10 | GNU General Public License. This exception does not however invalidate any
11 | other reasons why the executable file might be covered by the GNU General
12 | Public License.
13 |
14 | This library is distributed in the hope that it will be useful, but WITHOUT ANY
15 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
16 | PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 |
18 | You should have received a copy of the GNU General Public License along with
19 | this library; see the file GPL.txt. If not, write to the Free Software
20 | Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 |
--------------------------------------------------------------------------------
/ptam/include/ptam/MiniPatch.h:
--------------------------------------------------------------------------------
1 | // -*- c++ -*-
2 | // Copyright 2008 Isis Innovation Limited
3 | //
4 | // MiniPatch.h
5 | //
6 | // Declares MiniPatch class
7 | //
8 | // This is a simple pixel-patch class, used for tracking small patches
9 | // it's used by the tracker for building the initial map
10 |
11 | #ifndef __MINI_PATCH_H
12 | #define __MINI_PATCH_H
13 |
14 | #include
15 | #include
16 | #include
17 | #include
18 | using namespace TooN;
19 | #include
20 |
21 | struct MiniPatch
22 | {
23 | void SampleFromImage(CVD::ImageRef irPos, CVD::BasicImage &im); // Copy pixels out of source image
24 | bool FindPatch(CVD::ImageRef &irPos, // Find patch in a new image
25 | CVD::BasicImage &im,
26 | int nRange,
27 | std::vector &vCorners,
28 | std::vector *pvRowLUT = NULL);
29 |
30 | inline int SSDAtPoint(CVD::BasicImage &im, const CVD::ImageRef &ir); // Score function
31 | static int mnHalfPatchSize; // How big is the patch?
32 | static int mnRange; // How far to search?
33 | static int mnMaxSSD; // Max SSD for matches?
34 | CVD::Image mimOrigPatch; // Original pixels
35 | };
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/ptam/include/ptam/CameraCalibrator.h:
--------------------------------------------------------------------------------
1 | // -*- c++ -*-
2 | // Copyright 2008 Isis Innovation Limited
3 |
4 | #ifndef __CAMERACALIBRATOR_H
5 | #define __CAMERACALIBRATOR_H
6 | #include "CalibImage.h"
7 | #include
8 | #include
9 | #include "GLWindow2.h"
10 | #include
11 | #include
12 | #include
13 |
14 | class CameraCalibrator
15 | {
16 | public:
17 | CameraCalibrator();
18 | ~CameraCalibrator();
19 | void Run();
20 |
21 | protected:
22 | void Reset();
23 | void init();
24 | GLWindow2 *mGLWindow;
25 | ATANCamera mCamera;
26 | bool mbDone;
27 |
28 | std::vector mvCalibImgs;
29 | void OptimizeOneStep();
30 |
31 | bool mbGrabNextFrame;
32 |
33 | GVars3::gvar3 mgvnOptimizing;
34 | GVars3::gvar3 mgvnShowImage;
35 | GVars3::gvar3 mgvnDisableDistortion;
36 |
37 | double mdMeanPixelError;
38 |
39 | CVD::Image mCurrentImage;
40 | image_transport::Subscriber mImageSub;
41 | bool mDoOptimize;
42 | bool mNewImage;
43 | void imageCallback(const sensor_msgs::ImageConstPtr & img);
44 |
45 | void GUICommandHandler(std::string sCommand, std::string sParams);
46 | static void GUICommandCallBack(void* ptr, std::string sCommand, std::string sParams);
47 | };
48 |
49 | #endif
50 |
--------------------------------------------------------------------------------
/ptam/src/main.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2008 Isis Innovation Limited
2 | // This is the main extry point for PTAM
3 | #include
4 | #include
5 | #include
6 | #include "ptam/System.h"
7 | #include
8 |
9 | #include "ros/ros.h"
10 |
11 | using namespace std;
12 | using namespace GVars3;
13 |
14 | int main(int argc, char** argv)
15 | {
16 | ros::init(argc, argv, "ptam");
17 | ROS_INFO("starting ptam with node name %s", ros::this_node::getName().c_str());
18 |
19 | cout << " Welcome to PTAM " << endl;
20 | cout << " --------------- " << endl;
21 | cout << " Parallel tracking and mapping for Small AR workspaces" << endl;
22 | cout << " Copyright (C) Isis Innovation Limited 2008 " << endl;
23 | cout << endl;
24 |
25 | GUI.StartParserThread(); // Start parsing of the console input
26 | atexit(GUI.StopParserThread);
27 |
28 | try
29 | {
30 | std::cout<<"Gui is "<<(PtamParameters::fixparams().gui ? "on" : "off")< v3PlanePoint_C = k.se3CfromW * v3WorldPos;
12 |
13 | // Find the height of this above the plane.
14 | // Assumes the normal is pointing toward the camera.
15 | double dCamHeight = fabs(v3PlanePoint_C * v3Normal_NC);
16 |
17 | double dPixelRate = fabs(v3Center_NC * v3Normal_NC);
18 | double dOneRightRate = fabs(v3OneRightFromCenter_NC * v3Normal_NC);
19 | double dOneDownRate = fabs(v3OneDownFromCenter_NC * v3Normal_NC);
20 |
21 | // Find projections onto plane
22 | Vector<3> v3CenterOnPlane_C = v3Center_NC * dCamHeight / dPixelRate;
23 | Vector<3> v3OneRightOnPlane_C = v3OneRightFromCenter_NC * dCamHeight / dOneRightRate;
24 | Vector<3> v3OneDownOnPlane_C = v3OneDownFromCenter_NC * dCamHeight / dOneDownRate;
25 |
26 | // Find differences of these projections in the world frame
27 | v3PixelRight_W = k.se3CfromW.get_rotation().inverse() * (v3OneRightOnPlane_C - v3CenterOnPlane_C);
28 | v3PixelDown_W = k.se3CfromW.get_rotation().inverse() * (v3OneDownOnPlane_C - v3CenterOnPlane_C);
29 | }
30 |
--------------------------------------------------------------------------------
/rqt_ptam/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | rqt_ptam
4 | 0.0.1
5 |
6 |
7 | Remote PTAM plugin for rqt, based on rqt_image_view from Dirk Thomas, TU Darmstadt
8 |
9 |
10 |
11 | Markus Achtelik
12 | Stephan Weiss
13 | Simon Lynen
14 |
15 | see http://www.robots.ox.ac.uk/~gk/PTAM/download.html
16 |
17 | http://ros.org/wiki/ethzasl_ptam/rqt_ptam
18 | https://github.com/ethz-asl/ethzasl_ptam
19 | https://github.com/ethz-asl/ethzasl_ptam/issues
20 |
21 | Markus Achtelik
22 | Stephan Weiss
23 | Simon Lynen
24 |
25 | catkin
26 | roscpp
27 | std_msgs
28 | ptam_com
29 | sensor_msgs
30 | cv_bridge
31 |
32 | roscpp
33 | rqt_gui
34 | rqt_gui_cpp
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/ptam_com/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ptam_com
4 | 0.0.1
5 |
6 |
7 | header files for the modified version of the monocular SLAM framework PTAM
8 |
9 |
10 |
11 | Markus Achtelik
12 | Stephan Weiss
13 | Simon Lynen
14 |
15 | see http://www.robots.ox.ac.uk/~gk/PTAM/download.html
16 |
17 | http://ros.org/wiki/ethzasl_ptam/ptam
18 | https://github.com/ethz-asl/ethzasl_ptam
19 | https://github.com/ethz-asl/ethzasl_ptam/issues
20 |
21 | Markus Achtelik
22 | Stephan Weiss
23 | Simon Lynen
24 |
25 | catkin
26 |
27 | message_generation
28 | std_msgs
29 | roscpp
30 | sensor_msgs
31 | geometry_msgs
32 |
33 | message_runtime
34 | std_msgs
35 | roscpp
36 | sensor_msgs
37 | geometry_msgs
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/ptam/thirdparty/agast/installfiles/README:
--------------------------------------------------------------------------------
1 |
2 | *** AGAST corner detector *** Version: 1.0.4
3 | -------------------------------
4 |
5 | -- How to compile and use the demo program --
6 |
7 | Adapt the OPENCV paths in the 'Makefile' and compile the sources by typing 'make'
8 | in the program folder. Run the program by typing
9 | demo
10 | where specifies your input image.
11 |
12 | As result you get four images with the names oast9_16.ppm, agast7_12d.ppm,
13 | agast7_12s.ppm and agast5_8.ppm. These images represent the result of
14 | - the optimal accelerated segment test on a pixel mask of 16 pixels (with a 9 pixel arc length),
15 | - the adaptive and generic AST with a 12 pixel diamond and square shaped mask and
16 | - the adaptive and generic AST with a 8 pixel mask.
17 |
18 | With the parameters AST_THR_16, AST_THR_12 and AST_THR_8 in the 'demo.cc' file you
19 | can define the thresholds to adjust the corner response of the AST.
20 |
21 |
22 | -- Referencing this work --
23 |
24 | If you are publishing a project using this software, please refrence following
25 | publication:
26 |
27 | @inproceedings{mair2010_agast,
28 | title = "Adaptive and Generic Corner Detection Based on the Accelerated Segment Test",
29 | author = "Elmar Mair and Gregory D. Hager and Darius Burschka and Michael Suppa and Gerhard Hirzinger",
30 | year = "2010",
31 | month = "September",
32 | booktitle = "European Conference on Computer Vision (ECCV'10)",
33 | notes = "Poster presentation",
34 | url = "http://www6.in.tum.de/Main/ResearchAgast"
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/ptam/include/ptam/CalibImage.h:
--------------------------------------------------------------------------------
1 | // -*- c++ -*-
2 | // Copyright 2008 Isis Innovation Limited
3 |
4 | #ifndef __CALIB_IMAGE_H
5 | #define __CALIB_IMAGE_H
6 | #include "ATANCamera.h"
7 | #include "CalibCornerPatch.h"
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 | const int N_NOT_TRIED=-1;
14 | const int N_FAILED=-2;
15 |
16 | struct CalibGridCorner
17 | {
18 | struct NeighborState
19 | {
20 | NeighborState() {val = N_NOT_TRIED;}
21 | int val;
22 | };
23 |
24 | CalibCornerPatch::Params Params;
25 | CVD::ImageRef irGridPos;
26 | NeighborState aNeighborStates[4];
27 |
28 | Matrix<2> GetSteps(std::vector &vgc);
29 | Matrix<2> mInheritedSteps;
30 |
31 | void Draw();
32 |
33 | double ExpansionPotential();
34 | };
35 |
36 | class CalibImage
37 | {
38 | public:
39 |
40 | bool MakeFromImage(CVD::Image &im);
41 | SE3<> mse3CamFromWorld;
42 | void DrawImageGrid();
43 | void Draw3DGrid(ATANCamera &Camera, bool bDrawErrors);
44 | void GuessInitialPose(ATANCamera &Camera);
45 |
46 | struct ErrorAndJacobians
47 | {
48 | Vector<2> v2Error;
49 | Matrix<2,6> m26PoseJac;
50 | Matrix<2,NUMTRACKERCAMPARAMETERS> m2NCameraJac;
51 | };
52 |
53 | std::vector Project(ATANCamera &Camera);
54 |
55 | CVD::Image mim;
56 |
57 | protected:
58 | std::vector mvCorners;
59 | std::vector mvGridCorners;
60 |
61 |
62 | bool ExpandByAngle(int nSrc, int nDirn);
63 | int NextToExpand();
64 | void ExpandByStep(int n);
65 | CVD::ImageRef IR_from_dirn(int nDirn);
66 |
67 | };
68 |
69 |
70 |
71 |
72 | #endif
73 |
74 |
--------------------------------------------------------------------------------
/ptam/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ptam
4 | 0.0.1
5 |
6 |
7 | Modified version of the monocular SLAM framework PTAM
8 |
9 |
10 |
11 | Markus Achtelik
12 | Stephan Weiss
13 | Simon Lynen
14 |
15 | see http://www.robots.ox.ac.uk/~gk/PTAM/download.html
16 |
17 | http://ros.org/wiki/ethzasl_ptam/ptam
18 | https://github.com/ethz-asl/ethzasl_ptam
19 | https://github.com/ethz-asl/ethzasl_ptam/issues
20 |
21 | Markus Achtelik
22 | Stephan Weiss
23 | Simon Lynen
24 |
25 | catkin
26 |
27 | roscpp
28 | std_msgs
29 | ptam_com
30 | sensor_msgs
31 | image_transport
32 | tf
33 | visualization_msgs
34 | dynamic_reconfigure
35 | cv_bridge
36 |
37 | roscpp
38 | std_msgs
39 | ptam_com
40 | sensor_msgs
41 | image_transport
42 | tf
43 | visualization_msgs
44 | dynamic_reconfigure
45 | cv_bridge
46 |
47 |
--------------------------------------------------------------------------------
/ptam/thirdparty/agast/src/AstDetector.cc:
--------------------------------------------------------------------------------
1 | //
2 | // AstDetector - the interface class for the AGAST corner detector
3 | //
4 | // Copyright (C) 2010 Elmar Mair
5 | //
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 | //
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 | //
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see .
18 |
19 | #include "AstDetector.h"
20 | #include "cvWrapper.h"
21 |
22 | using namespace std;
23 | using namespace agast;
24 |
25 | void AstDetector::score(const unsigned char* i, const std::vector& corners_all)
26 | {
27 | unsigned int n=0;
28 | unsigned int num_corners=corners_all.size();
29 |
30 | if(num_corners > scores.capacity())
31 | {
32 | if(scores.capacity()==0)
33 | {
34 | scores.reserve(512 > num_corners ? 512 : num_corners);
35 | }
36 | else
37 | {
38 | unsigned int nScores = scores.capacity()*2;
39 | if(num_corners > nScores)
40 | nScores = num_corners;
41 | scores.reserve(nScores);
42 | }
43 | }
44 |
45 | scores.resize(num_corners);
46 |
47 | for(; n < num_corners; n++)
48 | scores[n] = cornerScore(i + corners_all[n].y*xsize + corners_all[n].x);
49 | }
50 |
51 | void AstDetector::nms(const unsigned char* im, const std::vector& corners_all,
52 | std::vector& corners_nms)
53 | {
54 | score(im,corners_all);
55 | nonMaximumSuppression(corners_all, corners_nms);
56 | }
57 |
--------------------------------------------------------------------------------
/ptam/include/ptam/LevelHelpers.h:
--------------------------------------------------------------------------------
1 | // -*- c++ -*-
2 | // Copyright 2008 Isis Innovation Limited
3 |
4 | // LevelHelpers.h - a few handy tools to ease using levels.
5 | // The important thing is the XXXPos functions, which convert
6 | // image positions from one level to another. Use these whenever
7 | // transforming positions to ensure consistent operation!!
8 |
9 | #ifndef __LEVEL_HELPERS_H
10 | #define __LEVEL_HELPERS_H
11 | #include
12 | using namespace TooN;
13 | #include
14 |
15 | // Set of global colours useful for drawing stuff:
16 | extern Vector<3> gavLevelColors[];
17 | // (These are filled in in KeyFrame.cc)
18 |
19 | // What is the scale of a level?
20 | inline int LevelScale(int nLevel)
21 | {
22 | return 1 << nLevel;
23 | }
24 |
25 | // 1-D transform to level zero:
26 | inline double LevelZeroPos(double dLevelPos, int nLevel)
27 | {
28 | return (dLevelPos + 0.5) * LevelScale(nLevel) - 0.5;
29 | }
30 |
31 | // 2-D transforms to level zero:
32 | inline Vector<2> LevelZeroPos(Vector<2> v2LevelPos, int nLevel)
33 | {
34 | Vector<2> v2Ans;
35 | v2Ans[0] = LevelZeroPos(v2LevelPos[0], nLevel);
36 | v2Ans[1] = LevelZeroPos(v2LevelPos[1], nLevel);
37 | return v2Ans;
38 | }
39 | inline Vector<2> LevelZeroPos(CVD::ImageRef irLevelPos, int nLevel)
40 | {
41 | Vector<2> v2Ans;
42 | v2Ans[0] = LevelZeroPos(irLevelPos.x, nLevel);
43 | v2Ans[1] = LevelZeroPos(irLevelPos.y, nLevel);
44 | return v2Ans;
45 | }
46 |
47 | // 1-D transform from level zero to level N:
48 | inline double LevelNPos(double dRootPos, int nLevel)
49 | {
50 | return (dRootPos + 0.5) / LevelScale(nLevel) - 0.5;
51 | }
52 |
53 | // 2-D transform from level zero to level N:
54 | inline Vector<2> LevelNPos(Vector<2> v2RootPos, int nLevel)
55 | {
56 | Vector<2> v2Ans;
57 | v2Ans[0] = LevelNPos(v2RootPos[0], nLevel);
58 | v2Ans[1] = LevelNPos(v2RootPos[1], nLevel);
59 | return v2Ans;
60 | }
61 |
62 | #endif
63 |
--------------------------------------------------------------------------------
/ptam/src/Relocaliser.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2008 Isis Innovation Limited
2 | #include "ptam/Relocaliser.h"
3 | #include "ptam/SmallBlurryImage.h"
4 | #include
5 | //#include
6 |
7 | using namespace CVD;
8 | using namespace std;
9 | //using namespace GVars3;
10 |
11 | Relocaliser::Relocaliser(Map &map, ATANCamera &camera)
12 | : mMap(map),
13 | mCamera(camera)
14 | {
15 | };
16 |
17 | SE3<> Relocaliser::BestPose()
18 | {
19 | return mse3Best;
20 | }
21 |
22 | bool Relocaliser::AttemptRecovery(KeyFrame& kCurrent)
23 | {
24 | // Ensure the incoming frame has a SmallBlurryImage attached
25 | if(!kCurrent.pSBI)
26 | kCurrent.pSBI = new SmallBlurryImage(kCurrent);
27 | else
28 | kCurrent.pSBI->MakeFromKF(kCurrent);
29 |
30 | // Find the best ZMSSD match from all keyframes in map
31 | ScoreKFs(kCurrent);
32 |
33 | // And estimate a camera rotation from a 3DOF image alignment
34 | pair, double> result_pair = kCurrent.pSBI->IteratePosRelToTarget(*mMap.vpKeyFrames[mnBest]->pSBI, 6);
35 | mse2 = result_pair.first;
36 | double dScore =result_pair.second;
37 |
38 | SE3<> se3KeyFramePos = mMap.vpKeyFrames[mnBest]->se3CfromW;
39 | mse3Best = SmallBlurryImage::SE3fromSE2(mse2, mCamera) * se3KeyFramePos;
40 |
41 | //Weiss{
42 |
43 | const ptam::PtamParamsConfig& pPars = PtamParameters::varparams();
44 | //if(dScore < GV2.GetDouble("Reloc2.MaxScore", 9e6, SILENT))
45 | if(dScore < pPars.RelocMaxScore)
46 | return true;
47 | else
48 | return false;
49 | //}
50 | };
51 |
52 | // Compare current KF to all KFs stored in map by
53 | // Zero-mean SSD
54 | void Relocaliser::ScoreKFs(KeyFrame& kCurrent)
55 | {
56 | mdBestScore = 99999999999999.9;
57 | mnBest = -1;
58 |
59 | for(unsigned int i=0; iZMSSD(*mMap.vpKeyFrames[i]->pSBI);
62 | if(dSSD < mdBestScore)
63 | {
64 | mdBestScore = dSSD;
65 | mnBest = i;
66 | }
67 | }
68 | }
69 |
70 |
--------------------------------------------------------------------------------
/ptam/include/ptam/HomographyInit.h:
--------------------------------------------------------------------------------
1 | // -*- c++ -*-
2 | // Copyright 2008 Isis Innovation Limited
3 |
4 | // HomographyInit.h
5 | // Declares the HomographyInit class and a few helper functions.
6 | //
7 | // This class is used by MapMaker to bootstrap the map, and implements
8 | // the homography decomposition of Faugeras and Lustman's 1988 tech
9 | // report.
10 | //
11 | // Implementation according to Faugeras and Lustman
12 |
13 | #ifndef __HOMOGRAPHY_INIT_H
14 | #define __HOMOGRAPHY_INIT_H
15 | #include
16 | using namespace TooN;
17 | #include
18 | #include
19 |
20 | // Homography matches are 2D-2D matches in a stereo pair, unprojected
21 | // to the Z=1 plane.
22 | struct HomographyMatch
23 | {
24 | // To be filled in by MapMaker:
25 | Vector<2> v2CamPlaneFirst;
26 | Vector<2> v2CamPlaneSecond;
27 | Matrix<2> m2PixelProjectionJac;
28 | };
29 |
30 | // Storage for each homography decomposition
31 | struct HomographyDecomposition
32 | {
33 | Vector<3> v3Tp;
34 | Matrix<3> m3Rp;
35 | double d;
36 | Vector<3> v3n;
37 |
38 | // The resolved composition..
39 | SE3<> se3SecondFromFirst;
40 | int nScore;
41 | };
42 |
43 | class HomographyInit
44 | {
45 | public:
46 | bool Compute(std::vector vMatches, double dMaxPixelError, SE3<> &se3SecondCameraPose);
47 | protected:
48 | Matrix<3> HomographyFromMatches(std::vector vMatches);
49 | void BestHomographyFromMatches_MLESAC();
50 | void DecomposeHomography();
51 | void ChooseBestDecomposition();
52 | void RefineHomographyWithInliers();
53 |
54 | bool IsHomographyInlier(Matrix<3> m3Homography, HomographyMatch match);
55 | double MLESACScore(Matrix<3> m3Homography, HomographyMatch match);
56 |
57 | double mdMaxPixelErrorSquared;
58 | Matrix<3> mm3BestHomography;
59 | std::vector mvMatches;
60 | std::vector mvHomographyInliers;
61 | std::vector mvDecompositions;
62 | };
63 |
64 |
65 |
66 | #endif
67 |
--------------------------------------------------------------------------------
/ptam/include/ptam/GLWindowMenu.h:
--------------------------------------------------------------------------------
1 | // -*- c++ -*-
2 | // Copyright 2008 Isis Innovation Limited
3 |
4 | #ifndef __GL_WINDOW_MENU_H
5 | #define __GL_WINDOW_MENU_H
6 |
7 | // A simple gvars-driven menu system for GLWindow2
8 | // N.b. each GLWindowMenu class internally contains sub-menus
9 |
10 | #include
11 | #include