c# - Tessnet2 returning only one character -


i'm writing application , want read image , extract text. testing porpuses i'm passing in image 6 characters. here code.

bitmap image = new bitmap("eurotext.tif"); tessnet2.tesseract ocr = new tessnet2.tesseract(); ocr.setvariable("tessedit_char_whitelist", "abcdefghijklmopqrstuvwxyz0123456789"); // if digit ocr.init(null, "eng", false); // 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); 

the result 100 : ~

the second time ran returned:

100 : -

please help!!! thanks

try bigger picture. got "~" few times result when started tessnet2. after used bigger picture (textsize should more 12) programm worked fine.

to enlarge picture , try different sizes, can use trackbar , following code:

c#

        bitmap originalimage = new bitmap(imagepath, true);         double needdedheigth = convert.todouble(trackbar1.value);         double faktor = needdedheigth / (double)originalimage.height;         int newwidth = convert.toint32(faktor * (double)originalimage.width);         bitmap orcimage = new bitmap(originalimage,newwidth,convert.toint32(needdedheigth)); 

use "ocrimage' bitmap in 'doocr()' method


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -