private void CalibrateBlacklevel() { Bitmap capture = settings.CaptureImage(); int tempBlacklevel = FeatureDetector.GetBlackLevel(ref capture); if (tempBlacklevel != -1 && tempBlacklevel < settings.cmpBlackLevel) { settings.cmpBlackLevel = tempBlacklevel; } FeatureDetector.ClearBackground(ref capture, settings.cmpBlackLevel); BitmapToPixConverter btp = new BitmapToPixConverter(); Pix img = btp.Convert(capture); string ResultText = ""; using (var page = engine.Process(img, PageSegMode.SingleChar)) { ResultText = page.GetText(); } int counter = 0; if (settings.platform == "ENG/PS2" || settings.platform == "ENG/XBOX&GC") { foreach (char c in expectedResultEng) { if (ResultText.Contains(c)) { counter++; } } if (counter > 5 && ResultText.Length == 8) { isCmpFinished = true; } } else if (settings.platform == "JPN/PS2") { foreach (char c in expectedResultJpn) { if (ResultText.Contains(c)) { counter++; } } if (counter > 3) { isCmpFinished = true; } } else { foreach (char c in expectedResultKrn) { if (ResultText.Contains(c)) { counter++; } } if (counter > 2) { isCmpFinished = true; } } if (isCmpFinished) { settings.blacklevel = settings.cmpBlackLevel; isCmpFinished = false; settings.isCalibratingBlacklevel = false; settings.cmpBlackLevel = 100; Console.WriteLine("BLACKLEVEL: {0}", settings.blacklevel); settings.UpdateBlacklevelLabel(); settings.Refresh(); } }