Skip to main content

Layout

Struct Layout 

Source
pub struct Layout {
    pub frames: Vec<u32>,
    pub pos_of: HashMap<String, usize>,
}
Expand description

위치 ↔ 영상 이름. 위치 = 선택된 프레임 목록의 순번(파일 번호 / stride 가 아님).

Fields§

§frames: Vec<u32>

위치별 입력 파일의 프레임 번호.

§pos_of: HashMap<String, usize>

영상 이름 → 위치.

Implementations§

Source§

impl Layout

Source

pub fn discover(src: &Path, stride: usize) -> Result<Self, String>

images/camF/camF_NNNN.jpg 중 번호 % stride == 0 인 것(번호 오름차순).

Examples found in repository?
examples/hooks.rs (line 30)
21fn main() -> Result<(), String> {
22    let out = std::env::args().nth(1).map(PathBuf::from).unwrap_or_else(|| std::env::temp_dir().join("cumulus3d_hooks"));
23    let src = out.with_extension("src");
24    if !src.join("gps_ref.txt").exists() {
25        common::make_dataset(&src);
26    }
27    if out.exists() {
28        std::fs::remove_dir_all(&out).map_err(|e| e.to_string())?;
29    }
30    let layout = Layout::discover(&src, 1)?;
31    let npos = layout.frames.len();
32
33    let mut cfg = SessionConfig::new(src.join("images"));
34    cfg.gps = read_gps_file(src.join("gps_ref.txt")).map_err(|e| e.to_string())?;
35    (cfg.span, cfg.overlap, cfg.total_positions, cfg.seed) = (4, 1, Some(npos), Some(7));
36    if cumulus3d_cuda::is_available() {
37        let mut d = DenseConfig::new(make_pm_backend("cuda"), parse_profile("fast")?);
38        d.undistort.max_image_size = 160;
39        cfg.dense = Some(d);
40    }
41
42    // 훅: 사건 문구 출력, 구역 점군 점 수, 경고·오류. 그리고 기본 출력 훅(파일).
43    let pipeline = Pipeline::new(Session::new(cfg))
44        .on_any(|e: &Event| {
45            if let Some(t) = e.timeline_text() {
46                println!("[event v{}] {t}", e.meta().version);
47            }
48        })
49        .on(EventKind::ZonePreview, |e: &Event| {
50            if let Event::ZonePreview { range, cloud, model, .. } = e {
51                println!("  초벌 {}: 조밀 점 {} / 희소 점 {}", range.zone, cloud.len(), model.num_points3d());
52            }
53        })
54        .on(EventKind::ZoneRefined, |e: &Event| {
55            if let Event::ZoneRefined { range, cloud, model, .. } = e {
56                println!("  정밀 {}: 조밀 점 {} / 희소 점 {}", range.zone, cloud.len(), model.num_points3d());
57            }
58        })
59        .on_message(|k, m| eprintln!("  {k:?}: {m}"));
60    let mut pipeline = sinks::attach(pipeline, &out, &SinkOptions::default()).map_err(|e| e.to_string())?;
61
62    for p in 0..npos {
63        pipeline.push(Input::Frames(FrameSet::new(CAMS.iter().map(|c| (*c, layout.name(c, p))))));
64    }
65    let (_, summary) = pipeline.finish();
66    println!("이벤트 {} 개, 훅 호출 {} 번, 훅 패닉 {}", summary.events, summary.hook_calls, summary.hook_panics);
67
68    for f in ["timeline.txt", "run.log", "snapshots/manifest.json", "snapshots/timeline.txt", "DONE"] {
69        let p = out.join(f);
70        println!("{} {}", if p.exists() { "있음" } else { "없음" }, p.display());
71    }
72    Ok(())
73}
Source

pub fn name(&self, cam: &str, p: usize) -> String

카메라·위치의 영상 이름(cam/cam_NNNN.jpg).

Examples found in repository?
examples/hooks.rs (line 63)
21fn main() -> Result<(), String> {
22    let out = std::env::args().nth(1).map(PathBuf::from).unwrap_or_else(|| std::env::temp_dir().join("cumulus3d_hooks"));
23    let src = out.with_extension("src");
24    if !src.join("gps_ref.txt").exists() {
25        common::make_dataset(&src);
26    }
27    if out.exists() {
28        std::fs::remove_dir_all(&out).map_err(|e| e.to_string())?;
29    }
30    let layout = Layout::discover(&src, 1)?;
31    let npos = layout.frames.len();
32
33    let mut cfg = SessionConfig::new(src.join("images"));
34    cfg.gps = read_gps_file(src.join("gps_ref.txt")).map_err(|e| e.to_string())?;
35    (cfg.span, cfg.overlap, cfg.total_positions, cfg.seed) = (4, 1, Some(npos), Some(7));
36    if cumulus3d_cuda::is_available() {
37        let mut d = DenseConfig::new(make_pm_backend("cuda"), parse_profile("fast")?);
38        d.undistort.max_image_size = 160;
39        cfg.dense = Some(d);
40    }
41
42    // 훅: 사건 문구 출력, 구역 점군 점 수, 경고·오류. 그리고 기본 출력 훅(파일).
43    let pipeline = Pipeline::new(Session::new(cfg))
44        .on_any(|e: &Event| {
45            if let Some(t) = e.timeline_text() {
46                println!("[event v{}] {t}", e.meta().version);
47            }
48        })
49        .on(EventKind::ZonePreview, |e: &Event| {
50            if let Event::ZonePreview { range, cloud, model, .. } = e {
51                println!("  초벌 {}: 조밀 점 {} / 희소 점 {}", range.zone, cloud.len(), model.num_points3d());
52            }
53        })
54        .on(EventKind::ZoneRefined, |e: &Event| {
55            if let Event::ZoneRefined { range, cloud, model, .. } = e {
56                println!("  정밀 {}: 조밀 점 {} / 희소 점 {}", range.zone, cloud.len(), model.num_points3d());
57            }
58        })
59        .on_message(|k, m| eprintln!("  {k:?}: {m}"));
60    let mut pipeline = sinks::attach(pipeline, &out, &SinkOptions::default()).map_err(|e| e.to_string())?;
61
62    for p in 0..npos {
63        pipeline.push(Input::Frames(FrameSet::new(CAMS.iter().map(|c| (*c, layout.name(c, p))))));
64    }
65    let (_, summary) = pipeline.finish();
66    println!("이벤트 {} 개, 훅 호출 {} 번, 훅 패닉 {}", summary.events, summary.hook_calls, summary.hook_panics);
67
68    for f in ["timeline.txt", "run.log", "snapshots/manifest.json", "snapshots/timeline.txt", "DONE"] {
69        let p = out.join(f);
70        println!("{} {}", if p.exists() { "있음" } else { "없음" }, p.display());
71    }
72    Ok(())
73}
Source

pub fn position(&self, name: &str) -> Option<usize>

영상 이름의 위치.

Trait Implementations§

Source§

impl Clone for Layout

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 Layout

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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<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