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

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, January 17, 2018 11:43:11 AM(UTC)
jnethercutt

Groups: Registered
Posts: 26

Thanks: 3 times

In batch mode (not an interactive application), I need to OCR a tif and highlight certain key text areas and save the highlighted document. I've already got an application that takes care of the OCR and text recognition. Looking for sample code that highlights and saves highlighted document. I found one solution that uses AnnHiliteObject but I don't understand how to associate the "bounds" of the OCR'd text with the "points" in the AnnHiliteObject.Points.Add(LeadPointD) command.
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, January 17, 2018 12:08:57 PM(UTC)
Anthony Northrup

Groups: Registered, Tech Support, Administrators
Posts: 199

Was thanked: 28 time(s) in 28 post(s)

Hello,

You can use the RectToContainerCoordinates method to convert between OCR bounds and annotation coordinates.
Code:

void HiliteWord(AnnContainer container, IOcrPage page, OcrWord word)
{
    // Get bounds of word as LeadRectD
    LeadRectD bounds = word.Bounds.ToRectangle(page.DpiX, page.DpiY).ToLeadRectD();
    // Convert to annotation coordinates
    bounds = container.Mapper.RectToContainerCoordinates(bounds);
    // Create the annotation
    AnnHiliteObject hilite = new AnnHiliteObject();
    hilite.Points.Clear();
    hilite.Points.Add(bounds.TopLeft);
    hilite.Points.Add(bounds.TopRight);
    hilite.Points.Add(bounds.BottomRight);
    hilite.Points.Add(bounds.BottomLeft);
    // Add to container
    container.Children.Add(hilite);
}
Anthony Northrup
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
thanks 1 user thanked Anthony Northrup for this useful post.
jnethercutt on 1/17/2018(UTC)
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.048 seconds.