Im using this ocr lib dll referenced in my project: http://www.pixel-technology.com/freeware/tessnet2/
Created a new class:
private void test()
{
Bitmap image = new Bitmap(@"d:\timessquare.jpg");
tessnet2.Tesseract ocr = new tessnet2.Tesseract();
ocr.SetVariable("tessedit_char_whitelist", "0123456789"); // If digit only
ocr.Init(@"c:\temp", "fra", false); // To use correct tessdata
List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);
foreach (tessnet2.Word word in result)
//Console.WriteLine("{0} : {1}", word.Confidence, word.Text);
t = string.Format("{0} : {1}", word.Confidence, word.Text);
}
But its never pass the line:
ocr.SetVariable("tessedit_char_whitelist", "0123456789");
For example i have this image:
I want to take out from the image the date and time and then to compare the date and time with my pc date and check if its the same date or a day or more days before.
How can i do it ?
You can either crop out that region containing the date&time on the image and perform OCR on that subimage or define the rectangle ROI for the second argument of the DoOCR
method. The SetVariable
statement is not needed in this case. Be sure to rescale your image to 300DPI first.