ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
arkitscenes.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6
7#include <array>
8#include <cstddef>
9#include <filesystem>
10#include <optional>
11#include <string>
12#include <vector>
13
14namespace reusex {
15class ProjectDB;
16}
17
18namespace reusex::io {
19
22 double width = 0, height = 0;
23 double fx = 0, fy = 0, cx = 0, cy = 0;
24};
25
29ArkitPincam parse_pincam(const std::string &line);
30
41std::array<double, 16> arkit_traj_to_optical_world(double rx, double ry,
42 double rz, double tx,
43 double ty, double tz);
44
48 double ts = 0;
49 std::array<double, 16> pose{};
50};
51
55using ArkitTrajectory = std::vector<ArkitPoseSample>;
56
61constexpr double kArkitMaxPoseGap = 0.5; // seconds
62
68ArkitTrajectory load_arkit_trajectory(const std::filesystem::path &traj_path);
69
90std::optional<std::array<double, 16>>
91interpolate_pose(const ArkitTrajectory &traj, double ts,
92 double max_gap = kArkitMaxPoseGap);
93
98bool parse_frame_timestamp(const std::filesystem::path &file, double &ts);
99
132 const std::filesystem::path &scene_dir);
133
134} // namespace reusex::io
constexpr double kArkitMaxPoseGap
Largest bracketing interval interpolate_pose will interpolate across.
ArkitPincam parse_pincam(const std::string &line)
Parse a single ARKitScenes .pincam line: width height fx fy cx cy (six whitespace-separated doubles).
bool parse_frame_timestamp(const std::filesystem::path &file, double &ts)
Extract the timestamp encoded in an ARKitScenes stream filename such as 41069021_452....
ArkitTrajectory load_arkit_trajectory(const std::filesystem::path &traj_path)
Parse the trajectory file into timestamp-sorted camera->world poses.
std::array< double, 16 > arkit_traj_to_optical_world(double rx, double ry, double rz, double tx, double ty, double tz)
Convert one ARKitScenes trajectory pose to an optical-to-world 4x4 matrix (row-major,...
std::size_t import_arkitscenes(ProjectDB &db, const std::filesystem::path &scene_dir)
Import an ARKitScenes scene (lowres iPad-LiDAR streams) into a ReUseX project.
std::vector< ArkitPoseSample > ArkitTrajectory
Trajectory as a timestamp-ascending sequence of camera->world samples.
std::optional< std::array< double, 16 > > interpolate_pose(const ArkitTrajectory &traj, double ts, double max_gap=kArkitMaxPoseGap)
Interpolate the camera->world pose at ts from the bracketing trajectory samples: SLERP on the rotatio...
Parsed contents of an ARKitScenes .pincam intrinsics line.
One trajectory sample: a device-relative timestamp and the optical-to-world (camera->world) pose at t...
std::array< double, 16 > pose