public bool IsValid(Pattern referencePattern, Bitmap destinationImage, float percentage = 0.8f) { if (referencePattern.coordinates.IsEmpty) { return(false); } Bitmap b = Resize(destinationImage, referencePattern.original.Size); Bitmap cropped = Crop(b, referencePattern.coordinates); Bitmap pattern = referencePattern.reference; if (Runner.RUN_DEBUG) { b.Save("E:\\dev\\venomsw\\images\\saved\\" + comparedId + "_reference" + ".png"); cropped.Save("E:\\dev\\venomsw\\images\\saved\\" + comparedId++ + "_compared" + ".png"); pattern.Save("E:\\dev\\venomsw\\images\\saved\\" + comparedId++ + "_pattern" + ".png"); } float equality = innerComparer.GetEquality(referencePattern.reference, cropped); if (Runner.RUN_DEBUG) { Console.WriteLine("Equality: " + equality); } return(equality >= percentage); }