public void CanRecognize7() { OpticalNumberRecognizer ocr = new OpticalNumberRecognizer(); Bitmap img = new Bitmap(Images.OCRSeven); var actual = ocr.RecognizeNumber(img); Assert.AreEqual("7", actual); img.Dispose(); }
public void UnrecognizableNumberReturns0() { OpticalNumberRecognizer ocr = new OpticalNumberRecognizer(); Bitmap img = new Bitmap(Images.OCRNoNumber); var actual = ocr.RecognizeNumber(img); Assert.AreEqual("0", actual); img.Dispose(); }
public void CanRecognize9WithExtraWhiteSpaces() { OpticalNumberRecognizer ocr = new OpticalNumberRecognizer(); Bitmap img = new Bitmap(Images.OCRLarge9); var actual = ocr.RecognizeNumber(img); Assert.AreEqual("9", actual); img.Dispose(); }
public void CanSeparateTwoNumbers() { Bitmap nineFiveImage = new Bitmap(Images.OCRTwoNumbers); List <Bitmap> actual = new OpticalNumberSeparator().Separate(nineFiveImage); var ocr = new OpticalNumberRecognizer(); Assert.AreEqual("9", ocr.RecognizeNumber(actual[0])); Assert.AreEqual("5", ocr.RecognizeNumber(actual[1])); }
public void CanSeparateMultipleNumbers() { Bitmap rowOfNumbers = new Bitmap(Images.OCRRow); List <Bitmap> actual = new OpticalNumberSeparator().Separate(new PixelFormatConverter().To24BppRGB(rowOfNumbers)); var ocr = new OpticalNumberRecognizer(); Assert.AreEqual("9", ocr.RecognizeNumber(actual[0])); Assert.AreEqual("5", ocr.RecognizeNumber(actual[1])); Assert.AreEqual("8", ocr.RecognizeNumber(actual[2])); Assert.AreEqual("0", ocr.RecognizeNumber(actual[3])); Assert.AreEqual("7", ocr.RecognizeNumber(actual[4])); Assert.AreEqual("5", ocr.RecognizeNumber(actual[5])); }
public void CanSeparateNumbersWithOnes() { Bitmap ones = new Bitmap(Images.Ones); List <Bitmap> actual = new OpticalNumberSeparator().Separate(ones); var ocr = new OpticalNumberRecognizer(); Assert.AreEqual("1", ocr.RecognizeNumber(actual[0])); Assert.AreEqual("0", ocr.RecognizeNumber(actual[1])); Assert.AreEqual("1", ocr.RecognizeNumber(actual[2])); Assert.AreEqual("6", ocr.RecognizeNumber(actual[3])); Assert.AreEqual("6", ocr.RecognizeNumber(actual[4])); Assert.AreEqual("9", ocr.RecognizeNumber(actual[5])); Assert.AreEqual("9", ocr.RecognizeNumber(actual[6])); }