-coord ignores perspective: LEDs on oblique strips are placed several cm off in height

Offen
#177 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
computer-vision

Rechercherichtung

Start with LED.conversion_matrix and _calculate_3d_coordinates in ledsa/ledpositions/coordinates.py, then inspect the demo geometry in ledsa/demo/demo_setup.py. Trace how LED pixel positions and gaps from dead or ignored LEDs are handled, and add tests for an oblique strip, a vertical strip, and a missing LED. Done means positions follow LED spacing along the strip while the vertical strip remains effectively unchanged.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug

Problem

-coord interpolates the 3D position of every LED linearly between the two tape-measured edge LEDs of its strip, according to where the LED appears in the image. Under perspective that is exact only for a strip at constant depth along the camera's line of sight, such as a vertical strip seen straight on. Along a strip that runs towards or away from the camera, the near part appears stretched and the far part compressed, so the LEDs are placed too far towards the far end. Lens distortion adds to this.

Cause

LED.conversion_matrix builds a linear map from pixel to world coordinates through the two edge LEDs, and _calculate_3d_coordinates maps every LED of the strip with it after projecting its pixel position onto the line between them.

For a pinhole camera, an LED at the fraction t of the way along the strip appears at the fraction

s(t) = t·Z1 / ((1 − t)·Z0 + t·Z1)

of the way along its image, where Z0 and Z1 are the depths of the two edge LEDs along the optical axis. The linear map puts the LED at s(t) instead of t. The error is largest in the middle of the strip and vanishes for Z0 = Z1.

Size on the demo

For the demo geometry (demo_setup.py, camera at 7.29, 6.46, 2.30) and a lens without distortion. The camera's aim isn't recorded, so two plausible aims:

Strip Shape Height error mid-strip, camera aimed at the centre of the setup … aimed at the middle of strip 0
0 diagonal 10.5 cm 7.0 cm
2 diagonal 7.8 cm 5.1 cm
4 diagonal 8.2 cm 6.0 cm
6 diagonal 6.3 cm 4.4 cm
1, 3, 5 vertical < 1 cm < 1 cm

The demo's layers are 11.8 cm thick, so the middle LEDs of a diagonal strip can sit almost a layer too high (strip 0, whose top end is farther from the camera) or too low (strip 4, whose top end is nearer). A wrong LED height changes how its ray is split between the layers, which distorts the profile of a diagonal strip in height, and the temperature correction is interpolated at the wrong heights.

Proposed fix

Place each LED by its position counted along the strip: LED i of N sits at start + i/(N − 1) · (end − start). That is exact for a straight strip with uniform pitch, whatever the perspective or lens distortion.

The count has to include dead and ignored LEDs. Each of them leaves a gap of a whole number of spacings between neighbouring LEDs in the image, so the gaps can be found from the pixel spacing.

Tests: a synthetic oblique strip seen in perspective, a vertical strip whose positions must not change, and a strip with a missing LED.

Results of oblique strips change when they are re-run; vertical strips move by less than about 1 cm.

Related: #47

Vorherrschende Sprache
Python
Sterne
7
Forks
4
Ø Merge
3 Std. 58 Min.
Gemergte PRs (30 T.)
35

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus FireDynamics/LEDSmokeAnalysis

Alle Issues in FireDynamics/LEDSmokeAnalysis

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.