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 : Tuesday, July 19, 2016 6:22:39 AM(UTC)
Paul Rayman

Rank: Administration

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

Thanks: 5 times
Was thanked: 121 time(s) in 118 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 Tuesday, July 19, 2016 7:26:08 AM(UTC)  | Reason: Not specified

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