예제 #1
0
파일: Program.cs 프로젝트: antgraf/BA
		static void Main32()
		{
			// Code usage sample
			Ocr32 ocr = new Ocr32();
			using(Bitmap bmp = new Bitmap(@"D:\temp\ocr\b1.bmp"))
			{
				tessnet2_32::tessnet2.Tesseract tessocr = new tessnet2_32::tessnet2.Tesseract();
				tessocr.Init(null, "eng", false);
				tessocr.GetThresholdedImage(bmp, Rectangle.Empty).Save("c:\\temp\\" + Guid.NewGuid() + ".bmp");
				// Tessdata directory must be in the directory than this exe
				Console.WriteLine("Multithread version");
				ocr.DoOcrMultiThread(bmp, "eng");
				Console.WriteLine("Normal version");
				Ocr32.DoOcrNormal(bmp, "eng");
			}
		}
예제 #2
0
파일: WindowTest.cs 프로젝트: antgraf/BA
 private static void Tesseract32()
 {
     Ocr32 ocr = new Ocr32();
     Assert.NotNull(ocr);
     using(Bitmap bmp = new Bitmap(pTestImagePath))
     {
         Assert.NotNull(bmp);
         tessnet2_32::tessnet2.Tesseract tessocr = new tessnet2_32::tessnet2.Tesseract();
         Assert.NotNull(tessocr);
         tessocr.Init(null, "eng", false);
         tessocr.GetThresholdedImage(bmp, Rectangle.Empty).Save(FileUtils.CombineWinPath(pTempDirectory, Guid.NewGuid().ToString()) + ".bmp");
         ocr.DoOcrMultiThread(bmp, "eng");
         List<tessnet2_32::tessnet2.Word> words = Ocr32.DoOcrNormal(bmp, "eng");
         Assert.NotNull(words);
     }
 }