Skip to main content

Module declare

Module declare 

Source
Expand description

Declarative builder layer: record a plan first and run it all at once later.

The methods of the ReconBuilder returned by Recon::declare only record a plan (“this is what to do”) and execute nothing (they neither create nor delete files or folders, and do not open devices). ReconBuilder::build validates the plan and builds an executable reconstruction (Recon); Recon::run assembles the session reducer + pipeline + hooks + default output hook and runs the position loop, the wait for background jobs and the shutdown in one go (deferred execution).

The plan itself is a value (Plan), so it can be compared, cloned and saved as TOML (Plan::to_toml / Plan::from_toml). Hooks (closures) are kept in the builder, not in the plan.

§Usage example

use cumulus3d_cli::declare::{Dense, Recon, Sinks};
use cumulus3d_cli::events::{Event, EventKind};

fn main() -> Result<(), String> {
    let recon = Recon::declare()
        .input("data")                      // data/images/<cam>/, data/gps_ref.txt
        .preset("aerial-formation")         // camF/camR/camL, formation pairing rule, stride 3
        .stride(3)
        .zones(12, 2)
        .dense(Dense::profile("fast").fusion_min_views(3))
        .sinks(Sinks::default_files("out").models(true))
        .seed(7)
        .on(EventKind::PositionDone, |e: &Event| {
            if let Some(t) = e.timeline_text() {
                println!("{t}");
            }
        })
        .on_zone_preview(|range, cloud| println!("preview {}: {} points", range.zone, cloud.len()))
        .build()                            // validation only (errors are collected and reported at once)
        .map_err(|e| e.to_string())?;
    println!("{}", recon.plan().to_toml());
    let summary = recon.run()?;              // actual execution happens here
    println!("{} events", summary.events);
    Ok(())
}

Run from a TOML plan file: cumulus3d run plan.toml. The default plan is cumulus3d plan --print-default. Relative paths in a plan file are relative to the working location (current folder).

Structs§

Align
Coordinate alignment.
Dense
Densification plan. Start from Dense::profile and add to it with methods. Unset fusion/filter values use the profile defaults.
Features
Feature extraction.
Filter
Depth map filter overrides (same meaning as --filter-* and --median-filter of the densify subcommand). If unset, the profile default.
Fusion
Fusion overrides (same meaning as --fusion-* of the densify subcommand). If unset, the profile default.
Matching
Descriptor matching.
Plan
Reconstruction plan (a value). It runs nothing and only holds “what to do and how”.
PlanError
Validation error of ReconBuilder::build. It holds all the problems found.
Problem
One plan validation problem.
Recon
An executable reconstruction that has passed validation. Run it with Recon::run.
ReconBuilder
Plan recorder. Methods only record and do not run anything. Validate with ReconBuilder::build.
Sinks
Output hook plan. If out is unset, no files are written (enabled file items are ignored, only hooks remain).
Source
Input images: <images>/<camera>/<camera>_NNNN.jpg.
Sparse
Sparse reconstruction.
Zones
Zones (in units of positions).

Enums§

AlignFrame
Alignment coordinate frame.
Pairing
Pairing strategy.

Constants§

DEFAULT_PRESET
Default preset name.
PRESETS
Known preset names.