Feature/local background subtraction#131
Conversation
The LED intensity sum_col_value is a plain sum over the search box and therefore contains scene-dependent background (stray light, smoke path radiance). Under smoke the LED dims while the background remains, biasing the transmission high and the reconstructed extinction coefficient low. Add a new quantity bgsub_sum_col_value computed alongside the existing sums: the local background is estimated as the median of the positive pixels in a 2 px border ring of the search area (zeros are excluded because raw Bayer arrays mask foreign-channel pixels with 0) and subtracted pixel-wise with clipping at 0 before summing. The value is written as an additional CSV column and picked up by the HDF aggregation, so it can be selected in the analysis via reference_property = bgsub_sum_col_val. Defaults are unchanged: sum_col_value is not modified and old CSV files still parse correctly.
Test with a synthetic Gaussian LED spot plus constant background that bgsub_sum_col_value is independent of the background level and matches the pure LED integral (also with a Bayer-like zero mask), while sum_col_value scales with the background. Also cover the background estimator edge cases and the HDF column name detection for old (5-column) and new (6-column) CSV files.
…default results - new suite 07: bgsub reference property reproduces ground truth on clean images; default analysis results are bit-identical with and without the bgsub column (old data format); constant background biases sum_col_val but not bgsub_sum_col_val - test library: optional constant background for generated test images, reference_property parameter for analysis config and result checks, keywords to strip the bgsub column and compare result files
|
Hi Manuel, thanks for adding the feature. For traceability can you maybe elaborate the feature and model behind that here? Thank you! |
|
Hi Kristian, sure — here is the feature and the model behind it. What the feature adds. Step 3 computes one additional quantity per LED and image, bgsub_sum_col_value: the local background Median → robust against LED tails and hot pixels; positive-only → raw Bayer arrays mask foreign-channel pixels with exactly 0, which would otherwise pull the median to ~0; clip at 0 → masked pixels stay untouched. The analysis uses it only when reference_property = bgsub_sum_col_val is set in config_analysis.ini — the default pipeline is unchanged (verified bit-identical by the new acceptance suite 07, which also covers reading pre-existing 5-column step-3 files). The model behind it. The search-area sum contains, besides the LED, an additive background (ambient/stray light plus a small estimator noise floor) that does not dim with smoke. Because this floor which propagates to the extinction coefficient as Empirical basis (Hasenheide data, camera F1L). The LED-free border ring falls only to 0.86 of its reference value while the LED signal falls to 0.51 — direct evidence of light in the box that the smoke does not dim. The floor fraction measured independently from the ring time series ( |
No description provided.