Skip to main content

Plan

Struct Plan 

Source
pub struct Plan {
Show 13 fields pub seed: Option<u64>, pub threads: usize, pub gps: Option<PathBuf>, pub pairing: Pairing, pub input: Source, pub zones: Zones, pub align: Align, pub features: Features, pub matching: Matching, pub sparse: Sparse, pub live: Live, pub dense: Dense, pub sinks: Sinks,
}
Expand description

Reconstruction plan (a value). It runs nothing and only holds “what to do and how”.

The default (Plan::default) is the aerial-formation preset + the cumulus3d stream defaults, and the paths are placeholders (data/images, data/gps_ref.txt, out).

Fields§

§seed: Option<u64>

RANSAC seed for two-view geometry and GPS alignment (if unset, differs from run to run).

§threads: usize

Number of rayon threads (0 = number of cores).

§gps: Option<PathBuf>

GPS record file (name latitude longitude altitude lines). Without it, alignment is impossible.

§pairing: Pairing

Pairing strategy.

§input: Source

Input images.

§zones: Zones

Zone splitting.

§align: Align

Coordinate alignment.

§features: Features

Feature extraction.

§matching: Matching

Descriptor matching.

§sparse: Sparse

Sparse reconstruction.

§live: Live

Live throughput: feature extraction ahead, backlog batching, sparse previews.

§dense: Dense

Densification.

§sinks: Sinks

Output hooks.

Implementations§

Source§

impl Plan

Source

pub fn to_toml(&self) -> String

As a TOML string.

Source

pub fn to_toml_annotated(&self) -> String

TOML with the profile’s effective dense defaults written as comments under empty [dense.fusion] / [dense.filter] tables (what cumulus3d plan --print-default prints). Comments do not change the plan: from_toml of the result equals self.

Source

pub fn from_toml(s: &str) -> Result<Self, String>

From a TOML string (missing items take defaults, unknown items are an error).

Source

pub fn load(path: impl AsRef<Path>) -> Result<Self, String>

From a TOML file.

Examples found in repository?
examples/frame_hook_plan.rs (line 55)
53fn main() -> Result<(), String> {
54    let path = std::env::args().nth(1).ok_or("usage: frame_hook_plan <plan.toml>")?;
55    let plan = Plan::load(&path)?;
56    let seen = Arc::new(Mutex::new(Seen::default()));
57    let refined = Arc::new(Mutex::new(Vec::new()));
58    let t0 = Instant::now();
59    let (s, r) = (seen.clone(), refined.clone());
60    let recon = Recon::from_plan(plan)
61        .on_frame(move |f: &Arc<Frame>| {
62            let mut s = s.lock().unwrap();
63            let t = t0.elapsed().as_secs_f64();
64            s.first_s.get_or_insert(t);
65            s.last_s = t;
66            *s.per_camera.entry(f.camera.clone()).or_default() += 1;
67            *s.sizes.entry((f.width, f.height)).or_default() += 1;
68            s.bytes += f.rgb.len();
69            s.positions = s.positions.max(f.position + 1);
70            if f.rgb.len() != (f.width * f.height * 3) as usize || f.width == 0 {
71                s.bad += 1;
72            }
73        })
74        .on_zone_refined(move |z, cloud| r.lock().unwrap().push((z.zone, cloud.len())))
75        .build()
76        .map_err(|e| e.to_string())?;
77    let summary = recon.run()?;
78    let s = seen.lock().unwrap();
79    let total: usize = s.per_camera.values().sum();
80    println!(
81        "frame hook: {total} frames over {} positions, per camera {:?}, sizes {:?}, {:.1} MB RGB, bad {}",
82        s.positions,
83        s.per_camera,
84        s.sizes,
85        s.bytes as f64 / 1e6,
86        s.bad
87    );
88    println!(
89        "frame hook: first frame at {:.2}s, last at {:.2}s; run total {:.1}s",
90        s.first_s.unwrap_or(0.0),
91        s.last_s,
92        t0.elapsed().as_secs_f64()
93    );
94    println!("refined zones (zone, dense points): {:?}", refined.lock().unwrap());
95    println!("events {}, hook calls {}, hook panics {}", summary.events, summary.hook_calls, summary.hook_panics);
96    if total == 0 || s.bad > 0 || summary.hook_panics > 0 {
97        return Err("frame hook check failed".into());
98    }
99    Ok(())
100}
Source

pub fn from_stream(c: &StreamConfig) -> Self

The plan equivalent to the cumulus3d stream settings (<src>/images, <src>/gps_ref.txt, aerial-formation cameras).

Trait Implementations§

Source§

impl Clone for Plan

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Plan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Plan

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Plan
where Plan: Default,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Plan

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Plan

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Plan

Auto Trait Implementations§

§

impl Freeze for Plan

§

impl RefUnwindSafe for Plan

§

impl Send for Plan

§

impl Sync for Plan

§

impl Unpin for Plan

§

impl UnsafeUnpin for Plan

§

impl UnwindSafe for Plan

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V