gen_measure_rectangle2 — MEASURE1D caliper op

• 資料種類:無 → measurehandle(僅由參數決定的運算子 —— 不接受影像或資料輸入)

• 呼叫: import fullseye as fs; fs.ledger.gen_measure_rectangle2(row, col, phi, length1, length2, shape)(要直接呼叫實作,import measuring1d; measuring1d.gen_measure_rectangle2(row, col, phi, length1, length2, shape);從台帳取用則 opsmeasure1d.get("gen_measure_rectangle2"))

• HALCON 對應:gen_measure_rectangle2(其含義與參數可參考 HALCON 手冊)

• GPU:無(僅 CPU 參考實作)

用法

定義旋轉量測矩形(沿長軸 phi 方向以 1 px 間隔取剖面)(gen_measure_rectangle2)。取樣數 n = max(2, round(2*length1)+1),起點位於距中心 -(n-1)/2 px 處。length2 為寬度方向的平均寬度 [px]。

> 以下的詳細說明為原文 —— 摘要與標題已翻譯。

★長さの意味(2026-11-09 に実装へ合わせて明記。値は変えていない):

• length1 は半長(プロファイルは中心 ± length1)。HALCON の Length1 と同じ。

• length2 は全幅: measure_pos は法線方向の np.linspace(-w/2, w/2, max(2, w)) (w = int(length2))の w 本を平均し、w ≤ 1 なら平均しない。HALCON の Length2 は 半高(Half height of the rectangle、HALCON の reference)で、同じライブラリの gen_rectangle2_contour_xld も length2 を半幅(角が ±length2)として描く —— 同じ数字を渡すと、ここでは半分の幅しか平均しない。★HALCON の整数 offset −L2..+L2(2·L2+1 本)をそのまま作る length2 は無い: length2 = 2·L2 + 1 を渡すと本数は 2·L2+1 だが、offset は ±(L2 + 0.5) の範囲に間隔 (2·L2+1)/(2·L2) で並ぶ(L2=2 → w=5 で −2.5, −1.25, 0, 1.25, 2.5)—— 整数でなく幅も 1 画素広い。辺が測定線に直交していれば平均の結果は近いが、幅方向に構造があると別の矩形を測る。

• w が偶数のとき標本は中心の行を通らない(w=2 は offset ±1 の 2 本だけ、w=4 は ±2, ±0.67)。中心を含めたいなら奇数の w。

★角の向き: プロファイルは (row + t·sin φ, col + t·cos φ) に進む。行が下向きの画像座標で φ を時計回りに数える(φ = +π/2 は画面の下向き)。HALCON の Phi は水平からの「数学的に正」の角(gen_rectangle2 の reference)で、行が下向きの画像では反時計回り(φ = π/2 は上向き)と読める —— 符号が逆。HALCON の Phi を移すなら phi = −Phi (極性 positive/negative と並び順が HALCON と揃う)。★HALCON の実機での照合はしていない(reference の文言からの読み)。ライブラリ内では gen_rectangle2_contour_xld も同じ +sin で一貫している。

詳細使用指南

• subpixel_measuring 族使用指南

參考(範例資料、文獻)

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

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

• 演算法的正典(作者、年份)與用途見上面的族使用指南。

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

• example_scratch_width — py -3.11 examples/example_scratch_width.py

• poc_barcode_1d — py -3.11 examples/poc_barcode_1d.py

• poc_battery_electrode_breathing — py -3.11 examples/poc_battery_electrode_breathing.py

• poc_calipers_under_illusion — py -3.11 examples/poc_calipers_under_illusion.py

• poc_dimensional_inspection — py -3.11 examples/poc_dimensional_inspection.py

• poc_screw_thread_metrology — py -3.11 examples/poc_screw_thread_metrology.py

• poc_solar_limb_darkening — py -3.11 examples/poc_solar_limb_darkening.py

• poc_telecentric_metrology — py -3.11 examples/poc_telecentric_metrology.py

• poc_tree_ring_dendro — py -3.11 examples/poc_tree_ring_dendro.py

• poc_water_level — py -3.11 examples/poc_water_level.py

• poc_weld_bead_profile — py -3.11 examples/poc_weld_bead_profile.py

• poc_weld_radiograph_porosity — py -3.11 examples/poc_weld_radiograph_porosity.py

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

translate_measure · measure_pos · measure_pairs · fuzzy_measure_pairing

同類別(caliper)

gen_measure_arc · translate_measure · measure_pos · measure_pairs · fuzzy_measure_pairing


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

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