* This file is part of Photo-SLAM
*
* Copyright (C) 2023-2024 Longwei Li and Hui Cheng, Sun Yat-sen University.
* Copyright (C) 2023-2024 Huajian Huang and Sai-Kit Yeung, Hong Kong University of Science and Technology.
*
* Photo-SLAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Photo-SLAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Photo-SLAM.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <filesystem>
#include <iostream>
#include <memory>
#include <torch/torch.h>
#include "include/gaussian_mapper.h"
#include "viewer/imgui_viewer.h"
int main(int argc, char** argv)
{
if (argc != 4)
{
std::cerr << std::endl
<< "Usage: " << argv[0]
<< " path_to_gaussian_mapping_settings"
<< " path_to_camera_parameters"
<< " path_to_result_ply_file"
<< std::endl;
return 1;
}
torch::DeviceType device_type;
if (torch::cuda::is_available())
{
std::cout << "CUDA available! Training on GPU." << std::endl;
device_type = torch::kCUDA;
}
else
{
std::cout << "Training on CPU." << std::endl;
device_type = torch::kCPU;
}
std::filesystem::path gaussian_cfg_path(argv[1]);
std::filesystem::path camera_path(argv[2]);
std::filesystem::path result_ply_path(argv[3]);
std::shared_ptr<GaussianMapper> pGausMapper =
std::make_shared<GaussianMapper>(
nullptr, gaussian_cfg_path, std::filesystem::path(), 0, device_type);
pGausMapper->loadPly(result_ply_path, camera_path);
std::thread viewer_thd;
std::shared_ptr<ImGuiViewer> pViewer;
pViewer = std::make_shared<ImGuiViewer>(nullptr, pGausMapper, false);
pViewer->run();
return 0;
}