laser_line_center_centroid — OPTICS light_section op

• Datenarten: image2d → table

• Aufruf: import fullseye as fs; fs.ledger.laser_line_center_centroid(image, min_peak_rel=0.1, half_window=None, background=0.0, clip_negative=True) (die Implementierung direkt: import lightsection; lightsection.laser_line_center_centroid(image, min_peak_rel=0.1, half_window=None, background=0.0, clip_negative=True); aus dem Register: opsoptics.get("laser_line_center_centroid"))

• GPU: nein (nur CPU-Referenzimplementierung)

Verwendung

Subpixel-Mitte einer hellen Laserlinie in jeder Spalte über den Helligkeitsschwerpunkt (table).

> Die ausführliche Beschreibung unten ist der Originaltext — Zusammenfassung und Überschriften sind übersetzt.

列ごとに最大の行 p を探し、[p − half_window, p + half_window](None = 列全体)の輝度から background を引いて負を 0 にした重みの重心を返す。最大値が画像全体の最大の min_peak_rel 倍以下の列は valid=False(row は NaN)。

For each column the peak row p is found, and the centroid of max(I − background, 0) over [p − half_window, p + half_window] (None = the whole column) is returned. Columns whose peak is at most min_peak_rel × the image maximum are marked valid=False (row NaN). clip_negative=False keeps negative weights (zero-mean noise stays zero-mean: the estimator is then linear in the noise, which is what light_section_uncertainty_budget's read-noise term assumes). Pixel-centre convention of camera: row r is the coordinate v = r exactly.

Returns {"kind": "laser_line_centers", "method": "centroid", "col", "row", "valid", "peak", "n_valid", "saturated", "truncated"}. Ground truth: a symmetric line profile has its centroid at the true centre; the centroid of a column-binned image equals that of the unbinned one (tests/test_lightsection.py). ★Limits: the centroid is biased toward the window's centre when the window cuts an off-centre profile, and a background left in the weights pulls it toward the column's middle.

★Saturation: the "peak" is the plateau of rows within 1e-9 of the column maximum that is connected to the first maximum; the window is [lo − half_window, hi + half_window] around that plateau (one row for an unclipped line: the same as before). A clipped, flat-topped line used to be windowed at the plateau's first row (−6.7 px at 20× over full scale, still valid). saturated marks the columns whose plateau has ≥ 3 rows, or ≥ 2 rows at the image's maximum (the ceiling); only those columns get the plateau window, every other column is windowed at its first maximum exactly as before (bit for bit). Two equal rows below the ceiling are common in quantised, unclipped lines (uint8, σ 3 px: 6 % of the columns at a peak of 200, 15 % at 60) and are not a plateau. The result in a saturated column is a centroid of clipped data, so treat it as degraded. ★Not detected: a plateau broken by a dip (dark-frame or flat-field correction after clipping leaves 1 LSB dips) — the plateau ends at the dip and the window shifts toward it again (measured 3.5 px, gauss 3.2 px, valid; 5.6 px before the plateau window); pass uncorrected data or clip it back to the ceiling first. truncated marks the columns whose weight at either end of the window (or of the image) is still ≥ max(min_peak_rel, 1e-3) × the column's peak weight — the profile was cut, so the centroid is pulled toward the window's middle (measured: σ 2 px, true 0.4 → 1.48). valid is not changed by either flag.

Familienweiter Eingabevertrag (fail-closed)

Jeder optics-Operator prüft seine Eingabe vor der Berechnung (nichts rutscht stillschweigend durch):

• Einheiten stecken im Argumentnamen — _mm / _um / _deg / _mrad. Eine Verwechslung von mm und µm stürzt nicht ab, sondern liefert eine plausibel aussehende falsche Antwort; der Name verhindert das. Aus der Größenordnung wird nie auf die Einheit geschlossen.

• Strings lösen ValueError aus — float('50') gelingt, sodass ein ungeparster Konfigurationswert als Länge durchrutschen würde (gemessen: thin_lens('50', '200') lieferte plausible 66,667 mm). bool wird als implizite Hochstufung True == 1 ebenfalls abgelehnt.

• complex / Masked Arrays lösen ValueError aus (nur reelle Slots; das stille Verwerfen des Imaginärteils bzw. Abstreifen der Maske wird abgelehnt). NaN/Inf löst bei jeder Eingabe ValueError aus. Ausnahme, ausdrücklich erklärt: Das u_map von bottle_fit_from_pattern nimmt nicht gemessene Pixel als NaN entgegen (Unendlich wird weiterhin abgelehnt).

• Division durch null und Verwandtes wird namentlich abgelehnt: Brennweite 0, Krümmungsradius 0, Brechzahl <= 0, undurchlässige Blende (alles 0, die Normierung wird 0/0), PSF mit Summe <= 0, Stokes-Vektor mit S0 = 0 und ein Objekt im vorderen Brennpunkt (Bild im Unendlichen).

• Nur zwei Operatoren liefern einen nicht-endlichen Wert, und beide halten das vertraglich fest: depth_of_field liefert jenseits der hyperfokalen Distanz far_mm = inf (genau das bedeutet die hyperfokale Distanz), und gaussian_beam liefert an der Taille wavefront_radius_mm = inf (der Krümmungsradius einer ebenen Wellenfront). Beide liefern zusätzlich einen endlichen Partner (far_is_infinite / curvature_per_mm). Jedes andere stille NaN/Inf wird intern erkannt und löst ValueError aus — "float64 ist übergelaufen" und "die Antwort ist unendlich" sind verschiedene Aussagen; die erste wird nie im Gewand der zweiten geliefert. Ausnahme, ausdrücklich erklärt: bottle_background_map liefert für Pixel mit unbrauchbarem Strahl (Totalreflexion u. Ä.) NaN in u_mm, zusammen mit einer valid-Maske und den Anzahlen.

• Größenobergrenzen: erzeugte Gitter durch optics.MAX_GRID (4096), übergebene Felder/PSFs/Blenden durch optics.MAX_FIELD_ELEMENTS (2^24), ABCD-Elementketten durch optics.MAX_SYSTEM_ELEMENTS (1024), Zernike durch MAX_ZERNIKE_TERMS (512) / MAX_ZERNIKE_ORDER (40) / MAX_ZERNIKE_BASIS (2^25). Damit werden Pfade fail-closed geschlossen, in denen ein kleines Argument eine riesige interne Allokation auslöst (gemessen: n_max=40 × 4096² braucht 108 GB).

• Physikalisch unmögliche Zustände werden ebenfalls abgelehnt: Stokes-Vektor mit Polarisationsgrad > 1, negative Transmission, negative Intensität und ungültige Zernike-Indizes wie ungerades n-|m|.

Ausführlicher Anwendungsleitfaden

• Leitfaden zur Familie optics_imaging

Referenzen (Beispieldaten, Literatur)

• Katalog der Beispieldaten (Download-URLs / Lizenzen) — 2-D nutzt skimage.data (BSD/Public Domain) plus synthetische Bilder, 3-D nennt Download-URLs echter Datenquellen (Stanford, PDS, …).

• Herkunft und Literatur der Operatoren — die Quellen der Forschung/Verfahren, auf denen diese Operatorfamilie beruht.

• Der kanonische Algorithmus (Autor, Jahr) und seine Anwendungen stehen im Familienleitfaden oben.

Ausführbare Beispiele (verifizierte Samples, die diesen Operator wirklich aufrufen)

• poc_3d_sensor_modalities — py -3.11 examples/poc_3d_sensor_modalities.py

• poc_weld_bead_profile — py -3.11 examples/poc_weld_bead_profile.py

Typkompatible Folge-Operatoren (nehmen table als Eingabe)

abcd_matrix · wavefront_stats · sfr_from_edge · paraxial_trace · seidel_coefficients · spot_stats · tolerance_analysis · wavefront_from_opd

Gleiche Kategorie (light_section)

laser_line_center_gauss · laser_line_center_steger · light_section_rig · light_section_targets · light_section_render · light_plane_calibrate · light_section_profile · light_section_scan


*Provenance: lightsection.py — OPTICS Operator-Registry. Diese Notiz wird von tools/opdocs.py md erzeugt (nicht von Hand bearbeiten).*

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