looking good
This commit is contained in:
parent
d8c9f8e11a
commit
20ef4d6fa7
3 changed files with 59 additions and 9 deletions
|
|
@ -66,8 +66,12 @@ public class MinimapCapture : IDisposable
|
|||
// Wall mask: target #A2AEE5 blue-lavender structure lines (range adapts per-map)
|
||||
var wallMask = BuildWallMask(hsv, playerMask, sample: true);
|
||||
|
||||
// Build classified mat (walls only — for stitching)
|
||||
// Fog of war: broad blue range minus walls minus player
|
||||
using var fogMask = BuildFogMask(hsv, wallMask, playerMask);
|
||||
|
||||
// Build classified mat (fog first, walls override)
|
||||
var classified = new Mat(_config.CaptureSize, _config.CaptureSize, MatType.CV_8UC1, Scalar.Black);
|
||||
classified.SetTo(new Scalar((byte)MapCell.Fog), fogMask);
|
||||
classified.SetTo(new Scalar((byte)MapCell.Wall), wallMask);
|
||||
|
||||
// Gray for correlation tracking (player zeroed)
|
||||
|
|
@ -110,6 +114,26 @@ public class MinimapCapture : IDisposable
|
|||
return wallMask;
|
||||
}
|
||||
|
||||
private Mat BuildFogMask(Mat hsv, Mat wallMask, Mat playerMask)
|
||||
{
|
||||
// Broad blue detection (captures walls + fog + any blue)
|
||||
using var allBlue = new Mat();
|
||||
Cv2.InRange(hsv, _config.FogLoHSV, _config.FogHiHSV, allBlue);
|
||||
|
||||
// Subtract player and walls → remaining blue is fog
|
||||
using var notPlayer = new Mat();
|
||||
Cv2.BitwiseNot(playerMask, notPlayer);
|
||||
Cv2.BitwiseAnd(allBlue, notPlayer, allBlue);
|
||||
|
||||
var fogMask = new Mat();
|
||||
using var notWalls = new Mat();
|
||||
Cv2.BitwiseNot(wallMask, notWalls);
|
||||
Cv2.BitwiseAnd(allBlue, notWalls, fogMask);
|
||||
|
||||
FilterSmallComponents(fogMask, _config.FogMinArea);
|
||||
return fogMask;
|
||||
}
|
||||
|
||||
private static void FilterSmallComponents(Mat mask, int minArea)
|
||||
{
|
||||
if (minArea <= 0) return;
|
||||
|
|
@ -164,10 +188,14 @@ public class MinimapCapture : IDisposable
|
|||
using var wallMask = BuildWallMask(hsv, playerMask);
|
||||
if (stage == MinimapDebugStage.Walls) return EncodePng(wallMask);
|
||||
|
||||
// Classified (walls + player only — explored is tracked by WorldMap)
|
||||
using var fogMask = BuildFogMask(hsv, wallMask, playerMask);
|
||||
if (stage == MinimapDebugStage.Fog) return EncodePng(fogMask);
|
||||
|
||||
// Classified (walls + fog + player — explored is tracked by WorldMap)
|
||||
using var classified = new Mat(_config.CaptureSize, _config.CaptureSize, MatType.CV_8UC3, Scalar.Black);
|
||||
classified.SetTo(new Scalar(26, 45, 61), wallMask);
|
||||
classified.SetTo(new Scalar(0, 165, 255), playerMask);
|
||||
classified.SetTo(new Scalar(180, 140, 70), fogMask); // light blue for fog
|
||||
classified.SetTo(new Scalar(26, 45, 61), wallMask); // brown for walls
|
||||
classified.SetTo(new Scalar(0, 165, 255), playerMask); // orange for player
|
||||
return EncodePng(classified);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue