graycode_decode — 3D structured_light op

• 資料種類:images → image2d

• 呼叫: import fullseye as fs; fs.ledger.graycode_decode(bit_images, thresh=0.5) -> 'np.ndarray'(要直接呼叫實作,import fringe; fringe.graycode_decode(bit_images, thresh=0.5) -> 'np.ndarray';從台帳取用則 ops3d.get("graycode_decode"))

用法

Gray code 位元影像序列 → 整數條紋級次圖(絕對級次)。

bit_images:長度為 K 的序列(各為 2D 影像,亮=1 / 暗=0)。MSB first(bit_images[0] 為

最高位元)。以 thresh 二值化。

thresh: 二值化閾值(像素值 >= thresh 為 1)。

處理:將各位元平面二值化 → 按 MSB first 組裝 Gray 值 → Gray→binary 轉換

(binary = gray ^ (gray>>1) ^ ... ^ (gray>>(K-1))),回傳絕對級次(整數)。

回傳值:dtype int64 的 2D 級次圖(值域 0..2**K-1)。

驗證(ValueError):None / 無法轉換為 (K, H, W) / K < 1 / K > 62(超出 int64) / 含 NaN、Inf。thresh 不做檢查(以與像素值相同的尺度給出。[0, 1] 影像時預設為 0.5)。

二值化只用固定閾值 >= thresh — 不與反轉圖案(負片影像)比較, 也不做局部閾值。因陰影、低反射而顯暗的像素被解碼為 0 位元, 不報錯卻得到錯誤級次,因此呼叫端應另行持有以 modulation 等產生的可信遮罩。

級次的含義:Gray 碼相鄰碼字只差 1 位元,因此邊界像素的二值化錯誤只會使級次偏移 ±1(若是 binary 碼則會大幅跳變)。回傳的整數可作為投影機行號或條紋絕對級次,用於 absolute_phase 的 coarse (按 2π * 級次 換算為相位)或 triangulate_column 的 column。

背景知識指南(該運算子背後的物理與規範)

• depth_sensors — 深度感測器知識 —— 測距原理、實機數值、缺測的表現

參考(範例資料、文獻)

• 範例資料目錄(下載 URL / 授權) —— 2-D 用 skimage.data(BSD/公有領域)加合成圖,3-D 給出真實資料源(Stanford/PDS 等)的下載 URL。

• 運算子來歷與參考文獻 —— 該運算子族所依據的研究/方法出處。

可執行的範例(實際呼叫該運算子並已驗證的樣例)

• graycode_structured_light — py -3.11 examples_3d/graycode_structured_light.py

• structured_light_scan — py -3.11 examples_3d/structured_light_scan.py

型別可銜接的下一個運算子(可接受 image2d 作為輸入)

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

同類別(structured_light)

wrapped_phase · unwrap_phase_2d · decode_fringe · synthesize_fringes · absolute_phase · triangulate_column


*Provenance: fringe.py — 3D 運算子登記表。本條目由 tools/opdocs.py md 自動產生(請勿手動編輯)。*

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