Patagames Software Support Forum
»
Tesseract.Net SDK
»
F.A.Q.
»
How to extract single characters, with box position, accuracy and font type
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,075
Thanks: 6 times Was thanked: 124 time(s) in 121 post(s)
|
QuestionI need example, or description how to read documents. I need as result single characters, with box position, accuracy and font type(from tessadata definition), which was used for reading. Thank you. AnswerHi, Please look at sample below. Also you can find documentation here: https://tesseract.patagames.com/helpand class diagram here: https://tesseract.pataga...6a-b024-d838a5562cc9.htmCode:
using (var api = OcrApi.Create())
{
using (var bmp = Bitmap.FromFile(@"test.jpg") as Bitmap)
{
api.Init();
api.SetImage(bmp);
api.Recognize();
api.PageSegmentationMode = Patagames.Ocr.Enums.PageSegMode.PSM_SINGLE_CHAR;
var iterator = api.Iterator;
do
{
//Gets the UTF-8 encoded text string for the current choice.
string character = iterator.ChoiceIterator.Utf8Text;
//Returns the confidence of the current choice. The number should be interpreted as a percent probability. (0.0f-100.0f)
float accuracy = iterator.ChoiceIterator.Confidence;
//Gets a font name of the word
string fontName = iterator.WordFontName;
//Gets bounding rectangle of the current object at the given level.
var rect = iterator.PageIterator.GetBoundingBox(Patagames.Ocr.Enums.PageIteratorLevel.RIL_SYMBOL);
}
while (iterator.Next(Patagames.Ocr.Enums.PageIteratorLevel.RIL_SYMBOL));
}
}
Edited by user Tuesday, July 19, 2016 7:26:08 AM(UTC)
| Reason: Not specified
|
|
|
|
Patagames Software Support Forum
»
Tesseract.Net SDK
»
F.A.Q.
»
How to extract single characters, with box position, accuracy and font type
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close