nx_visual_hull.nx
buildroot/runtime/nx_visual_hull.nx
about
nx_visual_hull.nx -- SILHOUETTE -> 3D FORM. Builds a signed field by intersecting the back-
projections of N silhouettes (the visual hull), which surface_nets then polygonizes into a mesh.
This is the missing rung between a photograph and geometry. The ecosystem could decode JPEG
(nx_jpeg_decode_rgb), polygonize a field (nx_isosurf), render a mesh (nx_trimesh) and import OBJ
(nx_obj_import) -- but had no way to turn images INTO a field. Verified absent before writing:
every `carve` in the corpus is terrain/geology.
★VIEWS MUST DIFFER IN ANGLE. An anterior and a posterior photograph project along the SAME axis
and therefore yield the SAME silhouette outline (mirrored) -- that is ONE shape constraint, not
two, however many images you have. Front + LATERAL is what constrains a form. Anterior/posterior
pairs are still valuable, but for per-surface ALBEDO, not for shape.
★CSG: the visual hull is an INTERSECTION of back-projected silhouette prisms, and intersection of
signed distance fields is max(). Each view is folded in with max, so views can be added
incrementally and in any order.
Caller supplies cos/sin of the view yaw in Q10 (1024 = 1.0) so this organ needs no trig table and
stays exact for the axis-aligned cases that matter (front 1024/0, lateral 0/1024).
license_tier: ORIGINAL
dependencies 1 imports · 2 importers
imports: nx_syscalls.nx
imported by: nx_hull_mesh.nxnx_visual_hull_gate.nx
structs
| none |
consts
| 23 | const VH_BIG: i64 = 1000000 |
| 24 | const VH_Q: i64 = 1024 |
functions
| 26 | func vh_abs(v: i64) -> i64 { if v < 0 { return 0 - v } return v } called by 1: vh_bg_mask |
| 27 | func vh_min(a: i64, b: i64) -> i64 { if a < b { return a } return b } called by 1: vh_sdf2d |
| 28 | func vh_max(a: i64, b: i64) -> i64 { if a > b { return a } return b } called by 1: vh_carve_view |
| 33 | func vh_bg_mask(rgb: *u8, w: i64, h: i64, tol: i64, mask: *u8) -> i64 |
| 74 | func vh_sdf2d(mask: *u8, w: i64, h: i64, out: *i64) -> i64 |
| 121 | func vh_samp(f: *i64, w: i64, h: i64, x: i64, y: i64) -> i64 called by 1: vh_carve_view |
| 136 | func vh_carve_view(f2d: *i64, w: i64, h: i64, cyaw: i64, syaw: i64, |