surface_normals — 3D photometric op

• Data kinds: image2d → normalmap

• Call: import fullseye as fs; fs.ledger.surface_normals(z) (to call the implementation directly, import photometric; photometric.surface_normals(z); from the registry, ops3d.get("surface_normals"))

Usage

Height field z (HxW) → unit normals (H,W,3). n ∝ (−dz/dx, −dz/dy, 1). The forward depth → normal conversion.

Takes the row-direction dz/dy and the column-direction dz/dx by the central differences of np.gradient (one-sided at the edges), and normalises n = (-dz/dx, -dz/dy, 1) to length 1 (+1e-12 avoids division by zero). The grid spacing is taken as 1 pixel, so if the unit of z differs from pixels (mm etc.), convert to z / pixel_pitch beforehand, or the slopes come out stronger/weaker than they really are. The z component of the normal is always positive (facing the camera). Returns float32 (H,W,3); the 3rd axis holds the (x, y, z) components, x along columns and y along rows. There is no input validation; anything other than 2-D fails in the unpacking of np.gradient. It is the inverse of integrate_normals and uses the same normal convention as the output of photometric_stereo, so it can be passed directly to render_lambertian to synthesise a shaded image.

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

Runnable examples (verified samples that actually call this op)

• photometric_stereo — py -3.11 examples_3d/photometric_stereo.py

Ops the type connects to (they accept normalmap as input)

fuse_to_voxel · render_shaded · phong_shade · matcap_shade · brdf_lommel_seeliger · brdf_hapke · bump_normals_fbm · integrate_normals

Same category (photometric)

photometric_stereo · integrate_normals · render_lambertian


*Provenance: photometric.py — 3D operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.