├── .gitignore ├── 3rd ├── json │ ├── LICENSE │ └── include │ │ └── nlohmann │ │ ├── json.hpp │ │ └── json_fwd.hpp ├── popl │ ├── LICENSE │ └── include │ │ └── popl.hpp └── spdlog │ ├── LICENSE │ └── include │ └── spdlog │ ├── async.h │ ├── async_logger.h │ ├── common.h │ ├── details │ ├── async_logger_impl.h │ ├── circular_q.h │ ├── console_globals.h │ ├── file_helper.h │ ├── fmt_helper.h │ ├── log_msg.h │ ├── logger_impl.h │ ├── mpmc_blocking_q.h │ ├── null_mutex.h │ ├── os.h │ ├── pattern_formatter.h │ ├── periodic_worker.h │ ├── registry.h │ └── thread_pool.h │ ├── fmt │ ├── bin_to_hex.h │ ├── bundled │ │ ├── LICENSE.rst │ │ ├── chrono.h │ │ ├── color.h │ │ ├── core.h │ │ ├── format-inl.h │ │ ├── format.h │ │ ├── locale.h │ │ ├── ostream.h │ │ ├── posix.h │ │ ├── printf.h │ │ ├── ranges.h │ │ └── time.h │ ├── fmt.h │ └── ostr.h │ ├── formatter.h │ ├── logger.h │ ├── sinks │ ├── android_sink.h │ ├── ansicolor_sink.h │ ├── base_sink.h │ ├── basic_file_sink.h │ ├── daily_file_sink.h │ ├── dist_sink.h │ ├── msvc_sink.h │ ├── null_sink.h │ ├── ostream_sink.h │ ├── rotating_file_sink.h │ ├── sink.h │ ├── stdout_color_sinks.h │ ├── stdout_sinks.h │ ├── syslog_sink.h │ └── wincolor_sink.h │ ├── spdlog.h │ ├── tweakme.h │ └── version.h ├── CMakeLists.txt ├── LICENSE ├── README.md ├── cmake ├── Config.cmake.in ├── DownloadProject.CMakeLists.cmake.in ├── DownloadProject.cmake ├── FindCXSparse.cmake ├── FindEigen3.cmake ├── FindGlog.cmake ├── FindGperftools.cmake ├── FindSuiteSparse.cmake └── FindYamlCpp.cmake ├── example ├── CMakeLists.txt ├── euroc │ ├── EuRoC_mono.yaml │ └── EuRoC_stereo.yaml ├── icl_nuim │ ├── mono.yaml │ └── rgbd.yaml ├── kitti │ ├── KITTI_mono_00-02.yaml │ ├── KITTI_mono_03.yaml │ ├── KITTI_mono_04-12.yaml │ ├── KITTI_stereo_00-02.yaml │ ├── KITTI_stereo_03.yaml │ └── KITTI_stereo_04-12.yaml ├── muselearn │ └── mono.yaml ├── run_camera_localization.cc ├── run_camera_slam.cc ├── run_euroc_slam.cc ├── run_euroc_slam_planeSeg.cc ├── run_euroc_slam_with_line.cc ├── run_image_localization.cc ├── run_image_localization_point_line.cc ├── run_image_slam.cc ├── run_image_slam_planeSeg.cc ├── run_kitti_slam.cc ├── run_kitti_slam_with_line.cc ├── run_slam_planeSeg.cc ├── run_tum_rgbd_slam.cc ├── run_tum_rgbd_slam_with_line.cc ├── run_video_localization.cc ├── run_video_slam.cc ├── tum_rgbd │ ├── TUM_RGBD_mono_1.yaml │ ├── TUM_RGBD_mono_2.yaml │ ├── TUM_RGBD_mono_3.yaml │ ├── TUM_RGBD_rgbd_1.yaml │ ├── TUM_RGBD_rgbd_2.yaml │ └── TUM_RGBD_rgbd_3.yaml ├── tum_vi │ ├── TUM_VI_mono.yaml │ └── TUM_VI_stereo.yaml └── util │ ├── euroc_planeSeg_util.cc │ ├── euroc_planeSeg_util.h │ ├── euroc_util.cc │ ├── euroc_util.h │ ├── image_planeSeg_util.cc │ ├── image_planeSeg_util.h │ ├── image_util.cc │ ├── image_util.h │ ├── kitti_util.cc │ ├── kitti_util.h │ ├── planeSeg_util.cc │ ├── planeSeg_util.h │ ├── tum_rgbd_util.cc │ └── tum_rgbd_util.h ├── image ├── Stereo.png ├── V1_03_difficult_full.png ├── fr2_pioneer.png ├── kitti_mono.png ├── living_room_0.png ├── living_room_2.png ├── mono.png ├── relocalization.png ├── result_dense.png ├── slam-workflow.png ├── str_tex_far.png └── traj0.png ├── orb_vocab └── orb_vocab.dbow2 ├── ros ├── .catkin_workspace └── src │ ├── openvslam │ ├── CMakeLists.txt │ ├── package.xml │ └── src │ │ ├── CMakeLists.txt │ │ ├── run_localization.cc │ │ └── run_slam.cc │ └── publisher │ ├── CMakeLists.txt │ ├── package.xml │ └── src │ ├── CMakeLists.txt │ ├── image_publisher.cc │ └── video_publisher.cc ├── src ├── CMakeLists.txt ├── PLPSLAM │ ├── CMakeLists.txt │ ├── camera │ │ ├── CMakeLists.txt │ │ ├── base.cc │ │ ├── base.h │ │ ├── equirectangular.cc │ │ ├── equirectangular.h │ │ ├── fisheye.cc │ │ ├── fisheye.h │ │ ├── perspective.cc │ │ └── perspective.h │ ├── config.cc │ ├── config.h │ ├── data │ │ ├── CMakeLists.txt │ │ ├── bow_database.cc │ │ ├── bow_database.h │ │ ├── bow_vocabulary.h │ │ ├── camera_database.cc │ │ ├── camera_database.h │ │ ├── common.cc │ │ ├── common.h │ │ ├── frame.cc │ │ ├── frame.h │ │ ├── frame_statistics.cc │ │ ├── frame_statistics.h │ │ ├── graph_node.cc │ │ ├── graph_node.h │ │ ├── keyframe.cc │ │ ├── keyframe.h │ │ ├── landmark.cc │ │ ├── landmark.h │ │ ├── landmark_line.cc │ │ ├── landmark_line.h │ │ ├── landmark_plane.cc │ │ ├── landmark_plane.h │ │ ├── map_database.cc │ │ └── map_database.h │ ├── feature │ │ ├── CMakeLists.txt │ │ ├── line_descriptor │ │ │ ├── CMakeLists.txt │ │ │ ├── LSDDetector_custom.cpp │ │ │ ├── READEME.txt │ │ │ ├── binary_descriptor_custom.cpp │ │ │ ├── binary_descriptor_matcher.cpp │ │ │ ├── bitarray_custom.hpp │ │ │ ├── bitops_custom.hpp │ │ │ ├── descriptor_custom.hpp │ │ │ ├── draw_custom.cpp │ │ │ ├── line_descriptor_custom.hpp │ │ │ ├── precomp_custom.hpp │ │ │ └── types_custom.hpp │ │ ├── line_extractor.cc │ │ ├── line_extractor.h │ │ ├── orb_extractor.cc │ │ ├── orb_extractor.h │ │ ├── orb_extractor_node.cc │ │ ├── orb_extractor_node.h │ │ ├── orb_params.cc │ │ ├── orb_params.h │ │ └── orb_point_pairs.h │ ├── global_optimization_module.cc │ ├── global_optimization_module.h │ ├── initialize │ │ ├── CMakeLists.txt │ │ ├── base.cc │ │ ├── base.h │ │ ├── bearing_vector.cc │ │ ├── bearing_vector.h │ │ ├── perspective.cc │ │ └── perspective.h │ ├── io │ │ ├── CMakeLists.txt │ │ ├── map_database_io.cc │ │ ├── map_database_io.h │ │ ├── trajectory_io.cc │ │ └── trajectory_io.h │ ├── mapping_module.cc │ ├── mapping_module.h │ ├── match │ │ ├── CMakeLists.txt │ │ ├── angle_checker.h │ │ ├── area.cc │ │ ├── area.h │ │ ├── base.h │ │ ├── bow_tree.cc │ │ ├── bow_tree.h │ │ ├── fuse.cc │ │ ├── fuse.h │ │ ├── projection.cc │ │ ├── projection.h │ │ ├── robust.cc │ │ ├── robust.h │ │ ├── stereo.cc │ │ └── stereo.h │ ├── module │ │ ├── CMakeLists.txt │ │ ├── frame_tracker.cc │ │ ├── frame_tracker.h │ │ ├── initializer.cc │ │ ├── initializer.h │ │ ├── keyframe_inserter.cc │ │ ├── keyframe_inserter.h │ │ ├── local_map_cleaner.cc │ │ ├── local_map_cleaner.h │ │ ├── local_map_updater.cc │ │ ├── local_map_updater.h │ │ ├── loop_bundle_adjuster.cc │ │ ├── loop_bundle_adjuster.h │ │ ├── loop_detector.cc │ │ ├── loop_detector.h │ │ ├── relocalizer.cc │ │ ├── relocalizer.h │ │ ├── two_view_triangulator.cc │ │ ├── two_view_triangulator.h │ │ ├── two_view_triangulator_line.cc │ │ ├── two_view_triangulator_line.h │ │ └── type.h │ ├── optimize │ │ ├── CMakeLists.txt │ │ ├── g2o │ │ │ ├── CMakeLists.txt │ │ │ ├── Plane3D.h │ │ │ ├── extended │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── plane_point_distance_edge.cc │ │ │ │ ├── plane_point_distance_edge.h │ │ │ │ └── point2plane_distance_edge_wrapper.h │ │ │ ├── landmark_vertex.cc │ │ │ ├── landmark_vertex.h │ │ │ ├── landmark_vertex_container.cc │ │ │ ├── landmark_vertex_container.h │ │ │ ├── landmark_vertex_container_line3d.cc │ │ │ ├── landmark_vertex_container_line3d.h │ │ │ ├── landmark_vertex_line3d.cc │ │ │ ├── landmark_vertex_line3d.h │ │ │ ├── landmark_vertex_plane.cc │ │ │ ├── landmark_vertex_plane.h │ │ │ ├── landmark_vertex_plane_container.cc │ │ │ ├── landmark_vertex_plane_container.h │ │ │ ├── line3d.cc │ │ │ ├── line3d.h │ │ │ ├── se3 │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── equirectangular_pose_opt_edge.cc │ │ │ │ ├── equirectangular_pose_opt_edge.h │ │ │ │ ├── equirectangular_reproj_edge.cc │ │ │ │ ├── equirectangular_reproj_edge.h │ │ │ │ ├── perspective_pose_opt_edge.cc │ │ │ │ ├── perspective_pose_opt_edge.h │ │ │ │ ├── perspective_reproj_edge.cc │ │ │ │ ├── perspective_reproj_edge.h │ │ │ │ ├── pose_opt_edge_line3d_orthonormal.cc │ │ │ │ ├── pose_opt_edge_line3d_orthonormal.h │ │ │ │ ├── pose_opt_edge_wrapper.h │ │ │ │ ├── reproj_edge_line3d_orthonormal.cc │ │ │ │ ├── reproj_edge_line3d_orthonormal.h │ │ │ │ ├── reproj_edge_wrapper.h │ │ │ │ ├── shot_vertex.cc │ │ │ │ ├── shot_vertex.h │ │ │ │ ├── shot_vertex_container.cc │ │ │ │ └── shot_vertex_container.h │ │ │ └── sim3 │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── backward_reproj_edge.cc │ │ │ │ ├── backward_reproj_edge.h │ │ │ │ ├── forward_reproj_edge.cc │ │ │ │ ├── forward_reproj_edge.h │ │ │ │ ├── graph_opt_edge.cc │ │ │ │ ├── graph_opt_edge.h │ │ │ │ ├── mutual_reproj_edge_wrapper.h │ │ │ │ ├── shot_vertex.cc │ │ │ │ ├── shot_vertex.h │ │ │ │ ├── transform_vertex.cc │ │ │ │ └── transform_vertex.h │ │ ├── global_bundle_adjuster.cc │ │ ├── global_bundle_adjuster.h │ │ ├── graph_optimizer.cc │ │ ├── graph_optimizer.h │ │ ├── local_bundle_adjuster.cc │ │ ├── local_bundle_adjuster.h │ │ ├── local_bundle_adjuster_extended_line.cc │ │ ├── local_bundle_adjuster_extended_line.h │ │ ├── local_bundle_adjuster_extended_plane.cc │ │ ├── local_bundle_adjuster_extended_plane.h │ │ ├── pose_optimizer.cc │ │ ├── pose_optimizer.h │ │ ├── pose_optimizer_extended_line.cc │ │ ├── pose_optimizer_extended_line.h │ │ ├── transform_optimizer.cc │ │ └── transform_optimizer.h │ ├── planar_mapping_module.cc │ ├── planar_mapping_module.h │ ├── planar_mapping_parameters.yaml │ ├── publish │ │ ├── CMakeLists.txt │ │ ├── frame_publisher.cc │ │ ├── frame_publisher.h │ │ ├── map_publisher.cc │ │ └── map_publisher.h │ ├── solve │ │ ├── CMakeLists.txt │ │ ├── GCRANSAC │ │ │ ├── CMakeLists.txt │ │ │ ├── GCRANSAC.h │ │ │ ├── estimator │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── essential_estimator.h │ │ │ │ ├── estimator.h │ │ │ │ ├── fundamental_estimator.h │ │ │ │ ├── homography_estimator.h │ │ │ │ ├── linear_model_estimator.h │ │ │ │ ├── perspective_n_point_estimator.h │ │ │ │ ├── rigid_transformation_estimator.h │ │ │ │ └── sample_consensus_estimator.h │ │ │ ├── flann_neighborhood_graph.h │ │ │ ├── grid_neighborhood_graph.h │ │ │ ├── model.h │ │ │ ├── neighborhood_graph.h │ │ │ ├── pearl │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── GCoptimization.cpp │ │ │ │ ├── GCoptimization.h │ │ │ │ ├── LinkedBlockList.cpp │ │ │ │ ├── LinkedBlockList.h │ │ │ │ ├── block.h │ │ │ │ ├── energy.h │ │ │ │ ├── graph.cpp │ │ │ │ ├── graph.h │ │ │ │ └── maxflow.cpp │ │ │ ├── preemption_empty.h │ │ │ ├── preemption_sprt.h │ │ │ ├── progressive_napsac_sampler.h │ │ │ ├── prosac_sampler.h │ │ │ ├── sampler.h │ │ │ ├── scoring_function.h │ │ │ ├── settings.h │ │ │ ├── single_point_sampler.h │ │ │ ├── solver │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── solver_dls_pnp.h │ │ │ │ ├── solver_engine.h │ │ │ │ ├── solver_epnp_lm.h │ │ │ │ ├── solver_essential_matrix_five_point_stewenius.h │ │ │ │ ├── solver_fundamental_matrix_eight_point.h │ │ │ │ ├── solver_fundamental_matrix_plane_and_parallax.h │ │ │ │ ├── solver_fundamental_matrix_seven_point.h │ │ │ │ ├── solver_homography_four_point.h │ │ │ │ ├── solver_linear_model.h │ │ │ │ ├── solver_p3p.h │ │ │ │ └── solver_rigid_transformation_svd.h │ │ │ ├── statistics.h │ │ │ ├── types.h │ │ │ ├── uniform_random_generator.h │ │ │ └── uniform_sampler.h │ │ ├── common.cc │ │ ├── common.h │ │ ├── essential_solver.cc │ │ ├── essential_solver.h │ │ ├── fundamental_solver.cc │ │ ├── fundamental_solver.h │ │ ├── homography_solver.cc │ │ ├── homography_solver.h │ │ ├── pnp_solver.cc │ │ ├── pnp_solver.h │ │ ├── sim3_solver.cc │ │ ├── sim3_solver.h │ │ └── triangulator.h │ ├── system.cc │ ├── system.h │ ├── tracking_module.cc │ ├── tracking_module.h │ ├── type.h │ └── util │ │ ├── CMakeLists.txt │ │ ├── converter.cc │ │ ├── converter.h │ │ ├── fancy_index.h │ │ ├── image_converter.cc │ │ ├── image_converter.h │ │ ├── random_array.cc │ │ ├── random_array.h │ │ ├── stereo_rectifier.cc │ │ ├── stereo_rectifier.h │ │ ├── string.h │ │ └── trigonometric.h ├── pangolin_viewer │ ├── CMakeLists.txt │ ├── color_scheme.cc │ ├── color_scheme.h │ ├── viewer.cc │ └── viewer.h └── socket_publisher │ ├── CMakeLists.txt │ ├── data_serializer.cc │ ├── data_serializer.h │ ├── protobuf │ └── map_segment.proto │ ├── publisher.cc │ ├── publisher.h │ ├── socket_client.cc │ └── socket_client.h ├── test ├── CMakeLists.txt ├── PLPSLAM │ ├── data │ │ └── common_get_cell_indices.cc │ ├── feature │ │ ├── orb_extractor.cc │ │ └── orb_params.cc │ ├── match │ │ ├── angle_checker.cc │ │ └── base.cc │ ├── solve │ │ ├── essential_solver.cc │ │ ├── fundamental_solver.cc │ │ ├── homography_solver.cc │ │ └── pnp_solver.cc │ └── util │ │ ├── fancy_index.cc │ │ ├── random_array.cc │ │ └── trigonometric.cc ├── data │ ├── equirectangular_image_001.jpg │ └── equirectangular_image_002.jpg └── helper │ ├── CMakeLists.txt │ ├── bearing_vector.cc │ ├── bearing_vector.h │ ├── keypoint.cc │ ├── keypoint.h │ ├── landmark.cc │ └── landmark.h ├── video ├── ICRA23_0006.mp4 └── cover.png └── viewer ├── .dockerignore ├── .gitignore ├── Dockerfile ├── app.js ├── package.json ├── public ├── js │ ├── CameraFrames.js │ ├── Mouse.js │ ├── PointCloud.js │ ├── ViewControls.js │ ├── lib │ │ ├── dat.gui.min.js │ │ ├── protobuf.min.js │ │ ├── stats.min.js │ │ └── three.min.js │ └── main.js └── map_segment.proto └── views └── index.ejs /.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | .vscode 3 | /evaluation_2021/ 4 | /evaluation_2022/ 5 | frame_trajectory.txt 6 | keyframe_trajectory.txt 7 | track_times.txt 8 | log.txt 9 | debug.txt 10 | *.msg -------------------------------------------------------------------------------- /3rd/json/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-2019 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 | -------------------------------------------------------------------------------- /3rd/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 | This serializer ignores the template arguments and uses ADL 20 | ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) 21 | for serialization. 22 | */ 23 | template 24 | struct adl_serializer; 25 | 26 | template class ObjectType = 27 | std::map, 28 | template class ArrayType = std::vector, 29 | class StringType = std::string, class BooleanType = bool, 30 | class NumberIntegerType = std::int64_t, 31 | class NumberUnsignedType = std::uint64_t, 32 | class NumberFloatType = double, 33 | template class AllocatorType = std::allocator, 34 | template class JSONSerializer = 35 | adl_serializer> 36 | class basic_json; 37 | 38 | /*! 39 | @brief JSON Pointer 40 | A JSON pointer defines a string syntax for identifying a specific value 41 | within a JSON document. It can be used with functions `at` and 42 | `operator[]`. Furthermore, JSON pointers are the base for JSON patches. 43 | @sa [RFC 6901](https://tools.ietf.org/html/rfc6901) 44 | @since version 2.0.0 45 | */ 46 | template 47 | class json_pointer; 48 | 49 | /*! 50 | @brief default JSON class 51 | This type is the default specialization of the @ref basic_json class which 52 | uses the standard template types. 53 | @since version 1.0.0 54 | */ 55 | using json = basic_json<>; 56 | } // namespace nlohmann 57 | 58 | #endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ -------------------------------------------------------------------------------- /3rd/popl/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2015-2016 Johannes Pohl 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. -------------------------------------------------------------------------------- /3rd/spdlog/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Gabi Melman. 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 13 | all 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 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/async_logger.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // Very fast asynchronous logger (millions of logs per second on an average 9 | // desktop) 10 | // Uses pre allocated lockfree queue for maximum throughput even under large 11 | // number of threads. 12 | // Creates a single back thread to pop messages from the queue and log them. 13 | // 14 | // Upon each log write the logger: 15 | // 1. Checks if its log level is enough to log the message 16 | // 2. Push a new copy of the message to a queue (or block the caller until 17 | // space is available in the queue) 18 | // 3. will throw spdlog_ex upon log exceptions 19 | // Upon destruction, logs all remaining messages in the queue before 20 | // destructing.. 21 | 22 | #include "spdlog/common.h" 23 | #include "spdlog/logger.h" 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace spdlog { 30 | 31 | // Async overflow policy - block by default. 32 | enum class async_overflow_policy 33 | { 34 | block, // Block until message can be enqueued 35 | overrun_oldest // Discard oldest message in the queue if full when trying to 36 | // add new item. 37 | }; 38 | 39 | namespace details { 40 | class thread_pool; 41 | } 42 | 43 | class async_logger final : public std::enable_shared_from_this, public logger 44 | { 45 | friend class details::thread_pool; 46 | 47 | public: 48 | template 49 | async_logger(std::string logger_name, It begin, It end, std::weak_ptr tp, 50 | async_overflow_policy overflow_policy = async_overflow_policy::block); 51 | 52 | async_logger(std::string logger_name, sinks_init_list sinks_list, std::weak_ptr tp, 53 | async_overflow_policy overflow_policy = async_overflow_policy::block); 54 | 55 | async_logger(std::string logger_name, sink_ptr single_sink, std::weak_ptr tp, 56 | async_overflow_policy overflow_policy = async_overflow_policy::block); 57 | 58 | std::shared_ptr clone(std::string new_name) override; 59 | 60 | protected: 61 | void sink_it_(details::log_msg &msg) override; 62 | void flush_() override; 63 | 64 | void backend_log_(const details::log_msg &incoming_log_msg); 65 | void backend_flush_(); 66 | 67 | private: 68 | std::weak_ptr thread_pool_; 69 | async_overflow_policy overflow_policy_; 70 | }; 71 | } // namespace spdlog 72 | 73 | #include "details/async_logger_impl.h" 74 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/details/circular_q.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2018 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | // cirucal q view of std::vector. 7 | #pragma once 8 | 9 | #include 10 | 11 | namespace spdlog { 12 | namespace details { 13 | template 14 | class circular_q 15 | { 16 | public: 17 | using item_type = T; 18 | 19 | explicit circular_q(size_t max_items) 20 | : max_items_(max_items + 1) // one item is reserved as marker for full q 21 | , v_(max_items_) 22 | { 23 | } 24 | 25 | // push back, overrun (oldest) item if no room left 26 | void push_back(T &&item) 27 | { 28 | v_[tail_] = std::move(item); 29 | tail_ = (tail_ + 1) % max_items_; 30 | 31 | if (tail_ == head_) // overrun last item if full 32 | { 33 | head_ = (head_ + 1) % max_items_; 34 | ++overrun_counter_; 35 | } 36 | } 37 | 38 | // Pop item from front. 39 | // If there are no elements in the container, the behavior is undefined. 40 | void pop_front(T &popped_item) 41 | { 42 | popped_item = std::move(v_[head_]); 43 | head_ = (head_ + 1) % max_items_; 44 | } 45 | 46 | bool empty() 47 | { 48 | return tail_ == head_; 49 | } 50 | 51 | bool full() 52 | { 53 | // head is ahead of the tail by 1 54 | return ((tail_ + 1) % max_items_) == head_; 55 | } 56 | 57 | size_t overrun_counter() const 58 | { 59 | return overrun_counter_; 60 | } 61 | 62 | private: 63 | size_t max_items_; 64 | typename std::vector::size_type head_ = 0; 65 | typename std::vector::size_type tail_ = 0; 66 | 67 | std::vector v_; 68 | 69 | size_t overrun_counter_ = 0; 70 | }; 71 | } // namespace details 72 | } // namespace spdlog 73 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/details/console_globals.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // 3 | // Copyright(c) 2018 Gabi Melman. 4 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 5 | // 6 | 7 | #include "spdlog/details/null_mutex.h" 8 | #include 9 | #include 10 | 11 | #ifdef _WIN32 12 | 13 | #ifndef NOMINMAX 14 | #define NOMINMAX // prevent windows redefining min/max 15 | #endif 16 | 17 | #ifndef WIN32_LEAN_AND_MEAN 18 | #define WIN32_LEAN_AND_MEAN 19 | #endif 20 | 21 | #include 22 | #endif 23 | 24 | namespace spdlog { 25 | namespace details { 26 | struct console_stdout 27 | { 28 | static std::FILE *stream() 29 | { 30 | return stdout; 31 | } 32 | #ifdef _WIN32 33 | static HANDLE handle() 34 | { 35 | return ::GetStdHandle(STD_OUTPUT_HANDLE); 36 | } 37 | #endif 38 | }; 39 | 40 | struct console_stderr 41 | { 42 | static std::FILE *stream() 43 | { 44 | return stderr; 45 | } 46 | #ifdef _WIN32 47 | static HANDLE handle() 48 | { 49 | return ::GetStdHandle(STD_ERROR_HANDLE); 50 | } 51 | #endif 52 | }; 53 | 54 | struct console_mutex 55 | { 56 | using mutex_t = std::mutex; 57 | static mutex_t &mutex() 58 | { 59 | static mutex_t s_mutex; 60 | return s_mutex; 61 | } 62 | }; 63 | 64 | struct console_nullmutex 65 | { 66 | using mutex_t = null_mutex; 67 | static mutex_t &mutex() 68 | { 69 | static mutex_t s_mutex; 70 | return s_mutex; 71 | } 72 | }; 73 | } // namespace details 74 | } // namespace spdlog 75 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/details/log_msg.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "spdlog/common.h" 9 | #include "spdlog/details/os.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace spdlog { 15 | namespace details { 16 | struct log_msg 17 | { 18 | 19 | log_msg(source_loc loc, const std::string *loggers_name, level::level_enum lvl, string_view_t view) 20 | : logger_name(loggers_name) 21 | , level(lvl) 22 | #ifndef SPDLOG_NO_DATETIME 23 | , time(os::now()) 24 | #endif 25 | 26 | #ifndef SPDLOG_NO_THREAD_ID 27 | , thread_id(os::thread_id()) 28 | #endif 29 | , source(loc) 30 | , payload(view) 31 | { 32 | } 33 | 34 | log_msg(const std::string *loggers_name, level::level_enum lvl, string_view_t view) 35 | : log_msg(source_loc{}, loggers_name, lvl, view) 36 | { 37 | } 38 | 39 | log_msg(const log_msg &other) = default; 40 | 41 | const std::string *logger_name{nullptr}; 42 | level::level_enum level{level::off}; 43 | log_clock::time_point time; 44 | size_t thread_id{0}; 45 | size_t msg_id{0}; 46 | 47 | // wrapping the formatted text with color (updated by pattern_formatter). 48 | mutable size_t color_range_start{0}; 49 | mutable size_t color_range_end{0}; 50 | 51 | source_loc source; 52 | const string_view_t payload; 53 | }; 54 | } // namespace details 55 | } // namespace spdlog 56 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/details/null_mutex.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | // null, no cost dummy "mutex" and dummy "atomic" int 10 | 11 | namespace spdlog { 12 | namespace details { 13 | struct null_mutex 14 | { 15 | void lock() {} 16 | void unlock() {} 17 | bool try_lock() 18 | { 19 | return true; 20 | } 21 | }; 22 | 23 | struct null_atomic_int 24 | { 25 | int value; 26 | null_atomic_int() = default; 27 | 28 | explicit null_atomic_int(int val) 29 | : value(val) 30 | { 31 | } 32 | 33 | int load(std::memory_order) const 34 | { 35 | return value; 36 | } 37 | 38 | void store(int val) 39 | { 40 | value = val; 41 | } 42 | }; 43 | 44 | } // namespace details 45 | } // namespace spdlog 46 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/details/periodic_worker.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // Copyright(c) 2018 Gabi Melman. 4 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 5 | // 6 | 7 | #pragma once 8 | 9 | // periodic worker thread - periodically executes the given callback function. 10 | // 11 | // RAII over the owned thread: 12 | // creates the thread on construction. 13 | // stops and joins the thread on destruction (if the thread is executing a callback, wait for it to finish first). 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | namespace spdlog { 21 | namespace details { 22 | 23 | class periodic_worker 24 | { 25 | public: 26 | periodic_worker(const std::function &callback_fun, std::chrono::seconds interval) 27 | { 28 | active_ = (interval > std::chrono::seconds::zero()); 29 | if (!active_) 30 | { 31 | return; 32 | } 33 | 34 | worker_thread_ = std::thread([this, callback_fun, interval]() { 35 | for (;;) 36 | { 37 | std::unique_lock lock(this->mutex_); 38 | if (this->cv_.wait_for(lock, interval, [this] { return !this->active_; })) 39 | { 40 | return; // active_ == false, so exit this thread 41 | } 42 | callback_fun(); 43 | } 44 | }); 45 | } 46 | 47 | periodic_worker(const periodic_worker &) = delete; 48 | periodic_worker &operator=(const periodic_worker &) = delete; 49 | 50 | // stop the worker thread and join it 51 | ~periodic_worker() 52 | { 53 | if (worker_thread_.joinable()) 54 | { 55 | { 56 | std::lock_guard lock(mutex_); 57 | active_ = false; 58 | } 59 | cv_.notify_one(); 60 | worker_thread_.join(); 61 | } 62 | } 63 | 64 | private: 65 | bool active_; 66 | std::thread worker_thread_; 67 | std::mutex mutex_; 68 | std::condition_variable cv_; 69 | }; 70 | } // namespace details 71 | } // namespace spdlog 72 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/fmt/bundled/LICENSE.rst: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - 2016, Victor Zverovich 2 | 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 met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 2. 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 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/fmt/fmt.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016-2018 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // 9 | // Include a bundled header-only copy of fmtlib or an external one. 10 | // By default spdlog include its own copy. 11 | // 12 | 13 | #if !defined(SPDLOG_FMT_EXTERNAL) 14 | #ifndef FMT_HEADER_ONLY 15 | #define FMT_HEADER_ONLY 16 | #endif 17 | #ifndef FMT_USE_WINDOWS_H 18 | #define FMT_USE_WINDOWS_H 0 19 | #endif 20 | #include "bundled/core.h" 21 | #include "bundled/format.h" 22 | #else // external fmtlib 23 | #include 24 | #include 25 | #endif 26 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/fmt/ostr.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | // 8 | // include bundled or external copy of fmtlib's ostream support 9 | // 10 | #if !defined(SPDLOG_FMT_EXTERNAL) 11 | #ifndef FMT_HEADER_ONLY 12 | #define FMT_HEADER_ONLY 13 | #endif 14 | #include "bundled/ostream.h" 15 | #include "fmt.h" 16 | #else 17 | #include 18 | #endif 19 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/formatter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "fmt/fmt.h" 9 | #include "spdlog/details/log_msg.h" 10 | 11 | namespace spdlog { 12 | 13 | class formatter 14 | { 15 | public: 16 | virtual ~formatter() = default; 17 | virtual void format(const details::log_msg &msg, fmt::memory_buffer &dest) = 0; 18 | virtual std::unique_ptr clone() const = 0; 19 | }; 20 | } // namespace spdlog 21 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/sinks/base_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | // 8 | // base sink templated over a mutex (either dummy or real) 9 | // concrete implementation should override the sink_it_() and flush_() methods. 10 | // locking is taken care of in this class - no locking needed by the 11 | // implementers.. 12 | // 13 | 14 | #include "spdlog/common.h" 15 | #include "spdlog/details/log_msg.h" 16 | #include "spdlog/formatter.h" 17 | #include "spdlog/sinks/sink.h" 18 | 19 | namespace spdlog { 20 | namespace sinks { 21 | template 22 | class base_sink : public sink 23 | { 24 | public: 25 | base_sink() = default; 26 | base_sink(const base_sink &) = delete; 27 | base_sink &operator=(const base_sink &) = delete; 28 | 29 | void log(const details::log_msg &msg) final 30 | { 31 | std::lock_guard lock(mutex_); 32 | sink_it_(msg); 33 | } 34 | 35 | void flush() final 36 | { 37 | std::lock_guard lock(mutex_); 38 | flush_(); 39 | } 40 | 41 | void set_pattern(const std::string &pattern) final 42 | { 43 | std::lock_guard lock(mutex_); 44 | set_pattern_(pattern); 45 | } 46 | 47 | void set_formatter(std::unique_ptr sink_formatter) final 48 | { 49 | std::lock_guard lock(mutex_); 50 | set_formatter_(std::move(sink_formatter)); 51 | } 52 | 53 | protected: 54 | virtual void sink_it_(const details::log_msg &msg) = 0; 55 | virtual void flush_() = 0; 56 | 57 | virtual void set_pattern_(const std::string &pattern) 58 | { 59 | set_formatter_(details::make_unique(pattern)); 60 | } 61 | 62 | virtual void set_formatter_(std::unique_ptr sink_formatter) 63 | { 64 | formatter_ = std::move(sink_formatter); 65 | } 66 | Mutex mutex_; 67 | }; 68 | } // namespace sinks 69 | } // namespace spdlog 70 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/sinks/basic_file_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015-2018 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "spdlog/details/file_helper.h" 13 | #include "spdlog/details/null_mutex.h" 14 | #include "spdlog/sinks/base_sink.h" 15 | 16 | #include 17 | #include 18 | 19 | namespace spdlog { 20 | namespace sinks { 21 | /* 22 | * Trivial file sink with single file as target 23 | */ 24 | template 25 | class basic_file_sink final : public base_sink 26 | { 27 | public: 28 | explicit basic_file_sink(const filename_t &filename, bool truncate = false) 29 | { 30 | file_helper_.open(filename, truncate); 31 | } 32 | 33 | protected: 34 | void sink_it_(const details::log_msg &msg) override 35 | { 36 | fmt::memory_buffer formatted; 37 | sink::formatter_->format(msg, formatted); 38 | file_helper_.write(formatted); 39 | } 40 | 41 | void flush_() override 42 | { 43 | file_helper_.flush(); 44 | } 45 | 46 | private: 47 | details::file_helper file_helper_; 48 | }; 49 | 50 | using basic_file_sink_mt = basic_file_sink; 51 | using basic_file_sink_st = basic_file_sink; 52 | 53 | } // namespace sinks 54 | 55 | // 56 | // factory functions 57 | // 58 | template 59 | inline std::shared_ptr basic_logger_mt(const std::string &logger_name, const filename_t &filename, bool truncate = false) 60 | { 61 | return Factory::template create(logger_name, filename, truncate); 62 | } 63 | 64 | template 65 | inline std::shared_ptr basic_logger_st(const std::string &logger_name, const filename_t &filename, bool truncate = false) 66 | { 67 | return Factory::template create(logger_name, filename, truncate); 68 | } 69 | 70 | } // namespace spdlog 71 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/sinks/dist_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 David Schury, Gabi Melman 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "base_sink.h" 13 | #include "spdlog/details/log_msg.h" 14 | #include "spdlog/details/null_mutex.h" 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | // Distribution sink (mux). Stores a vector of sinks which get called when log 22 | // is called 23 | 24 | namespace spdlog { 25 | namespace sinks { 26 | 27 | template 28 | class dist_sink : public base_sink 29 | { 30 | public: 31 | dist_sink() = default; 32 | dist_sink(const dist_sink &) = delete; 33 | dist_sink &operator=(const dist_sink &) = delete; 34 | 35 | void add_sink(std::shared_ptr sink) 36 | { 37 | std::lock_guard lock(base_sink::mutex_); 38 | sinks_.push_back(sink); 39 | } 40 | 41 | void remove_sink(std::shared_ptr sink) 42 | { 43 | std::lock_guard lock(base_sink::mutex_); 44 | sinks_.erase(std::remove(sinks_.begin(), sinks_.end(), sink), sinks_.end()); 45 | } 46 | 47 | void set_sinks(std::vector> sinks) 48 | { 49 | std::lock_guard lock(base_sink::mutex_); 50 | sinks_ = std::move(sinks); 51 | } 52 | 53 | protected: 54 | void sink_it_(const details::log_msg &msg) override 55 | { 56 | 57 | for (auto &sink : sinks_) 58 | { 59 | if (sink->should_log(msg.level)) 60 | { 61 | sink->log(msg); 62 | } 63 | } 64 | } 65 | 66 | void flush_() override 67 | { 68 | for (auto &sink : sinks_) 69 | { 70 | sink->flush(); 71 | } 72 | } 73 | 74 | void set_pattern_(const std::string &pattern) override 75 | { 76 | set_formatter_(details::make_unique(pattern)); 77 | } 78 | 79 | void set_formatter_(std::unique_ptr sink_formatter) override 80 | { 81 | base_sink::formatter_ = std::move(sink_formatter); 82 | for (auto &sink : sinks_) 83 | { 84 | sink->set_formatter(base_sink::formatter_->clone()); 85 | } 86 | } 87 | std::vector> sinks_; 88 | }; 89 | 90 | using dist_sink_mt = dist_sink; 91 | using dist_sink_st = dist_sink; 92 | 93 | } // namespace sinks 94 | } // namespace spdlog 95 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/sinks/msvc_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016 Alexander Dalshov. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #if defined(_WIN32) 13 | 14 | #include "spdlog/details/null_mutex.h" 15 | #include "spdlog/sinks/base_sink.h" 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | namespace spdlog { 23 | namespace sinks { 24 | /* 25 | * MSVC sink (logging using OutputDebugStringA) 26 | */ 27 | template 28 | class msvc_sink : public base_sink 29 | { 30 | public: 31 | explicit msvc_sink() {} 32 | 33 | protected: 34 | void sink_it_(const details::log_msg &msg) override 35 | { 36 | 37 | fmt::memory_buffer formatted; 38 | sink::formatter_->format(msg, formatted); 39 | OutputDebugStringA(fmt::to_string(formatted).c_str()); 40 | } 41 | 42 | void flush_() override {} 43 | }; 44 | 45 | using msvc_sink_mt = msvc_sink; 46 | using msvc_sink_st = msvc_sink; 47 | 48 | using windebug_sink_mt = msvc_sink_mt; 49 | using windebug_sink_st = msvc_sink_st; 50 | 51 | } // namespace sinks 52 | } // namespace spdlog 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/sinks/null_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "spdlog/details/null_mutex.h" 13 | #include "spdlog/sinks/base_sink.h" 14 | 15 | #include 16 | 17 | namespace spdlog { 18 | namespace sinks { 19 | 20 | template 21 | class null_sink : public base_sink 22 | { 23 | protected: 24 | void sink_it_(const details::log_msg &) override {} 25 | void flush_() override {} 26 | }; 27 | 28 | using null_sink_mt = null_sink; 29 | using null_sink_st = null_sink; 30 | 31 | } // namespace sinks 32 | 33 | template 34 | inline std::shared_ptr null_logger_mt(const std::string &logger_name) 35 | { 36 | auto null_logger = Factory::template create(logger_name); 37 | null_logger->set_level(level::off); 38 | return null_logger; 39 | } 40 | 41 | template 42 | inline std::shared_ptr null_logger_st(const std::string &logger_name) 43 | { 44 | auto null_logger = Factory::template create(logger_name); 45 | null_logger->set_level(level::off); 46 | return null_logger; 47 | } 48 | 49 | } // namespace spdlog 50 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/sinks/ostream_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "spdlog/details/null_mutex.h" 13 | #include "spdlog/sinks/base_sink.h" 14 | 15 | #include 16 | #include 17 | 18 | namespace spdlog { 19 | namespace sinks { 20 | template 21 | class ostream_sink final : public base_sink 22 | { 23 | public: 24 | explicit ostream_sink(std::ostream &os, bool force_flush = false) 25 | : ostream_(os) 26 | , force_flush_(force_flush) 27 | { 28 | } 29 | ostream_sink(const ostream_sink &) = delete; 30 | ostream_sink &operator=(const ostream_sink &) = delete; 31 | 32 | protected: 33 | void sink_it_(const details::log_msg &msg) override 34 | { 35 | fmt::memory_buffer formatted; 36 | sink::formatter_->format(msg, formatted); 37 | ostream_.write(formatted.data(), static_cast(formatted.size())); 38 | if (force_flush_) 39 | { 40 | ostream_.flush(); 41 | } 42 | } 43 | 44 | void flush_() override 45 | { 46 | ostream_.flush(); 47 | } 48 | 49 | std::ostream &ostream_; 50 | bool force_flush_; 51 | }; 52 | 53 | using ostream_sink_mt = ostream_sink; 54 | using ostream_sink_st = ostream_sink; 55 | 56 | } // namespace sinks 57 | } // namespace spdlog 58 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/sinks/sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "spdlog/details/log_msg.h" 9 | #include "spdlog/details/pattern_formatter.h" 10 | #include "spdlog/formatter.h" 11 | 12 | namespace spdlog { 13 | namespace sinks { 14 | class sink 15 | { 16 | public: 17 | sink() 18 | : level_(level::trace) 19 | , formatter_(new pattern_formatter()) 20 | { 21 | } 22 | 23 | explicit sink(std::unique_ptr formatter) 24 | : level_(level::trace) 25 | , formatter_(std::move(formatter)) 26 | { 27 | } 28 | 29 | virtual ~sink() = default; 30 | virtual void log(const details::log_msg &msg) = 0; 31 | virtual void flush() = 0; 32 | virtual void set_pattern(const std::string &pattern) = 0; 33 | virtual void set_formatter(std::unique_ptr sink_formatter) = 0; 34 | 35 | bool should_log(level::level_enum msg_level) const 36 | { 37 | return msg_level >= level_.load(std::memory_order_relaxed); 38 | } 39 | 40 | void set_level(level::level_enum log_level) 41 | { 42 | level_.store(log_level); 43 | } 44 | 45 | level::level_enum level() const 46 | { 47 | return static_cast(level_.load(std::memory_order_relaxed)); 48 | } 49 | 50 | protected: 51 | // sink log level - default is all 52 | level_t level_; 53 | 54 | // sink formatter - default is full format 55 | std::unique_ptr formatter_; 56 | }; 57 | 58 | } // namespace sinks 59 | } // namespace spdlog 60 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/sinks/stdout_color_sinks.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2018 spdlog 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #ifdef _WIN32 13 | #include "spdlog/sinks/wincolor_sink.h" 14 | #else 15 | #include "spdlog/sinks/ansicolor_sink.h" 16 | #endif 17 | 18 | namespace spdlog { 19 | namespace sinks { 20 | #ifdef _WIN32 21 | using stdout_color_sink_mt = wincolor_stdout_sink_mt; 22 | using stdout_color_sink_st = wincolor_stdout_sink_st; 23 | using stderr_color_sink_mt = wincolor_stderr_sink_mt; 24 | using stderr_color_sink_st = wincolor_stderr_sink_st; 25 | #else 26 | using stdout_color_sink_mt = ansicolor_stdout_sink_mt; 27 | using stdout_color_sink_st = ansicolor_stdout_sink_st; 28 | using stderr_color_sink_mt = ansicolor_stderr_sink_mt; 29 | using stderr_color_sink_st = ansicolor_stderr_sink_st; 30 | #endif 31 | } // namespace sinks 32 | 33 | template 34 | inline std::shared_ptr stdout_color_mt(const std::string &logger_name) 35 | { 36 | return Factory::template create(logger_name); 37 | } 38 | 39 | template 40 | inline std::shared_ptr stdout_color_st(const std::string &logger_name) 41 | { 42 | return Factory::template create(logger_name); 43 | } 44 | 45 | template 46 | inline std::shared_ptr stderr_color_mt(const std::string &logger_name) 47 | { 48 | return Factory::template create(logger_name); 49 | } 50 | 51 | template 52 | inline std::shared_ptr stderr_color_st(const std::string &logger_name) 53 | { 54 | return Factory::template create(logger_name); 55 | } 56 | } // namespace spdlog 57 | -------------------------------------------------------------------------------- /3rd/spdlog/include/spdlog/version.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #define SPDLOG_VER_MAJOR 1 9 | #define SPDLOG_VER_MINOR 3 10 | #define SPDLOG_VER_PATCH 1 11 | 12 | #define SPDLOG_VERSION (SPDLOG_VER_MAJOR * 10000 + SPDLOG_VER_MINOR * 100 + SPDLOG_VER_PATCH) 13 | -------------------------------------------------------------------------------- /cmake/Config.cmake.in: -------------------------------------------------------------------------------- 1 | include(CMakeFindDependencyMacro) 2 | 3 | find_dependency(Threads) 4 | find_dependency(OpenCV) 5 | find_dependency(Eigen3) 6 | find_dependency(g2o) 7 | find_dependency(yaml-cpp) 8 | 9 | if(USE_PANGOLIN_VIEWER) 10 | find_dependency(Pangolin) 11 | endif() 12 | 13 | if(USE_SOCKET_PUBLISHER) 14 | find_dependency(sioclient) 15 | find_dependency(Protobuf) 16 | endif() 17 | 18 | if(BOW_FRAMEWORK MATCHES "DBoW2") 19 | find_dependency(DBoW2) 20 | elseif(BOW_FRAMEWORK MATCHES "FBoW") 21 | find_dependency(fbow) 22 | endif() 23 | 24 | include("${CMAKE_CURRENT_LIST_DIR}/@PLPSLAM_TARGETS_EXPORT_NAME@.cmake") 25 | -------------------------------------------------------------------------------- /cmake/DownloadProject.CMakeLists.cmake.in: -------------------------------------------------------------------------------- 1 | # Distributed under the OSI-approved MIT License. See accompanying 2 | # file LICENSE or https://github.com/Crascit/DownloadProject for details. 3 | 4 | cmake_minimum_required(VERSION 2.8.2) 5 | 6 | project(${DL_ARGS_PROJ}-download NONE) 7 | 8 | include(ExternalProject) 9 | ExternalProject_Add(${DL_ARGS_PROJ}-download 10 | ${DL_ARGS_UNPARSED_ARGUMENTS} 11 | SOURCE_DIR "${DL_ARGS_SOURCE_DIR}" 12 | BINARY_DIR "${DL_ARGS_BINARY_DIR}" 13 | CONFIGURE_COMMAND "" 14 | BUILD_COMMAND "" 15 | INSTALL_COMMAND "" 16 | TEST_COMMAND "" 17 | ) 18 | 19 | -------------------------------------------------------------------------------- /cmake/FindGperftools.cmake: -------------------------------------------------------------------------------- 1 | # FindGperftools.cmake - Find google-perftools library. 2 | # 3 | # This module defines the following variables: 4 | # 5 | # GPERFTOOLS_FOUND: TRUE if google-perftools is found. 6 | # GPERFTOOLS_INCLUDE_DIRS: Include directories for google-perftools. 7 | # GPERFTOOLS_LIBRARIES: Libraries required to link google-perftools. 8 | # 9 | # The following variables control the behaviour of this module: 10 | # 11 | # GPERFTOOLS_INCLUDE_DIR_HINTS: List of additional directories in which to 12 | # search for google-perftools includes. 13 | # GPERFTOOLS_LIBRARY_DIR_HINTS: List of additional directories in which to 14 | # search for google-perftools libraries. 15 | 16 | # Find include directory 17 | string(REPLACE ":" ";" GPERFTOOLS_INCLUDE_DIR_HINTS "$ENV{GPERFTOOLS_INCLUDE_DIR_HINTS}") 18 | string(REPLACE ":" ";" CPATH "$ENV{CPATH}") 19 | string(REPLACE ":" ";" C_INCLUDE_PATH "$ENV{C_INCLUDE_PATH}") 20 | string(REPLACE ":" ";" CPLUS_INCLUDE_PATH "$ENV{CPLUS_INCLUDE_PATH}") 21 | list(APPEND GPERFTOOLS_CHECK_INCLUDE_DIRS 22 | ${GPERFTOOLS_INCLUDE_DIR_HINTS} 23 | ${CPATH} 24 | ${C_INCLUDE_PATH} 25 | ${CPLUS_INCLUDE_PATH} 26 | /opt/local/include 27 | /usr/local/include 28 | /usr/local/opt/include 29 | /usr/include) 30 | find_path(GPERFTOOLS_INCLUDE_DIRS NAMES gperftools/profiler.h 31 | PATHS ${GPERFTOOLS_CHECK_INCLUDE_DIRS}) 32 | 33 | # Find library 34 | string(REPLACE ":" ";" GPERFTOOLS_LIBRARY_DIR_HINTS "$ENV{GPERFTOOLS_LIBRARY_DIR_HINTS}") 35 | string(REPLACE ":" ";" LIBRARY_PATH "$ENV{LIBRARY_PATH}") 36 | string(REPLACE ":" ";" LD_LIBRARY_PATH "$ENV{LD_LIBRARY_PATH}") 37 | list(APPEND GPERFTOOLS_CHECK_LIBRARY_DIRS 38 | ${GPERFTOOLS_LIBRARY_DIR_HINTS} 39 | ${LIBRARY_PATH} 40 | ${LD_LIBRARY_PATH} 41 | /opt/local/lib 42 | /usr/local/lib 43 | /usr/local/opt/lib 44 | /usr/lib) 45 | find_library(GPERFTOOLS_LIBRARIES NAMES profiler 46 | PATHS ${GPERFTOOLS_CHECK_LIBRARY_DIRS}) 47 | 48 | include(FindPackageHandleStandardArgs) 49 | find_package_handle_standard_args(Gperftools DEFAULT_MSG 50 | GPERFTOOLS_INCLUDE_DIRS GPERFTOOLS_LIBRARIES) 51 | 52 | if(GPERFTOOLS_INCLUDE_DIRS AND GPERFTOOLS_LIBRARIES) 53 | message(STATUS "Found google-perftools library: ${GPERFTOOLS_LIBRARIES}") 54 | message(STATUS "Found google-perftools header in: ${GPERFTOOLS_INCLUDE_DIRS}") 55 | set(GPERFTOOLS_FOUND YES) 56 | mark_as_advanced(FORCE GPERFTOOLS_INCLUDE_DIRS GPERFTOOLS_LIBRARIES) 57 | else() 58 | message(FATAL_ERROR "Failed to find google-perftools") 59 | set(GPERFTOOLS_FOUND NO) 60 | mark_as_advanced(CLEAR GPERFTOOLS_INCLUDE_DIRS GPERFTOOLS_LIBRARIES) 61 | endif() 62 | -------------------------------------------------------------------------------- /cmake/FindYamlCpp.cmake: -------------------------------------------------------------------------------- 1 | # FindYamlCpp.cmake - Find yaml-cpp library. 2 | # 3 | # This module defines the following variables: 4 | # 5 | # YAMLCPP_FOUND: TRUE if yaml-cpp is found. 6 | # YAMLCPP_INCLUDE_DIRS: Include directories for yaml-cpp. 7 | # YAMLCPP_LIBRARIES: Libraries required to link yaml-cpp. 8 | # 9 | # The following variables control the behaviour of this module: 10 | # 11 | # YAMLCPP_INCLUDE_DIR_HINTS: List of additional directories in which to 12 | # search for yaml-cpp includes. 13 | # YAMLCPP_LIBRARY_DIR_HINTS: List of additional directories in which to 14 | # search for yaml-cpp libraries. 15 | 16 | # Find include directory 17 | string(REPLACE ":" ";" YAMLCPP_INCLUDE_DIR_HINTS "$ENV{YAMLCPP_INCLUDE_DIR_HINTS}") 18 | string(REPLACE ":" ";" CPATH "$ENV{CPATH}") 19 | string(REPLACE ":" ";" C_INCLUDE_PATH "$ENV{C_INCLUDE_PATH}") 20 | string(REPLACE ":" ";" CPLUS_INCLUDE_PATH "$ENV{CPLUS_INCLUDE_PATH}") 21 | list(APPEND YAMLCPP_CHECK_INCLUDE_DIRS 22 | ${YAMLCPP_INCLUDE_DIR_HINTS} 23 | ${CPATH} 24 | ${C_INCLUDE_PATH} 25 | ${CPLUS_INCLUDE_PATH} 26 | /opt/local/include 27 | /usr/local/include 28 | /usr/local/opt/include 29 | /usr/include) 30 | find_path(YAMLCPP_INCLUDE_DIRS NAMES yaml.h 31 | PATH_SUFFIXES yaml-cpp 32 | PATHS ${YAMLCPP_CHECK_INCLUDE_DIRS}) 33 | 34 | # Find library 35 | string(REPLACE ":" ";" YAMLCPP_LIBRARY_DIR_HINTS "$ENV{YAMLCPP_LIBRARY_DIR_HINTS}") 36 | string(REPLACE ":" ";" LIBRARY_PATH "$ENV{LIBRARY_PATH}") 37 | string(REPLACE ":" ";" LD_LIBRARY_PATH "$ENV{LD_LIBRARY_PATH}") 38 | list(APPEND YAMLCPP_CHECK_LIBRARY_DIRS 39 | ${YAMLCPP_LIBRARY_DIR_HINTS} 40 | ${LIBRARY_PATH} 41 | ${LD_LIBRARY_PATH} 42 | /opt/local/lib 43 | /usr/local/lib 44 | /usr/local/opt/lib 45 | /usr/lib) 46 | find_library(YAMLCPP_LIBRARIES NAMES yaml-cpp 47 | PATHS ${YAMLCPP_CHECK_LIBRARY_DIRS}) 48 | 49 | include(FindPackageHandleStandardArgs) 50 | find_package_handle_standard_args(YamlCpp DEFAULT_MSG 51 | YAMLCPP_INCLUDE_DIRS YAMLCPP_LIBRARIES) 52 | 53 | if(YAMLCPP_INCLUDE_DIRS AND YAMLCPP_LIBRARIES) 54 | message(STATUS "Found yaml-cpp library: ${YAMLCPP_LIBRARIES}") 55 | message(STATUS "Found yaml-cpp header in: ${YAMLCPP_INCLUDE_DIRS}") 56 | set(YAMLCPP_FOUND YES) 57 | mark_as_advanced(FORCE YAMLCPP_INCLUDE_DIRS YAMLCPP_LIBRARIES) 58 | else() 59 | message(FATAL_ERROR "Failed to find yaml-cpp") 60 | set(YAMLCPP_FOUND NO) 61 | mark_as_advanced(CLEAR YAMLCPP_INCLUDE_DIRS YAMLCPP_LIBRARIES) 62 | endif() 63 | -------------------------------------------------------------------------------- /example/euroc/EuRoC_mono.yaml: -------------------------------------------------------------------------------- 1 | # EuRoC monocular model 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "EuRoC monocular" 8 | Camera.setup: "monocular" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 458.654 12 | Camera.fy: 457.296 13 | Camera.cx: 367.215 14 | Camera.cy: 248.375 15 | 16 | Camera.k1: -0.28340811 17 | Camera.k2: 0.07395907 18 | Camera.p1: 0.00019359 19 | Camera.p2: 1.76187114e-05 20 | Camera.k3: 0.0 21 | 22 | Camera.fps: 20.0 23 | Camera.cols: 752 24 | Camera.rows: 480 25 | 26 | Camera.color_order: "Gray" 27 | 28 | #================# 29 | # ORB Parameters # 30 | #================# 31 | 32 | Feature.max_num_keypoints: 1000 33 | Feature.scale_factor: 1.2 34 | Feature.num_levels: 8 35 | Feature.ini_fast_threshold: 20 36 | Feature.min_fast_threshold: 7 37 | 38 | #=====================# 39 | # Tracking Parameters # 40 | #=====================# 41 | 42 | depth_threshold: 35 43 | 44 | #===========================# 45 | # PangolinViewer Parameters # 46 | #===========================# 47 | 48 | PangolinViewer.keyframe_size: 0.07 49 | PangolinViewer.keyframe_line_width: 1 50 | PangolinViewer.graph_line_width: 1 51 | PangolinViewer.point_size: 2 52 | PangolinViewer.camera_size: 0.08 53 | PangolinViewer.camera_line_width: 3 54 | PangolinViewer.viewpoint_x: 0 55 | PangolinViewer.viewpoint_y: -0.65 56 | PangolinViewer.viewpoint_z: -1.9 57 | PangolinViewer.viewpoint_f: 400 58 | -------------------------------------------------------------------------------- /example/icl_nuim/mono.yaml: -------------------------------------------------------------------------------- 1 | # ICL NUIM monocular model 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "ICL NUIM monocular" 8 | Camera.setup: "monocular" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 481.20 12 | Camera.fy: -480.00 13 | Camera.cx: 319.50 14 | Camera.cy: 239.50 15 | 16 | Camera.k1: 0.0 17 | Camera.k2: 0.0 18 | Camera.p1: 0.0 19 | Camera.p2: 0.0 20 | Camera.k3: 0.0 21 | 22 | Camera.fps: 30.0 23 | Camera.cols: 640 24 | Camera.rows: 480 25 | 26 | Camera.color_order: "RGB" 27 | 28 | #================# 29 | # ORB Parameters # 30 | #================# 31 | 32 | Feature.max_num_keypoints: 1000 33 | Feature.scale_factor: 1.2 34 | Feature.num_levels: 8 35 | Feature.ini_fast_threshold: 20 36 | Feature.min_fast_threshold: 2 37 | 38 | #===========================# 39 | # PangolinViewer Parameters # 40 | #===========================# 41 | 42 | PangolinViewer.keyframe_size: 0.05 43 | PangolinViewer.keyframe_line_width: 1 44 | PangolinViewer.graph_line_width: 1 45 | PangolinViewer.point_size: 2 46 | PangolinViewer.camera_size: 0.08 47 | PangolinViewer.camera_line_width: 3 48 | PangolinViewer.viewpoint_x: 0 49 | PangolinViewer.viewpoint_y: -0.9 50 | PangolinViewer.viewpoint_z: -1.9 51 | PangolinViewer.viewpoint_f: 400 52 | -------------------------------------------------------------------------------- /example/icl_nuim/rgbd.yaml: -------------------------------------------------------------------------------- 1 | # ICL NUIM RGBD model for 01 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "ICL NUIM RGBD" 8 | Camera.setup: "RGBD" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 481.20 12 | Camera.fy: -480.00 13 | Camera.cx: 319.50 14 | Camera.cy: 239.50 15 | 16 | Camera.k1: 0.0 17 | Camera.k2: 0.0 18 | Camera.p1: 0.0 19 | Camera.p2: 0.0 20 | Camera.k3: 0.0 21 | 22 | Camera.fps: 30.0 23 | Camera.cols: 640 24 | Camera.rows: 480 25 | Camera.focal_x_baseline: 40.0 26 | 27 | Camera.color_order: "RGB" 28 | 29 | #================# 30 | # ORB Parameters # 31 | #================# 32 | 33 | Feature.max_num_keypoints: 1000 34 | Feature.scale_factor: 1.2 35 | Feature.num_levels: 8 36 | Feature.ini_fast_threshold: 20 37 | Feature.min_fast_threshold: 7 38 | 39 | #=====================# 40 | # Tracking Parameters # 41 | #=====================# 42 | 43 | depth_threshold: 40.0 44 | depthmap_factor: 5000.0 45 | 46 | #===========================# 47 | # PangolinViewer Parameters # 48 | #===========================# 49 | 50 | PangolinViewer.keyframe_size: 0.05 51 | PangolinViewer.keyframe_line_width: 1 52 | PangolinViewer.graph_line_width: 1 53 | PangolinViewer.point_size: 2 54 | PangolinViewer.camera_size: 0.08 55 | PangolinViewer.camera_line_width: 3 56 | PangolinViewer.viewpoint_x: 0 57 | PangolinViewer.viewpoint_y: -0.9 58 | PangolinViewer.viewpoint_z: -1.9 59 | PangolinViewer.viewpoint_f: 400 60 | -------------------------------------------------------------------------------- /example/kitti/KITTI_mono_00-02.yaml: -------------------------------------------------------------------------------- 1 | # KITTI monocular model for seq.00-02 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "KITTI monocular 00-02" 8 | Camera.setup: "monocular" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 718.856 12 | Camera.fy: 718.856 13 | Camera.cx: 607.1928 14 | Camera.cy: 185.2157 15 | 16 | Camera.k1: 0.0 17 | Camera.k2: 0.0 18 | Camera.p1: 0.0 19 | Camera.p2: 0.0 20 | Camera.k3: 0.0 21 | 22 | Camera.fps: 10.0 23 | Camera.cols: 1241 24 | Camera.rows: 376 25 | 26 | Camera.color_order: "Gray" 27 | 28 | #================# 29 | # ORB Parameters # 30 | #================# 31 | 32 | Feature.max_num_keypoints: 2000 33 | Feature.scale_factor: 1.2 34 | Feature.num_levels: 8 35 | Feature.ini_fast_threshold: 20 36 | Feature.min_fast_threshold: 7 37 | 38 | #===========================# 39 | # PangolinViewer Parameters # 40 | #===========================# 41 | 42 | PangolinViewer.keyframe_size: 0.06 43 | PangolinViewer.keyframe_line_width: 1 44 | PangolinViewer.graph_line_width: 1 45 | PangolinViewer.point_size: 2 46 | PangolinViewer.camera_size: 0.07 47 | PangolinViewer.camera_line_width: 2 48 | PangolinViewer.viewpoint_x: 0 49 | PangolinViewer.viewpoint_y: -20 50 | PangolinViewer.viewpoint_z: -0.1 51 | PangolinViewer.viewpoint_f: 2800 52 | -------------------------------------------------------------------------------- /example/kitti/KITTI_mono_03.yaml: -------------------------------------------------------------------------------- 1 | # KITTI monocular model for seq.03 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "KITTI monocular 03" 8 | Camera.setup: "monocular" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 721.5377 12 | Camera.fy: 721.5377 13 | Camera.cx: 609.5593 14 | Camera.cy: 172.854 15 | 16 | Camera.k1: 0.0 17 | Camera.k2: 0.0 18 | Camera.p1: 0.0 19 | Camera.p2: 0.0 20 | Camera.k3: 0.0 21 | 22 | Camera.fps: 10.0 23 | Camera.cols: 1242 24 | Camera.rows: 375 25 | 26 | Camera.color_order: "Gray" 27 | 28 | #================# 29 | # ORB Parameters # 30 | #================# 31 | 32 | Feature.max_num_keypoints: 2000 33 | Feature.scale_factor: 1.2 34 | Feature.num_levels: 8 35 | Feature.ini_fast_threshold: 20 36 | Feature.min_fast_threshold: 7 37 | 38 | #===========================# 39 | # PangolinViewer Parameters # 40 | #===========================# 41 | 42 | PangolinViewer.keyframe_size: 0.06 43 | PangolinViewer.keyframe_line_width: 1 44 | PangolinViewer.graph_line_width: 1 45 | PangolinViewer.point_size: 2 46 | PangolinViewer.camera_size: 0.07 47 | PangolinViewer.camera_line_width: 2 48 | PangolinViewer.viewpoint_x: 0 49 | PangolinViewer.viewpoint_y: -20 50 | PangolinViewer.viewpoint_z: -0.1 51 | PangolinViewer.viewpoint_f: 2800 52 | -------------------------------------------------------------------------------- /example/kitti/KITTI_mono_04-12.yaml: -------------------------------------------------------------------------------- 1 | # KITTI monocular model for seq.04-12 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "KITTI monocular 04-12" 8 | Camera.setup: "monocular" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 707.0912 12 | Camera.fy: 707.0912 13 | Camera.cx: 601.8873 14 | Camera.cy: 183.1104 15 | 16 | Camera.k1: 0.0 17 | Camera.k2: 0.0 18 | Camera.p1: 0.0 19 | Camera.p2: 0.0 20 | Camera.k3: 0.0 21 | 22 | Camera.fps: 10.0 23 | Camera.cols: 1226 24 | Camera.rows: 370 25 | 26 | Camera.color_order: "Gray" 27 | 28 | #================# 29 | # ORB Parameters # 30 | #================# 31 | 32 | Feature.max_num_keypoints: 2000 33 | Feature.scale_factor: 1.2 34 | Feature.num_levels: 8 35 | Feature.ini_fast_threshold: 20 36 | Feature.min_fast_threshold: 7 37 | 38 | #===========================# 39 | # PangolinViewer Parameters # 40 | #===========================# 41 | 42 | PangolinViewer.keyframe_size: 0.06 43 | PangolinViewer.keyframe_line_width: 1 44 | PangolinViewer.graph_line_width: 1 45 | PangolinViewer.point_size: 2 46 | PangolinViewer.camera_size: 0.07 47 | PangolinViewer.camera_line_width: 2 48 | PangolinViewer.viewpoint_x: 0 49 | PangolinViewer.viewpoint_y: -20 50 | PangolinViewer.viewpoint_z: -0.1 51 | PangolinViewer.viewpoint_f: 2800 52 | -------------------------------------------------------------------------------- /example/kitti/KITTI_stereo_00-02.yaml: -------------------------------------------------------------------------------- 1 | # KITTI stereo model for seq.00-02 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "KITTI stereo 00-02" 8 | Camera.setup: "stereo" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 718.856 12 | Camera.fy: 718.856 13 | Camera.cx: 607.1928 14 | Camera.cy: 185.2157 15 | 16 | Camera.k1: 0.0 17 | Camera.k2: 0.0 18 | Camera.p1: 0.0 19 | Camera.p2: 0.0 20 | Camera.k3: 0.0 21 | 22 | Camera.fps: 10.0 23 | Camera.cols: 1241 24 | Camera.rows: 376 25 | Camera.focal_x_baseline: 386.1448 26 | 27 | Camera.color_order: "Gray" 28 | 29 | #================# 30 | # ORB Parameters # 31 | #================# 32 | 33 | Feature.max_num_keypoints: 2000 34 | Feature.scale_factor: 1.2 35 | Feature.num_levels: 8 36 | Feature.ini_fast_threshold: 12 37 | Feature.min_fast_threshold: 7 38 | 39 | #=====================# 40 | # Tracking Parameters # 41 | #=====================# 42 | 43 | depth_threshold: 40 44 | 45 | #========================# 46 | # Initializer Parameters # 47 | #========================# 48 | 49 | Initializer.num_min_triangulated_pts: 100 50 | 51 | #===========================# 52 | # PangolinViewer Parameters # 53 | #===========================# 54 | 55 | PangolinViewer.keyframe_size: 1.2 56 | PangolinViewer.keyframe_line_width: 1 57 | PangolinViewer.graph_line_width: 2 58 | PangolinViewer.point_size: 2 59 | PangolinViewer.camera_size: 0.8 60 | PangolinViewer.camera_line_width: 3 61 | PangolinViewer.viewpoint_x: 0.0 62 | PangolinViewer.viewpoint_y: -300 63 | PangolinViewer.viewpoint_z: -0.1 64 | PangolinViewer.viewpoint_f: 2800 65 | -------------------------------------------------------------------------------- /example/kitti/KITTI_stereo_03.yaml: -------------------------------------------------------------------------------- 1 | # KITTI stereo model for seq.03 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "KITTI stereo 03" 8 | Camera.setup: "stereo" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 721.5377 12 | Camera.fy: 721.5377 13 | Camera.cx: 609.5593 14 | Camera.cy: 172.854 15 | 16 | Camera.k1: 0.0 17 | Camera.k2: 0.0 18 | Camera.p1: 0.0 19 | Camera.p2: 0.0 20 | Camera.k3: 0.0 21 | 22 | Camera.fps: 10.0 23 | Camera.cols: 1242 24 | Camera.rows: 375 25 | Camera.focal_x_baseline: 387.5744 26 | 27 | Camera.color_order: "Gray" 28 | 29 | #================# 30 | # ORB Parameters # 31 | #================# 32 | 33 | Feature.max_num_keypoints: 2000 34 | Feature.scale_factor: 1.2 35 | Feature.num_levels: 8 36 | Feature.ini_fast_threshold: 12 37 | Feature.min_fast_threshold: 7 38 | 39 | #=====================# 40 | # Tracking Parameters # 41 | #=====================# 42 | 43 | depth_threshold: 40 44 | 45 | #========================# 46 | # Initializer Parameters # 47 | #========================# 48 | 49 | Initializer.num_min_triangulated_pts: 100 50 | 51 | #===========================# 52 | # PangolinViewer Parameters # 53 | #===========================# 54 | 55 | PangolinViewer.keyframe_size: 1.2 56 | PangolinViewer.keyframe_line_width: 1 57 | PangolinViewer.graph_line_width: 2 58 | PangolinViewer.point_size: 2 59 | PangolinViewer.camera_size: 0.8 60 | PangolinViewer.camera_line_width: 3 61 | PangolinViewer.viewpoint_x: 0.0 62 | PangolinViewer.viewpoint_y: -300 63 | PangolinViewer.viewpoint_z: -0.1 64 | PangolinViewer.viewpoint_f: 2800 65 | -------------------------------------------------------------------------------- /example/kitti/KITTI_stereo_04-12.yaml: -------------------------------------------------------------------------------- 1 | # KITTI stereo model for seq.04-12 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "KITTI stereo 04-12" 8 | Camera.setup: "stereo" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 707.0912 12 | Camera.fy: 707.0912 13 | Camera.cx: 601.8873 14 | Camera.cy: 183.1104 15 | 16 | Camera.k1: 0.0 17 | Camera.k2: 0.0 18 | Camera.p1: 0.0 19 | Camera.p2: 0.0 20 | Camera.k3: 0.0 21 | 22 | Camera.fps: 10.0 23 | Camera.cols: 1226 24 | Camera.rows: 370 25 | Camera.focal_x_baseline: 379.8145 26 | 27 | Camera.color_order: "Gray" 28 | 29 | #================# 30 | # ORB Parameters # 31 | #================# 32 | 33 | Feature.max_num_keypoints: 2000 34 | Feature.scale_factor: 1.2 35 | Feature.num_levels: 8 36 | Feature.ini_fast_threshold: 12 37 | Feature.min_fast_threshold: 7 38 | 39 | #=====================# 40 | # Tracking Parameters # 41 | #=====================# 42 | 43 | depth_threshold: 40 44 | 45 | #========================# 46 | # Initializer Parameters # 47 | #========================# 48 | 49 | Initializer.num_min_triangulated_pts: 100 50 | 51 | #===========================# 52 | # PangolinViewer Parameters # 53 | #===========================# 54 | 55 | PangolinViewer.keyframe_size: 1.2 56 | PangolinViewer.keyframe_line_width: 1 57 | PangolinViewer.graph_line_width: 2 58 | PangolinViewer.point_size: 2 59 | PangolinViewer.camera_size: 0.8 60 | PangolinViewer.camera_line_width: 3 61 | PangolinViewer.viewpoint_x: 0.0 62 | PangolinViewer.viewpoint_y: -300 63 | PangolinViewer.viewpoint_z: -0.1 64 | PangolinViewer.viewpoint_f: 2800 65 | -------------------------------------------------------------------------------- /example/muselearn/mono.yaml: -------------------------------------------------------------------------------- 1 | # TUM RGBD monocular model for 02 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "Muselearn" 8 | Camera.setup: "monocular" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 575.816 12 | Camera.fy: 575.816 13 | Camera.cx: 320 14 | Camera.cy: 240 15 | 16 | Camera.k1: 0.0 17 | Camera.k2: 0.0 18 | Camera.p1: 0.0 19 | Camera.p2: 0.0 20 | Camera.k3: 0.0 21 | 22 | Camera.fps: 30.0 23 | Camera.cols: 640 24 | Camera.rows: 480 25 | 26 | Camera.color_order: "RGB" 27 | 28 | #================# 29 | # ORB Parameters # 30 | #================# 31 | 32 | Feature.max_num_keypoints: 1500 33 | Feature.scale_factor: 1.2 34 | Feature.num_levels: 8 35 | Feature.ini_fast_threshold: 20 36 | Feature.min_fast_threshold: 7 37 | 38 | #===========================# 39 | # PangolinViewer Parameters # 40 | #===========================# 41 | 42 | PangolinViewer.keyframe_size: 0.05 43 | PangolinViewer.keyframe_line_width: 1 44 | PangolinViewer.graph_line_width: 1 45 | PangolinViewer.point_size: 2 46 | PangolinViewer.camera_size: 0.08 47 | PangolinViewer.camera_line_width: 3 48 | PangolinViewer.viewpoint_x: 0 49 | PangolinViewer.viewpoint_y: -0.9 50 | PangolinViewer.viewpoint_z: -1.9 51 | PangolinViewer.viewpoint_f: 400 52 | -------------------------------------------------------------------------------- /example/tum_rgbd/TUM_RGBD_mono_1.yaml: -------------------------------------------------------------------------------- 1 | # TUM RGBD monocular model for 01 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "TUM RGBD monocular 01" 8 | Camera.setup: "monocular" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 517.306408 12 | Camera.fy: 516.469215 13 | Camera.cx: 318.643040 14 | Camera.cy: 255.313989 15 | 16 | Camera.k1: 0.262383 17 | Camera.k2: -0.953104 18 | Camera.p1: -0.005358 19 | Camera.p2: 0.002628 20 | Camera.k3: 1.163314 21 | 22 | Camera.fps: 30.0 23 | Camera.cols: 640 24 | Camera.rows: 480 25 | 26 | Camera.color_order: "RGB" 27 | 28 | #================# 29 | # ORB Parameters # 30 | #================# 31 | 32 | Feature.max_num_keypoints: 1000 33 | Feature.scale_factor: 1.2 34 | Feature.num_levels: 8 35 | Feature.ini_fast_threshold: 20 36 | Feature.min_fast_threshold: 7 37 | 38 | #===========================# 39 | # PangolinViewer Parameters # 40 | #===========================# 41 | 42 | PangolinViewer.keyframe_size: 0.05 43 | PangolinViewer.keyframe_line_width: 1 44 | PangolinViewer.graph_line_width: 1 45 | PangolinViewer.point_size: 2 46 | PangolinViewer.camera_size: 0.08 47 | PangolinViewer.camera_line_width: 3 48 | PangolinViewer.viewpoint_x: 0 49 | PangolinViewer.viewpoint_y: -0.9 50 | PangolinViewer.viewpoint_z: -1.9 51 | PangolinViewer.viewpoint_f: 400 52 | -------------------------------------------------------------------------------- /example/tum_rgbd/TUM_RGBD_mono_2.yaml: -------------------------------------------------------------------------------- 1 | # TUM RGBD monocular model for 02 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "TUM RGBD monocular 02" 8 | Camera.setup: "monocular" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 520.908620 12 | Camera.fy: 521.007327 13 | Camera.cx: 325.141442 14 | Camera.cy: 249.701764 15 | 16 | Camera.k1: 0.231222 17 | Camera.k2: -0.784899 18 | Camera.p1: -0.003257 19 | Camera.p2: -0.000105 20 | Camera.k3: 0.917205 21 | 22 | Camera.fps: 30.0 23 | Camera.cols: 640 24 | Camera.rows: 480 25 | 26 | Camera.color_order: "RGB" 27 | 28 | #================# 29 | # ORB Parameters # 30 | #================# 31 | 32 | Feature.max_num_keypoints: 1000 33 | Feature.scale_factor: 1.2 34 | Feature.num_levels: 8 35 | Feature.ini_fast_threshold: 20 36 | Feature.min_fast_threshold: 7 37 | 38 | #===========================# 39 | # PangolinViewer Parameters # 40 | #===========================# 41 | 42 | PangolinViewer.keyframe_size: 0.05 43 | PangolinViewer.keyframe_line_width: 1 44 | PangolinViewer.graph_line_width: 1 45 | PangolinViewer.point_size: 2 46 | PangolinViewer.camera_size: 0.08 47 | PangolinViewer.camera_line_width: 3 48 | PangolinViewer.viewpoint_x: 0 49 | PangolinViewer.viewpoint_y: -0.9 50 | PangolinViewer.viewpoint_z: -1.9 51 | PangolinViewer.viewpoint_f: 400 52 | -------------------------------------------------------------------------------- /example/tum_rgbd/TUM_RGBD_mono_3.yaml: -------------------------------------------------------------------------------- 1 | # TUM RGBD monocular model for 03 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "TUM RGBD monocular 03" 8 | Camera.setup: "monocular" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 535.4 12 | Camera.fy: 539.2 13 | Camera.cx: 320.1 14 | Camera.cy: 247.6 15 | 16 | Camera.k1: 0.0 17 | Camera.k2: 0.0 18 | Camera.p1: 0.0 19 | Camera.p2: 0.0 20 | Camera.k3: 0.0 21 | 22 | Camera.fps: 30.0 23 | Camera.cols: 640 24 | Camera.rows: 480 25 | 26 | Camera.color_order: "RGB" 27 | 28 | #================# 29 | # ORB Parameters # 30 | #================# 31 | 32 | Feature.max_num_keypoints: 1000 33 | Feature.scale_factor: 1.2 34 | Feature.num_levels: 8 35 | Feature.ini_fast_threshold: 20 36 | Feature.min_fast_threshold: 7 37 | 38 | #===========================# 39 | # PangolinViewer Parameters # 40 | #===========================# 41 | 42 | PangolinViewer.keyframe_size: 0.05 43 | PangolinViewer.keyframe_line_width: 1 44 | PangolinViewer.graph_line_width: 1 45 | PangolinViewer.point_size: 2 46 | PangolinViewer.camera_size: 0.08 47 | PangolinViewer.camera_line_width: 3 48 | PangolinViewer.viewpoint_x: 0 49 | PangolinViewer.viewpoint_y: -0.9 50 | PangolinViewer.viewpoint_z: -1.9 51 | PangolinViewer.viewpoint_f: 400 52 | -------------------------------------------------------------------------------- /example/tum_rgbd/TUM_RGBD_rgbd_1.yaml: -------------------------------------------------------------------------------- 1 | # TUM-RGBD RGBD model for 01 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "TUM-RGBD RGBD 01" 8 | Camera.setup: "RGBD" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 517.306408 12 | Camera.fy: 516.469215 13 | Camera.cx: 318.643040 14 | Camera.cy: 255.313989 15 | 16 | Camera.k1: 0.262383 17 | Camera.k2: -0.953104 18 | Camera.p1: -0.005358 19 | Camera.p2: 0.002628 20 | Camera.k3: 1.163314 21 | 22 | Camera.fps: 30.0 23 | Camera.cols: 640 24 | Camera.rows: 480 25 | Camera.focal_x_baseline: 40.0 26 | 27 | Camera.color_order: "RGB" 28 | 29 | #================# 30 | # ORB Parameters # 31 | #================# 32 | 33 | Feature.max_num_keypoints: 1000 34 | Feature.scale_factor: 1.2 35 | Feature.num_levels: 8 36 | Feature.ini_fast_threshold: 20 37 | Feature.min_fast_threshold: 7 38 | 39 | #=====================# 40 | # Tracking Parameters # 41 | #=====================# 42 | 43 | depth_threshold: 40.0 44 | depthmap_factor: 5000.0 45 | 46 | #===========================# 47 | # PangolinViewer Parameters # 48 | #===========================# 49 | 50 | PangolinViewer.keyframe_size: 0.05 51 | PangolinViewer.keyframe_line_width: 1 52 | PangolinViewer.graph_line_width: 1 53 | PangolinViewer.point_size: 2 54 | PangolinViewer.camera_size: 0.08 55 | PangolinViewer.camera_line_width: 3 56 | PangolinViewer.viewpoint_x: 0 57 | PangolinViewer.viewpoint_y: -0.9 58 | PangolinViewer.viewpoint_z: -1.9 59 | PangolinViewer.viewpoint_f: 400 60 | -------------------------------------------------------------------------------- /example/tum_rgbd/TUM_RGBD_rgbd_2.yaml: -------------------------------------------------------------------------------- 1 | # TUM-RGBD RGBD model for 02 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "TUM-RGBD RGBD 02" 8 | Camera.setup: "RGBD" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 520.908620 12 | Camera.fy: 521.007327 13 | Camera.cx: 325.141442 14 | Camera.cy: 249.701764 15 | 16 | Camera.k1: 0.231222 17 | Camera.k2: -0.784899 18 | Camera.p1: -0.003257 19 | Camera.p2: -0.000105 20 | Camera.k3: 0.917205 21 | 22 | Camera.fps: 30.0 23 | Camera.cols: 640 24 | Camera.rows: 480 25 | Camera.focal_x_baseline: 40.0 26 | 27 | Camera.color_order: "RGB" 28 | 29 | #================# 30 | # ORB Parameters # 31 | #================# 32 | 33 | Feature.max_num_keypoints: 1000 34 | Feature.scale_factor: 1.2 35 | Feature.num_levels: 8 36 | Feature.ini_fast_threshold: 20 37 | Feature.min_fast_threshold: 7 38 | 39 | #=====================# 40 | # Tracking Parameters # 41 | #=====================# 42 | 43 | depth_threshold: 40.0 44 | depthmap_factor: 5000.0 45 | 46 | #===========================# 47 | # PangolinViewer Parameters # 48 | #===========================# 49 | 50 | PangolinViewer.keyframe_size: 0.05 51 | PangolinViewer.keyframe_line_width: 1 52 | PangolinViewer.graph_line_width: 1 53 | PangolinViewer.point_size: 2 54 | PangolinViewer.camera_size: 0.08 55 | PangolinViewer.camera_line_width: 3 56 | PangolinViewer.viewpoint_x: 0 57 | PangolinViewer.viewpoint_y: -0.9 58 | PangolinViewer.viewpoint_z: -1.9 59 | PangolinViewer.viewpoint_f: 400 60 | -------------------------------------------------------------------------------- /example/tum_rgbd/TUM_RGBD_rgbd_3.yaml: -------------------------------------------------------------------------------- 1 | # TUM-RGBD RGBD model for 03 2 | 3 | #==============# 4 | # Camera Model # 5 | #==============# 6 | 7 | Camera.name: "TUM-RGBD RGBD 03" 8 | Camera.setup: "RGBD" 9 | Camera.model: "perspective" 10 | 11 | Camera.fx: 535.4 12 | Camera.fy: 539.2 13 | Camera.cx: 320.1 14 | Camera.cy: 247.6 15 | 16 | Camera.k1: 0.0 17 | Camera.k2: 0.0 18 | Camera.p1: 0.0 19 | Camera.p2: 0.0 20 | Camera.k3: 0.0 21 | 22 | Camera.fps: 30.0 23 | Camera.cols: 640 24 | Camera.rows: 480 25 | Camera.focal_x_baseline: 40.0 26 | 27 | Camera.color_order: "RGB" 28 | 29 | #================# 30 | # ORB Parameters # 31 | #================# 32 | 33 | Feature.max_num_keypoints: 1000 34 | Feature.scale_factor: 1.2 35 | Feature.num_levels: 8 36 | Feature.ini_fast_threshold: 20 37 | Feature.min_fast_threshold: 7 38 | 39 | #=====================# 40 | # Tracking Parameters # 41 | #=====================# 42 | 43 | depth_threshold: 40.0 44 | depthmap_factor: 5000.0 45 | 46 | #===========================# 47 | # PangolinViewer Parameters # 48 | #===========================# 49 | 50 | PangolinViewer.keyframe_size: 0.05 51 | PangolinViewer.keyframe_line_width: 1 52 | PangolinViewer.graph_line_width: 1 53 | PangolinViewer.point_size: 2 54 | PangolinViewer.camera_size: 0.08 55 | PangolinViewer.camera_line_width: 3 56 | PangolinViewer.viewpoint_x: 0 57 | PangolinViewer.viewpoint_y: -0.9 58 | PangolinViewer.viewpoint_z: -1.9 59 | PangolinViewer.viewpoint_f: 400 60 | -------------------------------------------------------------------------------- /example/tum_vi/TUM_VI_mono.yaml: -------------------------------------------------------------------------------- 1 | # TUM VI monocular model 2 | # https://vision.in.tum.de/data/datasets/visual-inertial-dataset#geometric_calibration 3 | # pinhole (512x512) 4 | 5 | #==============# 6 | # Camera Model # 7 | #==============# 8 | 9 | Camera.name: "TUM VI monocular" 10 | Camera.setup: "monocular" 11 | Camera.model: "fisheye" 12 | 13 | Camera.fx: 190.97847715128717 14 | Camera.fy: 190.9733070521226 15 | Camera.cx: 254.93170605935475 16 | Camera.cy: 256.8974428996504 17 | 18 | Camera.k1: 0.0034823894022493434 19 | Camera.k2: 0.0007150348452162257 20 | Camera.k3: -0.0020532361418706202 21 | Camera.k4: 0.00020293673591811182 22 | 23 | Camera.fps: 20 24 | Camera.cols: 512 25 | Camera.rows: 512 26 | 27 | Camera.color_order: "Gray" 28 | 29 | #================# 30 | # ORB Parameters # 31 | #================# 32 | 33 | Feature.max_num_keypoints: 1000 34 | Feature.scale_factor: 1.2 35 | Feature.num_levels: 8 36 | Feature.ini_fast_threshold: 20 37 | Feature.min_fast_threshold: 7 38 | 39 | #========================# 40 | # Initializer Parameters # 41 | #========================# 42 | 43 | Initializer.scaling_factor: 2.0 44 | -------------------------------------------------------------------------------- /example/tum_vi/TUM_VI_stereo.yaml: -------------------------------------------------------------------------------- 1 | # TUM VI stereo rectify model 2 | # https://vision.in.tum.de/data/datasets/visual-inertial-dataset#geometric_calibration 3 | # pinhole (512x512) 4 | 5 | #==============# 6 | # Camera Model # 7 | #==============# 8 | 9 | Camera.name: "TUM VI stereo" 10 | Camera.setup: "stereo" 11 | Camera.model: "perspective" 12 | 13 | # new "rectified" matrices is the first three cols of the projection matrix which is calculated with cv::stereoRectify() 14 | # e.g. fx = P1[0][0] or P2[0][0], cx = P1[0][2] or P2[0][2] 15 | # fy = P1[1][1] or P2[1][1], cy = P1[1][2] or P2[1][2] 16 | 17 | Camera.fx: 61.75453410721205 18 | Camera.fy: 61.75453410721205 19 | Camera.cx: 240.22941720459062 20 | Camera.cy: 255.73235402091632 21 | 22 | # there is no distortion after stereo rectification 23 | 24 | Camera.k1: 0.0 25 | Camera.k2: 0.0 26 | Camera.p1: 0.0 27 | Camera.p2: 0.0 28 | Camera.k3: 0.0 29 | 30 | # focal_x_baseline is -P2[0][3] which is calculated with cv::stereoRectify() 31 | 32 | Camera.fps: 20 33 | Camera.cols: 512 34 | Camera.rows: 512 35 | Camera.focal_x_baseline: 6.242596912726197 36 | 37 | Camera.color_order: "Gray" 38 | 39 | #======================# 40 | # Stereo Rectification # 41 | #======================# 42 | 43 | # original intrinsic parameters (K, D) and stereo-recitification parameters (R) 44 | # matrices (K, R) are written in row-major order 45 | # StereoRectifier.model is camera model before rectification 46 | 47 | StereoRectifier.model: "fisheye" 48 | StereoRectifier.K_left: [190.97847715128717, 0.0, 254.93170605935475, 0.0, 190.9733070521226, 256.8974428996504, 0.0, 0.0, 1.0] 49 | StereoRectifier.D_left: [0.0034823894022493434, 0.0007150348452162257, -0.0020532361418706202, 0.00020293673591811182] 50 | StereoRectifier.R_left: [0.9997641946925044, 0.01925271884177015, 0.010044293307535757, -0.01901185247371587, 0.9995418997803748, -0.02354867403818772, -0.010493068014919314, 0.02335216051329943, 0.99967223234568] 51 | StereoRectifier.K_right: [190.44236969414825, 0.0, 252.59949716835982, 0.0, 190.4344384721956, 254.91723064636983, 0.0, 0.0, 1.0] 52 | StereoRectifier.D_right: [0.0034003170790442797, 0.001766278153469831, -0.00266312569781606, 0.0003299517423931039] 53 | StereoRectifier.R_right: [0.9997411981023351, 0.01955199401713946, 0.011629976219300583, -0.019819377433695273, 0.9995311538731381, 0.02333805294307984, -0.011168218078479885, -0.023562511898925578, 0.9996599816627474] 54 | 55 | #================# 56 | # ORB Parameters # 57 | #================# 58 | 59 | Feature.max_num_keypoints: 1000 60 | Feature.scale_factor: 1.2 61 | Feature.num_levels: 8 62 | Feature.ini_fast_threshold: 20 63 | Feature.min_fast_threshold: 7 64 | 65 | #========================# 66 | # Initializer Parameters # 67 | #========================# 68 | 69 | Initializer.num_min_triangulated_pts: 100 70 | -------------------------------------------------------------------------------- /example/util/euroc_planeSeg_util.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Developed by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef EXAMPLE_UTIL_EUROC_PLANESEG_UTIL_H 25 | #define EXAMPLE_UTIL_EUROC_PLANESEG_UTIL_H 26 | 27 | #include 28 | #include 29 | 30 | class euroc_sequence 31 | { 32 | public: 33 | struct frame 34 | { 35 | frame(const std::string &left_img_path, const std::string &right_img_path, const double timestamp, const std::string &mask_img_path) 36 | : left_img_path_(left_img_path), right_img_path_(right_img_path), timestamp_(timestamp), _mask_img_path(mask_img_path){}; 37 | 38 | const std::string left_img_path_; 39 | const std::string right_img_path_; 40 | const double timestamp_; 41 | 42 | // FW: 43 | const std::string _mask_img_path; 44 | }; 45 | 46 | explicit euroc_sequence(const std::string &seq_dir_path); 47 | 48 | virtual ~euroc_sequence() = default; 49 | 50 | std::vector get_frames() const; 51 | 52 | private: 53 | std::vector timestamps_; 54 | std::vector left_img_file_paths_; 55 | std::vector right_img_file_paths_; 56 | 57 | // FW: 58 | std::vector _mask_img_file_paths; 59 | }; 60 | 61 | #endif // EXAMPLE_UTIL_EUROC_UTIL_H 62 | -------------------------------------------------------------------------------- /example/util/euroc_util.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef EXAMPLE_UTIL_EUROC_UTIL_H 25 | #define EXAMPLE_UTIL_EUROC_UTIL_H 26 | 27 | #include 28 | #include 29 | 30 | class euroc_sequence 31 | { 32 | public: 33 | struct frame 34 | { 35 | frame(const std::string &left_img_path, const std::string &right_img_path, const double timestamp) 36 | : left_img_path_(left_img_path), right_img_path_(right_img_path), timestamp_(timestamp){}; 37 | 38 | const std::string left_img_path_; 39 | const std::string right_img_path_; 40 | const double timestamp_; 41 | }; 42 | 43 | explicit euroc_sequence(const std::string &seq_dir_path); 44 | 45 | virtual ~euroc_sequence() = default; 46 | 47 | std::vector get_frames() const; 48 | 49 | private: 50 | std::vector timestamps_; 51 | std::vector left_img_file_paths_; 52 | std::vector right_img_file_paths_; 53 | }; 54 | 55 | #endif // EXAMPLE_UTIL_EUROC_UTIL_H 56 | -------------------------------------------------------------------------------- /example/util/image_planeSeg_util.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Developed by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef EXAMPLE_UTIL_IMAGE_PLANESEG_UTIL_H 25 | #define EXAMPLE_UTIL_IMAGE_PLANESEG_UTIL_H 26 | 27 | #include 28 | #include 29 | 30 | class image_sequence 31 | { 32 | public: 33 | struct frame 34 | { 35 | frame(const std::string &img_path, 36 | const std::string &mask_img_path, 37 | const double timestamp) 38 | : img_path_(img_path), 39 | mask_img_path_(mask_img_path), 40 | timestamp_(timestamp){}; 41 | 42 | const std::string img_path_; 43 | const std::string mask_img_path_; 44 | const double timestamp_; 45 | }; 46 | 47 | image_sequence(const std::string &img_dir_path, const double fps); 48 | 49 | virtual ~image_sequence() = default; 50 | 51 | std::vector get_frames() const; 52 | 53 | private: 54 | const double fps_; 55 | 56 | std::vector img_file_paths_; 57 | std::vector mask_file_paths_; 58 | }; 59 | 60 | #endif // EXAMPLE_UTIL_IMAGE_UTIL_H 61 | -------------------------------------------------------------------------------- /example/util/image_util.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #include "image_util.h" 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | image_sequence::image_sequence(const std::string &img_dir_path, const double fps) 31 | : fps_(fps) 32 | { 33 | DIR *dir; 34 | if ((dir = opendir(img_dir_path.c_str())) == nullptr) 35 | { 36 | throw std::runtime_error("directory " + img_dir_path + " does not exist"); 37 | } 38 | dirent *dp; 39 | for (dp = readdir(dir); dp != nullptr; dp = readdir(dir)) 40 | { 41 | const std::string img_file_name = dp->d_name; 42 | if (img_file_name == "." || img_file_name == "..") 43 | { 44 | continue; 45 | } 46 | img_file_paths_.push_back(img_dir_path + "/" + img_file_name); 47 | } 48 | closedir(dir); 49 | 50 | std::sort(img_file_paths_.begin(), img_file_paths_.end()); 51 | } 52 | 53 | std::vector image_sequence::get_frames() const 54 | { 55 | std::vector frames; 56 | for (unsigned int i = 0; i < img_file_paths_.size(); ++i) 57 | { 58 | frames.emplace_back(frame{img_file_paths_.at(i), (1.0 / fps_) * i}); 59 | } 60 | return frames; 61 | } 62 | -------------------------------------------------------------------------------- /example/util/image_util.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef EXAMPLE_UTIL_IMAGE_UTIL_H 25 | #define EXAMPLE_UTIL_IMAGE_UTIL_H 26 | 27 | #include 28 | #include 29 | 30 | class image_sequence 31 | { 32 | public: 33 | struct frame 34 | { 35 | frame(const std::string &img_path, const double timestamp) 36 | : img_path_(img_path), timestamp_(timestamp){}; 37 | 38 | const std::string img_path_; 39 | const double timestamp_; 40 | }; 41 | 42 | image_sequence(const std::string &img_dir_path, const double fps); 43 | 44 | virtual ~image_sequence() = default; 45 | 46 | std::vector get_frames() const; 47 | 48 | private: 49 | const double fps_; 50 | 51 | std::vector img_file_paths_; 52 | }; 53 | 54 | #endif // EXAMPLE_UTIL_IMAGE_UTIL_H 55 | -------------------------------------------------------------------------------- /example/util/kitti_util.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef EXAMPLE_UTIL_KITTI_UTIL_H 25 | #define EXAMPLE_UTIL_KITTI_UTIL_H 26 | 27 | #include 28 | #include 29 | 30 | class kitti_sequence 31 | { 32 | public: 33 | struct frame 34 | { 35 | frame(const std::string &left_img_path, const std::string &right_img_path, const double timestamp) 36 | : left_img_path_(left_img_path), right_img_path_(right_img_path), timestamp_(timestamp){}; 37 | 38 | const std::string left_img_path_; 39 | const std::string right_img_path_; 40 | const double timestamp_; 41 | }; 42 | 43 | explicit kitti_sequence(const std::string &seq_dir_path); 44 | 45 | virtual ~kitti_sequence() = default; 46 | 47 | std::vector get_frames() const; 48 | 49 | private: 50 | std::vector timestamps_; 51 | std::vector left_img_file_paths_; 52 | std::vector right_img_file_paths_; 53 | }; 54 | 55 | #endif // EXAMPLE_UTIL_KITTI_UTIL_H 56 | -------------------------------------------------------------------------------- /example/util/tum_rgbd_util.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef EXAMPLE_UTIL_TUM_RGBD_UTIL_H 25 | #define EXAMPLE_UTIL_TUM_RGBD_UTIL_H 26 | 27 | #include 28 | #include 29 | 30 | class tum_rgbd_sequence 31 | { 32 | public: 33 | struct frame 34 | { 35 | frame(const std::string &rgb_img_path, const std::string &depth_img_path, const double timestamp) 36 | : rgb_img_path_(rgb_img_path), depth_img_path_(depth_img_path), timestamp_(timestamp){}; 37 | 38 | const std::string rgb_img_path_; 39 | const std::string depth_img_path_; 40 | const double timestamp_; 41 | }; 42 | 43 | explicit tum_rgbd_sequence(const std::string &seq_dir_path, const double min_timediff_thr = 0.1); 44 | 45 | virtual ~tum_rgbd_sequence() = default; 46 | 47 | std::vector get_frames() const; 48 | 49 | private: 50 | struct img_info 51 | { 52 | img_info(const double timestamp, const std::string &img_file_path) 53 | : timestamp_(timestamp), img_file_path_(img_file_path){}; 54 | 55 | const double timestamp_; 56 | const std::string img_file_path_; 57 | }; 58 | 59 | std::vector acquire_image_information(const std::string &seq_dir_path, 60 | const std::string ×tamp_file_path) const; 61 | 62 | std::vector timestamps_; 63 | std::vector rgb_img_file_paths_; 64 | std::vector depth_img_file_paths_; 65 | }; 66 | 67 | #endif // EXAMPLE_UTIL_TUM_RGBD_UTIL_H 68 | -------------------------------------------------------------------------------- /image/Stereo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/image/Stereo.png -------------------------------------------------------------------------------- /image/V1_03_difficult_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/image/V1_03_difficult_full.png -------------------------------------------------------------------------------- /image/fr2_pioneer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/image/fr2_pioneer.png -------------------------------------------------------------------------------- /image/kitti_mono.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/image/kitti_mono.png -------------------------------------------------------------------------------- /image/living_room_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/image/living_room_0.png -------------------------------------------------------------------------------- /image/living_room_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/image/living_room_2.png -------------------------------------------------------------------------------- /image/mono.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/image/mono.png -------------------------------------------------------------------------------- /image/relocalization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/image/relocalization.png -------------------------------------------------------------------------------- /image/result_dense.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/image/result_dense.png -------------------------------------------------------------------------------- /image/slam-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/image/slam-workflow.png -------------------------------------------------------------------------------- /image/str_tex_far.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/image/str_tex_far.png -------------------------------------------------------------------------------- /image/traj0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/image/traj0.png -------------------------------------------------------------------------------- /orb_vocab/orb_vocab.dbow2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/orb_vocab/orb_vocab.dbow2 -------------------------------------------------------------------------------- /ros/.catkin_workspace: -------------------------------------------------------------------------------- 1 | # This file currently only serves to mark the location of a catkin workspace for tool integration 2 | -------------------------------------------------------------------------------- /ros/src/openvslam/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PLPSLAM 4 | 0.0.0 5 | The ROS package for PLPSLAM 6 | 7 | Mitsumasa Ichihara 8 | Shinya Sumikura 9 | Ken Sakurada 10 | 11 | 2-clause BSD 12 | https://PLPSLAM.readthedocs.io/en/master/overview.html 13 | 14 | catkin 15 | 16 | image_transport 17 | cv_bridge 18 | 19 | image_transport 20 | cv_bridge 21 | 22 | image_transport 23 | cv_bridge 24 | 25 | -------------------------------------------------------------------------------- /ros/src/openvslam/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(USE_PANGOLIN_VIEWER) 2 | message(STATUS "Viewer for examples: pangolin viewer") 3 | elseif(USE_SOCKET_PUBLISHER) 4 | message(STATUS "Viewer for examples: socket publisher") 5 | else() 6 | message(STATUS "Viewer for examples: none") 7 | endif() 8 | 9 | set(EXECUTABLE_TARGETS "") 10 | 11 | add_executable(run_slam run_slam.cc) 12 | list(APPEND EXECUTABLE_TARGETS run_slam) 13 | 14 | add_executable(run_localization run_localization.cc) 15 | list(APPEND EXECUTABLE_TARGETS run_localization) 16 | 17 | foreach(EXECUTABLE_TARGET IN LISTS EXECUTABLE_TARGETS) 18 | add_dependencies(${EXECUTABLE_TARGET} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 19 | 20 | # pangolin_viewer is used on a priority basis 21 | if(USE_PANGOLIN_VIEWER) 22 | # set macro flag 23 | target_compile_definitions(${EXECUTABLE_TARGET} 24 | PRIVATE -DUSE_PANGOLIN_VIEWER) 25 | # link viewer 26 | target_link_libraries(${EXECUTABLE_TARGET} PRIVATE 27 | ${Pangolin_Viewer_LIB} ${Pangolin_LIBRARIES}) 28 | elseif(USE_SOCKET_PUBLISHER) 29 | # set macro flag 30 | target_compile_definitions(${EXECUTABLE_TARGET} 31 | PRIVATE -DUSE_SOCKET_PUBLISHER) 32 | # link viewer 33 | target_link_libraries(${EXECUTABLE_TARGET} PRIVATE 34 | ${Socket_Publisher_LIB} ${SIOCLIENT_LIBRARY} ${PROTOBUF_LIBRARIES}) 35 | endif() 36 | 37 | # setup stack trace logger 38 | if(USE_STACK_TRACE_LOGGER) 39 | target_compile_definitions(${EXECUTABLE_TARGET} 40 | PRIVATE -DUSE_STACK_TRACE_LOGGER) 41 | target_link_libraries(${EXECUTABLE_TARGET} PRIVATE 42 | ${GLOG_LIBRARIES}) 43 | endif() 44 | 45 | # setup google-perftools 46 | if(USE_GOOGLE_PERFTOOLS) 47 | target_compile_definitions(${EXECUTABLE_TARGET} 48 | PRIVATE -DUSE_GOOGLE_PERFTOOLS) 49 | target_link_libraries(${EXECUTABLE_TARGET} PRIVATE 50 | ${GPERFTOOLS_LIBRARIES}) 51 | endif() 52 | 53 | endforeach() 54 | -------------------------------------------------------------------------------- /ros/src/publisher/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | publisher 4 | 0.0.0 5 | The ROS package for PLPSLAM 6 | 7 | Mitsumasa Ichihara 8 | Shinya Sumikura 9 | Ken Sakurada 10 | 11 | 2-clause BSD 12 | https://PLPSLAM.readthedocs.io/en/master/overview.html 13 | 14 | catkin 15 | 16 | image_transport 17 | cv_bridge 18 | 19 | image_transport 20 | cv_bridge 21 | 22 | image_transport 23 | cv_bridge 24 | 25 | -------------------------------------------------------------------------------- /ros/src/publisher/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(EXECUTABLE_TARGETS "") 2 | 3 | add_executable(video_publisher video_publisher.cc) 4 | list(APPEND EXECUTABLE_TARGETS video_publisher) 5 | set_target_properties(video_publisher PROPERTIES OUTPUT_NAME video PREFIX "") 6 | 7 | add_executable(image_publisher image_publisher.cc ${PLPSLAM_ROOT}/example/util/image_util.cc) 8 | target_include_directories(image_publisher PRIVATE ${PLPSLAM_ROOT}/example) 9 | list(APPEND EXECUTABLE_TARGETS image_publisher) 10 | set_target_properties(image_publisher PROPERTIES OUTPUT_NAME image PREFIX "") 11 | 12 | foreach(EXECUTABLE_TARGET IN LISTS EXECUTABLE_TARGETS) 13 | add_dependencies(${EXECUTABLE_TARGET} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 14 | endforeach() 15 | -------------------------------------------------------------------------------- /ros/src/publisher/src/image_publisher.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | int main(int argc, char* argv[]) { 14 | ros::init(argc, argv, "image_publisher"); 15 | 16 | // create options 17 | popl::OptionParser op("Allowed options"); 18 | auto help = op.add("h", "help", "produce help message"); 19 | auto img_dir_path = op.add>("i", "img-dir", "directory path which contains images"); 20 | auto img_fps = op.add>("", "fps", "FPS of images", 30); 21 | 22 | try { 23 | op.parse(argc, argv); 24 | } 25 | catch (const std::exception& e) { 26 | std::cerr << e.what() << std::endl; 27 | std::cerr << std::endl; 28 | std::cerr << op << std::endl; 29 | return EXIT_FAILURE; 30 | } 31 | 32 | // check validness of options 33 | if (help->is_set()) { 34 | std::cerr << op << std::endl; 35 | return EXIT_FAILURE; 36 | } 37 | if (!img_dir_path->is_set()) { 38 | std::cerr << "invalid arguments" << std::endl; 39 | std::cerr << std::endl; 40 | std::cerr << op << std::endl; 41 | return EXIT_FAILURE; 42 | } 43 | 44 | // initialize this node 45 | const ros::NodeHandle nh; 46 | image_transport::ImageTransport it(nh); 47 | image_transport::Publisher publisher = it.advertise("/video/image_raw", 1); 48 | 49 | sensor_msgs::ImagePtr msg; 50 | 51 | // load video file 52 | image_sequence sequence(img_dir_path->value(), img_fps->value()); 53 | const auto frames = sequence.get_frames(); 54 | 55 | ros::Rate pub_rate(img_fps->value()); 56 | 57 | for (unsigned int i = 0; i < frames.size() && nh.ok(); ++i) { 58 | const auto& frame = frames.at(i); 59 | std::cout << "next img: " << frame.img_path_ << std::endl; 60 | const auto img = cv::imread(frame.img_path_, cv::IMREAD_UNCHANGED); 61 | msg = cv_bridge::CvImage(std_msgs::Header(), "bgr8", img).toImageMsg(); 62 | publisher.publish(msg); 63 | ros::spinOnce(); 64 | pub_rate.sleep(); 65 | } 66 | return EXIT_SUCCESS; 67 | } -------------------------------------------------------------------------------- /ros/src/publisher/src/video_publisher.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | int main(int argc, char* argv[]) { 12 | ros::init(argc, argv, "video_publisher"); 13 | 14 | // create options 15 | popl::OptionParser op("Allowed options"); 16 | auto help = op.add("h", "help", "produce help message"); 17 | auto video_file_path = op.add>("m", "video", "video file path"); 18 | try { 19 | op.parse(argc, argv); 20 | } 21 | catch (const std::exception& e) { 22 | std::cerr << e.what() << std::endl; 23 | std::cerr << std::endl; 24 | std::cerr << op << std::endl; 25 | return EXIT_FAILURE; 26 | } 27 | 28 | // check validness of options 29 | if (help->is_set()) { 30 | std::cerr << op << std::endl; 31 | return EXIT_FAILURE; 32 | } 33 | if (!video_file_path->is_set()) { 34 | std::cerr << "invalid arguments" << std::endl; 35 | std::cerr << std::endl; 36 | std::cerr << op << std::endl; 37 | return EXIT_FAILURE; 38 | } 39 | 40 | // initialize this node 41 | const ros::NodeHandle nh; 42 | image_transport::ImageTransport it(nh); 43 | const image_transport::Publisher publisher = it.advertise("/video/image_raw", 1); 44 | 45 | cv::Mat frame; 46 | cv::VideoCapture video; 47 | sensor_msgs::ImagePtr msg; 48 | 49 | // load video file 50 | if (!video.open(video_file_path->value(), cv::CAP_FFMPEG)) { 51 | std::cerr << "can't load video file" << std::endl; 52 | std::cerr << std::endl; 53 | return EXIT_FAILURE; 54 | } 55 | 56 | ros::Rate pub_rate(video.get(cv::CAP_PROP_FPS)); 57 | 58 | while (nh.ok() && video.read(frame)) { 59 | // send message 60 | msg = cv_bridge::CvImage(std_msgs::Header(), "bgr8", frame).toImageMsg(); 61 | publisher.publish(msg); 62 | ros::spinOnce(); 63 | pub_rate.sleep(); 64 | } 65 | return EXIT_SUCCESS; 66 | } -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(PLPSLAM) 2 | 3 | if(USE_PANGOLIN_VIEWER) 4 | add_subdirectory(pangolin_viewer) 5 | endif() 6 | 7 | if(USE_SOCKET_PUBLISHER) 8 | add_subdirectory(socket_publisher) 9 | endif() 10 | -------------------------------------------------------------------------------- /src/PLPSLAM/camera/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/base.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/perspective.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/fisheye.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/equirectangular.h 8 | ${CMAKE_CURRENT_SOURCE_DIR}/base.cc 9 | ${CMAKE_CURRENT_SOURCE_DIR}/perspective.cc 10 | ${CMAKE_CURRENT_SOURCE_DIR}/fisheye.cc 11 | ${CMAKE_CURRENT_SOURCE_DIR}/equirectangular.cc) 12 | 13 | # Install headers 14 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 15 | install(FILES ${HEADERS} 16 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/camera) 17 | -------------------------------------------------------------------------------- /src/PLPSLAM/config.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_CONFIG_H 25 | #define PLPSLAM_CONFIG_H 26 | 27 | #include "PLPSLAM/camera/base.h" 28 | #include "PLPSLAM/feature/orb_params.h" 29 | 30 | #include 31 | 32 | namespace PLPSLAM 33 | { 34 | 35 | class config 36 | { 37 | public: 38 | //! Constructor 39 | explicit config(const std::string &config_file_path); 40 | explicit config(const YAML::Node &yaml_node, const std::string &config_file_path = ""); 41 | 42 | //! Destructor 43 | ~config(); 44 | 45 | friend std::ostream &operator<<(std::ostream &os, const config &cfg); 46 | 47 | //! path to config YAML file 48 | const std::string config_file_path_; 49 | 50 | //! YAML node 51 | const YAML::Node yaml_node_; 52 | 53 | //! Camera model 54 | camera::base *camera_ = nullptr; 55 | 56 | //! ORB feature parameters 57 | feature::orb_params orb_params_; 58 | 59 | //! depth threshold 60 | double true_depth_thr_ = 40.0; 61 | 62 | //! depthmap factor (pixel_value / depthmap_factor = true_depth) 63 | double depthmap_factor_ = 1.0; 64 | }; 65 | 66 | } // namespace PLPSLAM 67 | 68 | #endif // PLPSLAM_CONFIG_H 69 | -------------------------------------------------------------------------------- /src/PLPSLAM/data/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/bow_vocabulary.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/common.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/frame.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/keyframe.h 8 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/graph_node.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/camera_database.h 11 | ${CMAKE_CURRENT_SOURCE_DIR}/map_database.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/bow_database.h 13 | ${CMAKE_CURRENT_SOURCE_DIR}/frame_statistics.h 14 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_plane.h 15 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_line.h 16 | ${CMAKE_CURRENT_SOURCE_DIR}/common.cc 17 | ${CMAKE_CURRENT_SOURCE_DIR}/frame.cc 18 | ${CMAKE_CURRENT_SOURCE_DIR}/keyframe.cc 19 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark.cc 20 | ${CMAKE_CURRENT_SOURCE_DIR}/graph_node.cc 21 | ${CMAKE_CURRENT_SOURCE_DIR}/camera_database.cc 22 | ${CMAKE_CURRENT_SOURCE_DIR}/map_database.cc 23 | ${CMAKE_CURRENT_SOURCE_DIR}/bow_database.cc 24 | ${CMAKE_CURRENT_SOURCE_DIR}/frame_statistics.cc 25 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_plane.cc 26 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_line.cc) 27 | 28 | # Install headers 29 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 30 | install(FILES ${HEADERS} 31 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/data) 32 | -------------------------------------------------------------------------------- /src/PLPSLAM/data/bow_vocabulary.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_DATA_BOW_VOCABULARY_H 25 | #define PLPSLAM_DATA_BOW_VOCABULARY_H 26 | 27 | #ifdef USE_DBOW2 28 | #include 29 | #include 30 | #else 31 | #include 32 | #endif // USE_DBOW2 33 | 34 | namespace PLPSLAM 35 | { 36 | namespace data 37 | { 38 | 39 | #ifdef USE_DBOW2 40 | 41 | typedef DBoW2::TemplatedVocabulary bow_vocabulary; 42 | 43 | #else 44 | 45 | typedef fbow::Vocabulary bow_vocabulary; 46 | 47 | #endif // USE_DBOW2 48 | 49 | } // namespace data 50 | } // namespace PLPSLAM 51 | 52 | #endif // PLPSLAM_DATA_BOW_VOCABULARY_H 53 | -------------------------------------------------------------------------------- /src/PLPSLAM/data/camera_database.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_DATA_CAMERA_DATABASE_H 25 | #define PLPSLAM_DATA_CAMERA_DATABASE_H 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | namespace PLPSLAM 33 | { 34 | 35 | namespace camera 36 | { 37 | class base; 38 | } // namespace camera 39 | 40 | namespace data 41 | { 42 | 43 | class camera_database 44 | { 45 | public: 46 | explicit camera_database(camera::base *curr_camera); 47 | 48 | ~camera_database(); 49 | 50 | camera::base *get_camera(const std::string &camera_name) const; 51 | 52 | void from_json(const nlohmann::json &json_cameras); 53 | 54 | nlohmann::json to_json() const; 55 | 56 | private: 57 | //----------------------------------------- 58 | //! mutex to access the database 59 | mutable std::mutex mtx_database_; 60 | //! pointer to the camera which used in the current tracking 61 | //! (NOTE: the object is owned by config class, 62 | //! thus this class does NOT delete the object of curr_camera_) 63 | camera::base *curr_camera_ = nullptr; 64 | //! database (key: camera name, value: pointer of camera::base) 65 | //! (NOTE: tracking camera must NOT be contained in the database) 66 | std::unordered_map database_; 67 | }; 68 | 69 | } // namespace data 70 | } // namespace PLPSLAM 71 | 72 | #endif // PLPSLAM_DATA_CAMERA_DATABASE_H 73 | -------------------------------------------------------------------------------- /src/PLPSLAM/feature/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/orb_params.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/orb_extractor.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/orb_extractor_node.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/orb_params.cc 8 | ${CMAKE_CURRENT_SOURCE_DIR}/orb_extractor.cc 9 | ${CMAKE_CURRENT_SOURCE_DIR}/orb_extractor_node.cc 10 | 11 | ${CMAKE_CURRENT_SOURCE_DIR}/line_extractor.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/line_extractor.cc 13 | ) 14 | 15 | # Install headers 16 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 17 | install(FILES ${HEADERS} 18 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/feature) 19 | 20 | # FW: Append subdirectory for customized LSD and LBD (line segment detector and descriptor) 21 | add_subdirectory(line_descriptor) -------------------------------------------------------------------------------- /src/PLPSLAM/feature/line_descriptor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${PROJECT_NAME} 2 | PRIVATE 3 | ${CMAKE_CURRENT_SOURCE_DIR}/types_custom.hpp 4 | ${CMAKE_CURRENT_SOURCE_DIR}/descriptor_custom.hpp 5 | ${CMAKE_CURRENT_SOURCE_DIR}/line_descriptor_custom.hpp 6 | ${CMAKE_CURRENT_SOURCE_DIR}/precomp_custom.hpp 7 | ${CMAKE_CURRENT_SOURCE_DIR}/binary_descriptor_custom.cpp 8 | ${CMAKE_CURRENT_SOURCE_DIR}/binary_descriptor_matcher.cpp 9 | ${CMAKE_CURRENT_SOURCE_DIR}/bitarray_custom.hpp 10 | ${CMAKE_CURRENT_SOURCE_DIR}/bitops_custom.hpp 11 | ${CMAKE_CURRENT_SOURCE_DIR}/draw_custom.cpp 12 | ${CMAKE_CURRENT_SOURCE_DIR}/LSDDetector_custom.cpp 13 | ) 14 | 15 | # Install headers 16 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 17 | install(FILES ${HEADERS} 18 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/feature/line_descriptor) -------------------------------------------------------------------------------- /src/PLPSLAM/feature/line_descriptor/READEME.txt: -------------------------------------------------------------------------------- 1 | // see VINS-PL: https://github.com/cnqiangfu/PL-VINS 2 | // FW: I simply put everything together 3 | 4 | // include: 5 | line_descriptor_custom.hpp 6 | descriptor_custom.hpp 7 | 8 | // src: 9 | binary_descriptor_custom.cpp 10 | binary_descriptor_matcher.cpp 11 | bitarray_custom.hpp 12 | bitops_custom.hpp 13 | draw_custom.cpp 14 | LSDDetector_custom.cpp 15 | precomp_custom.hpp 16 | types_custom.hpp 17 | -------------------------------------------------------------------------------- /src/PLPSLAM/feature/orb_extractor_node.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_FEATURE_ORB_EXTRACTOR_NODE_H 25 | #define PLPSLAM_FEATURE_ORB_EXTRACTOR_NODE_H 26 | 27 | #include 28 | 29 | #include 30 | 31 | namespace PLPSLAM 32 | { 33 | namespace feature 34 | { 35 | 36 | class orb_extractor_node 37 | { 38 | public: 39 | //! Constructor 40 | orb_extractor_node() = default; 41 | 42 | //! Divide node to four child nodes 43 | std::array divide_node(); 44 | 45 | //! Keypoints which distributed into this node 46 | std::vector keypts_; 47 | 48 | //! Begin and end of the allocated area on the image 49 | cv::Point2i pt_begin_, pt_end_; 50 | 51 | //! A iterator pointing to self, used for removal on list 52 | std::list::iterator iter_; 53 | 54 | //! A flag designating if this node is a leaf node 55 | bool is_leaf_node_ = false; 56 | }; 57 | 58 | } // namespace feature 59 | } // namespace PLPSLAM 60 | 61 | #endif // PLPSLAM_FEATURE_ORB_EXTRACTOR_NODE_H 62 | -------------------------------------------------------------------------------- /src/PLPSLAM/initialize/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/base.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/perspective.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/bearing_vector.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/base.cc 8 | ${CMAKE_CURRENT_SOURCE_DIR}/perspective.cc 9 | ${CMAKE_CURRENT_SOURCE_DIR}/bearing_vector.cc) 10 | 11 | # Install headers 12 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 13 | install(FILES ${HEADERS} 14 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/initialize) 15 | -------------------------------------------------------------------------------- /src/PLPSLAM/initialize/bearing_vector.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_INITIALIZE_BEARING_VECTOR_H 25 | #define PLPSLAM_INITIALIZE_BEARING_VECTOR_H 26 | 27 | #include "PLPSLAM/type.h" 28 | #include "PLPSLAM/initialize/base.h" 29 | 30 | #include 31 | 32 | namespace PLPSLAM 33 | { 34 | 35 | namespace data 36 | { 37 | class frame; 38 | } // namespace data 39 | 40 | namespace initialize 41 | { 42 | 43 | class bearing_vector final : public base 44 | { 45 | public: 46 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW 47 | 48 | bearing_vector() = delete; 49 | 50 | //! Constructor 51 | bearing_vector(const data::frame &ref_frm, 52 | const unsigned int num_ransac_iters, const unsigned int min_num_triangulated, 53 | const float parallax_deg_thr, const float reproj_err_thr); 54 | 55 | //! Destructor 56 | ~bearing_vector() override; 57 | 58 | //! Initialize with the current frame 59 | bool initialize(const data::frame &cur_frm, const std::vector &ref_matches_with_cur) override; 60 | 61 | private: 62 | //! Reconstruct the initial map with the E matrix 63 | //! (NOTE: the output variables will be set if succeeded) 64 | bool reconstruct_with_E(const Mat33_t &E_ref_to_cur, const std::vector &is_inlier_match); 65 | }; 66 | 67 | } // namespace initialize 68 | } // namespace PLPSLAM 69 | 70 | #endif // PLPSLAM_INITIALIZE_BEARING_VECTOR_H 71 | -------------------------------------------------------------------------------- /src/PLPSLAM/io/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/trajectory_io.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/map_database_io.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/trajectory_io.cc 7 | ${CMAKE_CURRENT_SOURCE_DIR}/map_database_io.cc) 8 | 9 | # Install headers 10 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 11 | install(FILES ${HEADERS} 12 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/io) 13 | -------------------------------------------------------------------------------- /src/PLPSLAM/io/trajectory_io.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_IO_TRAJECTORY_IO_H 25 | #define PLPSLAM_IO_TRAJECTORY_IO_H 26 | 27 | #include 28 | 29 | namespace PLPSLAM 30 | { 31 | 32 | namespace data 33 | { 34 | class map_database; 35 | } // namespace data 36 | 37 | namespace io 38 | { 39 | 40 | class trajectory_io 41 | { 42 | public: 43 | /** 44 | * Constructor 45 | */ 46 | explicit trajectory_io(data::map_database *map_db); 47 | 48 | /** 49 | * Destructor 50 | */ 51 | ~trajectory_io() = default; 52 | 53 | /** 54 | * Save the frame trajectory in the specified format 55 | */ 56 | void save_frame_trajectory(const std::string &path, const std::string &format) const; 57 | 58 | /** 59 | * Save the keyframe trajectory in the specified format 60 | */ 61 | void save_keyframe_trajectory(const std::string &path, const std::string &format) const; 62 | 63 | private: 64 | //! map_database 65 | data::map_database *const map_db_ = nullptr; 66 | }; 67 | 68 | } // namespace io 69 | } // namespace PLPSLAM 70 | 71 | #endif // PLPSLAM_IO_TRAJECTORY_IO_H 72 | -------------------------------------------------------------------------------- /src/PLPSLAM/match/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/area.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/bow_tree.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/fuse.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/projection.h 8 | ${CMAKE_CURRENT_SOURCE_DIR}/robust.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/stereo.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/area.cc 11 | ${CMAKE_CURRENT_SOURCE_DIR}/bow_tree.cc 12 | ${CMAKE_CURRENT_SOURCE_DIR}/fuse.cc 13 | ${CMAKE_CURRENT_SOURCE_DIR}/projection.cc 14 | ${CMAKE_CURRENT_SOURCE_DIR}/robust.cc 15 | ${CMAKE_CURRENT_SOURCE_DIR}/stereo.cc) 16 | 17 | # Install headers 18 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 19 | install(FILES ${HEADERS} 20 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/match) 21 | -------------------------------------------------------------------------------- /src/PLPSLAM/match/area.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_MATCH_AREA_H 25 | #define PLPSLAM_MATCH_AREA_H 26 | 27 | #include "PLPSLAM/match/base.h" 28 | 29 | namespace PLPSLAM 30 | { 31 | 32 | namespace data 33 | { 34 | class frame; 35 | } // namespace data 36 | 37 | namespace match 38 | { 39 | 40 | class area final : public base 41 | { 42 | public: 43 | area(const float lowe_ratio, const bool check_orientation) 44 | : base(lowe_ratio, check_orientation) {} 45 | 46 | ~area() final = default; 47 | 48 | unsigned int match_in_consistent_area(data::frame &frm_1, data::frame &frm_2, std::vector &prev_matched_pts, 49 | std::vector &matched_indices_2_in_frm_1, int margin = 10); 50 | }; 51 | 52 | } // namespace match 53 | } // namespace PLPSLAM 54 | 55 | #endif // PLPSLAM_MATCH_AREA_H 56 | -------------------------------------------------------------------------------- /src/PLPSLAM/match/robust.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_MATCH_ROBUST_H 25 | #define PLPSLAM_MATCH_ROBUST_H 26 | 27 | #include "PLPSLAM/type.h" 28 | #include "PLPSLAM/match/base.h" 29 | 30 | namespace PLPSLAM 31 | { 32 | 33 | namespace data 34 | { 35 | class frame; 36 | class keyframe; 37 | class landmark; 38 | } // namespace data 39 | 40 | namespace match 41 | { 42 | 43 | class robust final : public base 44 | { 45 | public: 46 | explicit robust(const float lowe_ratio, const bool check_orientation) 47 | : base(lowe_ratio, check_orientation) {} 48 | 49 | ~robust() final = default; 50 | 51 | unsigned int match_for_triangulation(data::keyframe *keyfrm_1, data::keyframe *keyfrm_2, const Mat33_t &E_12, 52 | std::vector> &matched_idx_pairs); 53 | 54 | unsigned int match_frame_and_keyframe(data::frame &frm, data::keyframe *keyfrm, 55 | std::vector &matched_lms_in_frm); 56 | 57 | unsigned int brute_force_match(data::frame &frm, data::keyframe *keyfrm, std::vector> &matches); 58 | 59 | private: 60 | bool check_epipolar_constraint(const Vec3_t &bearing_1, const Vec3_t &bearing_2, 61 | const Mat33_t &E_12, const float bearing_1_scale_factor = 1.0); 62 | }; 63 | 64 | } // namespace match 65 | } // namespace PLPSLAM 66 | 67 | #endif // PLPSLAM_MATCH_ROBUST_H 68 | -------------------------------------------------------------------------------- /src/PLPSLAM/module/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/initializer.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/relocalizer.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/frame_tracker.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/keyframe_inserter.h 8 | ${CMAKE_CURRENT_SOURCE_DIR}/two_view_triangulator.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/two_view_triangulator_line.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/local_map_cleaner.h 11 | ${CMAKE_CURRENT_SOURCE_DIR}/local_map_updater.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/loop_detector.h 13 | ${CMAKE_CURRENT_SOURCE_DIR}/loop_bundle_adjuster.h 14 | ${CMAKE_CURRENT_SOURCE_DIR}/initializer.cc 15 | ${CMAKE_CURRENT_SOURCE_DIR}/relocalizer.cc 16 | ${CMAKE_CURRENT_SOURCE_DIR}/frame_tracker.cc 17 | ${CMAKE_CURRENT_SOURCE_DIR}/keyframe_inserter.cc 18 | ${CMAKE_CURRENT_SOURCE_DIR}/two_view_triangulator.cc 19 | ${CMAKE_CURRENT_SOURCE_DIR}/two_view_triangulator_line.cc 20 | ${CMAKE_CURRENT_SOURCE_DIR}/local_map_cleaner.cc 21 | ${CMAKE_CURRENT_SOURCE_DIR}/local_map_updater.cc 22 | ${CMAKE_CURRENT_SOURCE_DIR}/loop_detector.cc 23 | ${CMAKE_CURRENT_SOURCE_DIR}/loop_bundle_adjuster.cc 24 | ) 25 | 26 | # Install headers 27 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 28 | install(FILES ${HEADERS} 29 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/module) 30 | -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/pose_optimizer.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/pose_optimizer_extended_line.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/local_bundle_adjuster.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/local_bundle_adjuster_extended_plane.h 8 | ${CMAKE_CURRENT_SOURCE_DIR}/local_bundle_adjuster_extended_line.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/transform_optimizer.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/graph_optimizer.h 11 | ${CMAKE_CURRENT_SOURCE_DIR}/global_bundle_adjuster.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/pose_optimizer.cc 13 | ${CMAKE_CURRENT_SOURCE_DIR}/pose_optimizer_extended_line.cc 14 | ${CMAKE_CURRENT_SOURCE_DIR}/local_bundle_adjuster.cc 15 | ${CMAKE_CURRENT_SOURCE_DIR}/local_bundle_adjuster_extended_plane.cc 16 | ${CMAKE_CURRENT_SOURCE_DIR}/local_bundle_adjuster_extended_line.cc 17 | ${CMAKE_CURRENT_SOURCE_DIR}/transform_optimizer.cc 18 | ${CMAKE_CURRENT_SOURCE_DIR}/graph_optimizer.cc 19 | ${CMAKE_CURRENT_SOURCE_DIR}/global_bundle_adjuster.cc) 20 | 21 | # Install headers 22 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 23 | install(FILES ${HEADERS} 24 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/optimize) 25 | 26 | # Append subdirectory 27 | add_subdirectory(g2o) 28 | -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/g2o/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_vertex.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_vertex_container.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/Plane3D.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_vertex_plane.h 8 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_vertex_plane_container.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/line3d.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_vertex_line3d.h 11 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_vertex_container_line3d.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_vertex.cc 13 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_vertex_container.cc 14 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_vertex_plane.cc 15 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_vertex_plane_container.cc 16 | ${CMAKE_CURRENT_SOURCE_DIR}/line3d.cc 17 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_vertex_line3d.cc 18 | ${CMAKE_CURRENT_SOURCE_DIR}/landmark_vertex_container_line3d.cc 19 | ) 20 | 21 | # Install headers 22 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 23 | install(FILES ${HEADERS} 24 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/optimize/g2o) 25 | 26 | # Append subdirectory 27 | add_subdirectory(se3) 28 | add_subdirectory(sim3) 29 | 30 | add_subdirectory(extended) # for additional landmark plane -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/g2o/extended/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/plane_point_distance_edge.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/plane_point_distance_edge.cc 6 | ${CMAKE_CURRENT_SOURCE_DIR}/point2plane_distance_edge_wrapper.h 7 | ) 8 | 9 | # Install headers 10 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 11 | install(FILES ${HEADERS} 12 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/optimize/g2o/extended) 13 | -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/g2o/landmark_vertex.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #include "PLPSLAM/optimize/g2o/landmark_vertex.h" 25 | 26 | namespace PLPSLAM 27 | { 28 | namespace optimize 29 | { 30 | namespace g2o 31 | { 32 | 33 | landmark_vertex::landmark_vertex() : BaseVertex<3, Vec3_t>() 34 | { 35 | } 36 | 37 | bool landmark_vertex::read(std::istream &is) 38 | { 39 | Vec3_t lv; 40 | for (unsigned int i = 0; i < 3; ++i) 41 | { 42 | is >> _estimate(i); 43 | } 44 | return true; 45 | } 46 | 47 | bool landmark_vertex::write(std::ostream &os) const 48 | { 49 | const Vec3_t pos_w = estimate(); 50 | for (unsigned int i = 0; i < 3; ++i) 51 | { 52 | os << pos_w(i) << " "; 53 | } 54 | return os.good(); 55 | } 56 | 57 | } // namespace g2o 58 | } // namespace optimize 59 | } // namespace PLPSLAM 60 | -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/g2o/landmark_vertex_line3d.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Developed by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #include "PLPSLAM/optimize/g2o/landmark_vertex_line3d.h" 25 | 26 | namespace PLPSLAM 27 | { 28 | namespace optimize 29 | { 30 | namespace g2o 31 | { 32 | VertexLine3D::VertexLine3D() : ::g2o::BaseVertex<4, Line3D>() 33 | { 34 | } 35 | 36 | bool VertexLine3D::read(std::istream &is) 37 | { 38 | Vector6 lv; 39 | bool state = ::g2o::internal::readVector(is, lv); 40 | setEstimate(Line3D(lv)); 41 | return state; 42 | } 43 | 44 | bool VertexLine3D::write(std::ostream &os) const 45 | { 46 | return ::g2o::internal::writeVector(os, _estimate); 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/g2o/landmark_vertex_plane.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Developed by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #include "PLPSLAM/optimize/g2o/landmark_vertex_plane.h" 25 | 26 | namespace PLPSLAM 27 | { 28 | namespace optimize 29 | { 30 | namespace g2o 31 | { 32 | landmark_vertex_plane::landmark_vertex_plane() 33 | : ::g2o::BaseVertex<3, Plane3D>() 34 | { 35 | } 36 | 37 | bool landmark_vertex_plane::read(std::istream &is) 38 | { 39 | ::g2o::Vector4 lv; 40 | bool state = ::g2o::internal::readVector(is, lv); 41 | setEstimate(Plane3D(lv)); 42 | return state; 43 | } 44 | 45 | bool landmark_vertex_plane::write(std::ostream &os) const 46 | { 47 | bool state = ::g2o::internal::writeVector(os, _estimate.toVector()); 48 | return state; 49 | } 50 | } // namespace g2o 51 | } // namespace optimize 52 | } // namespace PLPSLAM 53 | -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/g2o/se3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/shot_vertex.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/shot_vertex_container.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/perspective_pose_opt_edge.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/perspective_reproj_edge.h 8 | ${CMAKE_CURRENT_SOURCE_DIR}/equirectangular_pose_opt_edge.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/equirectangular_reproj_edge.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/reproj_edge_line3d_orthonormal.h 11 | ${CMAKE_CURRENT_SOURCE_DIR}/pose_opt_edge_line3d_orthonormal.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/shot_vertex.cc 13 | ${CMAKE_CURRENT_SOURCE_DIR}/shot_vertex_container.cc 14 | ${CMAKE_CURRENT_SOURCE_DIR}/perspective_pose_opt_edge.cc 15 | ${CMAKE_CURRENT_SOURCE_DIR}/perspective_reproj_edge.cc 16 | ${CMAKE_CURRENT_SOURCE_DIR}/equirectangular_pose_opt_edge.cc 17 | ${CMAKE_CURRENT_SOURCE_DIR}/equirectangular_reproj_edge.cc 18 | ${CMAKE_CURRENT_SOURCE_DIR}/reproj_edge_line3d_orthonormal.cc 19 | ${CMAKE_CURRENT_SOURCE_DIR}/pose_opt_edge_line3d_orthonormal.cc 20 | ) 21 | 22 | # Install headers 23 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 24 | install(FILES ${HEADERS} 25 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/optimize/g2o/se3) 26 | -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/g2o/se3/shot_vertex.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #include "PLPSLAM/optimize/g2o/se3/shot_vertex.h" 25 | 26 | namespace PLPSLAM 27 | { 28 | namespace optimize 29 | { 30 | namespace g2o 31 | { 32 | namespace se3 33 | { 34 | 35 | shot_vertex::shot_vertex() 36 | : BaseVertex<6, ::g2o::SE3Quat>() 37 | { 38 | } 39 | 40 | bool shot_vertex::read(std::istream &is) 41 | { 42 | Vec7_t estimate; 43 | for (unsigned int i = 0; i < 7; ++i) 44 | { 45 | is >> estimate(i); 46 | } 47 | ::g2o::SE3Quat g2o_cam_pose_wc; 48 | g2o_cam_pose_wc.fromVector(estimate); 49 | setEstimate(g2o_cam_pose_wc.inverse()); 50 | return true; 51 | } 52 | 53 | bool shot_vertex::write(std::ostream &os) const 54 | { 55 | ::g2o::SE3Quat g2o_cam_pose_wc(estimate().inverse()); 56 | for (unsigned int i = 0; i < 7; ++i) 57 | { 58 | os << g2o_cam_pose_wc[i] << " "; 59 | } 60 | return os.good(); 61 | } 62 | 63 | } // namespace se3 64 | } // namespace g2o 65 | } // namespace optimize 66 | } // namespace PLPSLAM 67 | -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/g2o/se3/shot_vertex.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_OPTIMIZER_G2O_SE3_SHOT_VERTEX_H 25 | #define PLPSLAM_OPTIMIZER_G2O_SE3_SHOT_VERTEX_H 26 | 27 | #include "PLPSLAM/type.h" 28 | 29 | #include 30 | #include 31 | 32 | namespace PLPSLAM 33 | { 34 | namespace optimize 35 | { 36 | namespace g2o 37 | { 38 | namespace se3 39 | { 40 | 41 | class shot_vertex final : public ::g2o::BaseVertex<6, ::g2o::SE3Quat> 42 | { 43 | // vertex for frame/keyframe 44 | public: 45 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW 46 | 47 | shot_vertex(); 48 | 49 | bool read(std::istream &is) override; 50 | 51 | bool write(std::ostream &os) const override; 52 | 53 | void setToOriginImpl() override 54 | { 55 | _estimate = ::g2o::SE3Quat(); 56 | } 57 | 58 | void oplusImpl(const number_t *update_) override 59 | { 60 | Eigen::Map update(update_); 61 | setEstimate(::g2o::SE3Quat::exp(update) * estimate()); 62 | } 63 | }; 64 | 65 | } // namespace se3 66 | } // namespace g2o 67 | } // namespace optimize 68 | } // namespace PLPSLAM 69 | 70 | #endif // PLPSLAM_OPTIMIZER_G2O_SE3_SHOT_VERTEX_H 71 | -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/g2o/se3/shot_vertex_container.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #include "PLPSLAM/optimize/g2o/se3/shot_vertex_container.h" 25 | #include "PLPSLAM/util/converter.h" 26 | 27 | namespace PLPSLAM 28 | { 29 | namespace optimize 30 | { 31 | namespace g2o 32 | { 33 | namespace se3 34 | { 35 | 36 | shot_vertex_container::shot_vertex_container(const unsigned int offset, const unsigned int num_reserve) 37 | : offset_(offset) 38 | { 39 | vtx_container_.reserve(num_reserve); 40 | } 41 | 42 | shot_vertex *shot_vertex_container::create_vertex(const unsigned int id, const Mat44_t &cam_pose_cw, const bool is_constant) 43 | { 44 | // Create vertex 45 | const auto vtx_id = offset_ + id; 46 | auto vtx = new shot_vertex(); 47 | vtx->setId(vtx_id); 48 | vtx->setEstimate(util::converter::to_g2o_SE3(cam_pose_cw)); 49 | vtx->setFixed(is_constant); 50 | // Register in database 51 | vtx_container_[id] = vtx; 52 | // Update max ID 53 | if (max_vtx_id_ < vtx_id) 54 | { 55 | max_vtx_id_ = vtx_id; 56 | } 57 | // Return the created vertex 58 | return vtx; 59 | } 60 | 61 | } // namespace se3 62 | } // namespace g2o 63 | } // namespace optimize 64 | } // namespace PLPSLAM 65 | -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/g2o/sim3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/shot_vertex.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/graph_opt_edge.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/transform_vertex.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/backward_reproj_edge.h 8 | ${CMAKE_CURRENT_SOURCE_DIR}/forward_reproj_edge.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/shot_vertex.cc 10 | ${CMAKE_CURRENT_SOURCE_DIR}/graph_opt_edge.cc 11 | ${CMAKE_CURRENT_SOURCE_DIR}/transform_vertex.cc 12 | ${CMAKE_CURRENT_SOURCE_DIR}/backward_reproj_edge.cc 13 | ${CMAKE_CURRENT_SOURCE_DIR}/forward_reproj_edge.cc) 14 | 15 | # Install headers 16 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 17 | install(FILES ${HEADERS} 18 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/optimize/g2o/sim3) 19 | -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/g2o/sim3/shot_vertex.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #include "PLPSLAM/optimize/g2o/sim3/shot_vertex.h" 25 | 26 | namespace PLPSLAM 27 | { 28 | namespace optimize 29 | { 30 | namespace g2o 31 | { 32 | namespace sim3 33 | { 34 | 35 | shot_vertex::shot_vertex() : ::g2o::BaseVertex<7, ::g2o::Sim3>() 36 | { 37 | } 38 | 39 | bool shot_vertex::read(std::istream &is) 40 | { 41 | Vec7_t g2o_sim3_wc; 42 | for (int i = 0; i < 7; ++i) 43 | { 44 | is >> g2o_sim3_wc(i); 45 | } 46 | setEstimate(::g2o::Sim3(g2o_sim3_wc).inverse()); 47 | return true; 48 | } 49 | 50 | bool shot_vertex::write(std::ostream &os) const 51 | { 52 | ::g2o::Sim3 g2o_Sim3_wc(estimate().inverse()); 53 | const Vec7_t g2o_sim3_wc = g2o_Sim3_wc.log(); 54 | for (int i = 0; i < 7; ++i) 55 | { 56 | os << g2o_sim3_wc(i) << " "; 57 | } 58 | return os.good(); 59 | } 60 | 61 | } // namespace sim3 62 | } // namespace g2o 63 | } // namespace optimize 64 | } // namespace PLPSLAM 65 | -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/g2o/sim3/transform_vertex.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #include "PLPSLAM/optimize/g2o/sim3/transform_vertex.h" 25 | 26 | namespace PLPSLAM 27 | { 28 | namespace optimize 29 | { 30 | namespace g2o 31 | { 32 | namespace sim3 33 | { 34 | 35 | sim3::transform_vertex::transform_vertex() 36 | : ::g2o::BaseVertex<7, ::g2o::Sim3>() 37 | { 38 | } 39 | 40 | bool transform_vertex::read(std::istream &is) 41 | { 42 | Vec7_t g2o_sim3_wc; 43 | for (int i = 0; i < 7; ++i) 44 | { 45 | is >> g2o_sim3_wc(i); 46 | } 47 | setEstimate(::g2o::Sim3(g2o_sim3_wc).inverse()); 48 | return true; 49 | } 50 | 51 | bool transform_vertex::write(std::ostream &os) const 52 | { 53 | ::g2o::Sim3 g2o_Sim3_wc(estimate().inverse()); 54 | const Vec7_t g2o_sim3_wc = g2o_Sim3_wc.log(); 55 | for (int i = 0; i < 7; ++i) 56 | { 57 | os << g2o_sim3_wc(i) << " "; 58 | } 59 | return os.good(); 60 | } 61 | 62 | } // namespace sim3 63 | } // namespace g2o 64 | } // namespace optimize 65 | } // namespace PLPSLAM -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/local_bundle_adjuster.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_OPTIMIZE_LOCAL_BUNDLE_ADJUSTER_H 25 | #define PLPSLAM_OPTIMIZE_LOCAL_BUNDLE_ADJUSTER_H 26 | 27 | namespace PLPSLAM 28 | { 29 | 30 | namespace data 31 | { 32 | class keyframe; 33 | class map_database; 34 | } // namespace data 35 | 36 | namespace optimize 37 | { 38 | class local_bundle_adjuster 39 | { 40 | public: 41 | /** 42 | * Constructor 43 | * @param map_db 44 | * @param num_first_iter 45 | * @param num_second_iter 46 | */ 47 | explicit local_bundle_adjuster(data::map_database *map_db, 48 | const unsigned int num_first_iter = 5, 49 | const unsigned int num_second_iter = 10); 50 | 51 | /** 52 | * Destructor 53 | */ 54 | virtual ~local_bundle_adjuster() = default; 55 | 56 | /** 57 | * Perform optimization, local BA for keyframe 58 | * @param curr_keyfrm 59 | * @param force_stop_flag 60 | */ 61 | void optimize(data::keyframe *curr_keyfrm, bool *const force_stop_flag) const; 62 | 63 | private: 64 | data::map_database *_map_db; 65 | 66 | //! number of iterations of first optimization 67 | const unsigned int num_first_iter_; // 5 68 | //! number of iterations of second optimization 69 | const unsigned int num_second_iter_; // 10 70 | }; 71 | 72 | } // namespace optimize 73 | } // namespace PLPSLAM 74 | 75 | #endif // PLPSLAM_OPTIMIZE_LOCAL_BUNDLE_ADJUSTER_H 76 | -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/local_bundle_adjuster_extended_plane.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Developed by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_OPTIMIZE_LOCAL_BUNDLE_ADJUSTER_EXTENDED_PLANE_H 25 | #define PLPSLAM_OPTIMIZE_LOCAL_BUNDLE_ADJUSTER_EXTENDED_PLANE_H 26 | 27 | namespace PLPSLAM 28 | { 29 | namespace data 30 | { 31 | class keyframe; 32 | class map_database; 33 | class Plane; // FW: 34 | } 35 | 36 | namespace optimize 37 | { 38 | class local_bundle_adjuster_extended_plane 39 | { 40 | public: 41 | explicit local_bundle_adjuster_extended_plane(data::map_database *map_db, 42 | const unsigned int num_first_iter = 5, 43 | const unsigned int num_second_iter = 10); 44 | 45 | virtual ~local_bundle_adjuster_extended_plane() = default; 46 | 47 | void optimize(data::keyframe *curr_keyfrm, bool *const force_stop_flag) const; 48 | 49 | private: 50 | data::map_database *_map_db; 51 | 52 | //! number of iterations of first optimization 53 | const unsigned int num_first_iter_; // 5 54 | //! number of iterations of second optimization 55 | const unsigned int num_second_iter_; // 10 56 | }; 57 | 58 | } // namespace optimize 59 | } // namespace PLPSLAM 60 | 61 | #endif -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/pose_optimizer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_OPTIMIZE_POSE_OPTIMIZER_H 25 | #define PLPSLAM_OPTIMIZE_POSE_OPTIMIZER_H 26 | 27 | namespace PLPSLAM 28 | { 29 | 30 | namespace data 31 | { 32 | class frame; 33 | } 34 | 35 | namespace optimize 36 | { 37 | 38 | class pose_optimizer 39 | { 40 | public: 41 | /** 42 | * Constructor 43 | * @param num_trials 44 | * @param num_each_iter 45 | */ 46 | explicit pose_optimizer(const unsigned int num_trials = 4, const unsigned int num_each_iter = 10); 47 | 48 | /** 49 | * Destructor 50 | */ 51 | virtual ~pose_optimizer() = default; 52 | 53 | /** 54 | * Perform pose optimization 55 | * @param frm 56 | * @return 57 | */ 58 | unsigned int optimize(data::frame &frm) const; 59 | 60 | private: 61 | //! Number of robust optimization trials 62 | const unsigned int num_trials_ = 4; 63 | 64 | //! Number of optimization iterations 65 | const unsigned int num_each_iter_ = 10; 66 | }; 67 | 68 | } // namespace optimize 69 | } // namespace PLPSLAM 70 | 71 | #endif // PLPSLAM_OPTIMIZE_POSE_OPTIMIZER_H 72 | -------------------------------------------------------------------------------- /src/PLPSLAM/optimize/pose_optimizer_extended_line.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Developed by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_OPTIMIZE_POSE_OPTIMIZER_EXTENDED_LINE_H 25 | #define PLPSLAM_OPTIMIZE_POSE_OPTIMIZER_EXTENDED_LINE_H 26 | 27 | namespace PLPSLAM 28 | { 29 | 30 | namespace data 31 | { 32 | class frame; 33 | } 34 | 35 | namespace optimize 36 | { 37 | 38 | class pose_optimizer_extended_line 39 | { 40 | public: 41 | /** 42 | * Constructor 43 | * @param num_trials 44 | * @param num_each_iter 45 | */ 46 | explicit pose_optimizer_extended_line(const unsigned int num_trials = 4, const unsigned int num_each_iter = 10); 47 | 48 | /** 49 | * Destructor 50 | */ 51 | virtual ~pose_optimizer_extended_line() = default; 52 | 53 | /** 54 | * Perform pose optimization 55 | * @param frm 56 | * @return 57 | */ 58 | unsigned int optimize(data::frame &frm) const; 59 | 60 | private: 61 | //! Number of robust optimization trials 62 | const unsigned int num_trials_ = 4; 63 | 64 | //! Number of optimization iterations 65 | const unsigned int num_each_iter_ = 10; 66 | }; 67 | } 68 | } 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /src/PLPSLAM/publish/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/frame_publisher.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/map_publisher.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/frame_publisher.cc 7 | ${CMAKE_CURRENT_SOURCE_DIR}/map_publisher.cc) 8 | 9 | # Install headers 10 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 11 | install(FILES ${HEADERS} 12 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/publish) 13 | -------------------------------------------------------------------------------- /src/PLPSLAM/solve/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/common.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/homography_solver.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/fundamental_solver.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/essential_solver.h 8 | ${CMAKE_CURRENT_SOURCE_DIR}/pnp_solver.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/sim3_solver.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/common.cc 11 | ${CMAKE_CURRENT_SOURCE_DIR}/homography_solver.cc 12 | ${CMAKE_CURRENT_SOURCE_DIR}/fundamental_solver.cc 13 | ${CMAKE_CURRENT_SOURCE_DIR}/essential_solver.cc 14 | ${CMAKE_CURRENT_SOURCE_DIR}/pnp_solver.cc 15 | ${CMAKE_CURRENT_SOURCE_DIR}/sim3_solver.cc) 16 | 17 | # Install headers 18 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 19 | install(FILES ${HEADERS} 20 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/solve) 21 | 22 | # FW: Append subdirectory for recent advances of Robust Estimator 23 | add_subdirectory(GCRANSAC) # Graph-cut RANSAC -------------------------------------------------------------------------------- /src/PLPSLAM/solve/GCRANSAC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/model.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/flann_neighborhood_graph.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/GCRANSAC.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/grid_neighborhood_graph.h 8 | ${CMAKE_CURRENT_SOURCE_DIR}/neighborhood_graph.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/preemption_empty.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/preemption_sprt.h 11 | ${CMAKE_CURRENT_SOURCE_DIR}/progressive_napsac_sampler.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/prosac_sampler.h 13 | ${CMAKE_CURRENT_SOURCE_DIR}/sampler.h 14 | ${CMAKE_CURRENT_SOURCE_DIR}/scoring_function.h 15 | ${CMAKE_CURRENT_SOURCE_DIR}/settings.h 16 | ${CMAKE_CURRENT_SOURCE_DIR}/single_point_sampler.h 17 | ${CMAKE_CURRENT_SOURCE_DIR}/statistics.h 18 | ${CMAKE_CURRENT_SOURCE_DIR}/types.h 19 | ${CMAKE_CURRENT_SOURCE_DIR}/uniform_random_generator.h 20 | ${CMAKE_CURRENT_SOURCE_DIR}/uniform_sampler.h 21 | ) 22 | 23 | # Install headers 24 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 25 | install(FILES ${HEADERS} 26 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/solve/GCRANSAC) 27 | 28 | add_subdirectory(pearl) # Graph-cut RANSAC 29 | add_subdirectory(solver) # Graph-cut RANSAC 30 | add_subdirectory(estimator) # Graph-cut RANSAC 31 | -------------------------------------------------------------------------------- /src/PLPSLAM/solve/GCRANSAC/estimator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/estimator.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/essential_estimator.h 6 | 7 | # ${CMAKE_CURRENT_SOURCE_DIR}/perspective_n_point_estimator.h 8 | # ${CMAKE_CURRENT_SOURCE_DIR}/rigid_transformation_estimator.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/sample_consensus_estimator.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/fundamental_estimator.h 11 | ${CMAKE_CURRENT_SOURCE_DIR}/homography_estimator.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/linear_model_estimator.h 13 | ) 14 | 15 | # Install headers 16 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 17 | install(FILES ${HEADERS} 18 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/solve/GCRANSAC/estimator) -------------------------------------------------------------------------------- /src/PLPSLAM/solve/GCRANSAC/pearl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/block.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/graph.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/energy.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/GCoptimization.h 8 | ${CMAKE_CURRENT_SOURCE_DIR}/LinkedBlockList.h 9 | 10 | ${CMAKE_CURRENT_SOURCE_DIR}/graph.cpp 11 | ${CMAKE_CURRENT_SOURCE_DIR}/GCoptimization.cpp 12 | ${CMAKE_CURRENT_SOURCE_DIR}/LinkedBlockList.cpp 13 | ${CMAKE_CURRENT_SOURCE_DIR}/maxflow.cpp 14 | ) 15 | 16 | # Install headers 17 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 18 | install(FILES ${HEADERS} 19 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/solve/GCRANSAC/pearl) 20 | -------------------------------------------------------------------------------- /src/PLPSLAM/solve/GCRANSAC/pearl/LinkedBlockList.cpp: -------------------------------------------------------------------------------- 1 | #include "PLPSLAM/solve/GCRANSAC/pearl/LinkedBlockList.h" 2 | #include 3 | #include 4 | 5 | /*********************************************************************/ 6 | 7 | void LinkedBlockList::addFront(ListType item) 8 | { 9 | 10 | if (m_head_block_size == GCLL_BLOCK_SIZE) 11 | { 12 | LLBlock *tmp = (LLBlock *)new LLBlock; 13 | if (!tmp) 14 | { 15 | printf("\nOut of memory"); 16 | exit(1); 17 | } 18 | tmp->m_next = m_head; 19 | m_head = tmp; 20 | m_head_block_size = 0; 21 | } 22 | 23 | m_head->m_item[m_head_block_size] = item; 24 | m_head_block_size++; 25 | } 26 | 27 | /*********************************************************************/ 28 | 29 | ListType LinkedBlockList::next() 30 | { 31 | ListType toReturn = m_cursor->m_item[m_cursor_ind]; 32 | 33 | m_cursor_ind++; 34 | 35 | if (m_cursor == m_head && m_cursor_ind >= m_head_block_size) 36 | { 37 | m_cursor = m_cursor->m_next; 38 | m_cursor_ind = 0; 39 | } 40 | else if (m_cursor_ind == GCLL_BLOCK_SIZE) 41 | { 42 | m_cursor = m_cursor->m_next; 43 | m_cursor_ind = 0; 44 | } 45 | return (toReturn); 46 | } 47 | 48 | /*********************************************************************/ 49 | 50 | bool LinkedBlockList::hasNext() 51 | { 52 | if (m_cursor != 0) 53 | return (true); 54 | else 55 | return (false); 56 | } 57 | 58 | /*********************************************************************/ 59 | 60 | LinkedBlockList::~LinkedBlockList() 61 | { 62 | LLBlock *tmp; 63 | 64 | while (m_head != 0) 65 | { 66 | tmp = m_head; 67 | m_head = m_head->m_next; 68 | delete tmp; 69 | } 70 | }; 71 | 72 | /*********************************************************************/ 73 | -------------------------------------------------------------------------------- /src/PLPSLAM/solve/GCRANSAC/pearl/LinkedBlockList.h: -------------------------------------------------------------------------------- 1 | /* Singly Linked List of Blocks */ 2 | // This data structure should be used only for the GCoptimization class implementation 3 | // because it lucks some important general functions for general list, like remove_item() 4 | // The head block may be not full 5 | // For regular 2D grids, it's better to set GCLL_BLOCK_SIZE to 2 6 | // For other graphs, it should be set to the average expected number of neighbors 7 | // Data in linked list for the neighborhood system is allocated in blocks of size GCLL_BLOCK_SIZE 8 | 9 | #ifndef __LINKEDBLOCKLIST_H__ 10 | #define __LINKEDBLOCKLIST_H__ 11 | 12 | #define GCLL_BLOCK_SIZE 4 13 | // GCLL_BLOCKSIZE should "fit" into the type BlockType. That is 14 | // if GCLL_BLOCKSIZE is larger than 255 but smaller than largest short integer 15 | // then BlockType should be set to short 16 | typedef char BlockType; 17 | 18 | //The type of data stored in the linked list 19 | typedef void *ListType; 20 | 21 | class LinkedBlockList 22 | { 23 | 24 | public: 25 | void addFront(ListType item); 26 | inline bool isEmpty() 27 | { 28 | if (m_head == 0) 29 | return (true); 30 | else 31 | return (false); 32 | }; 33 | inline LinkedBlockList() 34 | { 35 | m_head = 0; 36 | m_head_block_size = GCLL_BLOCK_SIZE; 37 | }; 38 | ~LinkedBlockList(); 39 | 40 | // Next three functins are for the linked list traversal 41 | inline void setCursorFront() 42 | { 43 | m_cursor = m_head; 44 | m_cursor_ind = 0; 45 | }; 46 | ListType next(); 47 | bool hasNext(); 48 | 49 | private: 50 | typedef struct LLBlockStruct 51 | { 52 | ListType m_item[GCLL_BLOCK_SIZE]; 53 | struct LLBlockStruct *m_next; 54 | } LLBlock; 55 | 56 | LLBlock *m_head; 57 | // Remembers the number of elements in the head block, since it may not be full 58 | BlockType m_head_block_size; 59 | // For block traversal, points to current element in the current block 60 | BlockType m_cursor_ind; 61 | // For block traversal, points to current block in the linked list 62 | LLBlock *m_cursor; 63 | }; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/PLPSLAM/solve/GCRANSAC/solver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | 5 | # ${CMAKE_CURRENT_SOURCE_DIR}/solver_dls_pnp.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/solver_engine.h 7 | 8 | # ${CMAKE_CURRENT_SOURCE_DIR}/solver_epnp_lm.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/solver_essential_matrix_five_point_stewenius.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/solver_fundamental_matrix_eight_point.h 11 | ${CMAKE_CURRENT_SOURCE_DIR}/solver_fundamental_matrix_plane_and_parallax.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/solver_fundamental_matrix_seven_point.h 13 | ${CMAKE_CURRENT_SOURCE_DIR}/solver_homography_four_point.h 14 | ${CMAKE_CURRENT_SOURCE_DIR}/solver_linear_model.h 15 | 16 | # ${CMAKE_CURRENT_SOURCE_DIR}/solver_p3p.h 17 | # ${CMAKE_CURRENT_SOURCE_DIR}/solver_rigid_transformation_svd.h 18 | ) 19 | 20 | # Install headers 21 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 22 | install(FILES ${HEADERS} 23 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/solve/GCRANSAC/solver) -------------------------------------------------------------------------------- /src/PLPSLAM/solve/GCRANSAC/statistics.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Czech Technical University. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following 13 | // disclaimer in the documentation and/or other materials provided 14 | // with the distribution. 15 | // 16 | // * Neither the name of Czech Technical University nor the 17 | // names of its contributors may be used to endorse or promote products 18 | // derived from this software without specific prior written permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE 24 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | // POSSIBILITY OF SUCH DAMAGE. 31 | // 32 | // Please contact the author of this library if you have any questions. 33 | // Author: Daniel Barath (barath.daniel@sztaki.mta.hu) 34 | #pragma once 35 | 36 | #include 37 | #include 38 | 39 | namespace gcransac 40 | { 41 | namespace utils 42 | { 43 | struct RANSACStatistics 44 | { 45 | size_t graph_cut_number, 46 | local_optimization_number, 47 | iteration_number, 48 | neighbor_number, 49 | accepted_models, 50 | rejected_models; 51 | 52 | std::string main_sampler_name, 53 | local_optimizer_sampler_name; 54 | 55 | double processing_time; 56 | 57 | std::vector inliers; 58 | 59 | RANSACStatistics() : graph_cut_number(0), 60 | local_optimization_number(0), 61 | iteration_number(0), 62 | neighbor_number(0), 63 | accepted_models(0), 64 | rejected_models(0), 65 | processing_time(0.0) 66 | { 67 | } 68 | }; 69 | } 70 | } -------------------------------------------------------------------------------- /src/PLPSLAM/solve/common.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_SOLVE_UTIL_H 25 | #define PLPSLAM_SOLVE_UTIL_H 26 | 27 | #include "PLPSLAM/type.h" 28 | 29 | #include 30 | 31 | #include 32 | 33 | namespace PLPSLAM 34 | { 35 | namespace solve 36 | { 37 | 38 | void normalize(const std::vector &keypts, std::vector &normalized_pts, Mat33_t &transform); 39 | 40 | } // namespace solve 41 | } // namespace PLPSLAM 42 | 43 | #endif // PLPSLAM_SOLVE_UTIL_H 44 | -------------------------------------------------------------------------------- /src/PLPSLAM/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Add sources 2 | target_sources(${PROJECT_NAME} 3 | PRIVATE 4 | ${CMAKE_CURRENT_SOURCE_DIR}/converter.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/image_converter.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/random_array.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/converter.cc 8 | ${CMAKE_CURRENT_SOURCE_DIR}/image_converter.cc 9 | ${CMAKE_CURRENT_SOURCE_DIR}/random_array.cc 10 | ${CMAKE_CURRENT_SOURCE_DIR}/stereo_rectifier.cc) 11 | 12 | # Install headers 13 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 14 | install(FILES ${HEADERS} 15 | DESTINATION ${PLPSLAM_INCLUDE_INSTALL_DIR}/util) 16 | -------------------------------------------------------------------------------- /src/PLPSLAM/util/converter.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_UTIL_CONVERTER_H 25 | #define PLPSLAM_UTIL_CONVERTER_H 26 | 27 | #include "PLPSLAM/type.h" 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | namespace PLPSLAM 35 | { 36 | namespace util 37 | { 38 | 39 | class converter 40 | { 41 | public: 42 | //! descriptor vector 43 | static std::vector to_desc_vec(const cv::Mat &desc); 44 | 45 | //! to SE3 of g2o 46 | static g2o::SE3Quat to_g2o_SE3(const Mat44_t &cam_pose); 47 | 48 | //! to Eigen::Mat/Vec 49 | static Mat44_t to_eigen_mat(const g2o::SE3Quat &g2o_SE3); 50 | static Mat44_t to_eigen_mat(const g2o::Sim3 &g2o_Sim3); 51 | static Mat44_t to_eigen_cam_pose(const Mat33_t &rot, const Vec3_t &trans); 52 | 53 | //! from/to angle axis 54 | static Vec3_t to_angle_axis(const Mat33_t &rot_mat); 55 | static Mat33_t to_rot_mat(const Vec3_t &angle_axis); 56 | 57 | //! to homogeneous coordinates 58 | template 59 | static Vec3_t to_homogeneous(const cv::Point_ &pt) 60 | { 61 | return Vec3_t{pt.x, pt.y, 1.0}; 62 | } 63 | 64 | //! to skew symmetric matrix 65 | static Mat33_t to_skew_symmetric_mat(const Vec3_t &vec); 66 | }; 67 | 68 | } // namespace util 69 | } // namespace PLPSLAM 70 | 71 | #endif // PLPSLAM_UTIL_CONVERTER_H 72 | -------------------------------------------------------------------------------- /src/PLPSLAM/util/image_converter.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_UTIL_IMAGE_CONVERTER_H 25 | #define PLPSLAM_UTIL_IMAGE_CONVERTER_H 26 | 27 | #include "PLPSLAM/camera/base.h" 28 | 29 | #include 30 | 31 | namespace PLPSLAM 32 | { 33 | namespace util 34 | { 35 | 36 | void convert_to_grayscale(cv::Mat &img, const camera::color_order_t in_color_order); 37 | 38 | void convert_to_true_depth(cv::Mat &img, const double depthmap_factor); 39 | 40 | void equalize_histogram(cv::Mat &img); 41 | 42 | } // namespace util 43 | } // namespace PLPSLAM 44 | 45 | #endif // PLPSLAM_UTIL_IMAGE_CONVERTER_H 46 | -------------------------------------------------------------------------------- /src/PLPSLAM/util/random_array.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_UTIL_RANDOM_ARRAY_H 25 | #define PLPSLAM_UTIL_RANDOM_ARRAY_H 26 | 27 | #include 28 | #include 29 | 30 | namespace PLPSLAM 31 | { 32 | namespace util 33 | { 34 | 35 | std::mt19937 create_random_engine(); 36 | 37 | template 38 | std::vector create_random_array(const size_t size, const T rand_min, const T rand_max); 39 | 40 | } // namespace util 41 | } // namespace PLPSLAM 42 | 43 | #endif // PLPSLAM_UTIL_RANDOM_ARRAY_H 44 | -------------------------------------------------------------------------------- /src/PLPSLAM/util/string.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_UTIL_STRING_H 25 | #define PLPSLAM_UTIL_STRING_H 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | namespace PLPSLAM 32 | { 33 | namespace util 34 | { 35 | 36 | inline std::vector split_string(const std::string &str, const char del) 37 | { 38 | std::vector splitted_strs; 39 | std::stringstream ss(str); 40 | std::string item; 41 | while (std::getline(ss, item, del)) 42 | { 43 | if (!item.empty()) 44 | { 45 | splitted_strs.push_back(item); 46 | } 47 | } 48 | return splitted_strs; 49 | } 50 | 51 | inline bool string_startswith(const std::string &str, const std::string &qry) 52 | { 53 | return str.size() >= qry.size() && std::equal(std::begin(qry), std::end(qry), std::begin(str)); 54 | } 55 | 56 | } // namespace util 57 | } // namespace PLPSLAM 58 | 59 | #endif // PLPSLAM_UTIL_STRING_H 60 | -------------------------------------------------------------------------------- /src/PLPSLAM/util/trigonometric.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PLPSLAM_UTIL_TRIGONOMETRIC_H 25 | #define PLPSLAM_UTIL_TRIGONOMETRIC_H 26 | 27 | #include 28 | 29 | #include 30 | 31 | namespace PLPSLAM 32 | { 33 | namespace util 34 | { 35 | 36 | static constexpr float _PI = 3.14159265358979f; 37 | static constexpr float _PI_2 = _PI / 2.0f; 38 | static constexpr float _TWO_PI = 2.0f * _PI; 39 | static constexpr float _INV_TWO_PI = 1.0f / _TWO_PI; 40 | static constexpr float _THREE_PI_2 = 3.0f * _PI_2; 41 | 42 | inline float _cos(float v) 43 | { 44 | constexpr float c1 = 0.99940307f; 45 | constexpr float c2 = -0.49558072f; 46 | constexpr float c3 = 0.03679168f; 47 | 48 | const float v2 = v * v; 49 | return c1 + v2 * (c2 + c3 * v2); 50 | } 51 | 52 | inline float cos(float v) 53 | { 54 | v = v - cvFloor(v * _INV_TWO_PI) * _TWO_PI; 55 | v = (0.0f < v) ? v : -v; 56 | 57 | if (v < _PI_2) 58 | { 59 | return _cos(v); 60 | } 61 | else if (v < _PI) 62 | { 63 | return -_cos(_PI - v); 64 | } 65 | else if (v < _THREE_PI_2) 66 | { 67 | return -_cos(v - _PI); 68 | } 69 | else 70 | { 71 | return _cos(_TWO_PI - v); 72 | } 73 | } 74 | 75 | inline float sin(float v) 76 | { 77 | return PLPSLAM::util::cos(_PI_2 - v); 78 | } 79 | 80 | } // namespace util 81 | } // namespace PLPSLAM 82 | 83 | #endif // PLPSLAM_UTIL_TRIGONOMETRIC_H 84 | -------------------------------------------------------------------------------- /src/pangolin_viewer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ----- Find dependencies ----- 2 | 3 | # Pangolin 4 | find_package(Pangolin REQUIRED) 5 | 6 | # ----- Configure PangolinViewer library ----- 7 | add_library(pangolin_viewer 8 | SHARED 9 | viewer.h 10 | color_scheme.h 11 | viewer.cc 12 | color_scheme.cc) 13 | 14 | set_target_properties(pangolin_viewer PROPERTIES 15 | OUTPUT_NAME pangolin_viewer 16 | LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 17 | 18 | target_include_directories(pangolin_viewer 19 | PUBLIC 20 | ${Pangolin_INCLUDE_DIR}) 21 | 22 | target_link_libraries(pangolin_viewer 23 | PUBLIC 24 | ${PROJECT_NAME} 25 | opencv_highgui 26 | pangolin) 27 | 28 | # ----- Install configuration ----- 29 | set(INSTALL_PANGOLIN_VIEWER OFF CACHE BOOL "Install PangolinViewer library") 30 | 31 | if(INSTALL_PANGOLIN_VIEWER) 32 | set(PANGOLIN_VIEWER_INCLUDE_INSTALL_DIR ${INCLUDES_DESTINATION}/pangolin_viewer) 33 | 34 | install(TARGETS pangolin_viewer 35 | EXPORT ${PLPSLAM_TARGETS_EXPORT_NAME} 36 | RUNTIME DESTINATION ${RUNTIME_DESTINATION} 37 | LIBRARY DESTINATION ${LIBRARY_DESTINATION} 38 | ARCHIVE DESTINATION ${ARCHIVE_DESTINATION} 39 | INCLUDES DESTINATION ${PANGOLIN_VIEWER_INCLUDE_INSTALL_DIR}) 40 | 41 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 42 | install(FILES ${HEADERS} 43 | DESTINATION ${PANGOLIN_VIEWER_INCLUDE_INSTALL_DIR}) 44 | endif() 45 | -------------------------------------------------------------------------------- /src/pangolin_viewer/color_scheme.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of Structure PLP-SLAM, originally from OpenVSLAM. 3 | * 4 | * Copyright 2022 DFKI (German Research Center for Artificial Intelligence) 5 | * Modified by Fangwen Shu 6 | * 7 | * If you use this code, please cite the respective publications as 8 | * listed on the github repository. 9 | * 10 | * Structure PLP-SLAM is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Structure PLP-SLAM is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Structure PLP-SLAM. If not, see . 22 | */ 23 | 24 | #ifndef PANGOLIN_VIEWER_COLOR_SCHEME_H 25 | #define PANGOLIN_VIEWER_COLOR_SCHEME_H 26 | 27 | #include 28 | #include 29 | 30 | namespace pangolin_viewer 31 | { 32 | 33 | class color_scheme 34 | { 35 | public: 36 | explicit color_scheme(const std::string &color_set_str); 37 | 38 | virtual ~color_scheme() = default; 39 | 40 | //! background color 41 | std::array bg_{}; 42 | //! grid color 43 | std::array grid_{}; 44 | //! current camera color 45 | std::array curr_cam_{}; 46 | //! keyframe line color 47 | std::array kf_line_{}; 48 | //! graph edge line color 49 | std::array graph_line_{}; 50 | //! landmark color 51 | std::array lm_{}; 52 | //! local_landmark color 53 | std::array local_lm_{}; 54 | 55 | private: 56 | void set_color_as_white(); 57 | 58 | void set_color_as_black(); 59 | 60 | void set_color_as_purple(); 61 | 62 | static bool stricmp(const std::string &str1, const std::string &str2); 63 | }; 64 | 65 | } // namespace pangolin_viewer 66 | 67 | #endif // PANGOLIN_VIEWER_COLOR_SCHEME_H 68 | -------------------------------------------------------------------------------- /src/socket_publisher/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ----- Find dependencies ----- 2 | 3 | # socket.io-cpp-client 4 | find_package(sioclient REQUIRED) 5 | 6 | # Protobuf 7 | find_package(Protobuf REQUIRED) 8 | 9 | if(NOT PROTOBUF_PROTOC_EXECUTABLE) 10 | message(FATAL_ERROR "Could not find protoc executable (PROTOBUF_PROTOC_EXECUTABLE)") 11 | endif() 12 | 13 | message(STATUS "Found protoc executable: ${PROTOBUF_PROTOC_EXECUTABLE}") 14 | 15 | # ----- Protobuf transpile ----- 16 | protobuf_generate_cpp(MAP_PB_SOURCE MAP_PB_HEADER protobuf/map_segment.proto) 17 | set_source_files_properties(${MAP_PB_HEADER} ${MAP_PB_SOURCE} 18 | COMPILE_FLAGS -Wno-unused-variable) 19 | 20 | # ----- Configure SocketPublisher library ----- 21 | add_library(socket_publisher 22 | SHARED 23 | data_serializer.h 24 | publisher.h 25 | socket_client.h 26 | data_serializer.cc 27 | publisher.cc 28 | socket_client.cc 29 | ${MAP_PB_SOURCE}) 30 | 31 | set_target_properties(socket_publisher PROPERTIES 32 | OUTPUT_NAME socket_publisher 33 | LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 34 | 35 | target_include_directories(socket_publisher 36 | PUBLIC 37 | ${SIOCLIENT_INCLUDE_DIR} 38 | ${PROTOBUF_INCLUDE_DIRS} 39 | PRIVATE 40 | ${CMAKE_CURRENT_BINARY_DIR}) 41 | 42 | target_link_libraries(socket_publisher 43 | PUBLIC 44 | ${PROJECT_NAME} 45 | opencv_imgcodecs 46 | ${SIOCLIENT_LIBRARY} 47 | ${PROTOBUF_LIBRARIES}) 48 | 49 | # ----- Install configuration ----- 50 | set(INSTALL_SOCKET_PUBLISHER OFF CACHE BOOL "Install SocketPublisher library") 51 | 52 | if(INSTALL_SOCKET_PUBLISHER) 53 | set(SOCKER_PUBLISHER_INCLUDE_INSTALL_DIR ${INCLUDES_DESTINATION}/socket_publisher) 54 | 55 | install(TARGETS socket_publisher 56 | EXPORT ${PLPSLAM_TARGETS_EXPORT_NAME} 57 | RUNTIME DESTINATION ${RUNTIME_DESTINATION} 58 | LIBRARY DESTINATION ${LIBRARY_DESTINATION} 59 | ARCHIVE DESTINATION ${ARCHIVE_DESTINATION} 60 | INCLUDES DESTINATION ${SOCKER_PUBLISHER_INCLUDE_INSTALL_DIR}) 61 | 62 | file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 63 | install(FILES ${HEADERS} 64 | DESTINATION ${SOCKER_PUBLISHER_INCLUDE_INSTALL_DIR}) 65 | endif() 66 | -------------------------------------------------------------------------------- /src/socket_publisher/protobuf/map_segment.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package map_segment; 4 | 5 | message map { 6 | 7 | message keyframe { 8 | uint32 id = 1; 9 | Mat44 pose = 2; 10 | } 11 | 12 | message edge { 13 | uint32 id0 = 1; 14 | uint32 id1 = 2; 15 | } 16 | 17 | message landmark { 18 | uint32 id = 1; 19 | repeated double coords = 2; 20 | repeated double color = 3; 21 | } 22 | 23 | message Mat44 { 24 | repeated double pose = 1; 25 | } 26 | 27 | message msg { 28 | string tag = 1; 29 | string txt = 2; 30 | } 31 | 32 | Mat44 current_frame = 1; 33 | repeated keyframe keyframes = 2; 34 | repeated edge edges = 3; 35 | repeated landmark landmarks = 4; 36 | repeated uint32 local_landmarks = 5; 37 | repeated msg messages = 6; 38 | } 39 | -------------------------------------------------------------------------------- /src/socket_publisher/publisher.h: -------------------------------------------------------------------------------- 1 | #ifndef SOCKET_PUBLISHER_PUBLISHER_H 2 | #define SOCKET_PUBLISHER_PUBLISHER_H 3 | 4 | #include "socket_publisher/data_serializer.h" 5 | #include "socket_publisher/socket_client.h" 6 | 7 | #include 8 | 9 | namespace PLPSLAM 10 | { 11 | 12 | class config; 13 | class system; 14 | 15 | namespace publish 16 | { 17 | class frame_publisher; 18 | class map_publisher; 19 | } // namespace publish 20 | 21 | } // namespace PLPSLAM 22 | 23 | namespace socket_publisher 24 | { 25 | 26 | class publisher 27 | { 28 | public: 29 | publisher(const std::shared_ptr &cfg, PLPSLAM::system *system, 30 | const std::shared_ptr &frame_publisher, 31 | const std::shared_ptr &map_publisher); 32 | 33 | void run(); 34 | 35 | /* thread controls */ 36 | void request_pause(); 37 | bool is_paused(); 38 | void resume(); 39 | void request_terminate(); 40 | bool is_terminated(); 41 | 42 | private: 43 | PLPSLAM::system *system_; 44 | const unsigned int emitting_interval_; 45 | const unsigned int image_quality_; 46 | 47 | std::unique_ptr client_; 48 | std::unique_ptr data_serializer_; 49 | 50 | void callback(const std::string &message); 51 | 52 | /* thread controls */ 53 | bool check_and_execute_pause(); 54 | 55 | bool terminate_is_requested(); 56 | void terminate(); 57 | 58 | std::mutex mtx_terminate_; 59 | bool terminate_is_requested_ = false; 60 | bool is_terminated_ = true; 61 | 62 | std::mutex mtx_pause_; 63 | bool pause_is_requested_ = false; 64 | bool is_paused_ = true; 65 | }; 66 | 67 | } // namespace socket_publisher 68 | 69 | #endif // SOCKET_PUBLISHER_PUBLISHER_H 70 | -------------------------------------------------------------------------------- /src/socket_publisher/socket_client.cc: -------------------------------------------------------------------------------- 1 | #include "socket_publisher/socket_client.h" 2 | 3 | #include 4 | 5 | namespace socket_publisher { 6 | 7 | socket_client::socket_client(const std::string& server_uri) 8 | : client_(), callback_() { 9 | // register socket callbacks 10 | client_.set_open_listener(std::bind(&socket_client::on_open, this)); 11 | client_.set_close_listener(std::bind(&socket_client::on_close, this)); 12 | client_.set_fail_listener(std::bind(&socket_client::on_fail, this)); 13 | 14 | // start connection 15 | client_.connect(server_uri); 16 | // get socket 17 | socket_ = client_.socket(); 18 | 19 | socket_->on("signal", std::bind(&socket_client::on_receive, this, std::placeholders::_1)); 20 | } 21 | 22 | void socket_client::on_close() { 23 | spdlog::info("connection closed correctly"); 24 | } 25 | 26 | void socket_client::on_fail() { 27 | spdlog::info("connection closed incorrectly"); 28 | } 29 | 30 | void socket_client::on_open() { 31 | spdlog::info("connected to server"); 32 | } 33 | 34 | void socket_client::on_receive(const sio::event& event) { 35 | try { 36 | const std::string message = event.get_message()->get_string(); 37 | if (callback_) { 38 | callback_(message); 39 | } 40 | } 41 | catch (std::exception& ex) { 42 | spdlog::error(ex.what()); 43 | } 44 | } 45 | 46 | } // namespace socket_publisher 47 | -------------------------------------------------------------------------------- /src/socket_publisher/socket_client.h: -------------------------------------------------------------------------------- 1 | #ifndef SOCKET_PUBLISHER_SOCKET_CLIENT_H 2 | #define SOCKET_PUBLISHER_SOCKET_CLIENT_H 3 | 4 | #include "PLPSLAM/config.h" 5 | 6 | #include 7 | 8 | namespace PLPSLAM 9 | { 10 | class config; 11 | } // namespace PLPSLAM 12 | 13 | namespace socket_publisher 14 | { 15 | 16 | class socket_client 17 | { 18 | public: 19 | socket_client(const std::string &server_uri); 20 | 21 | void emit(const std::string tag, const std::string buffer) 22 | { 23 | socket_->emit(tag, buffer); 24 | } 25 | 26 | void set_signal_callback(std::function callback) 27 | { 28 | callback_ = callback; 29 | } 30 | 31 | private: 32 | void on_close(); 33 | void on_fail(); 34 | void on_open(); 35 | void on_receive(const sio::event &event); 36 | 37 | sio::client client_; 38 | sio::socket::ptr socket_; 39 | 40 | std::function callback_; 41 | }; 42 | 43 | } // namespace socket_publisher 44 | 45 | #endif // SOCKET_PUBLISHER_SOCKET_CLIENT_H 46 | -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(INSTALL_GTEST OFF CACHE BOOL "Install google-test" FORCE) 2 | 3 | # ----- Download google-test ----- 4 | include(${PROJECT_SOURCE_DIR}/cmake/DownloadProject.cmake) 5 | download_project(PROJ googletest 6 | URL https://github.com/google/googletest/archive/release-1.10.0.tar.gz 7 | URL_HASH SHA1=9c89be7df9c5e8cb0bc20b3c4b39bf7e82686770 8 | DOWNLOAD_NO_PROGRESS YES) 9 | add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) 10 | 11 | # ----- Glob test codes----- 12 | file(GLOB_RECURSE PLPSLAM_SOURCE_PATHS "./PLPSLAM/*.cc") 13 | list(APPEND SOURCE_PATHS ${PLPSLAM_SOURCE_PATHS}) 14 | 15 | # ----- Build test executables ----- 16 | foreach(SOURCE_PATH ${SOURCE_PATHS}) 17 | # Get relative path from ./test/ 18 | file(RELATIVE_PATH SOURCE_REL_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${SOURCE_PATH}) 19 | 20 | # Test module name: test_foo_bar 21 | string(REGEX REPLACE "\\.cc$" "" TEST_MODULE_NAME test/${SOURCE_REL_PATH}) 22 | string(REPLACE "." "_" TEST_MODULE_NAME ${TEST_MODULE_NAME}) 23 | string(REPLACE "/" "_" TEST_MODULE_NAME ${TEST_MODULE_NAME}) 24 | 25 | # Executable name: test_foo_bar 26 | set(TEST_EXECUTABLE_NAME ${TEST_MODULE_NAME}) 27 | 28 | # Create test executable 29 | add_executable(${TEST_EXECUTABLE_NAME} ${SOURCE_PATH}) 30 | target_compile_definitions(${TEST_EXECUTABLE_NAME} PRIVATE TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data/") 31 | target_include_directories(${TEST_EXECUTABLE_NAME} SYSTEM 32 | PRIVATE 33 | ${PROJECT_SOURCE_DIR}/src 34 | ${googletest_SOURCE_DIR}/googletest/include) 35 | target_link_libraries(${TEST_EXECUTABLE_NAME} 36 | PRIVATE 37 | ${PROJECT_NAME} 38 | test_helper 39 | gtest_main 40 | opencv_imgcodecs 41 | opencv_highgui) 42 | set_target_properties(${TEST_EXECUTABLE_NAME} PROPERTIES 43 | RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/test 44 | RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/test 45 | RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${PROJECT_BINARY_DIR}/test 46 | RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${PROJECT_BINARY_DIR}/test) 47 | 48 | # Add test 49 | add_test(${TEST_MODULE_NAME} ${PROJECT_BINARY_DIR}/test/${TEST_EXECUTABLE_NAME}) 50 | endforeach() 51 | 52 | # Add test helper library 53 | add_subdirectory(helper) 54 | -------------------------------------------------------------------------------- /test/PLPSLAM/match/base.cc: -------------------------------------------------------------------------------- 1 | #include "PLPSLAM/type.h" 2 | #include "PLPSLAM/match/base.h" 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | using namespace PLPSLAM; 10 | 11 | TEST(base, compute_hamming_distance_1) 12 | { 13 | cv::Mat desc_1(1, 32, CV_8U); 14 | cv::Mat desc_2(1, 32, CV_8U); 15 | 16 | for (int i = 0; i < desc_1.rows; ++i) 17 | { 18 | desc_1.row(i) = 0b01010101; 19 | } 20 | 21 | for (int i = 0; i < desc_2.rows; ++i) 22 | { 23 | desc_2.row(i) = 0b01010101; 24 | } 25 | 26 | EXPECT_EQ(match::compute_descriptor_distance_32(desc_1, desc_2), 0); 27 | EXPECT_EQ(match::compute_descriptor_distance_64(desc_1, desc_2), 0); 28 | } 29 | 30 | TEST(base, compute_hamming_distance_2) 31 | { 32 | cv::Mat desc_1(1, 32, CV_8U); 33 | cv::Mat desc_2(1, 32, CV_8U); 34 | 35 | for (int i = 0; i < desc_1.rows; ++i) 36 | { 37 | desc_1.row(i) = 0b01010101; 38 | } 39 | 40 | for (int i = 0; i < desc_2.rows; ++i) 41 | { 42 | desc_2.row(i) = 0b10101010; 43 | } 44 | 45 | EXPECT_EQ(match::compute_descriptor_distance_32(desc_1, desc_2), 256); 46 | EXPECT_EQ(match::compute_descriptor_distance_64(desc_1, desc_2), 256); 47 | } 48 | 49 | TEST(base, compute_hamming_distance_3) 50 | { 51 | cv::Mat desc_1(1, 32, CV_8U); 52 | cv::Mat desc_2(1, 32, CV_8U); 53 | 54 | for (int i = 0; i < desc_1.rows; ++i) 55 | { 56 | desc_1.row(i) = 0b01100110; 57 | } 58 | 59 | for (int i = 0; i < desc_2.rows; ++i) 60 | { 61 | desc_2.row(i) = 0b00111100; 62 | } 63 | 64 | EXPECT_EQ(match::compute_descriptor_distance_32(desc_1, desc_2), 128); 65 | EXPECT_EQ(match::compute_descriptor_distance_64(desc_1, desc_2), 128); 66 | } 67 | -------------------------------------------------------------------------------- /test/PLPSLAM/util/random_array.cc: -------------------------------------------------------------------------------- 1 | #include "PLPSLAM/type.h" 2 | #include "PLPSLAM/util/random_array.h" 3 | 4 | #include 5 | 6 | using namespace PLPSLAM; 7 | 8 | TEST(random_array, create_random_array_1) 9 | { 10 | const auto array = util::create_random_array(5, 1, 5); 11 | 12 | EXPECT_EQ(array.size(), 5); 13 | // 重複なしのrandom arrayを作成しているので,最小値は1,最大値は5になるはず 14 | EXPECT_EQ(*std::min_element(array.begin(), array.end()), 1); 15 | EXPECT_EQ(*std::max_element(array.begin(), array.end()), 5); 16 | } 17 | 18 | TEST(random_array, create_random_array_2) 19 | { 20 | const auto array = util::create_random_array(10, 2, 11); 21 | 22 | EXPECT_EQ(array.size(), 10); 23 | // 重複なしのrandom arrayを作成しているので,std::setにしてもサイズは変わらないはず 24 | EXPECT_EQ(array.size(), std::set(array.begin(), array.end()).size()); 25 | } 26 | -------------------------------------------------------------------------------- /test/PLPSLAM/util/trigonometric.cc: -------------------------------------------------------------------------------- 1 | #include "PLPSLAM/type.h" 2 | #include "PLPSLAM/util/trigonometric.h" 3 | 4 | #include 5 | 6 | using namespace PLPSLAM; 7 | 8 | TEST(trigonometric, cos) 9 | { 10 | for (unsigned int deg = 0; deg <= 3600; ++deg) 11 | { 12 | const float rad = (deg / 10.0f) * M_PI / 180.0f; 13 | EXPECT_NEAR(std::cos(rad), util::cos(rad), 1e-3); 14 | } 15 | } 16 | 17 | TEST(trigonometric, sin) 18 | { 19 | for (unsigned int deg = 0; deg <= 3600; ++deg) 20 | { 21 | const float rad = (deg / 10.0f) * M_PI / 180.0f; 22 | EXPECT_NEAR(std::sin(rad), util::sin(rad), 1e-3); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/data/equirectangular_image_001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/test/data/equirectangular_image_001.jpg -------------------------------------------------------------------------------- /test/data/equirectangular_image_002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/test/data/equirectangular_image_002.jpg -------------------------------------------------------------------------------- /test/helper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Create test helper library 2 | add_library(test_helper 3 | SHARED 4 | bearing_vector.h 5 | keypoint.h 6 | landmark.h 7 | bearing_vector.cc 8 | keypoint.cc 9 | landmark.cc) 10 | 11 | # Add include directory as PUBLIC (because the headers are included in test codes) 12 | target_include_directories(test_helper 13 | PUBLIC 14 | ${PROJECT_SOURCE_DIR}/test 15 | ${PROJECT_SOURCE_DIR}/src) 16 | 17 | # Link to required libraries 18 | target_link_libraries(test_helper 19 | PUBLIC 20 | Eigen3::Eigen 21 | opencv_core) 22 | -------------------------------------------------------------------------------- /test/helper/bearing_vector.cc: -------------------------------------------------------------------------------- 1 | #include "helper/bearing_vector.h" 2 | 3 | #include 4 | 5 | void create_bearing_vectors(const Mat33_t& rot_cw, const Vec3_t& trans_cw, const eigen_alloc_vector& landmarks, 6 | eigen_alloc_vector& bearings, const double noise_stddev) { 7 | const auto num_landmarks = landmarks.size(); 8 | 9 | // convert a 3D point to a bearing vector 10 | bearings.resize(num_landmarks); 11 | for (unsigned int i = 0; i < num_landmarks; ++i) { 12 | const Vec3_t& lm = landmarks.at(i); 13 | const Vec3_t lm_in_1 = rot_cw * lm + trans_cw; 14 | bearings.at(i) = lm_in_1.normalized(); 15 | } 16 | 17 | if (noise_stddev == 0.0) { 18 | return; 19 | } 20 | 21 | // add Gaussian noise 22 | 23 | std::random_device rand_dev; 24 | std::mt19937 mt(rand_dev()); 25 | std::normal_distribution<> rand(0, noise_stddev); 26 | 27 | for (unsigned int i = 0; i < num_landmarks; ++i) { 28 | bearings.at(i) += Vec3_t{rand(mt), rand(mt), rand(mt)}; 29 | bearings.at(i).normalized(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/helper/bearing_vector.h: -------------------------------------------------------------------------------- 1 | #ifndef PLPSLAM_TEST_HELPER_BEARING_VECTOR_H 2 | #define PLPSLAM_TEST_HELPER_BEARING_VECTOR_H 3 | 4 | #include "PLPSLAM/type.h" 5 | 6 | using namespace PLPSLAM; 7 | 8 | void create_bearing_vectors(const Mat33_t &rot_cw, const Vec3_t &trans_cw, const eigen_alloc_vector &landmarks, 9 | eigen_alloc_vector &bearings, const double noise_stddev = 0.0); 10 | 11 | #endif // PLPSLAM_TEST_HELPER_BEARING_VECTOR_H 12 | -------------------------------------------------------------------------------- /test/helper/keypoint.cc: -------------------------------------------------------------------------------- 1 | #include "helper/keypoint.h" 2 | 3 | #include 4 | 5 | void create_keypoints(const Mat33_t& rot_cw, const Vec3_t& trans_cw, const Mat33_t& cam_matrix, const eigen_alloc_vector& landmarks, 6 | std::vector& keypts, const double noise_stddev) { 7 | const auto num_landmarks = landmarks.size(); 8 | 9 | // convert a 3D point to a bearing vector 10 | 11 | keypts.resize(num_landmarks); 12 | for (unsigned int i = 0; i < num_landmarks; ++i) { 13 | const Vec3_t& pos_w = landmarks.at(i); 14 | Vec3_t pos_c = rot_cw * pos_w + trans_cw; 15 | keypts.at(i).x = cam_matrix(0, 0) * pos_c(0) / pos_c(2) + cam_matrix(0, 2); 16 | keypts.at(i).y = cam_matrix(1, 1) * pos_c(1) / pos_c(2) + cam_matrix(1, 2); 17 | } 18 | 19 | if (noise_stddev == 0.0) { 20 | return; 21 | } 22 | 23 | // add Gaussian noise 24 | 25 | std::random_device rand_dev; 26 | std::mt19937 mt(rand_dev()); 27 | std::normal_distribution<> rand(0, noise_stddev); 28 | 29 | for (unsigned int i = 0; i < num_landmarks; ++i) { 30 | keypts.at(i) += cv::Point2f(rand(mt), rand(mt)); 31 | } 32 | } 33 | 34 | void create_keypoints(const Mat33_t& rot_cw, const Vec3_t& trans_cw, const Mat33_t& cam_matrix, const eigen_alloc_vector& landmarks, 35 | std::vector& keypts, const double noise_stddev) { 36 | const auto num_landmarks = landmarks.size(); 37 | 38 | // convert a 3D point to a bearing vector 39 | 40 | keypts.resize(num_landmarks); 41 | for (unsigned int i = 0; i < num_landmarks; ++i) { 42 | const Vec3_t& pos_w = landmarks.at(i); 43 | Vec3_t pos_c = rot_cw * pos_w + trans_cw; 44 | keypts.at(i).pt.x = cam_matrix(0, 0) * pos_c(0) / pos_c(2) + cam_matrix(0, 2); 45 | keypts.at(i).pt.y = cam_matrix(1, 1) * pos_c(1) / pos_c(2) + cam_matrix(1, 2); 46 | } 47 | 48 | if (noise_stddev == 0.0) { 49 | return; 50 | } 51 | 52 | // add Gaussian noise 53 | 54 | std::random_device rand_dev; 55 | std::mt19937 mt(rand_dev()); 56 | std::normal_distribution<> rand(0, noise_stddev); 57 | 58 | for (unsigned int i = 0; i < num_landmarks; ++i) { 59 | keypts.at(i).pt += cv::Point2f(rand(mt), rand(mt)); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /test/helper/keypoint.h: -------------------------------------------------------------------------------- 1 | #ifndef PLPSLAM_TEST_HELPER_KEYPOINT_H 2 | #define PLPSLAM_TEST_HELPER_KEYPOINT_H 3 | 4 | #include "PLPSLAM/type.h" 5 | 6 | using namespace PLPSLAM; 7 | 8 | void create_keypoints(const Mat33_t &rot_cw, const Vec3_t &trans_cw, const Mat33_t &cam_matrix, const eigen_alloc_vector &landmarks, 9 | std::vector &keypts, const double noise_stddev = 0.0); 10 | 11 | void create_keypoints(const Mat33_t &rot_cw, const Vec3_t &trans_cw, const Mat33_t &cam_matrix, const eigen_alloc_vector &landmarks, 12 | std::vector &keypts, const double noise_stddev = 0.0); 13 | 14 | #endif // PLPSLAM_TEST_HELPER_KEYPOINT_H 15 | -------------------------------------------------------------------------------- /test/helper/landmark.cc: -------------------------------------------------------------------------------- 1 | #include "helper/landmark.h" 2 | 3 | eigen_alloc_vector create_random_landmarks_in_space(const unsigned int num_landmarks, 4 | const float space_lim) { 5 | std::random_device rand_dev; 6 | std::mt19937 mt(rand_dev()); 7 | std::uniform_real_distribution<> rand(-space_lim, space_lim); 8 | 9 | eigen_alloc_vector landmarks(num_landmarks); 10 | for (unsigned int i = 0; i < num_landmarks; ++i) { 11 | landmarks.at(i)(0) = rand(mt); 12 | landmarks.at(i)(1) = rand(mt); 13 | landmarks.at(i)(2) = rand(mt); 14 | } 15 | 16 | return landmarks; 17 | } 18 | 19 | eigen_alloc_vector create_random_landmarks_on_plane(const unsigned int num_landmarks, 20 | const float space_lim, const Vec4_t& plane_coeffs) { 21 | std::random_device rand_dev; 22 | std::mt19937 mt(rand_dev()); 23 | std::uniform_real_distribution<> rand(-space_lim, space_lim); 24 | 25 | const auto a = plane_coeffs(0); 26 | const auto b = plane_coeffs(1); 27 | const auto c = plane_coeffs(2); 28 | const auto d = plane_coeffs(3); 29 | 30 | eigen_alloc_vector landmarks(num_landmarks); 31 | for (unsigned int i = 0; i < num_landmarks; ++i) { 32 | const double x = rand(mt); 33 | const double y = rand(mt); 34 | const double z = -(d + a * x + b * y) / c; 35 | if (z < -space_lim || space_lim < z) { 36 | --i; 37 | continue; 38 | } 39 | landmarks.at(i)(0) = x; 40 | landmarks.at(i)(1) = y; 41 | landmarks.at(i)(2) = z; 42 | } 43 | 44 | return landmarks; 45 | } 46 | -------------------------------------------------------------------------------- /test/helper/landmark.h: -------------------------------------------------------------------------------- 1 | #ifndef PLPSLAM_TEST_HELPER_LANDMARK_H 2 | #define PLPSLAM_TEST_HELPER_LANDMARK_H 3 | 4 | #include "PLPSLAM/type.h" 5 | 6 | #include 7 | 8 | using namespace PLPSLAM; 9 | 10 | eigen_alloc_vector create_random_landmarks_in_space(const unsigned int num_landmarks, 11 | const float space_lim); 12 | 13 | eigen_alloc_vector create_random_landmarks_on_plane(const unsigned int num_landmarks, 14 | const float space_lim, const Vec4_t &plane_coeffs); 15 | 16 | #endif // PLPSLAM_TEST_HELPER_LANDMARK_H 17 | -------------------------------------------------------------------------------- /video/ICRA23_0006.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/video/ICRA23_0006.mp4 -------------------------------------------------------------------------------- /video/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterFWS/Structure-PLP-SLAM/5faf68ffafbcf375ddc836fbe29cfdea6607a1b7/video/cover.png -------------------------------------------------------------------------------- /viewer/.dockerignore: -------------------------------------------------------------------------------- 1 | # hidden files and dirs 2 | .gitignore 3 | .git/ 4 | .idea/ 5 | .vscode/ 6 | 7 | # not needed 8 | node_modules/ 9 | -------------------------------------------------------------------------------- /viewer/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Optional REPL history 57 | .node_repl_history 58 | 59 | # Output of 'npm pack' 60 | *.tgz 61 | 62 | # Yarn Integrity file 63 | .yarn-integrity 64 | 65 | # dotenv environment variables file 66 | .env 67 | .env.test 68 | 69 | # parcel-bundler cache (https://parceljs.org/) 70 | .cache 71 | 72 | # next.js build output 73 | .next 74 | 75 | # nuxt.js build output 76 | .nuxt 77 | 78 | # vuepress build output 79 | .vuepress/dist 80 | 81 | # Serverless directories 82 | .serverless/ 83 | 84 | # FuseBox cache 85 | .fusebox/ 86 | 87 | # DynamoDB Local files 88 | .dynamodb/ 89 | -------------------------------------------------------------------------------- /viewer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:8.16.0-alpine 2 | 3 | COPY . /PLPSLAM-viewer/ 4 | 5 | RUN set -x && \ 6 | cd /PLPSLAM-viewer/ && \ 7 | npm install 8 | 9 | ENTRYPOINT ["node", "/PLPSLAM-viewer/app.js"] 10 | -------------------------------------------------------------------------------- /viewer/app.js: -------------------------------------------------------------------------------- 1 | let express = require("express"); 2 | let http_server = require("http").Server(express()); 3 | let io_server = require("socket.io")(http_server); 4 | 5 | let app = express(); 6 | let http_publisher = require("http").Server(app); 7 | let io_publisher = require("socket.io")(http_publisher); 8 | 9 | // setting express 10 | app.set("views", __dirname + "/views"); 11 | app.set("view engine", "ejs"); 12 | app.use(express.static(__dirname + "/public")); 13 | 14 | // render browser 15 | app.get("/", function (req, res) { 16 | res.render("index.ejs"); 17 | }); 18 | 19 | io_server.on("connection", function (socket) { 20 | console.log(`Connected - ID: ${socket.id}`); 21 | 22 | socket.on("map_publish", function (msg) { 23 | io_publisher.emit("map_publish", msg); 24 | }); 25 | 26 | socket.on("frame_publish", function (msg) { 27 | io_publisher.emit("frame_publish", { image: true, buffer: msg }); 28 | }); 29 | 30 | socket.on("disconnect", function () { 31 | console.log(`Disconnected - ID: ${socket.id}`); 32 | }); 33 | }); 34 | 35 | io_publisher.on("connection", function (socket) { 36 | socket.on("signal", function (msg) { 37 | io_server.emit("signal", msg); 38 | }); 39 | }); 40 | 41 | http_server.listen(3000, function () { 42 | console.log("WebSocket: listening on *:3000"); 43 | }); 44 | 45 | http_publisher.listen(3001, function () { 46 | console.log("HTTP server: listening on *:3001") 47 | }); 48 | -------------------------------------------------------------------------------- /viewer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PLPSLAM-viewer", 3 | "version": "0.0.1", 4 | "description": "A cross-platform viewer for PLPSLAM", 5 | "repository": "https://github.com/xdspacelab/PLPSLAM", 6 | "license": "BSD-2-Clause", 7 | "dependencies": { 8 | "express": "^4.16.2", 9 | "socket.io": "^2.0.4" 10 | }, 11 | "devDependencies": { 12 | "ejs": "^2.5.7" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /viewer/public/js/lib/stats.min.js: -------------------------------------------------------------------------------- 1 | // stats.js - http://github.com/mrdoob/stats.js 2 | (function(f,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"===typeof define&&define.amd?define(e):f.Stats=e()})(this,function(){var f=function(){function e(a){c.appendChild(a.dom);return a}function u(a){for(var d=0;d=g+1E3&&(r.update(1E3*a/(c-g),100),g=c,a=0,t)){var d=performance.memory;t.update(d.usedJSHeapSize/ 4 | 1048576,d.jsHeapSizeLimit/1048576)}return c},update:function(){k=this.end()},domElement:c,setMode:u}};f.Panel=function(e,f,l){var c=Infinity,k=0,g=Math.round,a=g(window.devicePixelRatio||1),r=80*a,h=48*a,t=3*a,v=2*a,d=3*a,m=15*a,n=74*a,p=30*a,q=document.createElement("canvas");q.width=r;q.height=h;q.style.cssText="width:80px;height:48px";var b=q.getContext("2d");b.font="bold "+9*a+"px Helvetica,Arial,sans-serif";b.textBaseline="top";b.fillStyle=l;b.fillRect(0,0,r,h);b.fillStyle=f;b.fillText(e,t,v); 5 | b.fillRect(d,m,n,p);b.fillStyle=l;b.globalAlpha=.9;b.fillRect(d,m,n,p);return{dom:q,update:function(h,w){c=Math.min(c,h);k=Math.max(k,h);b.fillStyle=l;b.globalAlpha=1;b.fillRect(0,0,r,m);b.fillStyle=f;b.fillText(g(h)+" "+e+" ("+g(c)+"-"+g(k)+")",t,v);b.drawImage(q,d+a,m,n-a,p,d,m,n-a,p);b.fillRect(d+n-a,m,a,p);b.fillStyle=l;b.globalAlpha=.9;b.fillRect(d+n-a,m,a,g((1-h/w)*p))}}};return f}); 6 | -------------------------------------------------------------------------------- /viewer/public/map_segment.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package map_segment; 4 | 5 | message map { 6 | 7 | message keyframe { 8 | uint32 id = 1; 9 | Mat44 pose = 2; 10 | } 11 | 12 | message edge { 13 | uint32 id0 = 1; 14 | uint32 id1 = 2; 15 | } 16 | 17 | message landmark { 18 | uint32 id = 1; 19 | repeated double coords = 2; 20 | repeated double color = 3; 21 | } 22 | 23 | message Mat44 { 24 | repeated double pose = 1; 25 | } 26 | 27 | message msg { 28 | string tag = 1; 29 | string txt = 2; 30 | } 31 | 32 | Mat44 current_frame = 1; 33 | repeated keyframe keyframes = 2; 34 | repeated edge edges = 3; 35 | repeated landmark landmarks = 4; 36 | repeated uint32 local_landmarks = 5; 37 | repeated msg messages = 6; 38 | } 39 | -------------------------------------------------------------------------------- /viewer/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PLPSLAM SocketViewer 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 28 | 29 | 30 | 31 | 32 |
33 |
34 |
35 |
36 | 37 | 38 | 61 | 62 | 63 | 64 | --------------------------------------------------------------------------------