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.