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

Notification

Icon
Error

Options
Go to last post Go to first unread
chirag.doshi  
#1 Posted : Friday, April 22, 2022 2:13:32 PM(UTC)
chirag.doshi

Rank: Newbie

Groups: Registered
Joined: 3/18/2022(UTC)
Posts: 3
United States
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.
Paul Rayman  
#2 Posted : Friday, April 22, 2022 6:42:40 PM(UTC)
Paul Rayman

Rank: Administration

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

Thanks: 5 times
Was thanked: 122 time(s) in 119 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

chirag.doshi  
#3 Posted : Monday, April 25, 2022 11:54:11 AM(UTC)
chirag.doshi

Rank: Newbie

Groups: Registered
Joined: 3/18/2022(UTC)
Posts: 3
United States
Location: Weston,FL

Thanks. I am able to retrieve bounding boxes for words and symbols.
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.