Skip to content

Commit

Permalink
improved reward recognition
Browse files Browse the repository at this point in the history
  • Loading branch information
jarig committed Jan 23, 2016
1 parent b213e08 commit 7944e1e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
Binary file modified EliteReporter/Assets/reward_eng.bmp
Binary file not shown.
Binary file modified EliteReporter/Assets/reward_rus.bmp
Binary file not shown.
5 changes: 3 additions & 2 deletions EliteReporter/Utils/ScreenAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,19 @@ public MissionInfo findAndAnalyzeMissionSummaryPage(string pathToBmp, bool inclu

}
}
source = source.GetSubRect(new Rectangle((int)(450*widthFactor), 0, source.Width - (int)(450*widthFactor), source.Height));
using (Image<Gray, float> result = source.MatchTemplate(rewardTemplate, Emgu.CV.CvEnum.TemplateMatchingType.CcoeffNormed))
{
double[] minValues, maxValues;
Point[] minLocations, maxLocations;
result.MinMax(out minValues, out maxValues, out minLocations, out maxLocations);

// You can try different values of the threshold. I guess somewhere between 0.75 and 0.95 would be good.
if (maxValues[0] > 0.7)
if (maxValues[0] > 0.65)
{
int reward = 0;
// reward
var match = new Rectangle(new Point(maxLocations[0].X + rewardTemplate.Width + (int)(210 * widthFactor),
var match = new Rectangle(new Point(maxLocations[0].X + rewardTemplate.Width,
maxLocations[0].Y),
new Size((int)(210 * widthFactor), rewardTemplate.Height));
if (match.X + match.Width > source.Width || match.Y + match.Height > source.Height)
Expand Down

0 comments on commit 7944e1e

Please sign in to comment.