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
/*
* lib.rs
*
* Copyright (c) 2026 ParkSangWoo
*
* Author(s):
*
* ParkSangWoo <dev.parksangwoo@gmail.com>
*
*
* This file is part of cumulus3d.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
//! Undistortion and multi-view densification.
//!
//! - [`undistort`](mod@undistort): distorted camera → PINHOLE camera computation, per-camera resampling-map cache, image resampling, sparse
//! model conversion.
//! - [`image`]: image buffers and resampling tools.
//! - [`scene`]: densification scene (view K, pose, image; sparse points).
//! - [`neighbors`]: neighbor view selection and depth ranges.
//! - [`kernel`]: PatchMatch backend boundary (propagation, view selection and refinement at one scale are done by the backend).
//! - [`densify`](mod@densify): multi-scale progression, detail restoration, filters, fusion hookup.
//! - [`fusion`], [`fusion_score`]: depth map fusion (agreement, extended median, score fusion).
//! - [`smooth`]: normal-direction bilateral smoothing of the fused cloud.
//! - [`visibility`]: free-space (visibility) filter that removes fused points in front of surfaces other views observed.
//! - [`postproc`], [`upsample`], [`math`], [`params`]: post-processing, upsampling, numeric tools, settings.
//! - [`stats`]: point cloud quality statistics.
//! - [`cache`]: depth map cache for overlapping zones.
//! - [`synthetic`]: synthetic scenes for tests.
//!
//! This crate has no PatchMatch backend implementation. [`densify()`] needs a [`PatchMatchBackend`] implementation
//! (e.g. the GPU backend `CudaPatchMatch` of `cumulus3d-cuda`).
//!
//! # Usage example
//!
//! Fuse the ground-truth depth maps of a synthetic scene on the CPU (no backend needed).
//!
//! ```
//! use cumulus3d_dense::neighbors::PairStats;
//! use cumulus3d_dense::synthetic::{make_scene, SynthConfig};
//! use cumulus3d_dense::{fuse, FusionInput, FusionParams};
//!
//! let cfg = SynthConfig { width: 96, height: 72, focal: 75.0, num_points: 500, ..SynthConfig::default() };
//! let s = make_scene(&cfg);
//! let stats = PairStats::new(&s.scene);
//! let overlap: Vec<Vec<usize>> = (0..s.scene.views.len()).map(|v| stats.select(v, 50, 0.0)).collect();
//! let inputs: Vec<Option<FusionInput>> =
//! s.depth.iter().zip(&s.normal).map(|(d, n)| Some(FusionInput::plain(d, n))).collect();
//! let out = fuse(&s.scene, &inputs, &overlap, &FusionParams::default(), 1);
//! assert!(out.cloud.len() > 0);
//! ```
//!
//! Real densification (undistortion → scene → depth maps → fusion → PLY). Pass a GPU implementation as the backend.
//!
//! ```no_run
//! use cumulus3d_dense::{densify, undistort_from_dir, DenseScene, DensifyOptions, PatchMatchBackend, SceneOptions, UndistortCache, UndistortOptions};
//!
//! fn run(backend: &dyn PatchMatchBackend) -> cumulus3d_core::Result<()> {
//! let rec = cumulus3d_core::interop::read_model("sparse/0")?;
//! let und = undistort_from_dir(&rec, "images", &UndistortOptions::pipeline(), &UndistortCache::new())?;
//! let scene = DenseScene::from_reconstruction(&und.reconstruction, &und.images, &SceneOptions::default())?;
//! let out = densify(&scene, &DensifyOptions::default(), backend, None)?;
//! out.write_ply("dense/fused.ply")?;
//! Ok(())
//! }
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use PostParams;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;