Update ScreenMatch.cs

This commit is contained in:
Namhyeon Go 2024-09-02 16:01:30 +09:00
parent 2f4b95313f
commit db557015fd

View File

@ -299,14 +299,19 @@ public class ScreenMatch
Point matchPosition = FindTemplate(_mainImage, (Bitmap)image.Clone(), out double maxCorrelation); Point matchPosition = FindTemplate(_mainImage, (Bitmap)image.Clone(), out double maxCorrelation);
if (matchPosition != Point.Empty) if (matchPosition != Point.Empty)
{ {
string text; string text = "";
if (isOCR128) if (isOCR128)
{ {
text = OCR((Bitmap)mainImage.Clone(), matchPosition.X, matchPosition.Y, imageWidth, imageHeight, 128, 128); parent.Log("Trying OCR...");
}
else try {
{ text = OCR((Bitmap)mainImage.Clone(), matchPosition.X, matchPosition.Y, imageWidth, imageHeight, 128, 128);
text = ""; parent.Log("Done OCR.");
}
catch (Exception ex)
{
parent.Log($"Error in OCR: {ex.Message}");
}
} }
results.Add(new ScreenMatchResult results.Add(new ScreenMatchResult