added filter for text

This commit is contained in:
Boki 2026-02-13 13:27:46 -05:00
parent dab5735c80
commit 7fd80b1645
3 changed files with 36 additions and 8 deletions

View file

@ -103,9 +103,23 @@ public class MinimapCapture : IDisposable
using var highS = new Mat();
Cv2.Threshold(satChan, highS, _config.WallMinSat, 255, ThresholdTypes.Binary);
// Exclude nameplate text: very bright (V > 230) AND unsaturated (S < 40)
// Nameplates are pure white text; minimap walls are colored (have saturation)
using var nameplateBright = new Mat();
Cv2.Threshold(valueChan, nameplateBright, _config.NameplateMinValue, 255, ThresholdTypes.Binary);
using var nameplateLowSat = new Mat();
Cv2.Threshold(satChan, nameplateLowSat, _config.NameplateMaxSat, 255, ThresholdTypes.BinaryInv);
using var nameplateMask = new Mat();
Cv2.BitwiseAnd(nameplateBright, nameplateLowSat, nameplateMask);
var wallMask = new Mat();
Cv2.BitwiseOr(highV, highS, wallMask);
// Subtract nameplates
using var notNameplate = new Mat();
Cv2.BitwiseNot(nameplateMask, notNameplate);
Cv2.BitwiseAnd(wallMask, notNameplate, wallMask);
// Dilate to connect wall line fragments
using var kernel = Cv2.GetStructuringElement(MorphShapes.Ellipse, new Size(3, 3));
Cv2.Dilate(wallMask, wallMask, kernel);