LEADTOOLS Support
Document
Document SDK Questions
values of DocumentWord Bounds are different from OcrWord Bounds
#1
Posted
:
Monday, April 5, 2021 5:03:20 AM(UTC)
Groups: Registered
Posts: 40
Thanks: 5 times
Hi,
I was trying to read a file with OcrEditDemo which uses OcrWord and I see that the coordinates of captured words are different from coordinates captured using LEADDocument DocumentPageText
Here is my code that I tried to use
LoadDocumentOptions options = new LoadDocumentOptions();
options.UseCache = false;
using (LEADDocument document = DocumentFactory.LoadFromFile("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\ocr1.tif", options))
{
_documentZoneWords = new List<List<DocumentWord>>();
document.Text.OcrEngine = _ocrEngine;
document.Text.TextExtractionMode = DocumentTextExtractionMode.Auto; //try to read as svg before ocr
DocumentPageText pageText = document.Pages[0].GetText();
if (pageText != null)
{
pageText.BuildWords();
foreach (DocumentWord wd in pageText.Words)
{
List<DocumentWord> words = new List<DocumentWord>();
words.Add(wd);
_documentZoneWords.Add(words);
}
}
}
Bounds values captured in _documentZoneWords array are different from Bounds values captured using OcrEditDemo sample that are on _ocrZoneWords array
example of first word: "LEAD"
DocumentWord Bounds = {727.2;746.4;540;208,8}
OcrWord Bounds = {307;313;216;62}
Why are the values different?
Is there any way to convert Bounds of DocumentWord to Bounds of OcrWord to get same values?
Thanks in advance
#2
Posted
:
Wednesday, April 7, 2021 4:13:59 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 163
Was thanked: 9 time(s) in 9 post(s)
I have reached out to you via email.
Nick Crook
Developer Support Engineer
LEAD Technologies, Inc.
#3
Posted
:
Thursday, April 8, 2021 3:51:19 PM(UTC)
Groups: Registered
Posts: 40
Thanks: 5 times
can be solved using this:
LeadRect lr = document.Pages[0].RectToPixels(wd.Bounds);
LEADTOOLS Support
Document
Document SDK Questions
values of DocumentWord Bounds are different from OcrWord Bounds
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.