This commit is contained in:
Boki 2026-02-13 13:01:55 -05:00
parent 6bc3fb6972
commit 40f013d07e
5 changed files with 129 additions and 129 deletions

View file

@ -68,22 +68,27 @@ public class MinimapCapture : IDisposable
var playerOffset = FindCentroid(playerMask);
// --- 3. Wall mask: bright OR saturated → structure lines ---
using var wallMask = BuildWallMask(satChan, valueChan, playerMask);
using var rawWallMask = BuildWallMask(satChan, valueChan, playerMask);
// --- 4. Build classified mat (walls only — explored is tracked by WorldMap) ---
var classified = new Mat(_config.CaptureSize, _config.CaptureSize, MatType.CV_8UC1, Scalar.Black);
classified.SetTo(new Scalar((byte)MapCell.Wall), wallMask);
classified.SetTo(new Scalar((byte)MapCell.Wall), rawWallMask);
// --- 5. Temporal smoothing: majority vote on walls ---
var smoothed = TemporalSmooth(classified); // classified goes into ring buffer
// --- 7. Gray for phase correlation (player zeroed — it stays centered, walls shift with map) ---
// --- 6. Extract smoothed wall mask for tracking (filters transient noise) ---
var stableWallMask = new Mat();
Cv2.Compare(smoothed, new Scalar((byte)MapCell.Wall), stableWallMask, CmpType.EQ);
// --- 7. Gray for optical flow tracking (player zeroed) ---
var grayForCorr = new Mat();
Cv2.CvtColor(bgr, grayForCorr, ColorConversionCodes.BGR2GRAY);
grayForCorr.SetTo(Scalar.Black, playerMask);
return new MinimapFrame(
GrayMat: grayForCorr,
WallMask: stableWallMask,
ClassifiedMat: smoothed,
PlayerOffset: playerOffset,
Timestamp: DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()