Skip to content

feat: make the 2.5D tracing parameters reachable from configuration - #15

Open
leiverkus wants to merge 1 commit into
mainfrom
feat/dem-tracing-knobs
Open

feat: make the 2.5D tracing parameters reachable from configuration#15
leiverkus wants to merge 1 commit into
mainfrom
feat/dem-tracing-knobs

Conversation

@leiverkus

Copy link
Copy Markdown
Owner

The item PR #14 named as out of scope: threshold_k, min_length_m, simplify_m and the relief kernel sizes were unreachable from configuration — only gap_bridge_m was. This is the same treatment the 2D track got in #10 and #13.

What is exposed

setting reaches default
STRUCTURA_RELIEF_KERNELS WallTracer.kernelsmultiscale_relief 9,25,51
STRUCTURA_DEM_THRESHOLD_K both tracers 1.0
STRUCTURA_DEM_MIN_LENGTH_M both tracers 0.5
STRUCTURA_DEM_SIMPLIFY_M both tracers unset

EdgeTracer was constructed with no arguments at all in pipeline.run; it now receives the three it accepts.

Why the kernels are the one that matters

They are in pixels, so they depend on the DEM's resolution, and they decide what gets traced rather than how much. A kernel near stone size makes the response follow individual stones and the skeleton meander around them instead of running along the course. On the Tiberias DEM at 2.10 cm/px the default (9,25,51) is only 19/53/107 cm — stone-sized, not wall-sized.

A sweep over the real trench (M10, 815 m²), all else equal:

kernels in cm lines total median sinuosity
9,25,51 19/53/107 137 248.0 m 1.22 m 1.10
51,101,201 107/213/423 78 171.0 m 1.39 m 1.10
101,201 213/423 59 137.5 m 1.33 m 1.08
201,401 423/844 7 62.1 m 4.80 m 1.01

That range is not reachable today without editing source.

What this does not do

It does not improve the 2.5D track. The sweep above is a good illustration of why: the recorded quantities cannot distinguish a wall from a smoothly-shaped artefact — 201,401 has the best-looking numbers and is most likely just over-smoothing. Measurements on M10 today ruled out DEM denoising (36 365 → 35 875 steep pixels, threshold unmoved), non-maximum suppression (the mask is already 2.1 px thin, and the response sits on the gradient maximum in 62.6 % of pixels — Canny at three scales was worse), and a physical step threshold in place of mean + k·std (fewer and more sinuous lines). The open problem is which edges to keep, which is not a parameter.

So these knobs are for experimenting, not a fix. They are worth having because every one of those measurements needed source edits to run.

Tests

None added. The four settings are pass-through; the change is that Settings has four more fields and pipeline.run forwards them. The two Settings fixtures in test_make_segmenter.py and test_pipeline.py are updated to construct the dataclass. _int_tuple parses a comma-separated list and falls back to the default when unset or blank, matching _opt_float.

ruff clean, mypy clean on 26 files, 72 tests passing — verified locally on this branch merged onto current main (which is one commit ahead, #14).

Only gap_bridge_m reached the tracers from Settings. threshold_k,
min_length_m and simplify_m existed on both tracers but were never
passed, and the relief kernels were not a parameter at all — the same
pattern the 2D track had until today, now the fifth instance.

The kernels are the ones that matter, and they are in *pixels*, so they
depend on the DEM's resolution. At 2.10 cm/px the default (9, 25, 51) is
19, 53 and 107 cm — stone-scale, not wall-scale. That is why the traced
lines follow individual stones and meander around them: the response has
a stone-sized term. Raising the kernels past a stone width merges the
stones into one ridge — on the Tiberias trench (9,25,51) gives 137 lines
of median length 1.22 m, while (201,401) gives 7 of median 4.80 m.

.env.example says this rather than just naming the variables, because a
pixel value that looks absolute is the same trap min_area and
gap_bridge_m set earlier.

Does not fix the 2.5D track. Cross-profiles through the traced lines show
they follow their response faithfully — the response is what sits in the
wrong place. Recorded in the PR; the fix is a different response, not a
different parameter.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant