logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Paul Rayman  
#1 Posted : 9 years ago
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,105

Thanks: 7 times
Was thanked: 130 time(s) in 127 post(s)
Question
I 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.

Answer
Hi,
Please look at sample below.
Also you can find documentation here: https://tesseract.patagames.com/help
and class diagram here: https://tesseract.pataga...6a-b024-d838a5562cc9.htm

Code:

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 9 years ago  | Reason: Not specified

Users browsing this topic
Guest
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.