From d8c9f8e11a2915b67b815e89634021e2d9fbd71e Mon Sep 17 00:00:00 2001 From: Boki Date: Fri, 13 Feb 2026 15:20:01 -0500 Subject: [PATCH] noise tuning --- src/Poe2Trade.Navigation/NavigationTypes.cs | 12 ++++++------ src/Poe2Trade.Navigation/WorldMap.cs | 14 ++++++++++---- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/Poe2Trade.Navigation/NavigationTypes.cs b/src/Poe2Trade.Navigation/NavigationTypes.cs index 833bca6..f6d2cba 100644 --- a/src/Poe2Trade.Navigation/NavigationTypes.cs +++ b/src/Poe2Trade.Navigation/NavigationTypes.cs @@ -99,15 +99,15 @@ public class MinimapConfig public int MatchSearchRadius { get; set; } = 100; // Template matching: minimum correlation confidence to accept a match - public double MatchConfidence { get; set; } = 0.15; + public double MatchConfidence { get; set; } = 0.25; // Wall confidence (canvas-level): per-pixel counters to filter transient noise - // Walls need ceil(Threshold/Inc) = 10 frames of reinforcement to appear. - // Transient noise (wisps, effects) moves around and can't accumulate enough. - public int ConfidenceInc { get; set; } = 2; + // Walls need ceil(Threshold/Inc) = 2 frames of reinforcement to appear. + // Block noise filter handles glow; confidence just smooths frame-to-frame jitter. + public int ConfidenceInc { get; set; } = 6; public int ConfidenceDec { get; set; } = 1; - public int ConfidenceThreshold { get; set; } = 20; - public int ConfidenceMax { get; set; } = 40; + public int ConfidenceThreshold { get; set; } = 10; + public int ConfidenceMax { get; set; } = 30; public int WarmupFrames { get; set; } = 5; // Frame dedup: min changed pixels to process a frame (skip near-identical minimap frames) diff --git a/src/Poe2Trade.Navigation/WorldMap.cs b/src/Poe2Trade.Navigation/WorldMap.cs index d130aef..a6dff7b 100644 --- a/src/Poe2Trade.Navigation/WorldMap.cs +++ b/src/Poe2Trade.Navigation/WorldMap.cs @@ -167,8 +167,8 @@ public class WorldMap : IDisposable var matchX = sx0 + maxLoc.X + frameSize / 2.0; var matchY = sy0 + maxLoc.Y + frameSize / 2.0; - Log.Debug("Map match: ({X:F1}, {Y:F1}) conf={Conf:F3} canvas={CanvasWalls} frame={FrameWalls}", - matchX, matchY, maxVal, canvasWallCount, frameWallCount); + Log.Information("Match OK: conf={Conf:F3} pos=({X:F1},{Y:F1}) canvas={CanvasWalls} frame={FrameWalls}", + maxVal, matchX, matchY, canvasWallCount, frameWallCount); return new MapPosition(matchX, matchY); } @@ -229,9 +229,15 @@ public class WorldMap : IDisposable confRoi.Set(row, col, conf); - if (conf >= confThreshold) + var current = dstRoi.At(row, col); + // Explored→Wall needs double evidence (protects already-walked areas from noise) + var needed = current == (byte)MapCell.Explored + ? (short)(confThreshold * 2) + : confThreshold; + + if (conf >= needed) dstRoi.Set(row, col, (byte)MapCell.Wall); - else if (dstRoi.At(row, col) == (byte)MapCell.Wall) + else if (current == (byte)MapCell.Wall && conf < confThreshold) dstRoi.Set(row, col, (byte)MapCell.Explored); // lost confidence → demote }