Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

FP2f: raea-sys-fingerprint-things holds things and geometry (the camera-speed, floating, passing-through and empty-frame reads), split from raea-sys-fingerprint-use to keep each crate under 2,000 lines

shinyobjectzb8d21bf71229
diff --git a/Cargo.lock b/Cargo.lock
index 5060c433..5adc6b30 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -13677,6 +13677,7 @@ dependencies = [
"raea-app-check",
"raea-sys-columns",
"raea-sys-fingerprint",
+ "raea-sys-fingerprint-things",
"raea-sys-fingerprint-use",
"serde",
"serde_json",
@@ -15478,6 +15479,19 @@ dependencies = [
"serde_json",
]
+[[package]]
+name = "raea-sys-fingerprint-things"
+version = "0.1.0"
+dependencies = [
+ "anyhow",
+ "image",
+ "raea-sys-columns",
+ "raea-sys-fingerprint-use",
+ "raea-sys-layers",
+ "serde",
+ "serde_json",
+]
+
[[package]]
name = "raea-sys-fingerprint-use"
version = "0.1.0"
@@ -15486,7 +15500,6 @@ dependencies = [
"image",
"raea-sys-columns",
"raea-sys-fingerprint",
- "raea-sys-layers",
"serde",
"serde_json",
]
diff --git a/Cargo.toml b/Cargo.toml
index 9fec479f..52010003 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -84,6 +84,7 @@ members = [
"systems/columns",
"systems/fingerprint",
"systems/fingerprint-use",
+ "systems/fingerprint-things",
"systems/song",
"systems/perceive",
"systems/footage",
diff --git a/apps/fingerprint/Cargo.toml b/apps/fingerprint/Cargo.toml
index be11f40a..15ef1196 100644
--- a/apps/fingerprint/Cargo.toml
+++ b/apps/fingerprint/Cargo.toml
@@ -11,6 +11,7 @@ description = "`raea fingerprint` (docs/fingerprint.feature FP3a): new, bootstra
raea-sys-fingerprint = { path = "../../systems/fingerprint" }
# scoring and the sheet, which one judges a piece, diff and profiles
raea-sys-fingerprint-use = { path = "../../systems/fingerprint-use" }
+raea-sys-fingerprint-things = { path = "../../systems/fingerprint-things" }
# the encoders and the columns they make
raea-sys-columns = { path = "../../systems/columns" }
# raea check's floor on the file: its findings go in the summary, and a check wins over a head (FP4c)
diff --git a/apps/fingerprint/src/things.rs b/apps/fingerprint/src/things.rs
index 20c8d7d2..f6acb0fd 100644
--- a/apps/fingerprint/src/things.rs
+++ b/apps/fingerprint/src/things.rs
@@ -1,12 +1,12 @@
//! `raea fingerprint things FILE [--project P] [--json]` (docs/fingerprint.feature FP13a, FP13c): a piece's shots,
//! their things (a render's layers, and every mark a person drew on a note of it in P's feed, P the folder it runs in
//! by default) and the camera's path, with what floats, passes through, lurches or is empty
-//! (raea-sys-fingerprint-use things.rs and geometry.rs). `--json` prints it all for `raea check --things`.
+//! (raea-sys-fingerprint-things). `--json` prints it all for `raea check --things`.
use crate::{flag, has};
use anyhow::Result;
use raea_sys_columns::Encoders;
-use raea_sys_fingerprint_use::things::{Mark, things};
+use raea_sys_fingerprint_things::things::{Mark, things};
use std::path::{Path, PathBuf};
pub(crate) fn run(enc: &mut Encoders, args: &[String], cwd: &Path) -> Result<(String, i32)> {
diff --git a/docs/fingerprint.feature b/docs/fingerprint.feature
index 356d7d31..479d9474 100644
--- a/docs/fingerprint.feature
+++ b/docs/fingerprint.feature
@@ -594,7 +594,7 @@ Feature: Fingerprint: a person's or a team's sense of good work, learned on thei
patch tokens pooled in its mask)
And on raea's renders the same things come from the layer pass, the depth and motion passes and the scene's
camera, with no model run
- And 11-12, so far: `raea fingerprint things FILE [--json]` (raea-sys-fingerprint-use things.rs): the shots
+ And 11-12, so far: `raea fingerprint things FILE [--json]` (raea-sys-fingerprint-things things.rs): the shots
(raea-perceive cuts), each thing's box, the median 1/depth of it, of its base and of the ground under it every
half second, and one SigLIP 2 vector on its box where it's largest (the box pooled, until FP12a's patch tokens);
and the camera's path (raea-perceive flow, Lucas-Kanade at 512: Vision's flow read a pan over plain ground at a
diff --git a/systems/fingerprint-things/Cargo.toml b/systems/fingerprint-things/Cargo.toml
new file mode 100644
index 00000000..6dbbf64e
--- /dev/null
+++ b/systems/fingerprint-things/Cargo.toml
@@ -0,0 +1,19 @@
+[package]
+name = "raea-sys-fingerprint-things"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "Fingerprint's things (docs/fingerprint.feature FP13a, FP13c): a piece's shots, its things with their depth and the ground under them, and the camera's path, from a render's layer and AOV passes or from marks followed by EdgeTAM and Depth Anything; and the geometry checks raea check reports from them"
+
+[dependencies]
+# a mark followed by EdgeTAM, raea-perceive found, the percentile (grow.rs, profile.rs)
+raea-sys-fingerprint-use = { path = "../fingerprint-use" }
+# frames, and SigLIP 2 on each thing's box
+raea-sys-columns = { path = "../columns" }
+# a render's layer pass read back: its things' masks with no model run
+raea-sys-layers = { path = "../layers" }
+serde = { version = "1", features = ["derive"] }
+serde_json = "1"
+anyhow = "1"
+image = { version = "0.25", default-features = false, features = ["png"] }
diff --git a/systems/fingerprint-use/src/geometry.rs b/systems/fingerprint-things/src/geometry.rs
similarity index 100%
rename from systems/fingerprint-use/src/geometry.rs
rename to systems/fingerprint-things/src/geometry.rs
diff --git a/systems/fingerprint-things/src/lib.rs b/systems/fingerprint-things/src/lib.rs
new file mode 100644
index 00000000..0a15476f
--- /dev/null
+++ b/systems/fingerprint-things/src/lib.rs
@@ -0,0 +1,5 @@
+//! Fingerprint's things (docs/fingerprint.feature FP13): things.rs finds a piece's shots, things and camera path;
+//! geometry.rs measures what floats, passes through, lurches or is empty in them, as checks, never heads.
+
+pub mod geometry;
+pub mod things;
diff --git a/systems/fingerprint-use/src/things.rs b/systems/fingerprint-things/src/things.rs
similarity index 99%
rename from systems/fingerprint-use/src/things.rs
rename to systems/fingerprint-things/src/things.rs
index 54456635..a3f2896c 100644
--- a/systems/fingerprint-use/src/things.rs
+++ b/systems/fingerprint-things/src/things.rs
@@ -6,7 +6,7 @@
//! camera's path Vision's optical flow (raea-perceive flow), the shots raea-perceive cuts'. geometry.rs measures them.
use crate::geometry::{self, Frame, Issue, Move, Seen};
-use crate::grow::{self, Matte, bounds, perceive};
+use raea_sys_fingerprint_use::grow::{self, Matte, bounds, perceive};
use anyhow::{Result, anyhow};
use raea_sys_columns::Encoders;
use serde::{Deserialize, Serialize};
@@ -77,7 +77,7 @@ fn median(mut v: Vec<f32>) -> Option<f32> {
}
fn quantile(v: &[f32], q: f64) -> f32 {
- crate::profile::pct(v, q as f32)
+ raea_sys_fingerprint_use::profile::pct(v, q as f32)
}
/// A frame's 1/depth over its 99th percentile, clamped to 0-1
diff --git a/systems/fingerprint-use/Cargo.toml b/systems/fingerprint-use/Cargo.toml
index 29cfaec5..a2a340c5 100644
--- a/systems/fingerprint-use/Cargo.toml
+++ b/systems/fingerprint-use/Cargo.toml
@@ -11,8 +11,6 @@ description = "Using a fingerprint (docs/fingerprint.feature FP3, FP6e, FP8b, FP
raea-sys-fingerprint = { path = "../fingerprint" }
# a piece's columns, and the frames and sound the sheet draws
raea-sys-columns = { path = "../columns" }
-# a render's layer pass read back: its things' masks with no model run (things.rs)
-raea-sys-layers = { path = "../layers" }
serde = { version = "1", features = ["derive"] }
anyhow = "1"
# a postmortem's asks kept beside the fingerprint, and the answers read from the inbox (postmortem.rs)
diff --git a/systems/fingerprint-use/src/lib.rs b/systems/fingerprint-use/src/lib.rs
index fd39a1a1..79b60ed5 100644
--- a/systems/fingerprint-use/src/lib.rs
+++ b/systems/fingerprint-use/src/lib.rs
@@ -11,14 +11,12 @@
pub mod diff;
pub mod fixed;
-pub mod geometry;
pub mod grow;
pub mod postmortem;
pub mod profile;
pub mod realness;
pub mod score;
pub mod sheet;
-pub mod things;
pub mod which;
#[cfg(test)]
diff --git a/systems/fingerprint-use/src/profile.rs b/systems/fingerprint-use/src/profile.rs
index 352aac2a..92dc3ed0 100644
--- a/systems/fingerprint-use/src/profile.rs
+++ b/systems/fingerprint-use/src/profile.rs
@@ -28,7 +28,8 @@ fn mean(v: &[f32]) -> f32 {
v.iter().sum::<f32>() / v.len().max(1) as f32
}
-pub(crate) fn pct(v: &[f32], q: f32) -> f32 {
+/// The q-th quantile of v (0 when empty)
+pub fn pct(v: &[f32], q: f32) -> f32 {
let mut s = v.to_vec();
s.sort_by(f32::total_cmp);
s.get(((s.len().max(1) - 1) as f32 * q) as usize).copied().unwrap_or(0.0)
diff --git a/tools/layers.toml b/tools/layers.toml
index 3ffa224f..2395e1ad 100644
--- a/tools/layers.toml
+++ b/tools/layers.toml
@@ -59,6 +59,7 @@ raea-sys-vision = "systems"
raea-sys-columns = "systems"
raea-sys-fingerprint = "systems"
raea-sys-fingerprint-use = "systems"
+raea-sys-fingerprint-things = "systems"
raea-sys-song = "systems"
raea-sys-perceive = "systems"
raea-sys-footage = "systems"
@@ -232,6 +233,8 @@ raea-sys-vision = true
raea-sys-columns = true
# a fingerprint's taxonomy, evidence and heads (raea-sys-fingerprint-use scores, compares and picks with them)
raea-sys-fingerprint = true
+# grow, profile and the heads' readings over a file (raea-sys-fingerprint-things reads things on them)
+raea-sys-fingerprint-use = true
raea-sys-song = true
raea-sys-k = true
raea-sys-wear = true