graycode_decode — 3D structured_light op

• Data kinds: images → image2d

• Call: import fullseye as fs; fs.ledger.graycode_decode(bit_images, thresh=0.5) -> 'np.ndarray' (to call the implementation directly, import fringe; fringe.graycode_decode(bit_images, thresh=0.5) -> 'np.ndarray'; from the registry, ops3d.get("graycode_decode"))

Usage

A series of Gray-code bit images → an integer fringe-order map (the absolute order).

bit_images: a sequence of length K (each a 2D image, bright=1 / dark=0). MSB first (bit_images[0] is

the most significant bit). Binarised with thresh.

thresh: binarisation threshold (pixel value >= thresh is 1).

Processing: binarise each bit plane → assemble the Gray value MSB first → Gray→binary conversion

(binary = gray ^ (gray>>1) ^ ... ^ (gray>>(K-1))), returning the absolute order (integer).

Returns: 2D order map of dtype int64 (range 0..2**K-1).

Validation (ValueError): None / not convertible to (K, H, W) / K < 1 / K > 62 (does not fit in int64) / contains NaN or Inf. thresh is not checked (give it on the same scale as the pixel values; for a [0, 1] image 0.5 is the default).

Binarisation is only the fixed threshold >= thresh — no comparison with an inverted pattern (negative image) and no local threshold. Pixels that come out dark because of shadow or low reflectance are decoded as 0 bits and, without an error, give a wrong order, so a reliability mask made with modulation or similar should be kept separately by the caller.

Meaning of the order: adjacent Gray codes differ in only 1 bit, so a binarisation error at a boundary pixel shifts the order by only ±1 (with a binary code it would jump a lot). Use the returned integer as the projector column number or the absolute fringe order, for coarse of absolute_phase (converted to phase as 2π * order) or column of triangulate_column.

Background guides (the physics and conventions behind this op)

• depth_sensors — Depth sensors — ranging principles, real-device figures, how dropouts appear

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)

• graycode_structured_light — py -3.11 examples_3d/graycode_structured_light.py

• structured_light_scan — py -3.11 examples_3d/structured_light_scan.py

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

fuse_to_voxel · fit_poly_surface · eval_poly_surface · surface_form_error · background_flatten · polar_unwrap · fit_zernike · matcap_shade

Same category (structured_light)

wrapped_phase · unwrap_phase_2d · decode_fringe · synthesize_fringes · absolute_phase · triangulate_column


*Provenance: fringe.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.