1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
//! Structure from Motion (SfM) 模块
//!
//! 这个模块实现了完整的 Structure from Motion 重建管道,用于从多视角图像中恢复 3D 场景结构和相机姿态。
//! 采用增量式重建策略,逐步添加图像并优化重建结果。
//!
//! # 主要功能
//!
//! - **增量式重建**:逐步添加图像进行 3D 重建
//! - **三角测量**:从多个视角恢复 3D 点坐标
//! - **束调整优化**:全局优化相机参数和 3D 点位置
//! - **姿态估计**:估计相机的位置和方向
//! - **轨迹管理**:管理特征点在多个图像中的对应关系
//!
//! # 使用示例
//!
//! ## 基本 SfM 重建
//!
//! ```rust,ignore
//! use colmap::sfm::*;
//! use colmap::core::*;
//!
//! // 创建 SfM 配置
//! let config = SfmConfig {
//! min_track_length: 2,
//! max_reprojection_error: 4.0,
//! ..Default::default()
//! };
//!
//! // 创建增量式重建器
//! let mut reconstructor = IncrementalSfm::new(config);
//!
//! // 添加图像和特征匹配
//! for (image_id, image) in images.iter() {
//! reconstructor.add_image(*image_id, image.clone())?;
//! }
//!
//! // 执行重建
//! let reconstruction = reconstructor.reconstruct()?;
//! println!("重建了 {} 个 3D 点", reconstruction.points.len());
//! # Ok::<(), ColmapError>(())
//! ```
//!
//! ## 三角测量示例
//!
//! ```rust,ignore
//! use colmap::sfm::*;
//! use colmap::core::*;
//!
//! // 配置三角测量参数
//! let config = TriangulationConfig {
//! min_angle: 1.5, // 最小视角(度)
//! max_reprojection_error: 4.0,
//! min_depth: 0.1,
//! max_depth: 1000.0,
//! };
//!
//! // 执行三角测量
//! let triangulator = Triangulator::new(config);
//! let point_3d = triangulator.triangulate(&observations, &cameras)?;
//!
//! println!("三角测量结果: {:?}", point_3d);
//! # Ok::<(), ColmapError>(())
//! ```
//!
//! ## 完整重建流程
//!
//! ```rust,ignore
//! use colmap::sfm::*;
//! use colmap::feature::*;
//! use colmap::core::*;
//!
//! // 1. 特征提取和匹配
//! let pipeline = FeaturePipeline::new(PipelineConfig::default());
//! let images = vec![]; // 示例图像列表
//! let matches = pipeline.extract_and_match(&images)?;
//!
//! // 2. SfM 重建
//! let sfm_config = SfmConfig::default();
//! let mut reconstructor = IncrementalReconstructor::new(sfm_config);
//!
//! // 3. 添加数据并重建
//! reconstructor.set_matches(matches);
//! let reconstruction = reconstructor.reconstruct()?;
//!
//! // 4. 输出结果
//! println!("重建统计:");
//! println!(" - 注册图像: {}", reconstruction.registered_images());
//! println!(" - 3D 点数量: {}", reconstruction.points.len());
//! println!(" - 平均重投影误差: {:.2}", reconstruction.mean_reprojection_error());
//! # Ok::<(), ColmapError>(())
//! ```
// TODO: 实现这些模块
// pub mod bundle_adjustment;
// pub mod pose_estimation;
// pub mod reconstruction;
// 重新导出主要类型
pub use *;
pub use *;
// pub use bundle_adjustment::*;
// pub use pose_estimation::*;
// pub use reconstruction::*;
use ;
/// SfM 重建配置
/// 束调整配置
/// 三角测量配置