This commit is contained in:
Boki 2026-02-13 14:42:35 -05:00
parent b9b9a41c3c
commit a336138ee2
4 changed files with 24 additions and 9 deletions

View file

@ -34,10 +34,14 @@ public class WorldMap : IDisposable
_frameCount++;
// Noise gate: skip frames with too many wall pixels (waypoint glow, effects)
// But NOT during warmup or re-bootstrap — we need to stitch something to get started
var wallPixels = Cv2.CountNonZero(wallMask);
var totalPixels = wallMask.Width * wallMask.Height;
var density = (double)wallPixels / totalPixels;
if (density > _config.WallMaxDensity)
var isNoisy = density > _config.WallMaxDensity;
var needsBootstrap = _frameCount <= _config.WarmupFrames || _consecutiveMatchFails >= 30;
if (isNoisy && !needsBootstrap)
{
Log.Information("Noise gate: {Density:P1} wall density ({Pixels} px), skipping ({Ms:F1}ms)",
density, wallPixels, sw.Elapsed.TotalMilliseconds);
@ -64,12 +68,21 @@ public class WorldMap : IDisposable
_prevWallMask?.Dispose();
_prevWallMask = wallMask.Clone();
// Warmup: stitch at center with boosted confidence to bootstrap canvas
if (_frameCount <= _config.WarmupFrames)
// Warmup / re-bootstrap: stitch at current position to seed the canvas
if (needsBootstrap)
{
StitchWithConfidence(classifiedMat, _position, boosted: true);
Log.Information("Warmup frame {N}/{Total}: stitch={Ms:F1}ms",
_frameCount, _config.WarmupFrames, sw.Elapsed.TotalMilliseconds);
StitchWithConfidence(classifiedMat, _position, boosted: _frameCount <= _config.WarmupFrames);
if (_consecutiveMatchFails >= 30)
{
Log.Information("Re-bootstrap: stitching at current position after {Fails} match failures ({Ms:F1}ms)",
_consecutiveMatchFails, sw.Elapsed.TotalMilliseconds);
_consecutiveMatchFails = 0;
}
else
{
Log.Information("Warmup frame {N}/{Total}: stitch={Ms:F1}ms",
_frameCount, _config.WarmupFrames, sw.Elapsed.TotalMilliseconds);
}
return _position;
}