├── CMakeLists.txt ├── Cameras ├── MI9T_640x360.yaml ├── MI9T_640x360_0.6.yaml ├── TUM1.yaml ├── TUM2.yaml ├── TUM3.yaml ├── deer_walk.yaml ├── diamond_vr_slow.yaml └── diamond_walk.yaml ├── Data ├── diamond_dji │ ├── detections_yolov8x_seg_diamond_dji_with_ellipse.json │ └── diamond_dji_associated.txt ├── diamond_ground │ ├── detections_yolov8x_seg_diamond_ground_robot_with_ellipse.json │ └── diamond_ground_robot_associated.txt ├── diamond_head │ ├── detections_yolov8x_seg_diamond_walk_head_with_ellipse.json │ └── diamond_walk_head_associated.txt ├── diamond_walk │ ├── detections_yolov8x_seg_diamond_with_ellipse.json │ └── diamond_walk_associated.txt ├── fr2_desk │ ├── detections_yolov8x_seg_tum_rgbd_fr2_desk_with_ellipse.json │ └── fr2_desk.txt ├── fr2_person │ ├── detections_yolov8x_seg_fr2_person_with_ellipse.json │ └── fr2_person_associated.txt └── fr3 │ ├── detections_yolov8x_seg_fr3_office_with_ellipse.json │ └── fr3_office.txt ├── Dependencies.md ├── Examples ├── rgbd_diamond_with_ellipse.cc └── rgbd_tum_with_ellipse.cc ├── LICENSE ├── PythonScripts ├── ReadMe.md ├── camera_pose_object.py ├── find_diamond_corresponds.py ├── find_tum_corresponds.py ├── generate_detection_files.py ├── generate_rgbd_association.py └── process_diamond_gt.py ├── README.md ├── Thirdparty ├── DBoW2 │ ├── CMakeLists.txt │ ├── DBoW2 │ │ ├── BowVector.cpp │ │ ├── BowVector.h │ │ ├── FClass.h │ │ ├── FORB.cpp │ │ ├── FORB.h │ │ ├── FeatureVector.cpp │ │ ├── FeatureVector.h │ │ ├── ScoringObject.cpp │ │ ├── ScoringObject.h │ │ └── TemplatedVocabulary.h │ ├── DUtils │ │ ├── Random.cpp │ │ ├── Random.h │ │ ├── Timestamp.cpp │ │ └── Timestamp.h │ ├── LICENSE.txt │ └── README.txt ├── Osmap │ ├── build.sh │ ├── include │ │ ├── Dummymap.h │ │ ├── Osmap.h │ │ └── Osmap2.h │ ├── osmap.pb.cc │ ├── osmap.pb.h │ ├── osmap.proto │ ├── readme.md │ └── src │ │ └── Osmap.cpp ├── g2o │ ├── CMakeLists.txt │ ├── README.txt │ ├── cmake_modules │ │ ├── FindBLAS.cmake │ │ ├── FindEigen3.cmake │ │ └── FindLAPACK.cmake │ ├── config.h │ ├── config.h.in │ ├── g2o │ │ ├── core │ │ │ ├── base_binary_edge.h │ │ │ ├── base_binary_edge.hpp │ │ │ ├── base_edge.h │ │ │ ├── base_multi_edge.h │ │ │ ├── base_multi_edge.hpp │ │ │ ├── base_unary_edge.h │ │ │ ├── base_unary_edge.hpp │ │ │ ├── base_vertex.h │ │ │ ├── base_vertex.hpp │ │ │ ├── batch_stats.cpp │ │ │ ├── batch_stats.h │ │ │ ├── block_solver.h │ │ │ ├── block_solver.hpp │ │ │ ├── cache.cpp │ │ │ ├── cache.h │ │ │ ├── creators.h │ │ │ ├── eigen_types.h │ │ │ ├── estimate_propagator.cpp │ │ │ ├── estimate_propagator.h │ │ │ ├── factory.cpp │ │ │ ├── factory.h │ │ │ ├── hyper_dijkstra.cpp │ │ │ ├── hyper_dijkstra.h │ │ │ ├── hyper_graph.cpp │ │ │ ├── hyper_graph.h │ │ │ ├── hyper_graph_action.cpp │ │ │ ├── hyper_graph_action.h │ │ │ ├── jacobian_workspace.cpp │ │ │ ├── jacobian_workspace.h │ │ │ ├── linear_solver.h │ │ │ ├── marginal_covariance_cholesky.cpp │ │ │ ├── marginal_covariance_cholesky.h │ │ │ ├── matrix_operations.h │ │ │ ├── matrix_structure.cpp │ │ │ ├── matrix_structure.h │ │ │ ├── openmp_mutex.h │ │ │ ├── optimizable_graph.cpp │ │ │ ├── optimizable_graph.h │ │ │ ├── optimization_algorithm.cpp │ │ │ ├── optimization_algorithm.h │ │ │ ├── optimization_algorithm_dogleg.cpp │ │ │ ├── optimization_algorithm_dogleg.h │ │ │ ├── optimization_algorithm_factory.cpp │ │ │ ├── optimization_algorithm_factory.h │ │ │ ├── optimization_algorithm_gauss_newton.cpp │ │ │ ├── optimization_algorithm_gauss_newton.h │ │ │ ├── optimization_algorithm_levenberg.cpp │ │ │ ├── optimization_algorithm_levenberg.h │ │ │ ├── optimization_algorithm_property.h │ │ │ ├── optimization_algorithm_with_hessian.cpp │ │ │ ├── optimization_algorithm_with_hessian.h │ │ │ ├── parameter.cpp │ │ │ ├── parameter.h │ │ │ ├── parameter_container.cpp │ │ │ ├── parameter_container.h │ │ │ ├── robust_kernel.cpp │ │ │ ├── robust_kernel.h │ │ │ ├── robust_kernel_factory.cpp │ │ │ ├── robust_kernel_factory.h │ │ │ ├── robust_kernel_impl.cpp │ │ │ ├── robust_kernel_impl.h │ │ │ ├── solver.cpp │ │ │ ├── solver.h │ │ │ ├── sparse_block_matrix.h │ │ │ ├── sparse_block_matrix.hpp │ │ │ ├── sparse_block_matrix_ccs.h │ │ │ ├── sparse_block_matrix_diagonal.h │ │ │ ├── sparse_block_matrix_test.cpp │ │ │ ├── sparse_optimizer.cpp │ │ │ └── sparse_optimizer.h │ │ ├── solvers │ │ │ ├── linear_solver_dense.h │ │ │ └── linear_solver_eigen.h │ │ ├── stuff │ │ │ ├── color_macros.h │ │ │ ├── macros.h │ │ │ ├── misc.h │ │ │ ├── os_specific.c │ │ │ ├── os_specific.h │ │ │ ├── property.cpp │ │ │ ├── property.h │ │ │ ├── string_tools.cpp │ │ │ ├── string_tools.h │ │ │ ├── timeutil.cpp │ │ │ └── timeutil.h │ │ └── types │ │ │ ├── se3_ops.h │ │ │ ├── se3_ops.hpp │ │ │ ├── se3quat.h │ │ │ ├── sim3.h │ │ │ ├── types_sba.cpp │ │ │ ├── types_sba.h │ │ │ ├── types_seven_dof_expmap.cpp │ │ │ ├── types_seven_dof_expmap.h │ │ │ ├── types_six_dof_expmap.cpp │ │ │ └── types_six_dof_expmap.h │ └── license-bsd.txt └── json │ ├── .clang-format │ ├── .clang-tidy │ ├── .drone.yml │ ├── .github │ ├── CODEOWNERS │ ├── CONTRIBUTING.md │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE │ │ ├── Bug_report.md │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ ├── SECURITY.md │ ├── config.yml │ ├── stale.yml │ └── workflows │ │ ├── codeql-analysis.yml │ │ ├── macos.yml │ │ ├── ubuntu.yml │ │ └── windows.yml │ ├── .gitignore │ ├── CITATION.cff │ ├── CMakeLists.txt │ ├── CODE_OF_CONDUCT.md │ ├── ChangeLog.md │ ├── LICENSE.MIT │ ├── Makefile │ ├── README.md │ ├── appveyor.yml │ ├── benchmarks │ ├── CMakeLists.txt │ └── src │ │ └── benchmarks.cpp │ ├── cmake │ ├── ci.cmake │ ├── config.cmake.in │ ├── download_test_data.cmake │ ├── nlohmann_jsonConfigVersion.cmake.in │ └── pkg-config.pc.in │ ├── include │ └── nlohmann │ │ ├── adl_serializer.hpp │ │ ├── byte_container_with_subtype.hpp │ │ ├── detail │ │ ├── conversions │ │ │ ├── from_json.hpp │ │ │ ├── to_chars.hpp │ │ │ └── to_json.hpp │ │ ├── exceptions.hpp │ │ ├── hash.hpp │ │ ├── input │ │ │ ├── binary_reader.hpp │ │ │ ├── input_adapters.hpp │ │ │ ├── json_sax.hpp │ │ │ ├── lexer.hpp │ │ │ ├── parser.hpp │ │ │ └── position_t.hpp │ │ ├── iterators │ │ │ ├── internal_iterator.hpp │ │ │ ├── iter_impl.hpp │ │ │ ├── iteration_proxy.hpp │ │ │ ├── iterator_traits.hpp │ │ │ ├── json_reverse_iterator.hpp │ │ │ └── primitive_iterator.hpp │ │ ├── json_pointer.hpp │ │ ├── json_ref.hpp │ │ ├── macro_scope.hpp │ │ ├── macro_unscope.hpp │ │ ├── meta │ │ │ ├── call_std │ │ │ │ ├── begin.hpp │ │ │ │ └── end.hpp │ │ │ ├── cpp_future.hpp │ │ │ ├── detected.hpp │ │ │ ├── identity_tag.hpp │ │ │ ├── is_sax.hpp │ │ │ ├── type_traits.hpp │ │ │ └── void_t.hpp │ │ ├── output │ │ │ ├── binary_writer.hpp │ │ │ ├── output_adapters.hpp │ │ │ └── serializer.hpp │ │ ├── string_escape.hpp │ │ └── value_t.hpp │ │ ├── json.hpp │ │ ├── json_fwd.hpp │ │ ├── ordered_map.hpp │ │ └── thirdparty │ │ └── hedley │ │ ├── hedley.hpp │ │ └── hedley_undef.hpp │ ├── meson.build │ ├── nlohmann_json.natvis │ ├── single_include │ └── nlohmann │ │ └── json.hpp │ ├── third_party │ ├── amalgamate │ │ ├── CHANGES.md │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── amalgamate.py │ │ └── config.json │ ├── cpplint │ │ ├── LICENSE │ │ ├── README.rst │ │ ├── cpplint.py │ │ └── update.sh │ ├── gdb_pretty_printer │ │ ├── README.md │ │ └── nlohmann-json.py │ └── macro_builder │ │ └── main.cpp │ └── wsjcpp.yml ├── Vocabulary └── ORBvoc.txt.tar.gz ├── build.sh ├── include ├── Camera.h ├── ColorManager.h ├── Converter.h ├── Distance.h ├── Ellipse.h ├── Ellipsoid.h ├── Frame.h ├── FrameDrawer.h ├── Graph.h ├── ImageDetections.h ├── Initializer.h ├── KeyFrame.h ├── KeyFrameDatabase.h ├── LocalMapping.h ├── LoopClosing.h ├── Map.h ├── MapDrawer.h ├── MapPoint.h ├── ORBVocabulary.h ├── ORBextractor.h ├── ORBmatcher.h ├── Object.h ├── ObjectMatcher.h ├── Optimizer.h ├── OptimizerObject.h ├── Osmap.h ├── PnPsolver.h ├── Reconstruction.h ├── RingBuffer.h ├── Scene.h ├── Sim3Solver.h ├── System.h ├── Tracking.h ├── Utils.h ├── Viewer.h ├── osmap.pb.h ├── p3p.h ├── rendertree.h └── shader.h ├── script └── src ├── ARViewer.cc ├── Camera.cc ├── ColorManager.cc ├── Converter.cc ├── Distance.cc ├── Ellipse.cc ├── Ellipsoid.cc ├── Frame.cc ├── FrameDrawer.cc ├── Graph.cc ├── ImageDetections.cc ├── Initializer.cc ├── KeyFrame.cc ├── KeyFrameDatabase.cc ├── LocalMapping.cc ├── LoopClosing.cc ├── Map.cc ├── MapDrawer.cc ├── MapPoint.cc ├── ORBextractor.cc ├── ORBmatcher.cc ├── Object.cc ├── ObjectMatcher.cc ├── Optimizer.cc ├── OptimizerObject.cc ├── Osmap.cpp ├── PnPsolver.cc ├── Reconstruction.cc ├── Scene.cc ├── Sim3Solver.cc ├── System.cc ├── Tracking.cc ├── Utils.cc ├── Viewer.cc ├── osmap.pb.cc └── p3p.cc /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | project(ORB_SLAM2) 3 | 4 | IF(NOT CMAKE_BUILD_TYPE) 5 | SET(CMAKE_BUILD_TYPE Release) 6 | ENDIF() 7 | 8 | MESSAGE("Build type: " ${CMAKE_BUILD_TYPE}) 9 | 10 | set(CMAKE_CXX_FLAGS "-std=c++17 -faligned-new -Wall -Wno-deprecated-declarations -O3 -march=native") 11 | 12 | LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules) 13 | 14 | #find_package(OpenCV REQUIRED) 15 | #if(NOT OpenCV_FOUND) 16 | # message(FATAL_ERROR "OpenCV > 2.4.3 not found.") 17 | #else() 18 | # if(NOT "${OpenCV_VERSION_MAJOR}" STREQUAL "4") 19 | # message(WARNING "OpenCV 4 is required for dnn module. Object detector will not be available.") 20 | # else() 21 | # message("OpenCV 4 found. Make sure OpenCV is built with dnn module and CUDA.") 22 | # add_definitions(-DUSE_DNN) 23 | # endif() 24 | #endif() 25 | 26 | find_package(OpenCV 3.0 QUIET) 27 | if(NOT OpenCV_FOUND) 28 | find_package(OpenCV 2.4.3 QUIET) 29 | if(NOT OpenCV_FOUND) 30 | message(FATAL_ERROR "OpenCV > 2.4.3 not found.") 31 | endif() 32 | endif() 33 | 34 | 35 | 36 | find_package(Eigen3 3.1.0 REQUIRED) 37 | find_package(Pangolin REQUIRED) 38 | find_package(Protobuf REQUIRED) 39 | 40 | # JSON 41 | set(JSON_BuildTests OFF CACHE INTERNAL "") 42 | add_subdirectory(Thirdparty/json) 43 | 44 | # Dlib 45 | find_package(dlib REQUIRED) 46 | 47 | include_directories( 48 | ${PROJECT_SOURCE_DIR} 49 | ${PROJECT_SOURCE_DIR}/include 50 | ${EIGEN3_INCLUDE_DIR} 51 | ${Pangolin_INCLUDE_DIRS} 52 | ${PROTOBUF_INCLUDE_DIR} 53 | ) 54 | 55 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) 56 | 57 | add_library(${PROJECT_NAME} SHARED 58 | src/System.cc 59 | src/Tracking.cc 60 | src/LocalMapping.cc 61 | src/LoopClosing.cc 62 | src/ORBextractor.cc 63 | src/ORBmatcher.cc 64 | src/FrameDrawer.cc 65 | src/Converter.cc 66 | src/MapPoint.cc 67 | src/KeyFrame.cc 68 | src/Map.cc 69 | src/MapDrawer.cc 70 | src/Optimizer.cc 71 | src/PnPsolver.cc 72 | src/Frame.cc 73 | src/KeyFrameDatabase.cc 74 | src/Sim3Solver.cc 75 | src/Initializer.cc 76 | src/Viewer.cc 77 | src/Osmap.cpp 78 | src/osmap.pb.cc 79 | src/ImageDetections.cc 80 | src/Ellipse.cc 81 | src/Ellipsoid.cc 82 | src/Distance.cc 83 | src/OptimizerObject.cc 84 | src/Utils.cc 85 | src/ColorManager.cc 86 | src/Reconstruction.cc 87 | src/Camera.cc 88 | src/p3p.cc 89 | src/Graph.cc 90 | src/Object.cc 91 | src/ObjectMatcher.cc 92 | ) 93 | 94 | target_link_libraries(${PROJECT_NAME} 95 | ${OpenCV_LIBS} 96 | ${EIGEN3_LIBS} 97 | ${Pangolin_LIBRARIES} 98 | ${PROJECT_SOURCE_DIR}/Thirdparty/DBoW2/lib/libDBoW2.so 99 | ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o.so 100 | ${PROTOBUF_LIBRARIES} 101 | nlohmann_json::nlohmann_json 102 | stdc++fs 103 | dlib::dlib 104 | ) 105 | 106 | 107 | 108 | # Build Examples 109 | 110 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) 111 | 112 | add_executable(rgbd_tum_with_ellipse 113 | Examples/rgbd_tum_with_ellipse.cc) 114 | target_link_libraries(rgbd_tum_with_ellipse ${PROJECT_NAME}) 115 | 116 | add_executable(rgbd_diamond_with_ellipse 117 | Examples/rgbd_diamond_with_ellipse.cc) 118 | target_link_libraries(rgbd_diamond_with_ellipse ${PROJECT_NAME}) 119 | 120 | -------------------------------------------------------------------------------- /Cameras/MI9T_640x360.yaml: -------------------------------------------------------------------------------- 1 | %YAML:1.0 2 | 3 | #-------------------------------------------------------------------------------------------- 4 | # Camera Parameters. Adjust them! 5 | #-------------------------------------------------------------------------------------------- 6 | 7 | # Camera calibration and distortion parameters (OpenCV) 8 | Camera.fx: 565.077 9 | Camera.fy: 565.077 10 | Camera.cx: 320 11 | Camera.cy: 180 12 | 13 | Camera.k1: 0.0561645 14 | Camera.k2: 0 15 | Camera.p1: 0 16 | Camera.p2: 0 17 | Camera.k3: 0 18 | 19 | Camera.width: 640 20 | Camera.height: 360 21 | 22 | # Camera frames per second 23 | Camera.fps: 30.0 24 | 25 | # Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale) 26 | Camera.RGB: 1 27 | 28 | #-------------------------------------------------------------------------------------------- 29 | # ORB Parameters 30 | #-------------------------------------------------------------------------------------------- 31 | 32 | # ORB Extractor: Number of features per image 33 | ORBextractor.nFeatures: 1000 34 | 35 | # ORB Extractor: Scale factor between levels in the scale pyramid 36 | ORBextractor.scaleFactor: 1.2 37 | 38 | # ORB Extractor: Number of levels in the scale pyramid 39 | ORBextractor.nLevels: 8 40 | 41 | # ORB Extractor: Fast threshold 42 | # Image is divided in a grid. At each cell FAST are extracted imposing a minimum response. 43 | # Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST 44 | # You can lower these values if your images have low contrast 45 | ORBextractor.iniThFAST: 20 46 | ORBextractor.minThFAST: 7 47 | 48 | #-------------------------------------------------------------------------------------------- 49 | # Viewer Parameters 50 | #-------------------------------------------------------------------------------------------- 51 | Viewer.KeyFrameSize: 0.05 52 | Viewer.KeyFrameLineWidth: 1 53 | Viewer.GraphLineWidth: 0.9 54 | Viewer.PointSize:2 55 | Viewer.CameraSize: 0.08 56 | Viewer.CameraLineWidth: 3 57 | Viewer.ViewpointX: 0 58 | Viewer.ViewpointY: -0.7 59 | Viewer.ViewpointZ: -1.8 60 | Viewer.ViewpointF: 500 61 | 62 | -------------------------------------------------------------------------------- /Cameras/MI9T_640x360_0.6.yaml: -------------------------------------------------------------------------------- 1 | %YAML:1.0 2 | 3 | #-------------------------------------------------------------------------------------------- 4 | # Camera Parameters. Adjust them! 5 | #-------------------------------------------------------------------------------------------- 6 | 7 | # Camera calibration and distortion parameters (OpenCV) 8 | Camera.fx: 349.8 9 | Camera.fy: 349.8 10 | Camera.cx: 320 11 | Camera.cy: 180 12 | 13 | Camera.k1: 0.0561645 14 | Camera.k2: 0 15 | Camera.p1: 0 16 | Camera.p2: 0 17 | Camera.k3: 0 18 | 19 | Camera.width: 640 20 | Camera.height: 360 21 | 22 | # Camera frames per second 23 | Camera.fps: 30.0 24 | 25 | # Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale) 26 | Camera.RGB: 1 27 | 28 | #-------------------------------------------------------------------------------------------- 29 | # ORB Parameters 30 | #-------------------------------------------------------------------------------------------- 31 | 32 | # ORB Extractor: Number of features per image 33 | ORBextractor.nFeatures: 1000 34 | 35 | # ORB Extractor: Scale factor between levels in the scale pyramid 36 | ORBextractor.scaleFactor: 1.2 37 | 38 | # ORB Extractor: Number of levels in the scale pyramid 39 | ORBextractor.nLevels: 8 40 | 41 | # ORB Extractor: Fast threshold 42 | # Image is divided in a grid. At each cell FAST are extracted imposing a minimum response. 43 | # Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST 44 | # You can lower these values if your images have low contrast 45 | ORBextractor.iniThFAST: 20 46 | ORBextractor.minThFAST: 7 47 | 48 | #-------------------------------------------------------------------------------------------- 49 | # Viewer Parameters 50 | #-------------------------------------------------------------------------------------------- 51 | Viewer.KeyFrameSize: 0.02 52 | Viewer.KeyFrameLineWidth: 0.8 53 | Viewer.GraphLineWidth: 0.6 54 | Viewer.PointSize:2 55 | # Viewer.CameraSize: 0.08 56 | # Viewer.CameraLineWidth: 3 57 | Viewer.CameraSize: 0.04 58 | Viewer.CameraLineWidth: 2 59 | Viewer.ViewpointX: 0 60 | Viewer.ViewpointY: -0.7 61 | Viewer.ViewpointZ: -1.8 62 | Viewer.ViewpointF: 500 63 | 64 | -------------------------------------------------------------------------------- /Cameras/TUM1.yaml: -------------------------------------------------------------------------------- 1 | %YAML:1.0 2 | 3 | #-------------------------------------------------------------------------------------------- 4 | # Camera Parameters. Adjust them! 5 | #-------------------------------------------------------------------------------------------- 6 | 7 | # Camera calibration and distortion parameters (OpenCV) 8 | Camera.fx: 517.306408 9 | Camera.fy: 516.469215 10 | Camera.cx: 318.643040 11 | Camera.cy: 255.313989 12 | 13 | Camera.k1: 0.262383 14 | Camera.k2: -0.953104 15 | Camera.p1: -0.005358 16 | Camera.p2: 0.002628 17 | Camera.k3: 1.163314 18 | 19 | # Camera frames per second 20 | Camera.fps: 30.0 21 | 22 | # Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale) 23 | Camera.RGB: 1 24 | 25 | Camera.width: 640 26 | Camera.height: 480 27 | 28 | # IR projector baseline times fx (aprox.) 29 | Camera.bf: 40.0 30 | 31 | # Close/Far threshold. Baseline times. 32 | ThDepth: 40.0 33 | 34 | # Deptmap values factor 35 | DepthMapFactor: 5000.0 36 | 37 | #-------------------------------------------------------------------------------------------- 38 | # ORB Parameters 39 | #-------------------------------------------------------------------------------------------- 40 | 41 | # ORB Extractor: Number of features per image 42 | ORBextractor.nFeatures: 1000 43 | 44 | # ORB Extractor: Scale factor between levels in the scale pyramid 45 | ORBextractor.scaleFactor: 1.2 46 | 47 | # ORB Extractor: Number of levels in the scale pyramid 48 | ORBextractor.nLevels: 8 49 | 50 | # ORB Extractor: Fast threshold 51 | # Image is divided in a grid. At each cell FAST are extracted imposing a minimum response. 52 | # Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST 53 | # You can lower these values if your images have low contrast 54 | ORBextractor.iniThFAST: 20 55 | ORBextractor.minThFAST: 7 56 | 57 | #-------------------------------------------------------------------------------------------- 58 | # Viewer Parameters 59 | #-------------------------------------------------------------------------------------------- 60 | Viewer.KeyFrameSize: 0.05 61 | Viewer.KeyFrameLineWidth: 1 62 | Viewer.GraphLineWidth: 0.9 63 | Viewer.PointSize:2 64 | Viewer.CameraSize: 0.08 65 | Viewer.CameraLineWidth: 3 66 | Viewer.ViewpointX: 0 67 | Viewer.ViewpointY: -0.7 68 | Viewer.ViewpointZ: -1.8 69 | Viewer.ViewpointF: 500 70 | 71 | -------------------------------------------------------------------------------- /Cameras/TUM2.yaml: -------------------------------------------------------------------------------- 1 | %YAML:1.0 2 | 3 | #-------------------------------------------------------------------------------------------- 4 | # Camera Parameters. Adjust them! 5 | #-------------------------------------------------------------------------------------------- 6 | 7 | # Camera calibration and distortion parameters (OpenCV) 8 | Camera.fx: 520.908620 9 | Camera.fy: 521.007327 10 | Camera.cx: 325.141442 11 | Camera.cy: 249.701764 12 | 13 | Camera.k1: 0.231222 14 | Camera.k2: -0.784899 15 | Camera.p1: -0.003257 16 | Camera.p2: -0.000105 17 | Camera.k3: 0.917205 18 | 19 | # Camera frames per second 20 | Camera.fps: 30.0 21 | 22 | # Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale) 23 | Camera.RGB: 1 24 | 25 | Camera.width: 640 26 | Camera.height: 480 27 | 28 | # IR projector baseline times fx (aprox.) 29 | Camera.bf: 40.0 30 | 31 | # Close/Far threshold. Baseline times. 32 | ThDepth: 40.0 33 | 34 | # Deptmap values factor 35 | DepthMapFactor: 5208.0 36 | 37 | #-------------------------------------------------------------------------------------------- 38 | # ORB Parameters 39 | #-------------------------------------------------------------------------------------------- 40 | 41 | # ORB Extractor: Number of features per image 42 | ORBextractor.nFeatures: 1000 43 | 44 | # ORB Extractor: Scale factor between levels in the scale pyramid 45 | ORBextractor.scaleFactor: 1.2 46 | 47 | # ORB Extractor: Number of levels in the scale pyramid 48 | ORBextractor.nLevels: 8 49 | 50 | # ORB Extractor: Fast threshold 51 | # Image is divided in a grid. At each cell FAST are extracted imposing a minimum response. 52 | # Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST 53 | # You can lower these values if your images have low contrast 54 | ORBextractor.iniThFAST: 20 55 | ORBextractor.minThFAST: 7 56 | 57 | #-------------------------------------------------------------------------------------------- 58 | # Viewer Parameters 59 | #-------------------------------------------------------------------------------------------- 60 | # Viewer.KeyFrameSize: 0.05 61 | # Viewer.KeyFrameLineWidth: 1 62 | # Viewer.GraphLineWidth: 0.9 63 | # Viewer.PointSize: 2 64 | # Viewer.CameraSize: 0.08 65 | # Viewer.CameraLineWidth: 3 66 | # Viewer.ViewpointX: 0 67 | # Viewer.ViewpointY: -1 68 | # Viewer.ViewpointZ: -1.5 69 | # Viewer.ViewpointF: 750 70 | 71 | 72 | Viewer.KeyFrameSize: 0.05 73 | Viewer.KeyFrameLineWidth: 1 74 | Viewer.GraphLineWidth: 0.9 75 | Viewer.PointSize: 2 76 | Viewer.CameraSize: 0.08 77 | Viewer.CameraLineWidth: 3 78 | Viewer.ViewpointX: 0 79 | Viewer.ViewpointY: -0.7 80 | Viewer.ViewpointZ: -1.5 81 | Viewer.ViewpointF: 700 82 | 83 | -------------------------------------------------------------------------------- /Cameras/TUM3.yaml: -------------------------------------------------------------------------------- 1 | %YAML:1.0 2 | 3 | #-------------------------------------------------------------------------------------------- 4 | # Camera Parameters. Adjust them! 5 | #-------------------------------------------------------------------------------------------- 6 | 7 | # Camera calibration and distortion parameters (OpenCV) 8 | Camera.fx: 535.4 9 | Camera.fy: 539.2 10 | Camera.cx: 320.1 11 | Camera.cy: 247.6 12 | 13 | Camera.k1: 0.0 14 | Camera.k2: 0.0 15 | Camera.p1: 0.0 16 | Camera.p2: 0.0 17 | 18 | # Camera frames per second 19 | Camera.fps: 30.0 20 | 21 | # Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale) 22 | Camera.RGB: 1 23 | 24 | Camera.width: 640 25 | Camera.height: 480 26 | 27 | # IR projector baseline times fx (aprox.) 28 | Camera.bf: 40.0 29 | 30 | # Close/Far threshold. Baseline times. 31 | ThDepth: 40.0 32 | 33 | # Deptmap values factor 34 | DepthMapFactor: 5000.0 35 | #-------------------------------------------------------------------------------------------- 36 | # ORB Parameters 37 | #-------------------------------------------------------------------------------------------- 38 | 39 | # ORB Extractor: Number of features per image 40 | ORBextractor.nFeatures: 1000 41 | 42 | # ORB Extractor: Scale factor between levels in the scale pyramid 43 | ORBextractor.scaleFactor: 1.2 44 | 45 | # ORB Extractor: Number of levels in the scale pyramid 46 | ORBextractor.nLevels: 8 47 | 48 | # ORB Extractor: Fast threshold 49 | # Image is divided in a grid. At each cell FAST are extracted imposing a minimum response. 50 | # Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST 51 | # You can lower these values if your images have low contrast 52 | ORBextractor.iniThFAST: 20 53 | ORBextractor.minThFAST: 7 54 | 55 | #-------------------------------------------------------------------------------------------- 56 | # Viewer Parameters 57 | #-------------------------------------------------------------------------------------------- 58 | Viewer.KeyFrameSize: 0.05 59 | Viewer.KeyFrameLineWidth: 1 60 | Viewer.GraphLineWidth: 0.9 61 | Viewer.PointSize: 2 62 | Viewer.CameraSize: 0.08 63 | Viewer.CameraLineWidth: 3 64 | Viewer.ViewpointX: 0 65 | Viewer.ViewpointY: -0.7 66 | Viewer.ViewpointZ: -1.8 67 | Viewer.ViewpointF: 500 68 | 69 | -------------------------------------------------------------------------------- /Cameras/deer_walk.yaml: -------------------------------------------------------------------------------- 1 | %YAML:1.0 2 | 3 | #-------------------------------------------------------------------------------------------- 4 | # Camera Parameters. Adjust them! 5 | #-------------------------------------------------------------------------------------------- 6 | 7 | # Camera calibration and distortion parameters (OpenCV) 8 | Camera.fx: 600.0 9 | Camera.fy: 600.0 10 | Camera.cx: 320.0 11 | Camera.cy: 240.0 12 | 13 | Camera.k1: 0.0 14 | Camera.k2: 0.0 15 | Camera.p1: 0.0 16 | Camera.p2: 0.0 17 | Camera.k3: 0.0 18 | 19 | Camera.width: 640 20 | Camera.height: 480 21 | 22 | # Camera frames per second 23 | Camera.fps: 20.0 24 | 25 | # IR projector baseline times fx (aprox.) 26 | Camera.bf: 40.0 27 | 28 | # Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale) 29 | Camera.RGB: 1 30 | 31 | # Close/Far threshold. Baseline times. 32 | ThDepth: 40.0 33 | 34 | # Deptmap values factor 35 | DepthMapFactor: 1000.0 36 | 37 | #-------------------------------------------------------------------------------------------- 38 | # ORB Parameters 39 | #-------------------------------------------------------------------------------------------- 40 | 41 | # ORB Extractor: Number of features per image 42 | ORBextractor.nFeatures: 1000 43 | 44 | # ORB Extractor: Scale factor between levels in the scale pyramid 45 | ORBextractor.scaleFactor: 1.2 46 | 47 | # ORB Extractor: Number of levels in the scale pyramid 48 | ORBextractor.nLevels: 8 49 | 50 | # ORB Extractor: Fast threshold 51 | # Image is divided in a grid. At each cell FAST are extracted imposing a minimum response. 52 | # Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST 53 | # You can lower these values if your images have low contrast 54 | ORBextractor.iniThFAST: 20 55 | ORBextractor.minThFAST: 7 56 | 57 | #-------------------------------------------------------------------------------------------- 58 | # Viewer Parameters 59 | #-------------------------------------------------------------------------------------------- 60 | Viewer.KeyFrameSize: 0.05 61 | Viewer.KeyFrameLineWidth: 1 62 | Viewer.GraphLineWidth: 0.9 63 | Viewer.PointSize: 2 64 | Viewer.CameraSize: 0.08 65 | Viewer.CameraLineWidth: 3 66 | Viewer.ViewpointX: 0 67 | Viewer.ViewpointY: -0.7 68 | Viewer.ViewpointZ: -1.8 69 | Viewer.ViewpointF: 500 70 | 71 | -------------------------------------------------------------------------------- /Cameras/diamond_vr_slow.yaml: -------------------------------------------------------------------------------- 1 | %YAML:1.0 2 | 3 | #-------------------------------------------------------------------------------------------- 4 | # Camera Parameters. Adjust them! 5 | #-------------------------------------------------------------------------------------------- 6 | 7 | # Camera calibration and distortion parameters (OpenCV) 8 | Camera.fx: 600.0 9 | Camera.fy: 600.0 10 | Camera.cx: 320.0 11 | Camera.cy: 240.0 12 | 13 | Camera.k1: 0.0 14 | Camera.k2: 0.0 15 | Camera.p1: 0.0 16 | Camera.p2: 0.0 17 | Camera.k3: 0.0 18 | 19 | Camera.width: 640 20 | Camera.height: 480 21 | 22 | # Camera frames per second 23 | Camera.fps: 30.0 24 | 25 | # IR projector baseline times fx (aprox.) 26 | Camera.bf: 40.0 27 | 28 | # Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale) 29 | Camera.RGB: 1 30 | 31 | # Close/Far threshold. Baseline times. 32 | ThDepth: 40.0 33 | 34 | # Deptmap values factor 35 | DepthMapFactor: 1000.0 36 | 37 | #-------------------------------------------------------------------------------------------- 38 | # ORB Parameters 39 | #-------------------------------------------------------------------------------------------- 40 | 41 | # ORB Extractor: Number of features per image 42 | ORBextractor.nFeatures: 1000 43 | 44 | # ORB Extractor: Scale factor between levels in the scale pyramid 45 | ORBextractor.scaleFactor: 1.2 46 | 47 | # ORB Extractor: Number of levels in the scale pyramid 48 | ORBextractor.nLevels: 8 49 | 50 | # ORB Extractor: Fast threshold 51 | # Image is divided in a grid. At each cell FAST are extracted imposing a minimum response. 52 | # Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST 53 | # You can lower these values if your images have low contrast 54 | ORBextractor.iniThFAST: 20 55 | ORBextractor.minThFAST: 7 56 | 57 | #-------------------------------------------------------------------------------------------- 58 | # Viewer Parameters 59 | #-------------------------------------------------------------------------------------------- 60 | Viewer.KeyFrameSize: 0.05 61 | Viewer.KeyFrameLineWidth: 1 62 | Viewer.GraphLineWidth: 0.9 63 | Viewer.PointSize: 2 64 | Viewer.CameraSize: 0.08 65 | Viewer.CameraLineWidth: 3 66 | Viewer.ViewpointX: 0 67 | Viewer.ViewpointY: -0.7 68 | Viewer.ViewpointZ: -1.8 69 | Viewer.ViewpointF: 500 70 | 71 | -------------------------------------------------------------------------------- /Cameras/diamond_walk.yaml: -------------------------------------------------------------------------------- 1 | %YAML:1.0 2 | 3 | #-------------------------------------------------------------------------------------------- 4 | # Camera Parameters. Adjust them! 5 | #-------------------------------------------------------------------------------------------- 6 | 7 | # Camera calibration and distortion parameters (OpenCV) 8 | Camera.fx: 600.0 9 | Camera.fy: 600.0 10 | Camera.cx: 320.0 11 | Camera.cy: 240.0 12 | 13 | Camera.k1: 0.0 14 | Camera.k2: 0.0 15 | Camera.p1: 0.0 16 | Camera.p2: 0.0 17 | Camera.k3: 0.0 18 | 19 | Camera.width: 640 20 | Camera.height: 480 21 | 22 | # Camera frames per second 23 | Camera.fps: 20.0 24 | 25 | # IR projector baseline times fx (aprox.) 26 | Camera.bf: 40.0 27 | 28 | # Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale) 29 | Camera.RGB: 1 30 | 31 | # Close/Far threshold. Baseline times. 32 | ThDepth: 40.0 33 | 34 | # Deptmap values factor 35 | DepthMapFactor: 1000.0 36 | 37 | #-------------------------------------------------------------------------------------------- 38 | # ORB Parameters 39 | #-------------------------------------------------------------------------------------------- 40 | 41 | # ORB Extractor: Number of features per image 42 | ORBextractor.nFeatures: 1000 43 | 44 | # ORB Extractor: Scale factor between levels in the scale pyramid 45 | ORBextractor.scaleFactor: 1.2 46 | 47 | # ORB Extractor: Number of levels in the scale pyramid 48 | ORBextractor.nLevels: 8 49 | 50 | # ORB Extractor: Fast threshold 51 | # Image is divided in a grid. At each cell FAST are extracted imposing a minimum response. 52 | # Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST 53 | # You can lower these values if your images have low contrast 54 | ORBextractor.iniThFAST: 20 55 | ORBextractor.minThFAST: 7 56 | 57 | #-------------------------------------------------------------------------------------------- 58 | # Viewer Parameters 59 | #-------------------------------------------------------------------------------------------- 60 | Viewer.KeyFrameSize: 0.05 61 | Viewer.KeyFrameLineWidth: 1 62 | Viewer.GraphLineWidth: 0.9 63 | Viewer.PointSize: 2 64 | Viewer.CameraSize: 0.08 65 | Viewer.CameraLineWidth: 3 66 | Viewer.ViewpointX: 0 67 | Viewer.ViewpointY: -0.7 68 | Viewer.ViewpointZ: -1.8 69 | Viewer.ViewpointF: 500 70 | 71 | -------------------------------------------------------------------------------- /Dependencies.md: -------------------------------------------------------------------------------- 1 | ##List of Known Dependencies 2 | ###VOOM version 1.0 3 | 4 | In this document we list all the pieces of code included by VOOM and linked libraries that are not the property of the authors of VOOM. 5 | 6 | 7 | #####Code in **src** and **include** folders 8 | 9 | * *ORBextractor.cc*. 10 | This is a modified version of orb.cpp of OpenCV library. The original code is BSD licensed. 11 | 12 | * *PnPsolver.h, PnPsolver.cc*. 13 | This is a modified version of the epnp.h and epnp.cc of Vincent Lepetit. 14 | This code can be found in popular BSD licensed computer vision libraries as [OpenCV](https://github.com/Itseez/opencv/blob/master/modules/calib3d/src/epnp.cpp) and [OpenGV](https://github.com/laurentkneip/opengv/blob/master/src/absolute_pose/modules/Epnp.cpp). The original code is FreeBSD. 15 | 16 | * Function *ORBmatcher::DescriptorDistance* in *ORBmatcher.cc*. 17 | The code is from: http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel. 18 | The code is in the public domain. 19 | 20 | * *Viewer.h, Viewer.cc, Framedrawer.cc, Framedrawer.h, Mapdrawer.cc, Mapdrawer.h* 21 | This is a modified version based on ORB SLAM2 and OA-SLAM. 22 | 23 | * *Tracking.h, Tracking.cc, LocalMapping.h, LocalMapping.cc, System.h, System.cc* 24 | This is a modified version based on ORB SLAM2 25 | 26 | #####Code in Thirdparty folder 27 | 28 | * All code in **DBoW2** folder. 29 | This is a modified version of [DBoW2](https://github.com/dorian3d/DBoW2) and [DLib](https://github.com/dorian3d/DLib) library. All files included are BSD licensed. 30 | 31 | * All code in **g2o** folder. 32 | This is a modified version of [g2o](https://github.com/RainerKuemmerle/g2o). All files included are BSD licensed. 33 | 34 | * Code in **Json** folder. 35 | This is an unchanged version of [Json](https://github.com/nlohmann/json). Their licenses include Apache BSD GPLv3 and MIT. 36 | 37 | * Code in **Osmap** folder. 38 | This is a modified version of [Osmap](https://github.com/AlejandroSilvestri/osmap). All files included are GPLv3 licensed. 39 | 40 | #####Library dependencies 41 | 42 | * **Pangolin (visualization and user interface)**. 43 | [MIT license](https://en.wikipedia.org/wiki/MIT_License). 44 | 45 | * **OpenCV**. 46 | BSD license. 47 | 48 | * **Eigen3**. 49 | For versions greater than 3.1.1 is MPL2, earlier versions are LGPLv3. 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /PythonScripts/ReadMe.md: -------------------------------------------------------------------------------- 1 | # Preparing Your Data 2 | 3 | ## Requirements 4 | Tested with Python 3.7. Ensure these packages are installed: `numpy`, `opencv`, `json`, `glob`, `yaml`, `scipy`, `math`, `yolov8` (ultralytics). 5 | 6 | ## File Descriptions 7 | - **find_xxx_corresponds.py**: Generates a basic JSON file (e.g., `diamond_vr_slow.json`), which includes paths to RGB and depth images, and ground truth poses. It's a utility script for the following file generation. 8 | - **generate_rgbd_association.py**: Creates a `.txt` file to facilitate RGBD SLAM by matching timestamps with RGB and depth images. It's utilized by ORB-SLAM2. 9 | - **generate_detection_files.py**: The primary script for creating JSON files for our VOOM system. It records detection data as follows: 10 | ```python 11 | det = dict() 12 | det["category_id"] = category_id 13 | det["detection_score"] = np.float64(conf) 14 | det["bbox"] = list(box) 15 | det["ellipse"] = list(ellipse_data) 16 | - **process_diamond_gt.py**: Adjusts the ground truth format of ICL data to match that of TUM, used solely for evaluation purposes. 17 | - **camera_pose_object.py**: Handles pose processing. 18 | 19 | ## Dataset 20 | ### TUM 21 | ```shell 22 | python find_tum_corresponds.py 23 | python generate_rgbd_association.py 24 | python generate_detection_files.py 25 | ``` 26 | ### ICL-data 27 | ```shell 28 | python find_diamond_corresponds.py 29 | python generate_rgbd_association.py 30 | python generate_detection_files.py 31 | python process_diamond_gt.py 32 | ``` 33 | ### Recorded data 34 | Assume we have a ros file: 35 | 36 | 37 | -------------------------------------------------------------------------------- /PythonScripts/find_diamond_corresponds.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import json 3 | import os 4 | import glob 5 | import yaml 6 | from yaml.loader import SafeLoader 7 | 8 | # Open the file and load the file 9 | rgb_files = sorted(filter(os.path.isfile, glob.glob( 10 | '/home/yutong/data/diamond_vr_slow/cam0/data/' + '*.png'))) 11 | rgb_filenames = [] 12 | for file in rgb_files: 13 | head, filename = os.path.split(file) 14 | filename = filename[:-4] 15 | rgb_filenames.append(float(filename)) 16 | print('r',len(rgb_filenames)) 17 | 18 | depth_files = sorted(filter(os.path.isfile, glob.glob( 19 | '/home/yutong/data/diamond_vr_slow/depth0/data/' + '*.png'))) 20 | depth_filenames = [] 21 | for file in depth_files: 22 | head, filename = os.path.split(file) 23 | filename = filename[:-4] 24 | depth_filenames.append(float(filename)) 25 | print('d',len(depth_filenames)) 26 | 27 | 28 | gt = np.loadtxt('/home/yutong/data/diamond_vr_slow/poses.txt', delimiter=',') 29 | 30 | corres_gt = [] 31 | for i in range(len(gt)-1): 32 | tmp_gt = [gt[i][0], gt[i][1], gt[i][2], gt[i][3], gt[i][5], gt[i][6], gt[i][7], gt[i][4]] 33 | corres_gt.append(tmp_gt) 34 | 35 | dict_all = {"rgb": rgb_files, "depth": depth_files, "gt": corres_gt} 36 | with open('support_files/diamond_vr_slow.json', 'w') as outfile: 37 | json.dump(dict_all, outfile) -------------------------------------------------------------------------------- /PythonScripts/find_tum_corresponds.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import json 3 | import os 4 | import glob 5 | import yaml 6 | from yaml.loader import SafeLoader 7 | 8 | # Open the file and load the file 9 | rgb_files = sorted(filter(os.path.isfile, glob.glob( 10 | '/home/yutong/data/rgbd_dataset_freiburg2_large_with_loop/rgb/' + '*.png'))) 11 | rgb_filenames = [] 12 | for file in rgb_files: 13 | head, filename = os.path.split(file) 14 | filename = filename[:-4] 15 | rgb_filenames.append(float(filename)) 16 | print('r',len(rgb_filenames)) 17 | 18 | depth_files = sorted(filter(os.path.isfile, glob.glob( 19 | '/home/yutong/data/rgbd_dataset_freiburg2_large_with_loop/depth/' + '*.png'))) 20 | depth_filenames = [] 21 | for file in depth_files: 22 | head, filename = os.path.split(file) 23 | filename = filename[:-4] 24 | depth_filenames.append(float(filename)) 25 | print('d',len(depth_filenames)) 26 | 27 | corres_depth = [] 28 | j = 0 29 | for i in range(len(rgb_filenames)): 30 | rgb_time = rgb_filenames[i] 31 | delta_time_min = 10 32 | while j < len(depth_filenames) and abs(rgb_time - depth_filenames[j]) < delta_time_min: 33 | delta_time_min = abs(rgb_time - depth_filenames[j]) 34 | j = j+1 35 | j = j - 1 36 | print(rgb_time, depth_filenames[j]) 37 | corres_depth.append(depth_files[j]) 38 | 39 | gt = np.loadtxt('/home/yutong/data/rgbd_dataset_freiburg2_large_with_loop/groundtruth.txt', delimiter=' ') 40 | timestamp_gt = list(np.array(gt)[:, 0]) 41 | #print(len(timestamp_gt)) 42 | corres_gt = [] 43 | j = 0 44 | for i in range(len(rgb_filenames)): 45 | rgb_time = rgb_filenames[i] 46 | delta_time_min = 100 47 | while j < len(timestamp_gt) and abs(rgb_time - timestamp_gt[j]) < delta_time_min: 48 | delta_time_min = abs(rgb_time - timestamp_gt[j]) 49 | j = j+1 50 | #j = j - 1 51 | #print(rgb_time, timestamp_gt[j - 1]) 52 | corres_gt.append(list(gt[j - 1])) 53 | 54 | dict_all = {"rgb": rgb_files, "depth": depth_files, "gt": corres_gt} 55 | with open('support_files/rgbd_dataset_freiburg2_large_with_loop.json', 'w') as outfile: 56 | json.dump(dict_all, outfile) -------------------------------------------------------------------------------- /PythonScripts/generate_detection_files.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import os 3 | import cv2 4 | import json 5 | import math 6 | from ultralytics import YOLO 7 | 8 | 9 | def get_image(ori_path, new_path=None, is_color=True, is_tum=False): 10 | head, filename = os.path.split(ori_path) 11 | if is_color: 12 | if is_tum: 13 | return cv2.imread(ori_path) 14 | # return cv2.imread(new_path + filename[:-4] + '.png') 15 | return cv2.imread(new_path + filename) 16 | else: 17 | if is_tum: 18 | return cv2.imread(ori_path, -1) 19 | im_depth = cv2.imread(new_path + filename[:-4] + '.png', -1) 20 | return im_depth 21 | 22 | def estimate_mask_contour(mask_box): 23 | mask_box = (mask_box * 255).astype(np.uint8) 24 | canny = cv2.Canny(mask_box, 100, 150) 25 | contours, hierarchies = cv2.findContours(canny, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE) 26 | if len(contours) == 0: 27 | return None 28 | contour = sorted(contours, key=cv2.contourArea, reverse=True)[0] 29 | return contour 30 | 31 | filenames = json.load(open('support_files/diamond_dji.json')) 32 | 33 | predictor = YOLO('/home/yutong/QISO_SLAM/support_files/weights/yolov8x-seg.pt') 34 | list_to_save = [] 35 | count = 0 36 | for rgb_file in filenames['rgb']: 37 | count += 1 38 | #if count == 10: 39 | #break 40 | head, filename = os.path.split(rgb_file) 41 | dict_per_im = dict() 42 | dict_per_im["file_name"] = filename 43 | dict_per_im["detections"] = [] 44 | im_rgb = cv2.imread(rgb_file) 45 | results = predictor.predict(im_rgb, save=False, conf=0.1, device=0, visualize=False, show=False) 46 | if results[0].masks is None: 47 | list_to_save.append(dict_per_im) 48 | continue 49 | boxes = results[0].boxes.to("cpu").numpy() 50 | masks = results[0].masks.to("cpu").numpy() 51 | for box_, cls, conf, mask in zip(boxes.xyxy, boxes.cls, boxes.conf, masks.data): 52 | y1, x1, y2, x2 = box_ 53 | box = np.array([y1, x1, y2, x2], dtype=np.float64) 54 | contour = estimate_mask_contour(mask) 55 | if contour is None: 56 | continue 57 | if len(contour) < 10: 58 | continue 59 | ellipse = cv2.fitEllipse(contour) 60 | theta = ellipse[2] * math.pi / 180 61 | ellipse_data = np.array([ellipse[0][0], ellipse[0][1], ellipse[1][0], ellipse[1][1], theta], 62 | dtype=np.float64) 63 | category_id = int(cls) 64 | det = dict() 65 | det["category_id"] = category_id 66 | det["detection_score"] = np.float64(conf) 67 | det["bbox"] = list(box) 68 | det["ellipse"] = list(ellipse_data) 69 | dict_per_im["detections"].append(det) 70 | list_to_save.append(dict_per_im) 71 | with open('support_files/detections_yolov8x_seg_diamond_dji_with_ellipse.json', 'w') as outfile: 72 | json.dump(list_to_save, outfile) -------------------------------------------------------------------------------- /PythonScripts/generate_rgbd_association.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import json 3 | import matplotlib.pyplot as plt 4 | import os 5 | 6 | filenames = json.load(open('support_files/diamond_vr_slow.json')) 7 | rgbs = filenames['rgb'] 8 | depths = filenames['depth'] 9 | f = open('support_files/diamond_vr_slow_associated.txt','a') 10 | for rgb, depth in zip(rgbs, depths): 11 | _, filename_rgb = os.path.split(rgb) 12 | time_rgb = filename_rgb[:-4] 13 | filename_rgb = 'rgb/' + filename_rgb 14 | _, filename_depth = os.path.split(depth) 15 | time_depth = filename_depth[:-4] 16 | filename_depth = 'depth/' + filename_depth 17 | line = time_rgb + ' ' + filename_rgb + ' ' + time_depth + ' ' + filename_depth + '\n' 18 | f.write(line) 19 | '''for i in range(1508): 20 | time = (i+1)/3.0 21 | line = str(time) + ' rgb/' + str(i+1) + '.png ' + str(time) + ' depth/' + str(i+1) + '.png' + '\n' 22 | f.write(line)''' 23 | f.close() -------------------------------------------------------------------------------- /PythonScripts/process_diamond_gt.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import os 3 | import json 4 | import scipy.spatial.transform as trans 5 | from camera_pose_object import CameraPoseObject 6 | from camera_pose_object import Calib 7 | 8 | 9 | def get_gt(gt, calib_K): 10 | cam_t = np.array([gt[1], gt[2], gt[3]]) 11 | gt_r = trans.Rotation.from_quat([gt[4], gt[5], gt[6], gt[7]]).as_matrix() 12 | r_gt_cam = np.eye(3) 13 | r_gt_cam[1, 1] = -1 14 | r_gt_cam[2, 2] = -1 15 | cam_r = np.dot(gt_r, r_gt_cam) 16 | cam_pose_i = CameraPoseObject(position=cam_t, rotation=cam_r) 17 | P = cam_pose_i.get_P(calib_K) 18 | return cam_pose_i, P 19 | 20 | 21 | calib = Calib(PP=[320.0, 240.0], focal=[600.0, 600.00]) 22 | filenames = json.load(open('support_files/diamond_dji.json')) 23 | data = np.zeros((len(filenames['gt']), 8)) 24 | for i in range(len(filenames['gt'])): 25 | rgb_file = filenames['rgb'][i] 26 | head, filename = os.path.split(rgb_file) 27 | timestamp = round(float(filename[:-4])*1e-10,3) 28 | #print(timestamp) 29 | cam_pose, _ = get_gt(filenames['gt'][i], calib_K=calib.K) 30 | position = cam_pose.position 31 | quat = cam_pose.quaternion 32 | data[i, 0] = timestamp 33 | data[i, 1:4] = position 34 | data[i, 4:] = quat 35 | np.savetxt('support_files/diamond_dji_gt.txt', data, fmt='%f', delimiter=' ') -------------------------------------------------------------------------------- /Thirdparty/DBoW2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | project(DBoW2) 3 | 4 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ") 5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native") 6 | 7 | set(HDRS_DBOW2 8 | DBoW2/BowVector.h 9 | DBoW2/FORB.h 10 | DBoW2/FClass.h 11 | DBoW2/FeatureVector.h 12 | DBoW2/ScoringObject.h 13 | DBoW2/TemplatedVocabulary.h) 14 | set(SRCS_DBOW2 15 | DBoW2/BowVector.cpp 16 | DBoW2/FORB.cpp 17 | DBoW2/FeatureVector.cpp 18 | DBoW2/ScoringObject.cpp) 19 | 20 | set(HDRS_DUTILS 21 | DUtils/Random.h 22 | DUtils/Timestamp.h) 23 | set(SRCS_DUTILS 24 | DUtils/Random.cpp 25 | DUtils/Timestamp.cpp) 26 | 27 | find_package(OpenCV QUIET) 28 | if(NOT OpenCV_FOUND) 29 | find_package(OpenCV 2.4.3 QUIET) 30 | if(NOT OpenCV_FOUND) 31 | message(FATAL_ERROR "OpenCV > 2.4.3 not found.") 32 | endif() 33 | endif() 34 | 35 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) 36 | 37 | include_directories(${OpenCV_INCLUDE_DIRS}) 38 | add_library(DBoW2 SHARED ${SRCS_DBOW2} ${SRCS_DUTILS}) 39 | target_link_libraries(DBoW2 ${OpenCV_LIBS}) 40 | 41 | -------------------------------------------------------------------------------- /Thirdparty/DBoW2/DBoW2/BowVector.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * File: BowVector.cpp 3 | * Date: March 2011 4 | * Author: Dorian Galvez-Lopez 5 | * Description: bag of words vector 6 | * License: see the LICENSE.txt file 7 | * 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include "BowVector.h" 17 | 18 | namespace DBoW2 { 19 | 20 | // -------------------------------------------------------------------------- 21 | 22 | BowVector::BowVector(void) 23 | { 24 | } 25 | 26 | // -------------------------------------------------------------------------- 27 | 28 | BowVector::~BowVector(void) 29 | { 30 | } 31 | 32 | // -------------------------------------------------------------------------- 33 | 34 | void BowVector::addWeight(WordId id, WordValue v) 35 | { 36 | BowVector::iterator vit = this->lower_bound(id); 37 | 38 | if(vit != this->end() && !(this->key_comp()(id, vit->first))) 39 | { 40 | vit->second += v; 41 | } 42 | else 43 | { 44 | this->insert(vit, BowVector::value_type(id, v)); 45 | } 46 | } 47 | 48 | // -------------------------------------------------------------------------- 49 | 50 | void BowVector::addIfNotExist(WordId id, WordValue v) 51 | { 52 | BowVector::iterator vit = this->lower_bound(id); 53 | 54 | if(vit == this->end() || (this->key_comp()(id, vit->first))) 55 | { 56 | this->insert(vit, BowVector::value_type(id, v)); 57 | } 58 | } 59 | 60 | // -------------------------------------------------------------------------- 61 | 62 | void BowVector::normalize(LNorm norm_type) 63 | { 64 | double norm = 0.0; 65 | BowVector::iterator it; 66 | 67 | if(norm_type == DBoW2::L1) 68 | { 69 | for(it = begin(); it != end(); ++it) 70 | norm += fabs(it->second); 71 | } 72 | else 73 | { 74 | for(it = begin(); it != end(); ++it) 75 | norm += it->second * it->second; 76 | norm = sqrt(norm); 77 | } 78 | 79 | if(norm > 0.0) 80 | { 81 | for(it = begin(); it != end(); ++it) 82 | it->second /= norm; 83 | } 84 | } 85 | 86 | // -------------------------------------------------------------------------- 87 | 88 | std::ostream& operator<< (std::ostream &out, const BowVector &v) 89 | { 90 | BowVector::const_iterator vit; 91 | std::vector::const_iterator iit; 92 | unsigned int i = 0; 93 | const unsigned int N = v.size(); 94 | for(vit = v.begin(); vit != v.end(); ++vit, ++i) 95 | { 96 | out << "<" << vit->first << ", " << vit->second << ">"; 97 | 98 | if(i < N-1) out << ", "; 99 | } 100 | return out; 101 | } 102 | 103 | // -------------------------------------------------------------------------- 104 | 105 | void BowVector::saveM(const std::string &filename, size_t W) const 106 | { 107 | std::fstream f(filename.c_str(), std::ios::out); 108 | 109 | WordId last = 0; 110 | BowVector::const_iterator bit; 111 | for(bit = this->begin(); bit != this->end(); ++bit) 112 | { 113 | for(; last < bit->first; ++last) 114 | { 115 | f << "0 "; 116 | } 117 | f << bit->second << " "; 118 | 119 | last = bit->first + 1; 120 | } 121 | for(; last < (WordId)W; ++last) 122 | f << "0 "; 123 | 124 | f.close(); 125 | } 126 | 127 | // -------------------------------------------------------------------------- 128 | 129 | } // namespace DBoW2 130 | 131 | -------------------------------------------------------------------------------- /Thirdparty/DBoW2/DBoW2/BowVector.h: -------------------------------------------------------------------------------- 1 | /** 2 | * File: BowVector.h 3 | * Date: March 2011 4 | * Author: Dorian Galvez-Lopez 5 | * Description: bag of words vector 6 | * License: see the LICENSE.txt file 7 | * 8 | */ 9 | 10 | #ifndef __D_T_BOW_VECTOR__ 11 | #define __D_T_BOW_VECTOR__ 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | namespace DBoW2 { 18 | 19 | /// Id of words 20 | typedef unsigned int WordId; 21 | 22 | /// Value of a word 23 | typedef double WordValue; 24 | 25 | /// Id of nodes in the vocabulary treee 26 | typedef unsigned int NodeId; 27 | 28 | /// L-norms for normalization 29 | enum LNorm 30 | { 31 | L1, 32 | L2 33 | }; 34 | 35 | /// Weighting type 36 | enum WeightingType 37 | { 38 | TF_IDF, 39 | TF, 40 | IDF, 41 | BINARY 42 | }; 43 | 44 | /// Scoring type 45 | enum ScoringType 46 | { 47 | L1_NORM, 48 | L2_NORM, 49 | CHI_SQUARE, 50 | KL, 51 | BHATTACHARYYA, 52 | DOT_PRODUCT, 53 | }; 54 | 55 | /// Vector of words to represent images 56 | class BowVector: 57 | public std::map 58 | { 59 | public: 60 | 61 | /** 62 | * Constructor 63 | */ 64 | BowVector(void); 65 | 66 | /** 67 | * Destructor 68 | */ 69 | ~BowVector(void); 70 | 71 | /** 72 | * Adds a value to a word value existing in the vector, or creates a new 73 | * word with the given value 74 | * @param id word id to look for 75 | * @param v value to create the word with, or to add to existing word 76 | */ 77 | void addWeight(WordId id, WordValue v); 78 | 79 | /** 80 | * Adds a word with a value to the vector only if this does not exist yet 81 | * @param id word id to look for 82 | * @param v value to give to the word if this does not exist 83 | */ 84 | void addIfNotExist(WordId id, WordValue v); 85 | 86 | /** 87 | * L1-Normalizes the values in the vector 88 | * @param norm_type norm used 89 | */ 90 | void normalize(LNorm norm_type); 91 | 92 | /** 93 | * Prints the content of the bow vector 94 | * @param out stream 95 | * @param v 96 | */ 97 | friend std::ostream& operator<<(std::ostream &out, const BowVector &v); 98 | 99 | /** 100 | * Saves the bow vector as a vector in a matlab file 101 | * @param filename 102 | * @param W number of words in the vocabulary 103 | */ 104 | void saveM(const std::string &filename, size_t W) const; 105 | }; 106 | 107 | } // namespace DBoW2 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /Thirdparty/DBoW2/DBoW2/FClass.h: -------------------------------------------------------------------------------- 1 | /** 2 | * File: FClass.h 3 | * Date: November 2011 4 | * Author: Dorian Galvez-Lopez 5 | * Description: generic FClass to instantiate templated classes 6 | * License: see the LICENSE.txt file 7 | * 8 | */ 9 | 10 | #ifndef __D_T_FCLASS__ 11 | #define __D_T_FCLASS__ 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | namespace DBoW2 { 18 | 19 | /// Generic class to encapsulate functions to manage descriptors. 20 | /** 21 | * This class must be inherited. Derived classes can be used as the 22 | * parameter F when creating Templated structures 23 | * (TemplatedVocabulary, TemplatedDatabase, ...) 24 | */ 25 | class FClass 26 | { 27 | class TDescriptor; 28 | typedef const TDescriptor *pDescriptor; 29 | 30 | /** 31 | * Calculates the mean value of a set of descriptors 32 | * @param descriptors 33 | * @param mean mean descriptor 34 | */ 35 | virtual void meanValue(const std::vector &descriptors, 36 | TDescriptor &mean) = 0; 37 | 38 | /** 39 | * Calculates the distance between two descriptors 40 | * @param a 41 | * @param b 42 | * @return distance 43 | */ 44 | static double distance(const TDescriptor &a, const TDescriptor &b); 45 | 46 | /** 47 | * Returns a string version of the descriptor 48 | * @param a descriptor 49 | * @return string version 50 | */ 51 | static std::string toString(const TDescriptor &a); 52 | 53 | /** 54 | * Returns a descriptor from a string 55 | * @param a descriptor 56 | * @param s string version 57 | */ 58 | static void fromString(TDescriptor &a, const std::string &s); 59 | 60 | /** 61 | * Returns a mat with the descriptors in float format 62 | * @param descriptors 63 | * @param mat (out) NxL 32F matrix 64 | */ 65 | static void toMat32F(const std::vector &descriptors, 66 | cv::Mat &mat); 67 | }; 68 | 69 | } // namespace DBoW2 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /Thirdparty/DBoW2/DBoW2/FORB.h: -------------------------------------------------------------------------------- 1 | /** 2 | * File: FORB.h 3 | * Date: June 2012 4 | * Author: Dorian Galvez-Lopez 5 | * Description: functions for ORB descriptors 6 | * License: see the LICENSE.txt file 7 | * 8 | */ 9 | 10 | #ifndef __D_T_F_ORB__ 11 | #define __D_T_F_ORB__ 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "FClass.h" 18 | 19 | namespace DBoW2 { 20 | 21 | /// Functions to manipulate ORB descriptors 22 | class FORB: protected FClass 23 | { 24 | public: 25 | 26 | /// Descriptor type 27 | typedef cv::Mat TDescriptor; // CV_8U 28 | /// Pointer to a single descriptor 29 | typedef const TDescriptor *pDescriptor; 30 | /// Descriptor length (in bytes) 31 | static const int L; 32 | 33 | /** 34 | * Calculates the mean value of a set of descriptors 35 | * @param descriptors 36 | * @param mean mean descriptor 37 | */ 38 | static void meanValue(const std::vector &descriptors, 39 | TDescriptor &mean); 40 | 41 | /** 42 | * Calculates the distance between two descriptors 43 | * @param a 44 | * @param b 45 | * @return distance 46 | */ 47 | static int distance(const TDescriptor &a, const TDescriptor &b); 48 | 49 | /** 50 | * Returns a string version of the descriptor 51 | * @param a descriptor 52 | * @return string version 53 | */ 54 | static std::string toString(const TDescriptor &a); 55 | 56 | /** 57 | * Returns a descriptor from a string 58 | * @param a descriptor 59 | * @param s string version 60 | */ 61 | static void fromString(TDescriptor &a, const std::string &s); 62 | 63 | /** 64 | * Returns a mat with the descriptors in float format 65 | * @param descriptors 66 | * @param mat (out) NxL 32F matrix 67 | */ 68 | static void toMat32F(const std::vector &descriptors, 69 | cv::Mat &mat); 70 | 71 | static void toMat8U(const std::vector &descriptors, 72 | cv::Mat &mat); 73 | 74 | }; 75 | 76 | } // namespace DBoW2 77 | 78 | #endif 79 | 80 | -------------------------------------------------------------------------------- /Thirdparty/DBoW2/DBoW2/FeatureVector.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * File: FeatureVector.cpp 3 | * Date: November 2011 4 | * Author: Dorian Galvez-Lopez 5 | * Description: feature vector 6 | * License: see the LICENSE.txt file 7 | * 8 | */ 9 | 10 | #include "FeatureVector.h" 11 | #include 12 | #include 13 | #include 14 | 15 | namespace DBoW2 { 16 | 17 | // --------------------------------------------------------------------------- 18 | 19 | FeatureVector::FeatureVector(void) 20 | { 21 | } 22 | 23 | // --------------------------------------------------------------------------- 24 | 25 | FeatureVector::~FeatureVector(void) 26 | { 27 | } 28 | 29 | // --------------------------------------------------------------------------- 30 | 31 | void FeatureVector::addFeature(NodeId id, unsigned int i_feature) 32 | { 33 | FeatureVector::iterator vit = this->lower_bound(id); 34 | 35 | if(vit != this->end() && vit->first == id) 36 | { 37 | vit->second.push_back(i_feature); 38 | } 39 | else 40 | { 41 | vit = this->insert(vit, FeatureVector::value_type(id, 42 | std::vector() )); 43 | vit->second.push_back(i_feature); 44 | } 45 | } 46 | 47 | // --------------------------------------------------------------------------- 48 | 49 | std::ostream& operator<<(std::ostream &out, 50 | const FeatureVector &v) 51 | { 52 | if(!v.empty()) 53 | { 54 | FeatureVector::const_iterator vit = v.begin(); 55 | 56 | const std::vector* f = &vit->second; 57 | 58 | out << "<" << vit->first << ": ["; 59 | if(!f->empty()) out << (*f)[0]; 60 | for(unsigned int i = 1; i < f->size(); ++i) 61 | { 62 | out << ", " << (*f)[i]; 63 | } 64 | out << "]>"; 65 | 66 | for(++vit; vit != v.end(); ++vit) 67 | { 68 | f = &vit->second; 69 | 70 | out << ", <" << vit->first << ": ["; 71 | if(!f->empty()) out << (*f)[0]; 72 | for(unsigned int i = 1; i < f->size(); ++i) 73 | { 74 | out << ", " << (*f)[i]; 75 | } 76 | out << "]>"; 77 | } 78 | } 79 | 80 | return out; 81 | } 82 | 83 | // --------------------------------------------------------------------------- 84 | 85 | } // namespace DBoW2 86 | -------------------------------------------------------------------------------- /Thirdparty/DBoW2/DBoW2/FeatureVector.h: -------------------------------------------------------------------------------- 1 | /** 2 | * File: FeatureVector.h 3 | * Date: November 2011 4 | * Author: Dorian Galvez-Lopez 5 | * Description: feature vector 6 | * License: see the LICENSE.txt file 7 | * 8 | */ 9 | 10 | #ifndef __D_T_FEATURE_VECTOR__ 11 | #define __D_T_FEATURE_VECTOR__ 12 | 13 | #include "BowVector.h" 14 | #include 15 | #include 16 | #include 17 | 18 | namespace DBoW2 { 19 | 20 | /// Vector of nodes with indexes of local features 21 | class FeatureVector: 22 | public std::map > 23 | { 24 | public: 25 | 26 | /** 27 | * Constructor 28 | */ 29 | FeatureVector(void); 30 | 31 | /** 32 | * Destructor 33 | */ 34 | ~FeatureVector(void); 35 | 36 | /** 37 | * Adds a feature to an existing node, or adds a new node with an initial 38 | * feature 39 | * @param id node id to add or to modify 40 | * @param i_feature index of feature to add to the given node 41 | */ 42 | void addFeature(NodeId id, unsigned int i_feature); 43 | 44 | /** 45 | * Sends a string versions of the feature vector through the stream 46 | * @param out stream 47 | * @param v feature vector 48 | */ 49 | friend std::ostream& operator<<(std::ostream &out, const FeatureVector &v); 50 | 51 | }; 52 | 53 | } // namespace DBoW2 54 | 55 | #endif 56 | 57 | -------------------------------------------------------------------------------- /Thirdparty/DBoW2/DBoW2/ScoringObject.h: -------------------------------------------------------------------------------- 1 | /** 2 | * File: ScoringObject.h 3 | * Date: November 2011 4 | * Author: Dorian Galvez-Lopez 5 | * Description: functions to compute bow scores 6 | * License: see the LICENSE.txt file 7 | * 8 | */ 9 | 10 | #ifndef __D_T_SCORING_OBJECT__ 11 | #define __D_T_SCORING_OBJECT__ 12 | 13 | #include "BowVector.h" 14 | 15 | namespace DBoW2 { 16 | 17 | /// Base class of scoring functions 18 | class GeneralScoring 19 | { 20 | public: 21 | /** 22 | * Computes the score between two vectors. Vectors must be sorted and 23 | * normalized if necessary 24 | * @param v (in/out) 25 | * @param w (in/out) 26 | * @return score 27 | */ 28 | virtual double score(const BowVector &v, const BowVector &w) const = 0; 29 | 30 | /** 31 | * Returns whether a vector must be normalized before scoring according 32 | * to the scoring scheme 33 | * @param norm norm to use 34 | * @return true iff must normalize 35 | */ 36 | virtual bool mustNormalize(LNorm &norm) const = 0; 37 | 38 | /// Log of epsilon 39 | static const double LOG_EPS; 40 | // If you change the type of WordValue, make sure you change also the 41 | // epsilon value (this is needed by the KL method) 42 | 43 | virtual ~GeneralScoring() {} //!< Required for virtual base classes 44 | 45 | }; 46 | 47 | /** 48 | * Macro for defining Scoring classes 49 | * @param NAME name of class 50 | * @param MUSTNORMALIZE if vectors must be normalized to compute the score 51 | * @param NORM type of norm to use when MUSTNORMALIZE 52 | */ 53 | #define __SCORING_CLASS(NAME, MUSTNORMALIZE, NORM) \ 54 | NAME: public GeneralScoring \ 55 | { public: \ 56 | /** \ 57 | * Computes score between two vectors \ 58 | * @param v \ 59 | * @param w \ 60 | * @return score between v and w \ 61 | */ \ 62 | virtual double score(const BowVector &v, const BowVector &w) const; \ 63 | \ 64 | /** \ 65 | * Says if a vector must be normalized according to the scoring function \ 66 | * @param norm (out) if true, norm to use 67 | * @return true iff vectors must be normalized \ 68 | */ \ 69 | virtual inline bool mustNormalize(LNorm &norm) const \ 70 | { norm = NORM; return MUSTNORMALIZE; } \ 71 | } 72 | 73 | /// L1 Scoring object 74 | class __SCORING_CLASS(L1Scoring, true, L1); 75 | 76 | /// L2 Scoring object 77 | class __SCORING_CLASS(L2Scoring, true, L2); 78 | 79 | /// Chi square Scoring object 80 | class __SCORING_CLASS(ChiSquareScoring, true, L1); 81 | 82 | /// KL divergence Scoring object 83 | class __SCORING_CLASS(KLScoring, true, L1); 84 | 85 | /// Bhattacharyya Scoring object 86 | class __SCORING_CLASS(BhattacharyyaScoring, true, L1); 87 | 88 | /// Dot product Scoring object 89 | class __SCORING_CLASS(DotProductScoring, false, L1); 90 | 91 | #undef __SCORING_CLASS 92 | 93 | } // namespace DBoW2 94 | 95 | #endif 96 | 97 | -------------------------------------------------------------------------------- /Thirdparty/DBoW2/LICENSE.txt: -------------------------------------------------------------------------------- 1 | DBoW2: bag-of-words library for C++ with generic descriptors 2 | 3 | Copyright (c) 2015 Dorian Galvez-Lopez (Universidad de Zaragoza) 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 3. Neither the name of copyright holders nor the names of its 15 | contributors may be used to endorse or promote products derived 16 | from this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS 22 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | 30 | If you use it in an academic work, please cite: 31 | 32 | @ARTICLE{GalvezTRO12, 33 | author={G\'alvez-L\'opez, Dorian and Tard\'os, J. D.}, 34 | journal={IEEE Transactions on Robotics}, 35 | title={Bags of Binary Words for Fast Place Recognition in Image Sequences}, 36 | year={2012}, 37 | month={October}, 38 | volume={28}, 39 | number={5}, 40 | pages={1188--1197}, 41 | doi={10.1109/TRO.2012.2197158}, 42 | ISSN={1552-3098} 43 | } 44 | 45 | -------------------------------------------------------------------------------- /Thirdparty/DBoW2/README.txt: -------------------------------------------------------------------------------- 1 | You should have received this DBoW2 version along with ORB-SLAM2 (https://github.com/raulmur/ORB_SLAM2). 2 | See the original DBoW2 library at: https://github.com/dorian3d/DBoW2 3 | All files included in this version are BSD, see LICENSE.txt 4 | 5 | We also use Random.h, Random.cpp, Timestamp.pp and Timestamp.h from DLib/DUtils. 6 | See the original DLib library at: https://github.com/dorian3d/DLib 7 | All files included in this version are BSD, see LICENSE.txt 8 | -------------------------------------------------------------------------------- /Thirdparty/Osmap/build.sh: -------------------------------------------------------------------------------- 1 | FOLDER="../.." 2 | 3 | 4 | protoc --cpp_out=. osmap.proto 5 | cp osmap.pb.cc "${FOLDER}/src/" 6 | cp src/Osmap.cpp "${FOLDER}/src/" 7 | 8 | cp osmap.pb.h "${FOLDER}/include/" 9 | cp include/Osmap.h "${FOLDER}/include/" 10 | -------------------------------------------------------------------------------- /Thirdparty/g2o/README.txt: -------------------------------------------------------------------------------- 1 | You should have received this g2o version along with ORB-SLAM2 (https://github.com/raulmur/ORB_SLAM2). 2 | See the original g2o library at: https://github.com/RainerKuemmerle/g2o 3 | All files included in this g2o version are BSD, see license-bsd.txt 4 | -------------------------------------------------------------------------------- /Thirdparty/g2o/config.h: -------------------------------------------------------------------------------- 1 | #ifndef G2O_CONFIG_H 2 | #define G2O_CONFIG_H 3 | 4 | /* #undef G2O_OPENMP */ 5 | /* #undef G2O_SHARED_LIBS */ 6 | 7 | // give a warning if Eigen defaults to row-major matrices. 8 | // We internally assume column-major matrices throughout the code. 9 | #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR 10 | # error "g2o requires column major Eigen matrices (see http://eigen.tuxfamily.org/bz/show_bug.cgi?id=422)" 11 | #endif 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /Thirdparty/g2o/config.h.in: -------------------------------------------------------------------------------- 1 | #ifndef G2O_CONFIG_H 2 | #define G2O_CONFIG_H 3 | 4 | #cmakedefine G2O_OPENMP 1 5 | #cmakedefine G2O_SHARED_LIBS 1 6 | 7 | // give a warning if Eigen defaults to row-major matrices. 8 | // We internally assume column-major matrices throughout the code. 9 | #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR 10 | # error "g2o requires column major Eigen matrices (see http://eigen.tuxfamily.org/bz/show_bug.cgi?id=422)" 11 | #endif 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/core/base_vertex.hpp: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | template 28 | BaseVertex::BaseVertex() : 29 | OptimizableGraph::Vertex(), 30 | _hessian(0, D, D) 31 | { 32 | _dimension = D; 33 | } 34 | 35 | template 36 | double BaseVertex::solveDirect(double lambda) { 37 | Matrix tempA=_hessian + Matrix ::Identity()*lambda; 38 | double det=tempA.determinant(); 39 | if (g2o_isnan(det) || det < std::numeric_limits::epsilon()) 40 | return det; 41 | Matrix dx=tempA.llt().solve(_b); 42 | oplus(&dx[0]); 43 | return det; 44 | } 45 | 46 | template 47 | void BaseVertex::clearQuadraticForm() { 48 | _b.setZero(); 49 | } 50 | 51 | template 52 | void BaseVertex::mapHessianMemory(double* d) 53 | { 54 | new (&_hessian) HessianBlockType(d, D, D); 55 | } 56 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/core/creators.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_CREATORS_H 28 | #define G2O_CREATORS_H 29 | 30 | #include "hyper_graph.h" 31 | 32 | #include 33 | #include 34 | 35 | namespace g2o 36 | { 37 | 38 | /** 39 | * \brief Abstract interface for allocating HyperGraphElement 40 | */ 41 | class AbstractHyperGraphElementCreator 42 | { 43 | public: 44 | /** 45 | * create a hyper graph element. Has to implemented in derived class. 46 | */ 47 | virtual HyperGraph::HyperGraphElement* construct() = 0; 48 | /** 49 | * name of the class to be created. Has to implemented in derived class. 50 | */ 51 | virtual const std::string& name() const = 0; 52 | 53 | virtual ~AbstractHyperGraphElementCreator() { } 54 | }; 55 | 56 | /** 57 | * \brief templatized creator class which creates graph elements 58 | */ 59 | template 60 | class HyperGraphElementCreator : public AbstractHyperGraphElementCreator 61 | { 62 | public: 63 | HyperGraphElementCreator() : _name(typeid(T).name()) {} 64 | #if defined (WINDOWS) && defined(__GNUC__) // force stack alignment on Windows with GCC 65 | __attribute__((force_align_arg_pointer)) 66 | #endif 67 | HyperGraph::HyperGraphElement* construct() { return new T;} 68 | virtual const std::string& name() const { return _name;} 69 | protected: 70 | std::string _name; 71 | }; 72 | 73 | } // end namespace 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/core/matrix_structure.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_MATRIX_STRUCTURE_H 28 | #define G2O_MATRIX_STRUCTURE_H 29 | 30 | 31 | namespace g2o { 32 | 33 | /** 34 | * \brief representing the structure of a matrix in column compressed structure (only the upper triangular part of the matrix) 35 | */ 36 | class MatrixStructure 37 | { 38 | public: 39 | MatrixStructure(); 40 | ~MatrixStructure(); 41 | /** 42 | * allocate space for the Matrix Structure. You may call this on an already allocated struct, it will 43 | * then reallocate the memory + additional space (double the required space). 44 | */ 45 | void alloc(int n_, int nz); 46 | 47 | void free(); 48 | 49 | /** 50 | * Write the matrix pattern to a file. File is also loadable by octave, e.g., then use spy(matrix) 51 | */ 52 | bool write(const char* filename) const; 53 | 54 | int n; ///< A is m-by-n. n must be >= 0. 55 | int m; ///< A is m-by-n. m must be >= 0. 56 | int* Ap; ///< column pointers for A, of size n+1 57 | int* Aii; ///< row indices of A, of size nz = Ap [n] 58 | 59 | //! max number of non-zeros blocks 60 | int nzMax() const { return maxNz;} 61 | 62 | protected: 63 | int maxN; ///< size of the allocated memory 64 | int maxNz; ///< size of the allocated memory 65 | }; 66 | 67 | } // end namespace 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/core/openmp_mutex.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_OPENMP_MUTEX 28 | #define G2O_OPENMP_MUTEX 29 | 30 | #include "../../config.h" 31 | 32 | #ifdef G2O_OPENMP 33 | #include 34 | #else 35 | #include 36 | #endif 37 | 38 | namespace g2o { 39 | 40 | #ifdef G2O_OPENMP 41 | 42 | /** 43 | * \brief Mutex realized via OpenMP 44 | */ 45 | class OpenMPMutex 46 | { 47 | public: 48 | OpenMPMutex() { omp_init_lock(&_lock); } 49 | ~OpenMPMutex() { omp_destroy_lock(&_lock); } 50 | void lock() { omp_set_lock(&_lock); } 51 | void unlock() { omp_unset_lock(&_lock); } 52 | protected: 53 | omp_lock_t _lock; 54 | }; 55 | 56 | #else 57 | 58 | /* 59 | * dummy which does nothing in case we don't have OpenMP support. 60 | * In debug mode, the mutex allows to verify the correct lock and unlock behavior 61 | */ 62 | class OpenMPMutex 63 | { 64 | public: 65 | #ifdef NDEBUG 66 | OpenMPMutex() {} 67 | #else 68 | OpenMPMutex() : _cnt(0) {} 69 | #endif 70 | ~OpenMPMutex() { assert(_cnt == 0 && "Freeing locked mutex");} 71 | void lock() { assert(++_cnt == 1 && "Locking already locked mutex");} 72 | void unlock() { assert(--_cnt == 0 && "Trying to unlock a mutex which is not locked");} 73 | protected: 74 | #ifndef NDEBUG 75 | char _cnt; 76 | #endif 77 | }; 78 | 79 | #endif 80 | 81 | /** 82 | * \brief lock a mutex within a scope 83 | */ 84 | class ScopedOpenMPMutex 85 | { 86 | public: 87 | explicit ScopedOpenMPMutex(OpenMPMutex* mutex) : _mutex(mutex) { _mutex->lock(); } 88 | ~ScopedOpenMPMutex() { _mutex->unlock(); } 89 | private: 90 | OpenMPMutex* const _mutex; 91 | ScopedOpenMPMutex(const ScopedOpenMPMutex&); 92 | void operator=(const ScopedOpenMPMutex&); 93 | }; 94 | 95 | } 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/core/optimization_algorithm.cpp: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #include "optimization_algorithm.h" 28 | 29 | using namespace std; 30 | 31 | namespace g2o { 32 | 33 | OptimizationAlgorithm::OptimizationAlgorithm() : 34 | _optimizer(0) 35 | { 36 | } 37 | 38 | OptimizationAlgorithm::~OptimizationAlgorithm() 39 | { 40 | } 41 | 42 | void OptimizationAlgorithm::printProperties(std::ostream& os) const 43 | { 44 | os << "------------- Algorithm Properties -------------" << endl; 45 | for (PropertyMap::const_iterator it = _properties.begin(); it != _properties.end(); ++it) { 46 | BaseProperty* p = it->second; 47 | os << it->first << "\t" << p->toString() << endl; 48 | } 49 | os << "------------------------------------------------" << endl; 50 | } 51 | 52 | bool OptimizationAlgorithm::updatePropertiesFromString(const std::string& propString) 53 | { 54 | return _properties.updateMapFromString(propString); 55 | } 56 | 57 | void OptimizationAlgorithm::setOptimizer(SparseOptimizer* optimizer) 58 | { 59 | _optimizer = optimizer; 60 | } 61 | 62 | } // end namespace 63 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/core/optimization_algorithm_gauss_newton.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_OPTIMIZATION_ALGORITHM_GAUSS_NEWTON_H 28 | #define G2O_OPTIMIZATION_ALGORITHM_GAUSS_NEWTON_H 29 | 30 | #include "optimization_algorithm_with_hessian.h" 31 | 32 | namespace g2o { 33 | 34 | /** 35 | * \brief Implementation of the Gauss Newton Algorithm 36 | */ 37 | class OptimizationAlgorithmGaussNewton : public OptimizationAlgorithmWithHessian 38 | { 39 | public: 40 | /** 41 | * construct the Gauss Newton algorithm, which use the given Solver for solving the 42 | * linearized system. 43 | */ 44 | explicit OptimizationAlgorithmGaussNewton(Solver* solver); 45 | virtual ~OptimizationAlgorithmGaussNewton(); 46 | 47 | virtual SolverResult solve(int iteration, bool online = false); 48 | 49 | virtual void printVerbose(std::ostream& os) const; 50 | }; 51 | 52 | } // end namespace 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/core/optimization_algorithm_property.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_OPTIMIZATION_ALGORITHM_PROPERTY_H 28 | #define G2O_OPTIMIZATION_ALGORITHM_PROPERTY_H 29 | 30 | #include 31 | 32 | namespace g2o { 33 | 34 | /** 35 | * \brief describe the properties of a solver 36 | */ 37 | struct OptimizationAlgorithmProperty 38 | { 39 | std::string name; ///< name of the solver, e.g., var 40 | std::string desc; ///< short description of the solver 41 | std::string type; ///< type of solver, e.g., "CSparse Cholesky", "PCG" 42 | bool requiresMarginalize; ///< whether the solver requires marginalization of landmarks 43 | int poseDim; ///< dimension of the pose vertices (-1 if variable) 44 | int landmarkDim; ///< dimension of the landmar vertices (-1 if variable) 45 | OptimizationAlgorithmProperty() : 46 | name(), desc(), type(), requiresMarginalize(false), poseDim(-1), landmarkDim(-1) 47 | { 48 | } 49 | OptimizationAlgorithmProperty(const std::string& name_, const std::string& desc_, const std::string& type_, bool requiresMarginalize_, int poseDim_, int landmarkDim_) : 50 | name(name_), desc(desc_), type(type_), requiresMarginalize(requiresMarginalize_), poseDim(poseDim_), landmarkDim(landmarkDim_) 51 | { 52 | } 53 | }; 54 | 55 | } // end namespace 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/core/optimization_algorithm_with_hessian.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_OPTIMIZATION_ALGORITHM_WITH_HESSIAN_H 28 | #define G2O_OPTIMIZATION_ALGORITHM_WITH_HESSIAN_H 29 | 30 | #include "optimization_algorithm.h" 31 | 32 | namespace g2o { 33 | 34 | class Solver; 35 | 36 | /** 37 | * \brief Base for solvers operating on the approximated Hessian, e.g., Gauss-Newton, Levenberg 38 | */ 39 | class OptimizationAlgorithmWithHessian : public OptimizationAlgorithm 40 | { 41 | public: 42 | explicit OptimizationAlgorithmWithHessian(Solver* solver); 43 | virtual ~OptimizationAlgorithmWithHessian(); 44 | 45 | virtual bool init(bool online = false); 46 | 47 | virtual bool computeMarginals(SparseBlockMatrix& spinv, const std::vector >& blockIndices); 48 | 49 | virtual bool buildLinearStructure(); 50 | 51 | virtual void updateLinearSystem(); 52 | 53 | virtual bool updateStructure(const std::vector& vset, const HyperGraph::EdgeSet& edges); 54 | 55 | //! return the underlying solver used to solve the linear system 56 | Solver* solver() { return _solver;} 57 | 58 | /** 59 | * write debug output of the Hessian if system is not positive definite 60 | */ 61 | virtual void setWriteDebug(bool writeDebug); 62 | virtual bool writeDebug() const { return _writeDebug->value();} 63 | 64 | protected: 65 | Solver* _solver; 66 | Property* _writeDebug; 67 | 68 | }; 69 | 70 | }// end namespace 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/core/parameter.cpp: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #include "parameter.h" 28 | 29 | namespace g2o { 30 | 31 | Parameter::Parameter() : _id(-1) 32 | { 33 | } 34 | 35 | void Parameter::setId(int id_) 36 | { 37 | _id = id_; 38 | } 39 | 40 | } // end namespace 41 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/core/parameter.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_GRAPH_PARAMETER_HH_ 28 | #define G2O_GRAPH_PARAMETER_HH_ 29 | 30 | #include 31 | 32 | #include "hyper_graph.h" 33 | 34 | namespace g2o { 35 | 36 | class Parameter : public HyperGraph::HyperGraphElement 37 | { 38 | public: 39 | Parameter(); 40 | virtual ~Parameter() {}; 41 | //! read the data from a stream 42 | virtual bool read(std::istream& is) = 0; 43 | //! write the data to a stream 44 | virtual bool write(std::ostream& os) const = 0; 45 | int id() const {return _id;} 46 | void setId(int id_); 47 | virtual HyperGraph::HyperGraphElementType elementType() const { return HyperGraph::HGET_PARAMETER;} 48 | protected: 49 | int _id; 50 | }; 51 | 52 | typedef std::vector ParameterVector; 53 | 54 | } // end namespace 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/core/parameter_container.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_GRAPH_PARAMETER_CONTAINER_HH_ 28 | #define G2O_GRAPH_PARAMETER_CONTAINER_HH_ 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | namespace g2o { 35 | 36 | class Parameter; 37 | 38 | /** 39 | * \brief map id to parameters 40 | */ 41 | class ParameterContainer : protected std::map 42 | { 43 | public: 44 | typedef std::map BaseClass; 45 | 46 | /** 47 | * create a container for the parameters. 48 | * @param isMainStorage_ pointers to the parameters are owned by this container, i.e., freed in its constructor 49 | */ 50 | ParameterContainer(bool isMainStorage_=true); 51 | virtual ~ParameterContainer(); 52 | //! add parameter to the container 53 | bool addParameter(Parameter* p); 54 | //! return a parameter based on its ID 55 | Parameter* getParameter(int id); 56 | //! remove a parameter from the container, i.e., the user now owns the pointer 57 | Parameter* detachParameter(int id); 58 | //! read parameters from a stream 59 | virtual bool read(std::istream& is, const std::map* renamedMap =0); 60 | //! write the data to a stream 61 | virtual bool write(std::ostream& os) const; 62 | bool isMainStorage() const {return _isMainStorage;} 63 | void clear(); 64 | 65 | // stuff of the base class that should re-appear 66 | using BaseClass::size; 67 | 68 | protected: 69 | bool _isMainStorage; 70 | }; 71 | 72 | } // end namespace 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/core/robust_kernel.cpp: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #include "robust_kernel.h" 28 | 29 | namespace g2o { 30 | 31 | RobustKernel::RobustKernel() : 32 | _delta(1.) 33 | { 34 | } 35 | 36 | RobustKernel::RobustKernel(double delta) : 37 | _delta(delta) 38 | { 39 | } 40 | 41 | void RobustKernel::setDelta(double delta) 42 | { 43 | _delta = delta; 44 | } 45 | 46 | } // end namespace g2o 47 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/core/robust_kernel.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_ROBUST_KERNEL_H 28 | #define G2O_ROBUST_KERNEL_H 29 | 30 | #ifdef _MSC_VER 31 | #include 32 | #else 33 | #include 34 | #endif 35 | #include 36 | 37 | 38 | namespace g2o { 39 | 40 | /** 41 | * \brief base for all robust cost functions 42 | * 43 | * Note in all the implementations for the other cost functions the e in the 44 | * funtions corresponds to the sqaured errors, i.e., the robustification 45 | * functions gets passed the squared error. 46 | * 47 | * e.g. the robustified least squares function is 48 | * 49 | * chi^2 = sum_{e} rho( e^T Omega e ) 50 | */ 51 | class RobustKernel 52 | { 53 | public: 54 | RobustKernel(); 55 | explicit RobustKernel(double delta); 56 | virtual ~RobustKernel() {} 57 | /** 58 | * compute the scaling factor for a error: 59 | * The error is e^T Omega e 60 | * The output rho is 61 | * rho[0]: The actual scaled error value 62 | * rho[1]: First derivative of the scaling function 63 | * rho[2]: Second derivative of the scaling function 64 | */ 65 | virtual void robustify(double squaredError, Eigen::Vector3d& rho) const = 0; 66 | 67 | /** 68 | * set the window size of the error. A squared error above delta^2 is considered 69 | * as outlier in the data. 70 | */ 71 | virtual void setDelta(double delta); 72 | double delta() const { return _delta;} 73 | 74 | protected: 75 | double _delta; 76 | }; 77 | typedef std::tr1::shared_ptr RobustKernelPtr; 78 | 79 | } // end namespace g2o 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/core/solver.cpp: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #include "solver.h" 28 | 29 | #include 30 | #include 31 | 32 | namespace g2o { 33 | 34 | Solver::Solver() : 35 | _optimizer(0), _x(0), _b(0), _xSize(0), _maxXSize(0), 36 | _isLevenberg(false), _additionalVectorSpace(0) 37 | { 38 | } 39 | 40 | Solver::~Solver() 41 | { 42 | delete[] _x; 43 | delete[] _b; 44 | } 45 | 46 | void Solver::resizeVector(size_t sx) 47 | { 48 | size_t oldSize = _xSize; 49 | _xSize = sx; 50 | sx += _additionalVectorSpace; // allocate some additional space if requested 51 | if (_maxXSize < sx) { 52 | _maxXSize = 2*sx; 53 | delete[] _x; 54 | _x = new double[_maxXSize]; 55 | #ifndef NDEBUG 56 | memset(_x, 0, _maxXSize * sizeof(double)); 57 | #endif 58 | if (_b) { // backup the former b, might still be needed for online processing 59 | memcpy(_x, _b, oldSize * sizeof(double)); 60 | delete[] _b; 61 | _b = new double[_maxXSize]; 62 | std::swap(_b, _x); 63 | } else { 64 | _b = new double[_maxXSize]; 65 | #ifndef NDEBUG 66 | memset(_b, 0, _maxXSize * sizeof(double)); 67 | #endif 68 | } 69 | } 70 | } 71 | 72 | void Solver::setOptimizer(SparseOptimizer* optimizer) 73 | { 74 | _optimizer = optimizer; 75 | } 76 | 77 | void Solver::setLevenberg(bool levenberg) 78 | { 79 | _isLevenberg = levenberg; 80 | } 81 | 82 | void Solver::setAdditionalVectorSpace(size_t s) 83 | { 84 | _additionalVectorSpace = s; 85 | } 86 | 87 | } // end namespace 88 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/stuff/color_macros.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_COLOR_MACROS_H 28 | #define G2O_COLOR_MACROS_H 29 | 30 | // font attributes 31 | #define FT_BOLD "\033[1m" 32 | #define FT_UNDERLINE "\033[4m" 33 | 34 | //background color 35 | #define BG_BLACK "\033[40m" 36 | #define BG_RED "\033[41m" 37 | #define BG_GREEN "\033[42m" 38 | #define BG_YELLOW "\033[43m" 39 | #define BG_LIGHTBLUE "\033[44m" 40 | #define BG_MAGENTA "\033[45m" 41 | #define BG_BLUE "\033[46m" 42 | #define BG_WHITE "\033[47m" 43 | 44 | // font color 45 | #define CL_BLACK(s) "\033[30m" << s << "\033[0m" 46 | #define CL_RED(s) "\033[31m" << s << "\033[0m" 47 | #define CL_GREEN(s) "\033[32m" << s << "\033[0m" 48 | #define CL_YELLOW(s) "\033[33m" << s << "\033[0m" 49 | #define CL_LIGHTBLUE(s) "\033[34m" << s << "\033[0m" 50 | #define CL_MAGENTA(s) "\033[35m" << s << "\033[0m" 51 | #define CL_BLUE(s) "\033[36m" << s << "\033[0m" 52 | #define CL_WHITE(s) "\033[37m" << s << "\033[0m" 53 | 54 | #define FG_BLACK "\033[30m" 55 | #define FG_RED "\033[31m" 56 | #define FG_GREEN "\033[32m" 57 | #define FG_YELLOW "\033[33m" 58 | #define FG_LIGHTBLUE "\033[34m" 59 | #define FG_MAGENTA "\033[35m" 60 | #define FG_BLUE "\033[36m" 61 | #define FG_WHITE "\033[37m" 62 | 63 | #define FG_NORM "\033[0m" 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/stuff/os_specific.c: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #include "os_specific.h" 28 | 29 | #ifdef WINDOWS 30 | 31 | int vasprintf(char** strp, const char* fmt, va_list ap) 32 | { 33 | int n; 34 | int size = 100; 35 | char* p; 36 | char* np; 37 | 38 | if ((p = (char*)malloc(size * sizeof(char))) == NULL) 39 | return -1; 40 | 41 | while (1) { 42 | #ifdef _MSC_VER 43 | n = vsnprintf_s(p, size, size - 1, fmt, ap); 44 | #else 45 | n = vsnprintf(p, size, fmt, ap); 46 | #endif 47 | if (n > -1 && n < size) { 48 | *strp = p; 49 | return n; 50 | } 51 | if (n > -1) 52 | size = n+1; 53 | else 54 | size *= 2; 55 | if ((np = (char*)realloc (p, size * sizeof(char))) == NULL) { 56 | free(p); 57 | return -1; 58 | } else 59 | p = np; 60 | } 61 | } 62 | 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/stuff/os_specific.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_OS_SPECIFIC_HH_ 28 | #define G2O_OS_SPECIFIC_HH_ 29 | 30 | #ifdef WINDOWS 31 | #include 32 | #include 33 | #include 34 | #ifndef _WINDOWS 35 | #include 36 | #endif 37 | #define drand48() ((double) rand()/(double)RAND_MAX) 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | int vasprintf(char** strp, const char* fmt, va_list ap); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif 50 | 51 | #ifdef UNIX 52 | #include 53 | // nothing to do on real operating systems 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/types/se3_ops.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 H. Strasdat 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_MATH_STUFF 28 | #define G2O_MATH_STUFF 29 | 30 | #include 31 | #include 32 | 33 | namespace g2o { 34 | using namespace Eigen; 35 | 36 | inline Matrix3d skew(const Vector3d&v); 37 | inline Vector3d deltaR(const Matrix3d& R); 38 | inline Vector2d project(const Vector3d&); 39 | inline Vector3d project(const Vector4d&); 40 | inline Vector3d unproject(const Vector2d&); 41 | inline Vector4d unproject(const Vector3d&); 42 | 43 | #include "se3_ops.hpp" 44 | 45 | } 46 | 47 | #endif //MATH_STUFF 48 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/types/se3_ops.hpp: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 H. Strasdat 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | Matrix3d skew(const Vector3d&v) 28 | { 29 | Matrix3d m; 30 | m.fill(0.); 31 | m(0,1) = -v(2); 32 | m(0,2) = v(1); 33 | m(1,2) = -v(0); 34 | m(1,0) = v(2); 35 | m(2,0) = -v(1); 36 | m(2,1) = v(0); 37 | return m; 38 | } 39 | 40 | Vector3d deltaR(const Matrix3d& R) 41 | { 42 | Vector3d v; 43 | v(0)=R(2,1)-R(1,2); 44 | v(1)=R(0,2)-R(2,0); 45 | v(2)=R(1,0)-R(0,1); 46 | return v; 47 | } 48 | 49 | Vector2d project(const Vector3d& v) 50 | { 51 | Vector2d res; 52 | res(0) = v(0)/v(2); 53 | res(1) = v(1)/v(2); 54 | return res; 55 | } 56 | 57 | Vector3d project(const Vector4d& v) 58 | { 59 | Vector3d res; 60 | res(0) = v(0)/v(3); 61 | res(1) = v(1)/v(3); 62 | res(2) = v(2)/v(3); 63 | return res; 64 | } 65 | 66 | Vector3d unproject(const Vector2d& v) 67 | { 68 | Vector3d res; 69 | res(0) = v(0); 70 | res(1) = v(1); 71 | res(2) = 1; 72 | return res; 73 | } 74 | 75 | Vector4d unproject(const Vector3d& v) 76 | { 77 | Vector4d res; 78 | res(0) = v(0); 79 | res(1) = v(1); 80 | res(2) = v(2); 81 | res(3) = 1; 82 | return res; 83 | } 84 | 85 | 86 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/types/types_sba.cpp: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 Kurt Konolige 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #include "types_sba.h" 28 | #include 29 | 30 | namespace g2o { 31 | 32 | using namespace std; 33 | 34 | 35 | VertexSBAPointXYZ::VertexSBAPointXYZ() : BaseVertex<3, Vector3d>() 36 | { 37 | } 38 | 39 | bool VertexSBAPointXYZ::read(std::istream& is) 40 | { 41 | Vector3d lv; 42 | for (int i=0; i<3; i++) 43 | is >> _estimate[i]; 44 | return true; 45 | } 46 | 47 | bool VertexSBAPointXYZ::write(std::ostream& os) const 48 | { 49 | Vector3d lv=estimate(); 50 | for (int i=0; i<3; i++){ 51 | os << lv[i] << " "; 52 | } 53 | return os.good(); 54 | } 55 | 56 | } // end namespace 57 | -------------------------------------------------------------------------------- /Thirdparty/g2o/g2o/types/types_sba.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 Kurt Konolige 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_SBA_TYPES 28 | #define G2O_SBA_TYPES 29 | 30 | #include "../core/base_vertex.h" 31 | 32 | #include 33 | #include 34 | 35 | namespace g2o { 36 | 37 | /** 38 | * \brief Point vertex, XYZ 39 | */ 40 | class VertexSBAPointXYZ : public BaseVertex<3, Vector3d> 41 | { 42 | public: 43 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW 44 | VertexSBAPointXYZ(); 45 | virtual bool read(std::istream& is); 46 | virtual bool write(std::ostream& os) const; 47 | 48 | virtual void setToOriginImpl() { 49 | _estimate.fill(0.); 50 | } 51 | 52 | virtual void oplusImpl(const double* update) 53 | { 54 | Eigen::Map v(update); 55 | _estimate += v; 56 | } 57 | }; 58 | 59 | } // end namespace 60 | 61 | #endif // SBA_TYPES 62 | -------------------------------------------------------------------------------- /Thirdparty/g2o/license-bsd.txt: -------------------------------------------------------------------------------- 1 | g2o - General Graph Optimization 2 | Copyright (C) 2011 Rainer Kuemmerle, Giorgio Grisetti, Hauke Strasdat, 3 | Kurt Konolige, and Wolfram Burgard 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are 8 | met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 17 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 19 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 22 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | -------------------------------------------------------------------------------- /Thirdparty/json/.clang-format: -------------------------------------------------------------------------------- 1 | #AccessModifierOffset: 2 2 | AlignAfterOpenBracket: Align 3 | AlignConsecutiveAssignments: false 4 | #AlignConsecutiveBitFields: false 5 | AlignConsecutiveDeclarations: false 6 | AlignConsecutiveMacros: false 7 | AlignEscapedNewlines: Right 8 | #AlignOperands: AlignAfterOperator 9 | AlignTrailingComments: true 10 | AllowAllArgumentsOnNextLine: false 11 | AllowAllConstructorInitializersOnNextLine: false 12 | AllowAllParametersOfDeclarationOnNextLine: false 13 | AllowShortBlocksOnASingleLine: Empty 14 | AllowShortCaseLabelsOnASingleLine: false 15 | #AllowShortEnumsOnASingleLine: true 16 | AllowShortFunctionsOnASingleLine: Empty 17 | AllowShortIfStatementsOnASingleLine: Never 18 | AllowShortLambdasOnASingleLine: Empty 19 | AllowShortLoopsOnASingleLine: false 20 | AlwaysBreakAfterReturnType: None 21 | AlwaysBreakBeforeMultilineStrings: false 22 | AlwaysBreakTemplateDeclarations: Yes 23 | BinPackArguments: false 24 | BinPackParameters: false 25 | #BitFieldColonSpacing: Both 26 | BreakBeforeBraces: Custom # or Allman 27 | BraceWrapping: 28 | AfterCaseLabel: true 29 | AfterClass: true 30 | AfterControlStatement: Always 31 | AfterEnum: true 32 | AfterFunction: true 33 | AfterNamespace: false 34 | AfterStruct: true 35 | AfterUnion: true 36 | AfterExternBlock: false 37 | BeforeCatch: true 38 | BeforeElse: true 39 | #BeforeLambdaBody: false 40 | #BeforeWhile: false 41 | SplitEmptyFunction: false 42 | SplitEmptyRecord: false 43 | SplitEmptyNamespace: false 44 | BreakBeforeTernaryOperators: true 45 | BreakConstructorInitializers: BeforeComma 46 | BreakStringLiterals: false 47 | ColumnLimit: 0 48 | CompactNamespaces: false 49 | ConstructorInitializerIndentWidth: 2 50 | Cpp11BracedListStyle: true 51 | PointerAlignment: Left 52 | FixNamespaceComments: true 53 | IncludeBlocks: Preserve 54 | #IndentCaseBlocks: false 55 | IndentCaseLabels: true 56 | IndentGotoLabels: false 57 | IndentPPDirectives: BeforeHash 58 | IndentWidth: 4 59 | KeepEmptyLinesAtTheStartOfBlocks: false 60 | MaxEmptyLinesToKeep: 1 61 | NamespaceIndentation: None 62 | ReflowComments: false 63 | SortIncludes: true 64 | SortUsingDeclarations: true 65 | SpaceAfterCStyleCast: false 66 | SpaceAfterLogicalNot: false 67 | SpaceAfterTemplateKeyword: false 68 | SpaceBeforeAssignmentOperators: true 69 | SpaceBeforeCpp11BracedList: false 70 | SpaceBeforeParens: ControlStatements 71 | SpaceBeforeRangeBasedForLoopColon: true 72 | SpaceBeforeSquareBrackets: false 73 | SpaceInEmptyBlock: false 74 | SpaceInEmptyParentheses: false 75 | SpacesBeforeTrailingComments: 2 76 | SpacesInAngles: false 77 | SpacesInCStyleCastParentheses: false 78 | SpacesInConditionalStatement: false 79 | SpacesInContainerLiterals: false 80 | SpacesInParentheses: false 81 | SpacesInSquareBrackets: false 82 | Standard: c++11 83 | TabWidth: 4 84 | UseTab: Never 85 | -------------------------------------------------------------------------------- /Thirdparty/json/.clang-tidy: -------------------------------------------------------------------------------- 1 | Checks: '*, 2 | -altera-id-dependent-backward-branch, 3 | -altera-struct-pack-align, 4 | -altera-unroll-loops, 5 | -android-cloexec-fopen, 6 | -bugprone-easily-swappable-parameters, 7 | -concurrency-mt-unsafe, 8 | -cppcoreguidelines-avoid-goto, 9 | -cppcoreguidelines-avoid-magic-numbers, 10 | -cppcoreguidelines-avoid-non-const-global-variables, 11 | -cppcoreguidelines-macro-usage, 12 | -cppcoreguidelines-pro-bounds-array-to-pointer-decay, 13 | -cppcoreguidelines-pro-bounds-constant-array-index, 14 | -cppcoreguidelines-pro-bounds-pointer-arithmetic, 15 | -cppcoreguidelines-pro-type-reinterpret-cast, 16 | -cppcoreguidelines-pro-type-union-access, 17 | -cppcoreguidelines-virtual-class-destructor, 18 | -fuchsia-default-arguments-calls, 19 | -fuchsia-default-arguments-declarations, 20 | -fuchsia-overloaded-operator, 21 | -google-explicit-constructor, 22 | -google-readability-function-size, 23 | -google-runtime-int, 24 | -google-runtime-references, 25 | -hicpp-avoid-goto, 26 | -hicpp-explicit-conversions, 27 | -hicpp-function-size, 28 | -hicpp-no-array-decay, 29 | -hicpp-no-assembler, 30 | -hicpp-signed-bitwise, 31 | -hicpp-uppercase-literal-suffix, 32 | -llvm-header-guard, 33 | -llvm-include-order, 34 | -llvmlibc-*, 35 | -misc-no-recursion, 36 | -misc-non-private-member-variables-in-classes, 37 | -modernize-concat-nested-namespaces, 38 | -modernize-use-nodiscard, 39 | -modernize-use-trailing-return-type, 40 | -readability-function-cognitive-complexity, 41 | -readability-function-size, 42 | -readability-identifier-length, 43 | -readability-magic-numbers, 44 | -readability-redundant-access-specifiers, 45 | -readability-uppercase-literal-suffix' 46 | 47 | CheckOptions: 48 | - key: hicpp-special-member-functions.AllowSoleDefaultDtor 49 | value: 1 50 | 51 | WarningsAsErrors: '*' 52 | 53 | #HeaderFilterRegex: '.*nlohmann.*' 54 | HeaderFilterRegex: '.*hpp$' 55 | -------------------------------------------------------------------------------- /Thirdparty/json/.drone.yml: -------------------------------------------------------------------------------- 1 | kind: pipeline 2 | name: test-on-arm64 3 | 4 | platform: 5 | arch: arm64 6 | 7 | steps: 8 | - name: build 9 | image: gcc 10 | commands: 11 | - wget https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz 12 | - tar xfz cmake-3.20.2.tar.gz 13 | - cd cmake-3.20.2 14 | - ./configure 15 | - make cmake ctest -j10 16 | - cd .. 17 | - mkdir build 18 | - cd build 19 | - ../cmake-3.20.2/bin/cmake .. -DJSON_FastTests=ON 20 | - make -j10 21 | - cd test 22 | - ../../cmake-3.20.2/bin/ctest -j10 23 | -------------------------------------------------------------------------------- /Thirdparty/json/.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # JSON for Modern C++ has been originally written by Niels Lohmann. 2 | # Since 2013 over 140 contributors have helped to improve the library. 3 | # This CODEOWNERS file is only to make sure that @nlohmann is requested 4 | # for a code review in case of a pull request. 5 | 6 | * @nlohmann 7 | -------------------------------------------------------------------------------- /Thirdparty/json/.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: nlohmann 2 | custom: http://paypal.me/nlohmann 3 | -------------------------------------------------------------------------------- /Thirdparty/json/.github/ISSUE_TEMPLATE/Bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: 'kind: bug' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | 12 | #### What is the issue you have? 13 | 14 | 15 | 16 | 17 | #### Please describe the steps to reproduce the issue. 18 | 19 | 20 | 21 | 22 | 1. 23 | 2. 24 | 3. 25 | 26 | #### Can you provide a small but working code example? 27 | 28 | 29 | 30 | #### What is the expected behavior? 31 | 32 | 33 | 34 | #### And what is the actual behavior instead? 35 | 36 | 37 | 38 | #### Which compiler and operating system are you using? 39 | 40 | 41 | 42 | 43 | - Compiler: ___ 44 | - Operating system: ___ 45 | 46 | #### Which version of the library did you use? 47 | 48 | 49 | 50 | - [ ] latest release version 3.10.5 51 | - [ ] other release - please state the version: ___ 52 | - [ ] the `develop` branch 53 | 54 | #### If you experience a compilation error: can you [compile and run the unit tests](https://github.com/nlohmann/json#execute-unit-tests)? 55 | 56 | - [ ] yes 57 | - [ ] no - please copy/paste the error message below 58 | -------------------------------------------------------------------------------- /Thirdparty/json/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Ask a question 4 | url: https://github.com/nlohmann/json/discussions 5 | about: Ask questions and discuss with other community members 6 | -------------------------------------------------------------------------------- /Thirdparty/json/.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | [Describe your pull request here. Please read the text below the line, and make sure you follow the checklist.] 2 | 3 | * * * 4 | 5 | ## Pull request checklist 6 | 7 | Read the [Contribution Guidelines](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md) for detailed information. 8 | 9 | - [ ] Changes are described in the pull request, or an [existing issue is referenced](https://github.com/nlohmann/json/issues). 10 | - [ ] The test suite [compiles and runs](https://github.com/nlohmann/json/blob/develop/README.md#execute-unit-tests) without error. 11 | - [ ] [Code coverage](https://coveralls.io/github/nlohmann/json) is 100%. Test cases can be added by editing the [test suite](https://github.com/nlohmann/json/tree/develop/test/src). 12 | - [ ] The source code is amalgamated; that is, after making changes to the sources in the `include/nlohmann` directory, run `make amalgamate` to create the single-header file `single_include/nlohmann/json.hpp`. The whole process is described [here](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md#files-to-change). 13 | 14 | ## Please don't 15 | 16 | - The C++11 support varies between different **compilers** and versions. Please note the [list of supported compilers](https://github.com/nlohmann/json/blob/master/README.md#supported-compilers). Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support. Please refrain from proposing changes that work around these compiler's limitations with `#ifdef`s or other means. 17 | - Specifically, I am aware of compilation problems with **Microsoft Visual Studio** (there even is an [issue label](https://github.com/nlohmann/json/issues?utf8=✓&q=label%3A%22visual+studio%22+) for these kind of bugs). I understand that even in 2016, complete C++11 support isn't there yet. But please also understand that I do not want to drop features or uglify the code just to make Microsoft's sub-standard compiler happy. The past has shown that there are ways to express the functionality such that the code compiles with the most recent MSVC - unfortunately, this is not the main objective of the project. 18 | - Please refrain from proposing changes that would **break [JSON](https://json.org) conformance**. If you propose a conformant extension of JSON to be supported by the library, please motivate this extension. 19 | - Please do not open pull requests that address **multiple issues**. 20 | -------------------------------------------------------------------------------- /Thirdparty/json/.github/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | Usually, all issues are tracked publicly on [GitHub](https://github.com/nlohmann/json/issues). If you want to make a private report (e.g., for a vulnerability or to attach an example that is not meant to be published), please send an email to . You can use [this key](https://keybase.io/nlohmann/pgp_keys.asc?fingerprint=797167ae41c0a6d9232e48457f3cea63ae251b69) for encryption. 6 | -------------------------------------------------------------------------------- /Thirdparty/json/.github/config.yml: -------------------------------------------------------------------------------- 1 | # Configuration for sentiment-bot - https://github.com/behaviorbot/sentiment-bot 2 | 3 | # *Required* toxicity threshold between 0 and .99 with the higher numbers being the most toxic 4 | # Anything higher than this threshold will be marked as toxic and commented on 5 | sentimentBotToxicityThreshold: .7 6 | 7 | # *Required* Comment to reply with 8 | sentimentBotReplyComment: > 9 | Please be sure to review the [code of conduct](https://github.com/nlohmann/json/blob/develop/CODE_OF_CONDUCT.md) and be respectful of other users. cc/ @nlohmann 10 | 11 | 12 | # Configuration for request-info - https://github.com/behaviorbot/request-info 13 | 14 | # *Required* Comment to reply with 15 | requestInfoReplyComment: > 16 | We would appreciate it if you could provide us with more info about this issue or pull request! Please check the [issue template](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE.md) and the [pull request template](https://github.com/nlohmann/json/blob/develop/.github/PULL_REQUEST_TEMPLATE.md). 17 | 18 | # *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given 19 | requestInfoLabelToAdd: "state: needs more info" 20 | -------------------------------------------------------------------------------- /Thirdparty/json/.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 30 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | # Label to use when marking an issue as stale 10 | staleLabel: "state: stale" 11 | # Comment to post when marking an issue as stale. Set to `false` to disable 12 | markComment: > 13 | This issue has been automatically marked as stale because it has not had 14 | recent activity. It will be closed if no further activity occurs. Thank you 15 | for your contributions. 16 | # Comment to post when closing a stale issue. Set to `false` to disable 17 | closeComment: false 18 | -------------------------------------------------------------------------------- /Thirdparty/json/.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: "Code scanning - action" 2 | 3 | on: 4 | push: 5 | branches: 6 | - develop 7 | - master 8 | - release/* 9 | pull_request: 10 | schedule: 11 | - cron: '0 19 * * 1' 12 | 13 | jobs: 14 | CodeQL-Build: 15 | 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - name: Checkout repository 20 | uses: actions/checkout@v2 21 | with: 22 | # We must fetch at least the immediate parents so that if this is 23 | # a pull request then we can checkout the head. 24 | fetch-depth: 2 25 | 26 | # If this run was triggered by a pull request event, then checkout 27 | # the head of the pull request instead of the merge commit. 28 | - run: git checkout HEAD^2 29 | if: ${{ github.event_name == 'pull_request' }} 30 | 31 | # Initializes the CodeQL tools for scanning. 32 | - name: Initialize CodeQL 33 | uses: github/codeql-action/init@v1 34 | # Override language selection by uncommenting this and choosing your languages 35 | # with: 36 | # languages: go, javascript, csharp, python, cpp, java 37 | 38 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 39 | # If this step fails, then you should remove it and run the build manually (see below) 40 | - name: Autobuild 41 | uses: github/codeql-action/autobuild@v1 42 | 43 | # ℹ️ Command-line programs to run using the OS shell. 44 | # 📚 https://git.io/JvXDl 45 | 46 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 47 | # and modify them (or add more) to build your code if your project 48 | # uses a compiled language 49 | 50 | #- run: | 51 | # make bootstrap 52 | # make release 53 | 54 | - name: Perform CodeQL Analysis 55 | uses: github/codeql-action/analyze@v1 56 | -------------------------------------------------------------------------------- /Thirdparty/json/.github/workflows/macos.yml: -------------------------------------------------------------------------------- 1 | name: macOS 2 | 3 | on: 4 | push: 5 | branches: 6 | - develop 7 | - master 8 | - release/* 9 | pull_request: 10 | 11 | jobs: 12 | xcode: 13 | runs-on: macos-10.15 14 | strategy: 15 | matrix: 16 | xcode: [12.4, 12.3, 12.2, 12.1.1, 12.1, 12, 11.7, 11.6, 11.5, 11.4.1, 11.3.1, 11.2.1, 10.3] 17 | env: 18 | DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer 19 | 20 | steps: 21 | - uses: actions/checkout@v2 22 | - name: cmake 23 | run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON 24 | - name: build 25 | run: cmake --build build --parallel 10 26 | - name: test 27 | run: cd build ; ctest -j 10 --output-on-failure 28 | 29 | xcode_standards: 30 | runs-on: macos-10.15 31 | strategy: 32 | matrix: 33 | standard: [11, 14, 17, 20] 34 | env: 35 | DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer 36 | 37 | steps: 38 | - uses: actions/checkout@v2 39 | - name: cmake 40 | run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DCMAKE_CXX_STANDARD_REQUIRED=ON 41 | - name: build 42 | run: cmake --build build --parallel 10 43 | - name: test 44 | run: cd build ; ctest -j 10 --output-on-failure 45 | -------------------------------------------------------------------------------- /Thirdparty/json/.gitignore: -------------------------------------------------------------------------------- 1 | json_unit 2 | json_benchmarks 3 | json_benchmarks_simple 4 | fuzz-testing 5 | 6 | *.dSYM 7 | *.o 8 | *.gcno 9 | *.gcda 10 | 11 | build 12 | build_coverage 13 | clang_analyze_build 14 | 15 | benchmarks/files/numbers/*.json 16 | 17 | .wsjcpp-logs/* 18 | .wsjcpp/* 19 | 20 | .idea 21 | /cmake-build-* 22 | 23 | test/test-* 24 | /.vs 25 | 26 | doc/html 27 | doc/mkdocs/venv/ 28 | doc/mkdocs/docs/examples 29 | doc/mkdocs/site 30 | doc/mkdocs/docs/__pycache__/ 31 | /doc/docset/JSON_for_Modern_C++.docset/ 32 | /doc/docset/JSON_for_Modern_C++.tgz 33 | -------------------------------------------------------------------------------- /Thirdparty/json/CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.1.0 2 | message: "If you use this software, please cite it as below." 3 | authors: 4 | - family-names: Lohmann 5 | given-names: Niels 6 | orcid: https://orcid.org/0000-0001-9037-795X 7 | email: mail@nlohmann.me 8 | website: https://nlohmann.me 9 | title: "JSON for Modern C++" 10 | version: 3.10.5 11 | date-released: 2022 12 | license: MIT 13 | repository-code: "https://github.com/nlohmann" 14 | url: https://json.nlohmann.me 15 | -------------------------------------------------------------------------------- /Thirdparty/json/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mail@nlohmann.me. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /Thirdparty/json/LICENSE.MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-2022 Niels Lohmann 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Thirdparty/json/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: '{build}' 2 | 3 | environment: 4 | matrix: 5 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 6 | configuration: Debug 7 | platform: x86 8 | CXX_FLAGS: "/W4 /WX" 9 | CMAKE_OPTIONS: "" 10 | GENERATOR: Visual Studio 14 2015 11 | 12 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 13 | configuration: Release 14 | platform: x86 15 | CXX_FLAGS: "/W4 /WX" 16 | CMAKE_OPTIONS: "" 17 | GENERATOR: Visual Studio 14 2015 18 | 19 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 20 | configuration: Release 21 | platform: x86 22 | name: with_win_header 23 | CXX_FLAGS: "/W4 /WX" 24 | CMAKE_OPTIONS: "" 25 | GENERATOR: Visual Studio 14 2015 26 | 27 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 28 | configuration: Release 29 | platform: x86 30 | CXX_FLAGS: "/permissive- /std:c++latest /utf-8 /W4 /WX" 31 | CMAKE_OPTIONS: "" 32 | GENERATOR: Visual Studio 15 2017 33 | 34 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 35 | configuration: Release 36 | platform: x86 37 | CXX_FLAGS: "/W4 /WX" 38 | CMAKE_OPTIONS: "-DJSON_ImplicitConversions=OFF" 39 | GENERATOR: Visual Studio 16 2019 40 | 41 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 42 | configuration: Release 43 | platform: x64 44 | CXX_FLAGS: "/W4 /WX" 45 | CMAKE_OPTIONS: "" 46 | GENERATOR: Visual Studio 14 2015 47 | 48 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 49 | configuration: Release 50 | platform: x64 51 | CXX_FLAGS: "/permissive- /std:c++latest /Zc:__cplusplus /utf-8 /W4 /WX" 52 | CMAKE_OPTIONS: "" 53 | GENERATOR: Visual Studio 15 2017 54 | 55 | init: 56 | - cmake --version 57 | - msbuild /version 58 | 59 | install: 60 | - if "%platform%"=="x86" set GENERATOR_PLATFORM=Win32 61 | 62 | before_build: 63 | # for with_win_header build, inject the inclusion of Windows.h to the single-header library 64 | - ps: if ($env:name -Eq "with_win_header") { $header_path = "single_include\nlohmann\json.hpp" } 65 | - ps: if ($env:name -Eq "with_win_header") { "#include `n" + (Get-Content $header_path | Out-String) | Set-Content $header_path } 66 | - cmake . -G "%GENERATOR%" -A "%GENERATOR_PLATFORM%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" -DJSON_BuildTests=On "%CMAKE_OPTIONS%" 67 | 68 | build_script: 69 | - cmake --build . --config "%configuration%" 70 | 71 | test_script: 72 | - if "%configuration%"=="Release" ctest -C "%configuration%" -V -j 73 | # On Debug builds, skip test-unicode_all 74 | # as it is extremely slow to run and cause 75 | # occasional timeouts on AppVeyor. 76 | # More info: https://github.com/nlohmann/json/pull/1570 77 | - if "%configuration%"=="Debug" ctest --exclude-regex "test-unicode" -C "%configuration%" -V -j 78 | 79 | # only build PRs and commits to develop branch 80 | # (see https://help.appveyor.com/discussions/questions/55079-two-builds-per-commit-to-pull-request) 81 | branches: 82 | only: 83 | - develop 84 | -------------------------------------------------------------------------------- /Thirdparty/json/benchmarks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.11) 2 | project(JSON_Benchmarks LANGUAGES CXX) 3 | 4 | # set compiler flags 5 | if((CMAKE_CXX_COMPILER_ID MATCHES GNU) OR (CMAKE_CXX_COMPILER_ID MATCHES Clang)) 6 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -DNDEBUG -O3") 7 | endif() 8 | 9 | # configure Google Benchmarks 10 | include(FetchContent) 11 | FetchContent_Declare( 12 | benchmark 13 | GIT_REPOSITORY https://github.com/google/benchmark.git 14 | GIT_TAG origin/main 15 | GIT_SHALLOW TRUE 16 | ) 17 | 18 | FetchContent_GetProperties(benchmark) 19 | if(NOT benchmark_POPULATED) 20 | FetchContent_Populate(benchmark) 21 | set(BENCHMARK_ENABLE_TESTING OFF CACHE INTERNAL "" FORCE) 22 | add_subdirectory(${benchmark_SOURCE_DIR} ${benchmark_BINARY_DIR}) 23 | endif() 24 | 25 | # download test data 26 | include(${CMAKE_SOURCE_DIR}/../cmake/download_test_data.cmake) 27 | 28 | # benchmark binary 29 | add_executable(json_benchmarks src/benchmarks.cpp) 30 | target_compile_features(json_benchmarks PRIVATE cxx_std_11) 31 | target_link_libraries(json_benchmarks benchmark ${CMAKE_THREAD_LIBS_INIT}) 32 | add_dependencies(json_benchmarks download_test_data) 33 | target_include_directories(json_benchmarks PRIVATE ${CMAKE_SOURCE_DIR}/../single_include ${CMAKE_BINARY_DIR}/include) 34 | -------------------------------------------------------------------------------- /Thirdparty/json/cmake/config.cmake.in: -------------------------------------------------------------------------------- 1 | include(FindPackageHandleStandardArgs) 2 | set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG ${CMAKE_CURRENT_LIST_FILE}) 3 | find_package_handle_standard_args(@PROJECT_NAME@ CONFIG_MODE) 4 | 5 | if(NOT TARGET @PROJECT_NAME@::@NLOHMANN_JSON_TARGET_NAME@) 6 | include("${CMAKE_CURRENT_LIST_DIR}/@NLOHMANN_JSON_TARGETS_EXPORT_NAME@.cmake") 7 | if((NOT TARGET @NLOHMANN_JSON_TARGET_NAME@) AND 8 | (NOT @PROJECT_NAME@_FIND_VERSION OR 9 | @PROJECT_NAME@_FIND_VERSION VERSION_LESS 3.2.0)) 10 | add_library(@NLOHMANN_JSON_TARGET_NAME@ INTERFACE IMPORTED) 11 | set_target_properties(@NLOHMANN_JSON_TARGET_NAME@ PROPERTIES 12 | INTERFACE_LINK_LIBRARIES @PROJECT_NAME@::@NLOHMANN_JSON_TARGET_NAME@ 13 | ) 14 | endif() 15 | endif() 16 | -------------------------------------------------------------------------------- /Thirdparty/json/cmake/download_test_data.cmake: -------------------------------------------------------------------------------- 1 | set(JSON_TEST_DATA_URL https://github.com/nlohmann/json_test_data) 2 | set(JSON_TEST_DATA_VERSION 3.0.0) 3 | 4 | # if variable is set, use test data from given directory rather than downloading them 5 | if(JSON_TestDataDirectory) 6 | message(STATUS "Using test data in ${JSON_TestDataDirectory}.") 7 | add_custom_target(download_test_data) 8 | file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${JSON_TestDataDirectory}\"\n") 9 | else() 10 | find_package(Git) 11 | # target to download test data 12 | add_custom_target(download_test_data 13 | COMMAND test -d json_test_data || ${GIT_EXECUTABLE} clone -c advice.detachedHead=false --branch v${JSON_TEST_DATA_VERSION} ${JSON_TEST_DATA_URL}.git --quiet --depth 1 14 | COMMENT "Downloading test data from ${JSON_TEST_DATA_URL} (v${JSON_TEST_DATA_VERSION})" 15 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 16 | ) 17 | # create a header with the path to the downloaded test data 18 | file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${CMAKE_BINARY_DIR}/json_test_data\"\n") 19 | endif() 20 | 21 | # determine the operating system (for debug and support purposes) 22 | find_program(UNAME_COMMAND uname) 23 | find_program(VER_COMMAND ver) 24 | find_program(LSB_RELEASE_COMMAND lsb_release) 25 | find_program(SW_VERS_COMMAND sw_vers) 26 | set(OS_VERSION_STRINGS "${CMAKE_SYSTEM}") 27 | if (VER_COMMAND) 28 | execute_process(COMMAND ${VER_COMMAND} OUTPUT_VARIABLE VER_COMMAND_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE) 29 | set(OS_VERSION_STRINGS "${OS_VERSION_STRINGS}; ${VER_COMMAND_RESULT}") 30 | endif() 31 | if (SW_VERS_COMMAND) 32 | execute_process(COMMAND ${SW_VERS_COMMAND} OUTPUT_VARIABLE SW_VERS_COMMAND_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) 33 | string(REGEX REPLACE "[ ]*\n" "; " SW_VERS_COMMAND_RESULT "${SW_VERS_COMMAND_RESULT}") 34 | set(OS_VERSION_STRINGS "${OS_VERSION_STRINGS}; ${SW_VERS_COMMAND_RESULT}") 35 | endif() 36 | if (LSB_RELEASE_COMMAND) 37 | execute_process(COMMAND ${LSB_RELEASE_COMMAND} -a OUTPUT_VARIABLE LSB_RELEASE_COMMAND_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) 38 | string(REGEX REPLACE "[ ]*\n" "; " LSB_RELEASE_COMMAND_RESULT "${LSB_RELEASE_COMMAND_RESULT}") 39 | set(OS_VERSION_STRINGS "${OS_VERSION_STRINGS}; ${LSB_RELEASE_COMMAND_RESULT}") 40 | endif() 41 | if (UNAME_COMMAND) 42 | execute_process(COMMAND ${UNAME_COMMAND} -a OUTPUT_VARIABLE UNAME_COMMAND_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) 43 | set(OS_VERSION_STRINGS "${OS_VERSION_STRINGS}; ${UNAME_COMMAND_RESULT}") 44 | endif() 45 | 46 | message(STATUS "Operating system: ${OS_VERSION_STRINGS}") 47 | 48 | # determine the compiler (for debug and support purposes) 49 | if (MSVC) 50 | execute_process(COMMAND ${CMAKE_CXX_COMPILER} OUTPUT_VARIABLE CXX_VERSION_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_VARIABLE CXX_VERSION_RESULT ERROR_STRIP_TRAILING_WHITESPACE) 51 | set(CXX_VERSION_RESULT "${CXX_VERSION_RESULT}; MSVC_VERSION=${MSVC_VERSION}; MSVC_TOOLSET_VERSION=${MSVC_TOOLSET_VERSION}") 52 | else() 53 | execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE CXX_VERSION_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE) 54 | endif() 55 | string(REGEX REPLACE "[ ]*\n" "; " CXX_VERSION_RESULT "${CXX_VERSION_RESULT}") 56 | message(STATUS "Compiler: ${CXX_VERSION_RESULT}") 57 | -------------------------------------------------------------------------------- /Thirdparty/json/cmake/nlohmann_jsonConfigVersion.cmake.in: -------------------------------------------------------------------------------- 1 | # This is essentially cmake's BasicConfigVersion-SameMajorVersion.cmake.in but 2 | # without the 32/64-bit check. Since json is a header-only library, it doesn't 3 | # matter if it was built on a different platform than what it is used on (see 4 | # https://github.com/nlohmann/json/issues/1697). 5 | set(PACKAGE_VERSION "@PROJECT_VERSION@") 6 | 7 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 8 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 9 | else() 10 | 11 | if(PACKAGE_FIND_VERSION_MAJOR STREQUAL "@PROJECT_VERSION_MAJOR@") 12 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 13 | else() 14 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 15 | endif() 16 | 17 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 18 | set(PACKAGE_VERSION_EXACT TRUE) 19 | endif() 20 | endif() 21 | -------------------------------------------------------------------------------- /Thirdparty/json/cmake/pkg-config.pc.in: -------------------------------------------------------------------------------- 1 | Name: ${PROJECT_NAME} 2 | Description: JSON for Modern C++ 3 | Version: ${PROJECT_VERSION} 4 | Cflags: -I${CMAKE_INSTALL_FULL_INCLUDEDIR} 5 | -------------------------------------------------------------------------------- /Thirdparty/json/include/nlohmann/adl_serializer.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace nlohmann 12 | { 13 | 14 | /// @sa https://json.nlohmann.me/api/adl_serializer/ 15 | template 16 | struct adl_serializer 17 | { 18 | /// @brief convert a JSON value to any value type 19 | /// @sa https://json.nlohmann.me/api/adl_serializer/from_json/ 20 | template 21 | static auto from_json(BasicJsonType && j, TargetType& val) noexcept( 22 | noexcept(::nlohmann::from_json(std::forward(j), val))) 23 | -> decltype(::nlohmann::from_json(std::forward(j), val), void()) 24 | { 25 | ::nlohmann::from_json(std::forward(j), val); 26 | } 27 | 28 | /// @brief convert a JSON value to any value type 29 | /// @sa https://json.nlohmann.me/api/adl_serializer/from_json/ 30 | template 31 | static auto from_json(BasicJsonType && j) noexcept( 32 | noexcept(::nlohmann::from_json(std::forward(j), detail::identity_tag {}))) 33 | -> decltype(::nlohmann::from_json(std::forward(j), detail::identity_tag {})) 34 | { 35 | return ::nlohmann::from_json(std::forward(j), detail::identity_tag {}); 36 | } 37 | 38 | /// @brief convert any value type to a JSON value 39 | /// @sa https://json.nlohmann.me/api/adl_serializer/to_json/ 40 | template 41 | static auto to_json(BasicJsonType& j, TargetType && val) noexcept( 42 | noexcept(::nlohmann::to_json(j, std::forward(val)))) 43 | -> decltype(::nlohmann::to_json(j, std::forward(val)), void()) 44 | { 45 | ::nlohmann::to_json(j, std::forward(val)); 46 | } 47 | }; 48 | } // namespace nlohmann 49 | -------------------------------------------------------------------------------- /Thirdparty/json/include/nlohmann/detail/input/position_t.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include // size_t 4 | 5 | namespace nlohmann 6 | { 7 | namespace detail 8 | { 9 | /// struct to capture the start position of the current token 10 | struct position_t 11 | { 12 | /// the total number of characters read 13 | std::size_t chars_read_total = 0; 14 | /// the number of characters read in the current line 15 | std::size_t chars_read_current_line = 0; 16 | /// the number of lines read 17 | std::size_t lines_read = 0; 18 | 19 | /// conversion to size_t to preserve SAX interface 20 | constexpr operator size_t() const 21 | { 22 | return chars_read_total; 23 | } 24 | }; 25 | 26 | } // namespace detail 27 | } // namespace nlohmann 28 | -------------------------------------------------------------------------------- /Thirdparty/json/include/nlohmann/detail/iterators/internal_iterator.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace nlohmann 6 | { 7 | namespace detail 8 | { 9 | /*! 10 | @brief an iterator value 11 | 12 | @note This structure could easily be a union, but MSVC currently does not allow 13 | unions members with complex constructors, see https://github.com/nlohmann/json/pull/105. 14 | */ 15 | template struct internal_iterator 16 | { 17 | /// iterator for JSON objects 18 | typename BasicJsonType::object_t::iterator object_iterator {}; 19 | /// iterator for JSON arrays 20 | typename BasicJsonType::array_t::iterator array_iterator {}; 21 | /// generic iterator for all other types 22 | primitive_iterator_t primitive_iterator {}; 23 | }; 24 | } // namespace detail 25 | } // namespace nlohmann 26 | -------------------------------------------------------------------------------- /Thirdparty/json/include/nlohmann/detail/iterators/iterator_traits.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include // random_access_iterator_tag 4 | 5 | #include 6 | #include 7 | 8 | namespace nlohmann 9 | { 10 | namespace detail 11 | { 12 | template 13 | struct iterator_types {}; 14 | 15 | template 16 | struct iterator_types < 17 | It, 18 | void_t> 20 | { 21 | using difference_type = typename It::difference_type; 22 | using value_type = typename It::value_type; 23 | using pointer = typename It::pointer; 24 | using reference = typename It::reference; 25 | using iterator_category = typename It::iterator_category; 26 | }; 27 | 28 | // This is required as some compilers implement std::iterator_traits in a way that 29 | // doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. 30 | template 31 | struct iterator_traits 32 | { 33 | }; 34 | 35 | template 36 | struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> 37 | : iterator_types 38 | { 39 | }; 40 | 41 | template 42 | struct iterator_traits::value>> 43 | { 44 | using iterator_category = std::random_access_iterator_tag; 45 | using value_type = T; 46 | using difference_type = ptrdiff_t; 47 | using pointer = T*; 48 | using reference = T&; 49 | }; 50 | } // namespace detail 51 | } // namespace nlohmann 52 | -------------------------------------------------------------------------------- /Thirdparty/json/include/nlohmann/detail/json_ref.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | namespace nlohmann 9 | { 10 | namespace detail 11 | { 12 | template 13 | class json_ref 14 | { 15 | public: 16 | using value_type = BasicJsonType; 17 | 18 | json_ref(value_type&& value) 19 | : owned_value(std::move(value)) 20 | {} 21 | 22 | json_ref(const value_type& value) 23 | : value_ref(&value) 24 | {} 25 | 26 | json_ref(std::initializer_list init) 27 | : owned_value(init) 28 | {} 29 | 30 | template < 31 | class... Args, 32 | enable_if_t::value, int> = 0 > 33 | json_ref(Args && ... args) 34 | : owned_value(std::forward(args)...) 35 | {} 36 | 37 | // class should be movable only 38 | json_ref(json_ref&&) noexcept = default; 39 | json_ref(const json_ref&) = delete; 40 | json_ref& operator=(const json_ref&) = delete; 41 | json_ref& operator=(json_ref&&) = delete; 42 | ~json_ref() = default; 43 | 44 | value_type moved_or_copied() const 45 | { 46 | if (value_ref == nullptr) 47 | { 48 | return std::move(owned_value); 49 | } 50 | return *value_ref; 51 | } 52 | 53 | value_type const& operator*() const 54 | { 55 | return value_ref ? *value_ref : owned_value; 56 | } 57 | 58 | value_type const* operator->() const 59 | { 60 | return &** this; 61 | } 62 | 63 | private: 64 | mutable value_type owned_value = nullptr; 65 | value_type const* value_ref = nullptr; 66 | }; 67 | } // namespace detail 68 | } // namespace nlohmann 69 | -------------------------------------------------------------------------------- /Thirdparty/json/include/nlohmann/detail/macro_unscope.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // restore clang diagnostic settings 4 | #if defined(__clang__) 5 | #pragma clang diagnostic pop 6 | #endif 7 | 8 | // clean up 9 | #undef JSON_ASSERT 10 | #undef JSON_INTERNAL_CATCH 11 | #undef JSON_CATCH 12 | #undef JSON_THROW 13 | #undef JSON_TRY 14 | #undef JSON_PRIVATE_UNLESS_TESTED 15 | #undef JSON_HAS_CPP_11 16 | #undef JSON_HAS_CPP_14 17 | #undef JSON_HAS_CPP_17 18 | #undef JSON_HAS_CPP_20 19 | #undef JSON_HAS_FILESYSTEM 20 | #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM 21 | #undef NLOHMANN_BASIC_JSON_TPL_DECLARATION 22 | #undef NLOHMANN_BASIC_JSON_TPL 23 | #undef JSON_EXPLICIT 24 | #undef NLOHMANN_CAN_CALL_STD_FUNC_IMPL 25 | 26 | #include 27 | -------------------------------------------------------------------------------- /Thirdparty/json/include/nlohmann/detail/meta/call_std/begin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace nlohmann 6 | { 7 | NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); 8 | } // namespace nlohmann 9 | -------------------------------------------------------------------------------- /Thirdparty/json/include/nlohmann/detail/meta/call_std/end.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace nlohmann 6 | { 7 | NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); 8 | } // namespace nlohmann 9 | -------------------------------------------------------------------------------- /Thirdparty/json/include/nlohmann/detail/meta/detected.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | // https://en.cppreference.com/w/cpp/experimental/is_detected 8 | namespace nlohmann 9 | { 10 | namespace detail 11 | { 12 | struct nonesuch 13 | { 14 | nonesuch() = delete; 15 | ~nonesuch() = delete; 16 | nonesuch(nonesuch const&) = delete; 17 | nonesuch(nonesuch const&&) = delete; 18 | void operator=(nonesuch const&) = delete; 19 | void operator=(nonesuch&&) = delete; 20 | }; 21 | 22 | template class Op, 25 | class... Args> 26 | struct detector 27 | { 28 | using value_t = std::false_type; 29 | using type = Default; 30 | }; 31 | 32 | template class Op, class... Args> 33 | struct detector>, Op, Args...> 34 | { 35 | using value_t = std::true_type; 36 | using type = Op; 37 | }; 38 | 39 | template class Op, class... Args> 40 | using is_detected = typename detector::value_t; 41 | 42 | template class Op, class... Args> 43 | struct is_detected_lazy : is_detected { }; 44 | 45 | template class Op, class... Args> 46 | using detected_t = typename detector::type; 47 | 48 | template class Op, class... Args> 49 | using detected_or = detector; 50 | 51 | template class Op, class... Args> 52 | using detected_or_t = typename detected_or::type; 53 | 54 | template class Op, class... Args> 55 | using is_detected_exact = std::is_same>; 56 | 57 | template class Op, class... Args> 58 | using is_detected_convertible = 59 | std::is_convertible, To>; 60 | } // namespace detail 61 | } // namespace nlohmann 62 | -------------------------------------------------------------------------------- /Thirdparty/json/include/nlohmann/detail/meta/identity_tag.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace nlohmann 4 | { 5 | namespace detail 6 | { 7 | // dispatching helper struct 8 | template struct identity_tag {}; 9 | } // namespace detail 10 | } // namespace nlohmann 11 | -------------------------------------------------------------------------------- /Thirdparty/json/include/nlohmann/detail/meta/void_t.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace nlohmann 4 | { 5 | namespace detail 6 | { 7 | template struct make_void 8 | { 9 | using type = void; 10 | }; 11 | template using void_t = typename make_void::type; 12 | } // namespace detail 13 | } // namespace nlohmann 14 | -------------------------------------------------------------------------------- /Thirdparty/json/include/nlohmann/detail/string_escape.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace nlohmann 7 | { 8 | namespace detail 9 | { 10 | 11 | /*! 12 | @brief replace all occurrences of a substring by another string 13 | 14 | @param[in,out] s the string to manipulate; changed so that all 15 | occurrences of @a f are replaced with @a t 16 | @param[in] f the substring to replace with @a t 17 | @param[in] t the string to replace @a f 18 | 19 | @pre The search string @a f must not be empty. **This precondition is 20 | enforced with an assertion.** 21 | 22 | @since version 2.0.0 23 | */ 24 | inline void replace_substring(std::string& s, const std::string& f, 25 | const std::string& t) 26 | { 27 | JSON_ASSERT(!f.empty()); 28 | for (auto pos = s.find(f); // find first occurrence of f 29 | pos != std::string::npos; // make sure f was found 30 | s.replace(pos, f.size(), t), // replace with t, and 31 | pos = s.find(f, pos + t.size())) // find next occurrence of f 32 | {} 33 | } 34 | 35 | /*! 36 | * @brief string escaping as described in RFC 6901 (Sect. 4) 37 | * @param[in] s string to escape 38 | * @return escaped string 39 | * 40 | * Note the order of escaping "~" to "~0" and "/" to "~1" is important. 41 | */ 42 | inline std::string escape(std::string s) 43 | { 44 | replace_substring(s, "~", "~0"); 45 | replace_substring(s, "/", "~1"); 46 | return s; 47 | } 48 | 49 | /*! 50 | * @brief string unescaping as described in RFC 6901 (Sect. 4) 51 | * @param[in] s string to unescape 52 | * @return unescaped string 53 | * 54 | * Note the order of escaping "~1" to "/" and "~0" to "~" is important. 55 | */ 56 | static void unescape(std::string& s) 57 | { 58 | replace_substring(s, "~1", "/"); 59 | replace_substring(s, "~0", "~"); 60 | } 61 | 62 | } // namespace detail 63 | } // namespace nlohmann 64 | -------------------------------------------------------------------------------- /Thirdparty/json/include/nlohmann/detail/value_t.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include // array 4 | #include // size_t 5 | #include // uint8_t 6 | #include // string 7 | 8 | namespace nlohmann 9 | { 10 | namespace detail 11 | { 12 | /////////////////////////// 13 | // JSON type enumeration // 14 | /////////////////////////// 15 | 16 | /*! 17 | @brief the JSON type enumeration 18 | 19 | This enumeration collects the different JSON types. It is internally used to 20 | distinguish the stored values, and the functions @ref basic_json::is_null(), 21 | @ref basic_json::is_object(), @ref basic_json::is_array(), 22 | @ref basic_json::is_string(), @ref basic_json::is_boolean(), 23 | @ref basic_json::is_number() (with @ref basic_json::is_number_integer(), 24 | @ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), 25 | @ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and 26 | @ref basic_json::is_structured() rely on it. 27 | 28 | @note There are three enumeration entries (number_integer, number_unsigned, and 29 | number_float), because the library distinguishes these three types for numbers: 30 | @ref basic_json::number_unsigned_t is used for unsigned integers, 31 | @ref basic_json::number_integer_t is used for signed integers, and 32 | @ref basic_json::number_float_t is used for floating-point numbers or to 33 | approximate integers which do not fit in the limits of their respective type. 34 | 35 | @sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON 36 | value with the default value for a given type 37 | 38 | @since version 1.0.0 39 | */ 40 | enum class value_t : std::uint8_t 41 | { 42 | null, ///< null value 43 | object, ///< object (unordered set of name/value pairs) 44 | array, ///< array (ordered collection of values) 45 | string, ///< string value 46 | boolean, ///< boolean value 47 | number_integer, ///< number value (signed integer) 48 | number_unsigned, ///< number value (unsigned integer) 49 | number_float, ///< number value (floating-point) 50 | binary, ///< binary array (ordered collection of bytes) 51 | discarded ///< discarded by the parser callback function 52 | }; 53 | 54 | /*! 55 | @brief comparison operator for JSON types 56 | 57 | Returns an ordering that is similar to Python: 58 | - order: null < boolean < number < object < array < string < binary 59 | - furthermore, each type is not smaller than itself 60 | - discarded values are not comparable 61 | - binary is represented as a b"" string in python and directly comparable to a 62 | string; however, making a binary array directly comparable with a string would 63 | be surprising behavior in a JSON file. 64 | 65 | @since version 1.0.0 66 | */ 67 | inline bool operator<(const value_t lhs, const value_t rhs) noexcept 68 | { 69 | static constexpr std::array order = {{ 70 | 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, 71 | 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, 72 | 6 /* binary */ 73 | } 74 | }; 75 | 76 | const auto l_index = static_cast(lhs); 77 | const auto r_index = static_cast(rhs); 78 | return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; 79 | } 80 | } // namespace detail 81 | } // namespace nlohmann 82 | -------------------------------------------------------------------------------- /Thirdparty/json/include/nlohmann/json_fwd.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ 2 | #define INCLUDE_NLOHMANN_JSON_FWD_HPP_ 3 | 4 | #include // int64_t, uint64_t 5 | #include // map 6 | #include // allocator 7 | #include // string 8 | #include // vector 9 | 10 | /*! 11 | @brief namespace for Niels Lohmann 12 | @see https://github.com/nlohmann 13 | @since version 1.0.0 14 | */ 15 | namespace nlohmann 16 | { 17 | /*! 18 | @brief default JSONSerializer template argument 19 | 20 | This serializer ignores the template arguments and uses ADL 21 | ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) 22 | for serialization. 23 | */ 24 | template 25 | struct adl_serializer; 26 | 27 | /// a class to store JSON values 28 | /// @sa https://json.nlohmann.me/api/basic_json/ 29 | template class ObjectType = 30 | std::map, 31 | template class ArrayType = std::vector, 32 | class StringType = std::string, class BooleanType = bool, 33 | class NumberIntegerType = std::int64_t, 34 | class NumberUnsignedType = std::uint64_t, 35 | class NumberFloatType = double, 36 | template class AllocatorType = std::allocator, 37 | template class JSONSerializer = 38 | adl_serializer, 39 | class BinaryType = std::vector> 40 | class basic_json; 41 | 42 | /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document 43 | /// @sa https://json.nlohmann.me/api/json_pointer/ 44 | template 45 | class json_pointer; 46 | 47 | /*! 48 | @brief default specialization 49 | @sa https://json.nlohmann.me/api/json/ 50 | */ 51 | using json = basic_json<>; 52 | 53 | /// @brief a minimal map-like container that preserves insertion order 54 | /// @sa https://json.nlohmann.me/api/ordered_map/ 55 | template 56 | struct ordered_map; 57 | 58 | /// @brief specialization that maintains the insertion order of object keys 59 | /// @sa https://json.nlohmann.me/api/ordered_json/ 60 | using ordered_json = basic_json; 61 | 62 | } // namespace nlohmann 63 | 64 | #endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ 65 | -------------------------------------------------------------------------------- /Thirdparty/json/meson.build: -------------------------------------------------------------------------------- 1 | project('nlohmann_json', 2 | 'cpp', 3 | version : '3.10.5', 4 | license : 'MIT', 5 | ) 6 | 7 | nlohmann_json_dep = declare_dependency( 8 | include_directories: include_directories('single_include') 9 | ) 10 | 11 | nlohmann_json_multiple_headers = declare_dependency( 12 | include_directories: include_directories('include') 13 | ) 14 | 15 | if not meson.is_subproject() 16 | install_headers('single_include/nlohmann/json.hpp', subdir: 'nlohmann') 17 | 18 | pkgc = import('pkgconfig') 19 | pkgc.generate(name: 'nlohmann_json', 20 | version: meson.project_version(), 21 | description: 'JSON for Modern C++' 22 | ) 23 | endif 24 | -------------------------------------------------------------------------------- /Thirdparty/json/nlohmann_json.natvis: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | null 5 | {*(m_value.object)} 6 | {*(m_value.array)} 7 | {*(m_value.string)} 8 | {m_value.boolean} 9 | {m_value.number_integer} 10 | {m_value.number_unsigned} 11 | {m_value.number_float} 12 | discarded 13 | 14 | 15 | *(m_value.object),view(simple) 16 | 17 | 18 | *(m_value.array),view(simple) 19 | 20 | 21 | 22 | 23 | 25 | 26 | {second} 27 | 28 | second 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Thirdparty/json/third_party/amalgamate/CHANGES.md: -------------------------------------------------------------------------------- 1 | The following changes have been made to the code with respect to : 2 | 3 | - Resolved inspection results from PyCharm: 4 | - replaced tabs with spaces 5 | - added encoding annotation 6 | - reindented file to remove trailing whitespaces 7 | - unused import `sys` 8 | - membership check 9 | - made function from `_is_within` 10 | - removed unused variable `actual_path` 11 | -------------------------------------------------------------------------------- /Thirdparty/json/third_party/amalgamate/LICENSE.md: -------------------------------------------------------------------------------- 1 | amalgamate.py - Amalgamate C source and header files 2 | Copyright (c) 2012, Erik Edlund 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of Erik Edlund, nor the names of its contributors may 15 | be used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /Thirdparty/json/third_party/amalgamate/README.md: -------------------------------------------------------------------------------- 1 | 2 | # amalgamate.py - Amalgamate C source and header files 3 | 4 | Origin: https://bitbucket.org/erikedlund/amalgamate 5 | 6 | Mirror: https://github.com/edlund/amalgamate 7 | 8 | `amalgamate.py` aims to make it easy to use SQLite-style C source and header 9 | amalgamation in projects. 10 | 11 | For more information, please refer to: http://sqlite.org/amalgamation.html 12 | 13 | ## Here be dragons 14 | 15 | `amalgamate.py` is quite dumb, it only knows the bare minimum about C code 16 | required in order to be able to handle trivial include directives. It can 17 | produce weird results for unexpected code. 18 | 19 | Things to be aware of: 20 | 21 | `amalgamate.py` will not handle complex include directives correctly: 22 | 23 | #define HEADER_PATH "path/to/header.h" 24 | #include HEADER_PATH 25 | 26 | In the above example, `path/to/header.h` will not be included in the 27 | amalgamation (HEADER_PATH is never expanded). 28 | 29 | `amalgamate.py` makes the assumption that each source and header file which 30 | is not empty will end in a new-line character, which is not immediately 31 | preceded by a backslash character (see 5.1.1.2p1.2 of ISO C99). 32 | 33 | `amalgamate.py` should be usable with C++ code, but raw string literals from 34 | C++11 will definitely cause problems: 35 | 36 | R"delimiter(Terrible raw \ data " #include )delimiter" 37 | R"delimiter(Terrible raw \ data " escaping)delimiter" 38 | 39 | In the examples above, `amalgamate.py` will stop parsing the raw string literal 40 | when it encounters the first quotation mark, which will produce unexpected 41 | results. 42 | 43 | ## Installing amalgamate.py 44 | 45 | Python v.2.7.0 or higher is required. 46 | 47 | `amalgamate.py` can be tested and installed using the following commands: 48 | 49 | ./test.sh && sudo -k cp ./amalgamate.py /usr/local/bin/ 50 | 51 | ## Using amalgamate.py 52 | 53 | amalgamate.py [-v] -c path/to/config.json -s path/to/source/dir \ 54 | [-p path/to/prologue.(c|h)] 55 | 56 | * The `-c, --config` option should specify the path to a JSON config file which 57 | lists the source files, include paths and where to write the resulting 58 | amalgamation. Have a look at `test/source.c.json` and `test/include.h.json` 59 | to see two examples. 60 | 61 | * The `-s, --source` option should specify the path to the source directory. 62 | This is useful for supporting separate source and build directories. 63 | 64 | * The `-p, --prologue` option should specify the path to a file which will be 65 | added to the beginning of the amalgamation. It is optional. 66 | 67 | -------------------------------------------------------------------------------- /Thirdparty/json/third_party/amalgamate/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "project": "JSON for Modern C++", 3 | "target": "single_include/nlohmann/json.hpp", 4 | "sources": [ 5 | "include/nlohmann/json.hpp" 6 | ], 7 | "include_paths": ["include"] 8 | } 9 | -------------------------------------------------------------------------------- /Thirdparty/json/third_party/cpplint/LICENSE: -------------------------------------------------------------------------------- 1 | cpplint.py and its corresponding unit tests are Copyright (C) 2009 Google Inc. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /Thirdparty/json/third_party/cpplint/README.rst: -------------------------------------------------------------------------------- 1 | cpplint - static code checker for C++ 2 | ===================================== 3 | 4 | .. image:: https://travis-ci.org/cpplint/cpplint.svg?branch=master 5 | :target: https://travis-ci.org/cpplint/cpplint 6 | 7 | .. image:: https://img.shields.io/pypi/v/cpplint.svg 8 | :target: https://pypi.python.org/pypi/cpplint 9 | 10 | .. image:: https://img.shields.io/pypi/pyversions/cpplint.svg 11 | :target: https://pypi.python.org/pypi/cpplint 12 | 13 | .. image:: https://img.shields.io/pypi/status/cpplint.svg 14 | :target: https://pypi.python.org/pypi/cpplint 15 | 16 | .. image:: https://img.shields.io/pypi/l/cpplint.svg 17 | :target: https://pypi.python.org/pypi/cpplint 18 | 19 | .. image:: https://img.shields.io/pypi/dd/cpplint.svg 20 | :target: https://pypi.python.org/pypi/cpplint 21 | 22 | .. image:: https://img.shields.io/pypi/dw/cpplint.svg 23 | :target: https://pypi.python.org/pypi/cpplint 24 | 25 | .. image:: https://img.shields.io/pypi/dm/cpplint.svg 26 | :target: https://pypi.python.org/pypi/cpplint 27 | 28 | Cpplint is a command-line tool to check C/C++ files for style issues following `Google's C++ style guide `_. 29 | Cpplint is developed and maintained by Google Inc. at `google/styleguide `_, also see the `wikipedia entry `_ 30 | 31 | While Google maintains cpplint, Google is not (very) responsive to issues and pull requests, this fork aims to be (somewhat) more open to add fixes to cpplint to enable fixes, when those fixes make cpplint usable in wider contexts. 32 | Also see discussion here https://github.com/google/styleguide/pull/528. 33 | 34 | 35 | Installation 36 | ============ 37 | 38 | 39 | To install cpplint from PyPI, run: 40 | 41 | .. code-block:: bash 42 | 43 | $ pip install cpplint 44 | 45 | Then run it with: 46 | 47 | .. code-block:: bash 48 | 49 | $ cpplint [OPTIONS] files 50 | 51 | For full usage instructions, run: 52 | 53 | .. code-block:: bash 54 | 55 | $ cpplint --help 56 | 57 | Changes 58 | ------- 59 | 60 | The modifications in this fork are minor fixes and cosmetic changes, such as: 61 | 62 | * python 3 compatibility 63 | * more default file extensions 64 | * customizable file extensions with the --extensions argument 65 | * continuous integration on travis 66 | * support for recursive file discovery via the --recursive argument 67 | * support for excluding files via --exclude 68 | * JUnit XML output format 69 | * Overriding repository root auto-detection via --repository 70 | * Support ``#pragma once`` as an alternative to header include guards 71 | * ... and a few more (most of which are open PRs on upstream) 72 | 73 | 74 | Acknowledgements 75 | ---------------- 76 | 77 | Thanks to Google Inc. for open-sourcing their in-house tool. 78 | Thanks to maintainers of the fork 79 | 80 | * `tkruse `_ 81 | * `mattyclarkson `_ 82 | * `theandrewdavis `_ 83 | -------------------------------------------------------------------------------- /Thirdparty/json/third_party/cpplint/update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | wget -N https://raw.githubusercontent.com/cpplint/cpplint/master/cpplint.py 4 | wget -N https://raw.githubusercontent.com/cpplint/cpplint/master/LICENSE 5 | wget -N https://raw.githubusercontent.com/cpplint/cpplint/master/README.rst 6 | -------------------------------------------------------------------------------- /Thirdparty/json/third_party/gdb_pretty_printer/README.md: -------------------------------------------------------------------------------- 1 | # GDB Pretty Printer 2 | 3 | File [nlohmann-json.py](nlohmann-json.py) contains a pretty printer for GDB for JSON values of this library. It was originally published as [Gist](https://gist.github.com/ssbssa/60da5339c6e6036b2afce17de06050ea#file-nlohmann-json-py) by [Hannes Domani](https://github.com/ssbssa). 4 | 5 | ## How to use 6 | 7 | - Add line 8 | 9 | ``` 10 | source /path/to/nlohmann-json.py 11 | ``` 12 | 13 | to `~/.gdbinit`. Note you must replace `/path/to` with whatever path you stored file `nlohmann-json.py`. 14 | - In GDB, debug as usual. When you want to pretty-print a JSON value `var`, type 15 | 16 | ``` 17 | p -pretty on -array on -- var 18 | ``` 19 | 20 | The result should look like 21 | 22 | ``` 23 | $1 = std::map with 5 elements = { 24 | ["Baptiste"] = std::map with 1 element = { 25 | ["first"] = "second" 26 | }, 27 | ["Emmanuel"] = std::vector of length 3, capacity 3 = { 28 | 3, 29 | "25", 30 | 0.5 31 | }, 32 | ["Jean"] = 0.7, 33 | ["Zorg"] = std::map with 8 elements = { 34 | ["array"] = std::vector of length 3, capacity 3 = { 35 | 1, 36 | 0, 37 | 2 38 | }, 39 | ["awesome_str"] = "bleh", 40 | ["bool"] = true, 41 | ["flex"] = 0.2, 42 | ["float"] = 5.22, 43 | ["int"] = 5, 44 | ["nested"] = std::map with 1 element = { 45 | ["bar"] = "barz" 46 | }, 47 | ["trap "] = "you fell" 48 | }, 49 | ["empty"] = nlohmann::detail::value_t::null 50 | } 51 | ``` 52 | 53 | Tested with GDB 9.2. See [#1952](https://github.com/nlohmann/json/issues/1952) for more information. Please post questions there. 54 | 55 | ## Copyright 56 | 57 | MIT License 58 | 59 | Copyright (C) 2020 [Hannes Domani](https://github.com/ssbssa) 60 | 61 | Permission is hereby granted, free of charge, to any person obtaining a copy 62 | of this software and associated documentation files (the "Software"), to deal 63 | in the Software without restriction, including without limitation the rights 64 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 65 | copies of the Software, and to permit persons to whom the Software is 66 | furnished to do so, subject to the following conditions: 67 | 68 | The above copyright notice and this permission notice shall be included in all 69 | copies or substantial portions of the Software. 70 | 71 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 72 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 73 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 74 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 75 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 76 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 77 | SOFTWARE. 78 | -------------------------------------------------------------------------------- /Thirdparty/json/third_party/gdb_pretty_printer/nlohmann-json.py: -------------------------------------------------------------------------------- 1 | import gdb 2 | 3 | class JsonValuePrinter: 4 | "Print a json-value" 5 | 6 | def __init__(self, val): 7 | self.val = val 8 | 9 | def to_string(self): 10 | if self.val.type.strip_typedefs().code == gdb.TYPE_CODE_FLT: 11 | return ("%.6f" % float(self.val)).rstrip("0") 12 | return self.val 13 | 14 | def json_lookup_function(val): 15 | name = val.type.strip_typedefs().name 16 | if name and name.startswith("nlohmann::basic_json<") and name.endswith(">"): 17 | t = str(val['m_type']) 18 | if t.startswith("nlohmann::detail::value_t::"): 19 | try: 20 | union_val = val['m_value'][t[27:]] 21 | if union_val.type.code == gdb.TYPE_CODE_PTR: 22 | return gdb.default_visualizer(union_val.dereference()) 23 | else: 24 | return JsonValuePrinter(union_val) 25 | except: 26 | return JsonValuePrinter(val['m_type']) 27 | 28 | gdb.pretty_printers.append(json_lookup_function) 29 | -------------------------------------------------------------------------------- /Thirdparty/json/third_party/macro_builder/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | void build_code(int max_args) 8 | { 9 | stringstream ss; 10 | ss << "#define NLOHMANN_JSON_EXPAND( x ) x" << endl; 11 | ss << "#define NLOHMANN_JSON_GET_MACRO("; 12 | for (int i = 0 ; i < max_args ; i++) 13 | ss << "_" << i + 1 << ", "; 14 | ss << "NAME,...) NAME" << endl; 15 | 16 | ss << "#define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \\" << endl; 17 | for (int i = max_args ; i > 1 ; i--) 18 | ss << "NLOHMANN_JSON_PASTE" << i << ", \\" << endl; 19 | ss << "NLOHMANN_JSON_PASTE1)(__VA_ARGS__))" << endl; 20 | 21 | ss << "#define NLOHMANN_JSON_PASTE2(func, v1) func(v1)" << endl; 22 | for (int i = 3 ; i <= max_args ; i++) 23 | { 24 | ss << "#define NLOHMANN_JSON_PASTE" << i << "(func, "; 25 | for (int j = 1 ; j < i -1 ; j++) 26 | ss << "v" << j << ", "; 27 | ss << "v" << i-1 << ") NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE" << i-1 << "(func, "; 28 | for (int j = 2 ; j < i-1 ; j++) 29 | ss << "v" << j << ", "; 30 | ss << "v" << i-1 << ")" << endl; 31 | } 32 | 33 | cout << ss.str() << endl; 34 | } 35 | 36 | int main(int argc, char** argv) 37 | { 38 | int max_args = 64; 39 | build_code(max_args); 40 | 41 | return 0; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /Thirdparty/json/wsjcpp.yml: -------------------------------------------------------------------------------- 1 | wsjcpp_version: "v0.1.1" 2 | cmake_minimum_required: "3.0" 3 | cmake_cxx_standard: "11" 4 | name: "nlohmann/json" 5 | version: "v3.10.5" 6 | description: "JSON for Modern C++" 7 | issues: "https://github.com/nlohmann/json/issues" 8 | keywords: 9 | - "c++" 10 | - "json" 11 | 12 | repositories: 13 | - type: main 14 | url: "https://github.com/nlohmann/json" 15 | 16 | authors: 17 | - name: "Niels Lohmann" 18 | email: "mail@nlohmann.me" 19 | 20 | distribution: 21 | - source-file: "single_include/nlohmann/json.hpp" 22 | target-file: "json.hpp" 23 | type: "source-code" 24 | -------------------------------------------------------------------------------- /Vocabulary/ORBvoc.txt.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yutongwangBIT/VOOM/c8a9b1bf7bf6f71530d103e63646452286dfcfb3/Vocabulary/ORBvoc.txt.tar.gz -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | echo "Configuring and building Thirdparty libraries ..." 2 | echo "BoW2 ..." 3 | 4 | cd Thirdparty 5 | cd DBoW2 6 | mkdir build 7 | cd build 8 | cmake .. 9 | make -j$(nproc) 10 | cd ../.. 11 | 12 | 13 | echo "BoW2 ..." 14 | cd g2o 15 | mkdir build 16 | cd build 17 | cmake .. 18 | make -j$(nproc) 19 | cd ../.. 20 | 21 | echo "Osmap ..." 22 | cd Osmap 23 | sh build.sh 24 | cd ../.. 25 | 26 | echo "Extracting vocabulary file ..." 27 | cd Vocabulary 28 | tar -xvf ORBvoc.txt.tar.gz 29 | cd .. 30 | 31 | echo "Configuring and building OA-SLAM ..." 32 | mkdir build 33 | cd build 34 | cmake .. 35 | make -j10 36 | -------------------------------------------------------------------------------- /include/Camera.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of OA-SLAM. 3 | * 4 | * Copyright (C) 2022 Matthieu Zins 5 | * (Inria, LORIA, Université de Lorraine) 6 | * OA-SLAM 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 | * OA-SLAM 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 OA-SLAM. If not, see . 18 | */ 19 | 20 | #ifndef CAMERA_H 21 | #define CAMERA_H 22 | 23 | #include 24 | 25 | namespace ORB_SLAM2 26 | { 27 | 28 | 29 | // Compute the orientaiton of a camera placed at center and looking at target, with y axis aligned 30 | // with up. 31 | Eigen::Matrix3d look_at(const Eigen::Vector3d& center, 32 | const Eigen::Vector3d& target, 33 | const Eigen::Vector3d& up=Eigen::Vector3d::UnitZ()); 34 | 35 | inline Eigen::Matrix3d generate_K(double fx, double fy, double ppx, double ppy) { 36 | Eigen::Matrix3d K; 37 | K << fx, 0.0, ppx, 0.0, fy, ppy, 0.0, 0.0, 1.0; 38 | return K; 39 | } 40 | 41 | std::pair, Eigen::Matrix> 42 | generate_camera_triaxe(const Eigen::Matrix3d& orientation, const Eigen::Vector3d& position, int sampling); 43 | 44 | // Compute a rotation error between two rotation matrices. 45 | inline double rotation_error(const Eigen::Matrix3d& R1, const Eigen::Matrix3d& R2) { 46 | return Eigen::AngleAxisd(R1 * R2.transpose()).angle(); 47 | } 48 | 49 | // Compute the pose error between two cameras 50 | inline std::pair pose_error(const Eigen::Matrix3d& o1, const Eigen::Vector3d& p1, 51 | const Eigen::Matrix3d& o2, const Eigen::Vector3d& p2) 52 | { 53 | return std::make_pair(rotation_error(o1, o2), (p1 - p2).norm()); 54 | } 55 | 56 | 57 | } 58 | 59 | 60 | #endif // CAMERA_H -------------------------------------------------------------------------------- /include/ColorManager.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of OA-SLAM. 3 | * 4 | * Copyright (C) 2022 Matthieu Zins 5 | * (Inria, LORIA, Université de Lorraine) 6 | * OA-SLAM 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 | * OA-SLAM 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 OA-SLAM. If not, see . 18 | */ 19 | 20 | 21 | #ifndef COLOR_MANAGER_H 22 | #define COLOR_MANAGER_H 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | namespace ORB_SLAM2 30 | { 31 | 32 | 33 | 34 | class RandomUniformColorGenerator 35 | { 36 | public: 37 | static cv::Scalar Generate() { 38 | cv::Scalar color; 39 | color(0) = RandomUniformColorGenerator::distr(RandomUniformColorGenerator::gen); 40 | color(1) = RandomUniformColorGenerator::distr(RandomUniformColorGenerator::gen); 41 | color(2) = RandomUniformColorGenerator::distr(RandomUniformColorGenerator::gen); 42 | return color; 43 | } 44 | 45 | private: 46 | static std::random_device rd; 47 | static std::mt19937 gen; 48 | static std::uniform_int_distribution distr; 49 | }; 50 | 51 | const int nb_category_colors = 500; 52 | 53 | 54 | class CategoryColorsManager 55 | { 56 | public: 57 | static const CategoryColorsManager& GetInstance() { 58 | if (!instance) { 59 | instance = new CategoryColorsManager(); 60 | } 61 | return *instance; 62 | } 63 | 64 | static void FreeInstance() { 65 | if (instance) 66 | delete instance; 67 | } 68 | 69 | const cv::Scalar& operator[](size_t idx) const { 70 | return colors_[idx]; 71 | } 72 | 73 | private: 74 | static CategoryColorsManager *instance; 75 | 76 | std::vector colors_; 77 | 78 | CategoryColorsManager(); 79 | }; 80 | 81 | 82 | } 83 | 84 | #endif // COLOR_MANAGER_H 85 | -------------------------------------------------------------------------------- /include/Converter.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of ORB-SLAM2. 3 | * 4 | * Copyright (C) 2014-2016 Raúl Mur-Artal (University of Zaragoza) 5 | * For more information see 6 | * 7 | * ORB-SLAM2 is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * ORB-SLAM2 is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with ORB-SLAM2. If not, see . 19 | */ 20 | 21 | #ifndef CONVERTER_H 22 | #define CONVERTER_H 23 | 24 | #include 25 | 26 | #include 27 | #include"Thirdparty/g2o/g2o/types/types_six_dof_expmap.h" 28 | #include"Thirdparty/g2o/g2o/types/types_seven_dof_expmap.h" 29 | 30 | namespace ORB_SLAM2 31 | { 32 | 33 | class Converter 34 | { 35 | public: 36 | static std::vector toDescriptorVector(const cv::Mat &Descriptors); 37 | 38 | static g2o::SE3Quat toSE3Quat(const cv::Mat &cvT); 39 | static g2o::SE3Quat toSE3Quat(const g2o::Sim3 &gSim3); 40 | 41 | static cv::Mat toCvMat(const g2o::SE3Quat &SE3); 42 | static cv::Mat toCvMat(const g2o::Sim3 &Sim3); 43 | static cv::Mat toCvMat(const Eigen::Matrix &m); 44 | static cv::Mat toCvMat(const Eigen::Matrix3d &m); 45 | static cv::Mat toCvMat(const Eigen::Matrix &m); 46 | static cv::Mat toCvSE3(const Eigen::Matrix &R, const Eigen::Matrix &t); 47 | 48 | static Eigen::Matrix toVector3d(const cv::Mat &cvVector); 49 | static Eigen::Matrix toVector3d(const cv::Point3f &cvPoint); 50 | static Eigen::Matrix toMatrix3d(const cv::Mat &cvMat3); 51 | 52 | static std::vector toQuaternion(const cv::Mat &M); 53 | }; 54 | 55 | }// namespace ORB_SLAM 56 | 57 | #endif // CONVERTER_H 58 | -------------------------------------------------------------------------------- /include/Distance.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of OA-SLAM. 3 | * 4 | * Copyright (C) 2022 Matthieu Zins 5 | * (Inria, LORIA, Université de Lorraine) 6 | * OA-SLAM 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 | * OA-SLAM 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 OA-SLAM. If not, see . 18 | */ 19 | 20 | #ifndef DISTANCE_H 21 | #define DISTANCE_H 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | #include "Ellipse.h" 29 | #include "Ellipsoid.h" 30 | #include "Utils.h" 31 | 32 | 33 | namespace ORB_SLAM2 34 | { 35 | 36 | double gaussian_wasserstein_2d(const Ellipse& ell1, const Ellipse& ell2); 37 | 38 | double normalized_gaussian_wasserstein_2d(const Ellipse& ell1, const Ellipse& ell2, const double constant_C); 39 | 40 | double gaussian_bhattacharrya_2d(const Ellipse& ell1, const Ellipse& ell2); 41 | 42 | std::vector> generate_sampling_points(const Ellipse& ell, int count_az, int count_dist, double scale); 43 | 44 | std::tuple, std::vector, std::vector>> 45 | ellipses_sampling_metric_ell(const Ellipse& ell1, const Ellipse& ell2, int N_az, int N_dist, double sampling_scale); 46 | 47 | std::tuple find_on_image_bbox(const Ellipse& ell, int width, int height); 48 | 49 | inline double algebraic_distance(const Ellipse& ell1, const Ellipse& ell2) 50 | { 51 | return (sym2vec(ell1.AsDual()) - sym2vec(ell2.AsDual())).norm(); 52 | } 53 | 54 | inline double tangency_segment_ellipsoid(const Eigen::Vector3d& line, const Ellipsoid& ellipsoid, const Matrix34d& P) 55 | { 56 | Eigen::Vector4d pl = P.transpose() * line; 57 | return pl.transpose() * ellipsoid.AsDual() * pl; 58 | } 59 | 60 | } 61 | 62 | #endif // DISTANCE_H -------------------------------------------------------------------------------- /include/Graph.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPH_H 2 | #define GRAPH_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include "Ellipse.h" 12 | 13 | using namespace std; 14 | 15 | namespace ORB_SLAM2 16 | { 17 | class Object; 18 | 19 | struct Attribute { 20 | int object_id; 21 | int label; 22 | float confidence; 23 | float hue; 24 | Eigen::Vector4d bbox; 25 | Ellipse ell; 26 | Object* obj; 27 | }; 28 | 29 | class Graph { 30 | public: 31 | Graph(); 32 | 33 | Graph(vector> edge_list, vector> node_labels); 34 | 35 | void add_node(int node_id, int label, float confidence=0.0f, float hue=0.0f, Eigen::Vector4d bbox=Eigen::Vector4d::Zero(), Ellipse ell=Ellipse()); 36 | 37 | void add_edge(int node1, int node2, float weight=1.0f); 38 | 39 | bool has_edge(int node1, int node2) { 40 | return edges.count(make_pair(node1,node2)) > 0; 41 | } 42 | 43 | bool has_node(int n){ 44 | return nodes.count(n)>0; 45 | } 46 | 47 | vector get_neighbours(int node_id) { 48 | return nodes[node_id]; 49 | } 50 | 51 | void compute_catagory_statistics(); 52 | 53 | void compute_feature_vectors(); 54 | 55 | Eigen::VectorXd compute_feature_vector_node(int node_id); 56 | 57 | double find_matches_score(map>> feature_vectors_another, 58 | std::vector, double>>& matches, size_t N_another, double thres=0.1); 59 | 60 | bool has_false(std::vector used){ 61 | return std::any_of(used.begin(), used.end(), [](bool b){return !b;}); 62 | } 63 | 64 | 65 | map> nodes; 66 | map, float> edges; 67 | map attributes; 68 | map>> feature_vectors; 69 | Eigen::VectorXd category_ids_statistics; 70 | }; 71 | 72 | } //namespace ORB_SLAM 73 | 74 | #endif // GRAPH_H 75 | -------------------------------------------------------------------------------- /include/KeyFrameDatabase.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of ORB-SLAM2. 3 | * 4 | * Copyright (C) 2014-2016 Raúl Mur-Artal (University of Zaragoza) 5 | * For more information see 6 | * 7 | * ORB-SLAM2 is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * ORB-SLAM2 is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with ORB-SLAM2. If not, see . 19 | */ 20 | 21 | #ifndef KEYFRAMEDATABASE_H 22 | #define KEYFRAMEDATABASE_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include "KeyFrame.h" 29 | #include "Frame.h" 30 | #include "ORBVocabulary.h" 31 | 32 | #include 33 | 34 | 35 | namespace ORB_SLAM2 36 | { 37 | 38 | class KeyFrame; 39 | class Frame; 40 | 41 | 42 | class KeyFrameDatabase 43 | { 44 | public: 45 | 46 | KeyFrameDatabase(const ORBVocabulary &voc); 47 | 48 | void add(KeyFrame* pKF); 49 | 50 | void erase(KeyFrame* pKF); 51 | 52 | void clear(); 53 | 54 | // Loop Detection 55 | std::vector DetectLoopCandidates(KeyFrame* pKF, float minScore); 56 | 57 | vector DetectLoopCandidatesByGraph(KeyFrame* pKF); 58 | 59 | // Relocalization 60 | std::vector DetectRelocalizationCandidates(Frame* F); 61 | 62 | vector< pair, double>> > > DetectRelocalizationCandidatesByGraph(Frame *F); 63 | 64 | vector< pair, double>> > > DetectRelocalizationCandidatesByGraphAndBoW(Frame *F); 65 | 66 | 67 | protected: 68 | 69 | // Associated vocabulary 70 | const ORBVocabulary* mpVoc; 71 | 72 | // Inverted file 73 | std::vector > mvInvertedFile; 74 | 75 | //GRAPH 76 | std::vector > mvInvertedFile_labels; 77 | 78 | // Mutex 79 | std::mutex mMutex; 80 | }; 81 | 82 | } //namespace ORB_SLAM 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /include/MapDrawer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of OA-SLAM. 3 | * 4 | * Copyright (C) 2022 Matthieu Zins 5 | * (Inria, LORIA, Université de Lorraine) 6 | * OA-SLAM 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 | * OA-SLAM 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 OA-SLAM. If not, see . 18 | */ 19 | 20 | 21 | /** 22 | * This file is part of ORB-SLAM2. 23 | * 24 | * Copyright (C) 2014-2016 Raúl Mur-Artal (University of Zaragoza) 25 | * For more information see 26 | * 27 | * ORB-SLAM2 is free software: you can redistribute it and/or modify 28 | * it under the terms of the GNU General Public License as published by 29 | * the Free Software Foundation, either version 3 of the License, or 30 | * (at your option) any later version. 31 | * 32 | * ORB-SLAM2 is distributed in the hope that it will be useful, 33 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | * GNU General Public License for more details. 36 | * 37 | * You should have received a copy of the GNU General Public License 38 | * along with ORB-SLAM2. If not, see . 39 | */ 40 | 41 | #ifndef MAPDRAWER_H 42 | #define MAPDRAWER_H 43 | 44 | #include"Map.h" 45 | #include"MapPoint.h" 46 | #include"KeyFrame.h" 47 | #include 48 | 49 | #include 50 | #include 51 | 52 | namespace ORB_SLAM2 53 | { 54 | 55 | class MapDrawer 56 | { 57 | public: 58 | MapDrawer(Map* pMap, const string &strSettingPath); 59 | 60 | Map* mpMap; 61 | 62 | void DrawMapPoints(double size, bool ignore_objects_points); 63 | void DrawMapObjectsPoints(double size); 64 | void DrawKeyFrames(const bool bDrawKF, const bool bDrawGraph, const bool bDrawObjGraph); 65 | void DrawCurrentCamera(pangolin::OpenGlMatrix &Twc); 66 | void SetCurrentCameraPose(const cv::Mat &Tcw); 67 | void SetReferenceKeyFrame(KeyFrame *pKF); 68 | void GetCurrentOpenGLCameraMatrix(pangolin::OpenGlMatrix &M); 69 | void DrawMapObjects(); 70 | void SetUseCategoryColors(bool use_cat_cols) { 71 | use_category_cols_ = use_cat_cols; 72 | } 73 | void SetDisplay3DBbox(bool disp_bbox) { 74 | display_3d_bbox_ = disp_bbox; 75 | } 76 | 77 | void DrawDistanceEstimation(double depth, cv::Mat &Tcw); 78 | 79 | private: 80 | 81 | float mKeyFrameSize; 82 | float mKeyFrameLineWidth; 83 | float mGraphLineWidth; 84 | float mPointSize; 85 | float mCameraSize; 86 | float mCameraLineWidth; 87 | 88 | cv::Mat mCameraPose; 89 | 90 | std::mutex mMutexCamera; 91 | 92 | bool use_category_cols_; 93 | bool display_3d_bbox_; 94 | }; 95 | 96 | } //namespace ORB_SLAM 97 | 98 | #endif // MAPDRAWER_H 99 | -------------------------------------------------------------------------------- /include/ORBVocabulary.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of ORB-SLAM2. 3 | * 4 | * Copyright (C) 2014-2016 Raúl Mur-Artal (University of Zaragoza) 5 | * For more information see 6 | * 7 | * ORB-SLAM2 is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * ORB-SLAM2 is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with ORB-SLAM2. If not, see . 19 | */ 20 | 21 | 22 | #ifndef ORBVOCABULARY_H 23 | #define ORBVOCABULARY_H 24 | 25 | #include"Thirdparty/DBoW2/DBoW2/FORB.h" 26 | #include"Thirdparty/DBoW2/DBoW2/TemplatedVocabulary.h" 27 | 28 | namespace ORB_SLAM2 29 | { 30 | 31 | typedef DBoW2::TemplatedVocabulary 32 | ORBVocabulary; 33 | 34 | } //namespace ORB_SLAM 35 | 36 | #endif // ORBVOCABULARY_H 37 | -------------------------------------------------------------------------------- /include/ObjectMatcher.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of ORB-SLAM2. 3 | * 4 | * Copyright (C) 2014-2016 Raúl Mur-Artal (University of Zaragoza) 5 | * For more information see 6 | * 7 | * ORB-SLAM2 is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * ORB-SLAM2 is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with ORB-SLAM2. If not, see . 19 | */ 20 | 21 | 22 | #ifndef OBJECTMATCHER_H 23 | #define OBJECTMATCHER_H 24 | 25 | #include 26 | 27 | #include"Object.h" 28 | #include "Graph.h" 29 | #include "Utils.h" 30 | 31 | 32 | namespace ORB_SLAM2 33 | { 34 | 35 | class ObjectMatcher 36 | { 37 | public: 38 | 39 | ObjectMatcher(Eigen::Matrix3d K); 40 | 41 | static int DescriptorDistance(const cv::Mat &a, const cv::Mat &b); 42 | 43 | int MatchObjectsByProjection(Frame &F, std::unordered_map proj_bboxes); 44 | 45 | int MatchObjectsHungarian(Frame &F, std::unordered_map proj_bboxes); 46 | 47 | int MatchObjectsWasserDistance(Frame &F, std::unordered_map proj_bboxes); 48 | 49 | int MatchObjectsIoU(Frame &F, std::unordered_map proj_bboxes); 50 | 51 | float AssociateFeaturesWithObjects(Frame &CurrentFrame); 52 | 53 | void SearchInBox(KeyFrame *pKF, const vector &vpMapPoints, const vector vIndices_in_box); 54 | 55 | int SearchByProjection(Frame &F, const std::vector &vpMapPoints, const vector vIndices, const float th=3); 56 | 57 | int SearchByProjection(Frame &F, const vector &vpMapPoints, const float th, const std::vector vb_in_boxes); 58 | 59 | 60 | public: 61 | 62 | static const int TH_LOW; 63 | static const int TH_HIGH; 64 | static const int HISTO_LENGTH; 65 | 66 | 67 | protected: 68 | float RadiusByViewingCos(const float &viewCos); 69 | Eigen::Matrix3d K_; 70 | 71 | }; 72 | 73 | }// namespace ORB_SLAM 74 | 75 | #endif // OBJECTMATCHER_H 76 | -------------------------------------------------------------------------------- /include/Optimizer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of ORB-SLAM2. 3 | * 4 | * Copyright (C) 2014-2016 Raúl Mur-Artal (University of Zaragoza) 5 | * For more information see 6 | * 7 | * ORB-SLAM2 is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * ORB-SLAM2 is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with ORB-SLAM2. If not, see . 19 | */ 20 | 21 | #ifndef OPTIMIZER_H 22 | #define OPTIMIZER_H 23 | 24 | #include "Map.h" 25 | #include "MapPoint.h" 26 | #include "KeyFrame.h" 27 | #include "LoopClosing.h" 28 | #include "Frame.h" 29 | 30 | #include "Thirdparty/g2o/g2o/types/types_seven_dof_expmap.h" 31 | 32 | namespace ORB_SLAM2 33 | { 34 | 35 | class LoopClosing; 36 | 37 | class Optimizer 38 | { 39 | public: 40 | void static BundleAdjustment(const std::vector &vpKF, const std::vector &vpMP, 41 | int nIterations = 5, bool *pbStopFlag=NULL, const unsigned long nLoopKF=0, 42 | const bool bRobust = true); 43 | void static GlobalBundleAdjustemnt(Map* pMap, int nIterations=5, bool *pbStopFlag=NULL, 44 | const unsigned long nLoopKF=0, const bool bRobust = true); 45 | void static LocalBundleAdjustment(KeyFrame* pKF, bool *pbStopFlag, Map *pMap); 46 | int static PoseOptimization(Frame* pFrame); 47 | 48 | // if bFixScale is true, 6DoF optimization (stereo,rgbd), 7DoF otherwise (mono) 49 | void static OptimizeEssentialGraph(Map* pMap, KeyFrame* pLoopKF, KeyFrame* pCurKF, 50 | const LoopClosing::KeyFrameAndPose &NonCorrectedSim3, 51 | const LoopClosing::KeyFrameAndPose &CorrectedSim3, 52 | const map > &LoopConnections, 53 | const bool &bFixScale); 54 | 55 | // if bFixScale is true, optimize SE3 (stereo,rgbd), Sim3 otherwise (mono) 56 | static int OptimizeSim3(KeyFrame* pKF1, KeyFrame* pKF2, std::vector &vpMatches1, 57 | g2o::Sim3 &g2oS12, const float th2, const bool bFixScale); 58 | }; 59 | 60 | } //namespace ORB_SLAM 61 | 62 | #endif // OPTIMIZER_H 63 | -------------------------------------------------------------------------------- /include/Reconstruction.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of OA-SLAM. 3 | * 4 | * Copyright (C) 2022 Matthieu Zins 5 | * (Inria, LORIA, Université de Lorraine) 6 | * OA-SLAM 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 | * OA-SLAM 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 OA-SLAM. If not, see . 18 | */ 19 | 20 | 21 | #ifndef RECONSTRUCTION_H 22 | #define RECONSTRUCTION_H 23 | 24 | #include "Ellipsoid.h" 25 | #include "Utils.h" 26 | 27 | namespace ORB_SLAM2 28 | { 29 | 30 | 31 | 32 | std::pair 33 | ReconstructEllipsoidFromCenters(const std::vector>& boxes, 34 | const std::vector>& Rts, 35 | const Eigen::Matrix3d& K); 36 | 37 | Eigen::Vector3d TriangulatePoints2(const Eigen::Vector2d& uv1, const Eigen::Vector2d& uv2, 38 | const Matrix34d& P1, const Matrix34d& P2); 39 | 40 | Eigen::Vector3d TriangulatePoints(const std::vector>& points, 41 | const std::vector>& projections); 42 | 43 | Eigen::Vector3d TriangulatePointsRansac(const std::vector>& points, 44 | const std::vector>& projections, 45 | int max_iter); 46 | 47 | std::pair 48 | ReconstructEllipsoidFromLandmarks(const std::vector>& bboxes, 49 | const std::vector>& Rts, 50 | const Eigen::Matrix3d& K, const Eigen::Matrix& pts); 51 | 52 | Ellipsoid reconstruct_ellipsoid_lstsq(const std::vector>& ellipses, 53 | const std::vector>& projections); 54 | 55 | std::pair 56 | ReconstructEllipsoidCrocco(const std::vector>& bboxes, 57 | const std::vector>& Rts, 58 | const Eigen::Matrix3d& K, bool use_two_passes); 59 | 60 | } 61 | 62 | #endif // RECONSTRUCTION_H -------------------------------------------------------------------------------- /include/Scene.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of OA-SLAM. 3 | * 4 | * Copyright (C) 2022 Matthieu Zins 5 | * (Inria, LORIA, Université de Lorraine) 6 | * OA-SLAM 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 | * OA-SLAM 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 OA-SLAM. If not, see . 18 | */ 19 | 20 | 21 | #ifndef SCENE_H 22 | #define SCENE_H 23 | 24 | #include "Ellipsoid.h" 25 | 26 | namespace ORB_SLAM2 27 | { 28 | 29 | std::vector> 30 | generate_random_scene(size_t n_ellipsoids, double axes_min, double axes_max, double rot_min, double rot_max, double pos_min, double pos_max); 31 | 32 | std::pair 33 | generate_random_camera(double azimuth_min, double azimuth_max, double elev_min, double elev_max, 34 | double dist_min, double dist_max, double target_min, double target_max); 35 | 36 | 37 | } 38 | 39 | #endif // SCENE_H -------------------------------------------------------------------------------- /script: -------------------------------------------------------------------------------- 1 | sh build.sh 2 | 3 | cd /bin 4 | 5 | <<<<<<< HEAD 6 | ./rgbd_tum_with_ellipse ../Vocabulary/ORBvoc.txt ../Cameras/TUM2.yaml /home/yutong/data/rgbd_dataset_freiburg2_desk ../Data/fr2_desk/fr2_desk.txt ../Data/fr2_desk/detections_yolov8x_seg_tum_rgbd_fr2_desk_with_ellipse.json null points fr2 7 | 8 | ======= 9 | >>>>>>> 3147a93da8ef989f8e3c4b8b2c6dd70bb07e5c82 10 | ./rgbd_tum_with_ellipse ../Vocabulary/ORBvoc.txt ../Cameras/TUM2.yaml /home/yutong/data/rgbd_dataset_freiburg2_desk_with_person ../Data/fr2_person/fr2_person_associated.txt ../Data/fr2_person/detections_yolov8x_seg_fr2_person_with_ellipse.json points fr2_person 11 | 12 | ./rgbd_tum_with_ellipse ../Vocabulary/ORBvoc.txt ../Cameras/TUM3.yaml /home/yutong/data/rgbd_dataset_freiburg3_long_office_household ../Data/fr3/fr3_office.txt ../Data/fr3/detections_yolov8x_seg_fr3_office_with_ellipse.json points fr3 13 | 14 | 15 | ./rgbd_tum_with_ellipse ../Vocabulary/ORBvoc.txt ../Cameras/TUM3.yaml /home/yutong/data/rgbd_dataset_freiburg3_teddy ../Data/fr3_teddy/rgbd_dataset_freiburg3_teddy_associated.txt ../Data/fr3_teddy/detections_yolov8x_seg_fr3_teddy_with_ellipse.json points fr3_teddy 16 | 17 | 18 | ./rgbd_tum_with_ellipse ../Vocabulary/ORBvoc.txt ../Cameras/TUM1.yaml /home/yutong/data/rgbd_dataset_freiburg1_desk ../Data/fr1_desk/fr1_desk.txt ../Data/fr1_desk/detections_yolov8x_seg_fr1_desk_with_ellipse.json points fr1_desk 19 | 20 | ./rgbd_tum_with_ellipse ../Vocabulary/ORBvoc.txt ../Cameras/TUM1.yaml /home/yutong/data/rgbd_dataset_freiburg1_desk2 ../Data/fr1_desk2/fr1_desk2.txt ../Data/fr1_desk2/detections_yolov8x_seg_fr1_desk2_with_ellipse.json points fr1_desk2 21 | 22 | 23 | ./rgbd_diamond_with_ellipse ../Vocabulary/ORBvoc.txt ../Cameras/diamond_walk.yaml /home/yutong/data/diamond_ground_robot_for_test ../Data/diamond_ground/diamond_ground_robot_associated.txt ../Data/diamond_ground/detections_yolov8x_seg_diamond_ground_robot_with_ellipse.json points diamond_ground 24 | 25 | ./rgbd_diamond_with_ellipse ../Vocabulary/ORBvoc.txt ../Cameras/diamond_vr_slow.yaml /home/yutong/data/diamond_vr_slow_for_test ../Data/diamond_vr_slow/diamond_vr_slow_associated.txt ../Data/diamond_vr_slow/detections_yolov8x_seg_diamond_vr_slow_with_ellipse.json points diamond_vr_slow 26 | 27 | ./rgbd_diamond_with_ellipse ../Vocabulary/ORBvoc.txt ../Cameras/diamond_walk.yaml /home/yutong/data/diamond_dji_for_test ../Data/diamond_dji/diamond_dji_associated.txt ../Data/diamond_dji/detections_yolov8x_seg_diamond_dji_with_ellipse.json points diamond_dji 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/Camera.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of OA-SLAM. 3 | * 4 | * Copyright (C) 2022 Matthieu Zins 5 | * (Inria, LORIA, Université de Lorraine) 6 | * OA-SLAM 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 | * OA-SLAM 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 OA-SLAM. If not, see . 18 | */ 19 | 20 | 21 | #include "Camera.h" 22 | 23 | 24 | namespace ORB_SLAM2 25 | { 26 | 27 | Eigen::Matrix3d look_at(const Eigen::Vector3d& center, 28 | const Eigen::Vector3d& target, 29 | const Eigen::Vector3d& up) 30 | { 31 | Eigen::Vector3d z = target - center; 32 | Eigen::Vector3d zn = z; 33 | zn.normalize(); 34 | Eigen::Vector3d x = -up.cross(z); 35 | Eigen::Vector3d xn = x; 36 | xn.normalize(); 37 | Eigen::Vector3d y = z.cross(x); 38 | Eigen::Vector3d yn = y; 39 | yn.normalize(); 40 | Eigen::Matrix3d R; 41 | R << xn, yn, zn; 42 | return R; 43 | } 44 | 45 | 46 | std::pair, Eigen::Matrix> 47 | generate_camera_triaxe(const Eigen::Matrix3d& orientation, const Eigen::Vector3d& position, int sampling) 48 | { 49 | Eigen::Matrix pts(sampling*3, 3); 50 | Eigen::Matrix colors(sampling*3, 3); 51 | for (int i = 0; i < sampling; ++i) { 52 | double f = static_cast(i) / (sampling-1); 53 | pts.row(i) = (orientation.col(0) * f + position).transpose(); 54 | colors(i, 0) = 255; 55 | colors(i, 1) = 0; 56 | colors(i, 2) = 0; 57 | } 58 | for (int i = 0; i < sampling; ++i) { 59 | double f = static_cast(i) / (sampling-1); 60 | pts.row(sampling+i) = (orientation.col(1) * f + position).transpose(); 61 | colors(sampling+i, 0) = 0; 62 | colors(sampling+i, 1) = 255; 63 | colors(sampling+i, 2) = 0; 64 | } 65 | for (int i = 0; i < sampling; ++i) { 66 | double f = static_cast(i) / (sampling-1); 67 | pts.row(2*sampling+i) = (orientation.col(2) * f + position).transpose(); 68 | colors(2*sampling+i, 0) = 0; 69 | colors(2*sampling+i, 1) = 0; 70 | colors(2*sampling+i, 2) = 255; 71 | } 72 | return std::make_pair(pts, colors); 73 | } 74 | 75 | } -------------------------------------------------------------------------------- /src/ColorManager.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of OA-SLAM. 3 | * 4 | * Copyright (C) 2022 Matthieu Zins 5 | * (Inria, LORIA, Université de Lorraine) 6 | * OA-SLAM 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 | * OA-SLAM 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 OA-SLAM. If not, see . 18 | */ 19 | 20 | 21 | #include "ColorManager.h" 22 | 23 | 24 | namespace ORB_SLAM2 25 | { 26 | 27 | std::random_device RandomUniformColorGenerator::rd("default"); 28 | std::mt19937 RandomUniformColorGenerator::gen(RandomUniformColorGenerator::rd()); 29 | std::uniform_int_distribution RandomUniformColorGenerator::distr = std::uniform_int_distribution(0, 255); 30 | 31 | 32 | CategoryColorsManager *CategoryColorsManager::instance = nullptr; 33 | 34 | 35 | CategoryColorsManager::CategoryColorsManager() 36 | : colors_(std::vector(nb_category_colors)) { 37 | for (int i = 0; i < nb_category_colors; ++i) { 38 | colors_[i] = RandomUniformColorGenerator::Generate(); 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/OptimizerObject.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of OA-SLAM. 3 | * 4 | * Copyright (C) 2022 Matthieu Zins 5 | * (Inria, LORIA, Université de Lorraine) 6 | * OA-SLAM 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 | * OA-SLAM 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 OA-SLAM. If not, see . 18 | */ 19 | 20 | #include "OptimizerObject.h" 21 | 22 | #include "Thirdparty/g2o/g2o/core/block_solver.h" 23 | #include "Thirdparty/g2o/g2o/core/optimization_algorithm_levenberg.h" 24 | #include "Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h" 25 | #include "Thirdparty/g2o/g2o/types/types_six_dof_expmap.h" 26 | #include "Thirdparty/g2o/g2o/core/robust_kernel_impl.h" 27 | #include "Thirdparty/g2o/g2o/solvers/linear_solver_dense.h" 28 | #include "Thirdparty/g2o/g2o/types/types_seven_dof_expmap.h" 29 | 30 | #include 31 | 32 | #include "Converter.h" 33 | 34 | #include 35 | 36 | namespace ORB_SLAM2 37 | { 38 | 39 | 40 | } //namespace ORB_SLAM 41 | -------------------------------------------------------------------------------- /src/Utils.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of OA-SLAM. 3 | * 4 | * Copyright (C) 2022 Matthieu Zins 5 | * (Inria, LORIA, Université de Lorraine) 6 | * OA-SLAM 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 | * OA-SLAM 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 OA-SLAM. If not, see . 18 | */ 19 | 20 | 21 | #include "Utils.h" 22 | 23 | #include 24 | #include 25 | 26 | namespace ORB_SLAM2 27 | { 28 | 29 | void writeOBJ(const std::string& filename, const Eigen::Matrix& pts, 30 | const Eigen::Matrix& colors) 31 | { 32 | std::ofstream f(filename); 33 | f << std::fixed; 34 | bool with_colors = pts.rows() == colors.rows(); 35 | for (int j = 0; j < pts.rows(); ++j) { 36 | f << "v " << std::setprecision(7) << " "<< pts(j, 0) 37 | << " " << pts(j, 1) 38 | << " " << pts(j, 2); 39 | if (with_colors) { 40 | f << " " << colors(j, 0) << " " << colors(j, 1) << " " << colors(j, 2); 41 | } 42 | f << "\n"; 43 | } 44 | f.close(); 45 | } 46 | 47 | 48 | } --------------------------------------------------------------------------------