Rank: Newbie
Groups: Registered
Joined: 3/18/2022(UTC) Posts: 3 Location: Weston,FL
|
I am using the following code:
api.SetImage(OcrPix.FromFile(testBitmap)); api.Recognize(); plainText = api.GetUtf8Text();
OcrBoxa ocrBoxa = null; OcrPixa ocrPixa = null;
api.GetWords(out ocrBoxa, out ocrPixa); ResultWords = new List<string>(); for (int i = 0; i < ocrPixa.Pixes.Length; i++) { string word = ocrPixa.Pixes[i].Text; if (api.IsValidWord(word.Trim())) ResultWords.Add(word); }
The property ocrPixa.Pixes[i].Text is always null. The plain text displays as many words. Please advise on getting the words list for a given language from OCRApi. I am trying to avoid parsing the words from text as rules of parsing are different in different languages.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,104
Thanks: 7 times Was thanked: 128 time(s) in 125 post(s)
|
Hello, The GetWords method returns Pixa in Leptonica style. The Text property of the Leptonics image returns the comment contained in the image's caption. It has nothing to do with the recognizable text. Please use the following code instead Code:var iter = api.Iterator;
api.SetImage(pix);
api.Recognize();
do
{
var text = iter.GetUtf8Text(PageIteratorLevel.RIL_WORD);
var bbox= iter.PageIterator.GetBoundingBox(PageIteratorLevel.RIL_WORD);
} while (iter.Next(PageIteratorLevel.RIL_WORD));
Edited by user Friday, April 22, 2022 6:43:21 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/18/2022(UTC) Posts: 3 Location: Weston,FL
|
Thanks. I am able to retrieve bounding boxes for words and symbols.
|
|
|
|
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