noise tuning
This commit is contained in:
parent
db37d3c179
commit
d8c9f8e11a
2 changed files with 16 additions and 10 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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<byte>(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<byte>(row, col) == (byte)MapCell.Wall)
|
||||
else if (current == (byte)MapCell.Wall && conf < confThreshold)
|
||||
dstRoi.Set(row, col, (byte)MapCell.Explored); // lost confidence → demote
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue