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



Last Go to last post Unread Go to first unread post
#1 Posted : Sunday, February 28, 2016 9:13:41 AM(UTC)

Groups: Registered
Posts: 3

Hi Support

When using The ImageViewer Control I was able to convert the coordinates from the OCR Zone to create a rectangle on the document image using the following code.

fieldinfo is the BO which stores the Bounds captured from OCR
Rectangle Bounds = new Rectangle(Convert.ToInt32(fieldInfo.Left), Convert.ToInt32(fieldInfo.Top), Convert.ToInt32(fieldInfo.Width), Convert.ToInt32(fieldInfo.Height));

LeadRectD View = ivCurrentPageConvertBoundsToView(Bounds, false);

_currentHightlightRect is the rectangle I draw on the ImageViewer
_currentHighlightRect = ivCurrentPage.ConvertRect(


Can someone please tell me the same functionality for the RasterImageViewer.

Thanks in advance



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 : Tuesday, March 1, 2016 5:36:56 AM(UTC)


Groups: Registered, Tech Support
Posts: 14

Please see attached project. It is a slightly-modified edition of the project in this forum post:

The project uses the RasterImageViewer control with our OCR features and draws the zones on the bitmap. This project does NOT do any coordinate conversions because it draws on the bitmap itself, so it deals with pixels directly, not the viewer.

Please try to modify it to test the drawing you need and if you can't get it to work, explain to me what you want to do exactly and I'll try to help you with it.

File Attachment(s):
CS_Automated_Shift_And_Rotation_LT19.rar (255kb) downloaded 46 time(s).
Hussam Barouqa
Developer Support Engineer
LEAD Technologies, Inc.

#3 Posted : Wednesday, March 2, 2016 1:08:25 AM(UTC)

Groups: Registered
Posts: 3


Our process is as follows:

Server Application:

The Server Application OCRs a document. It is looking for a certain piece of data in the following format CASE_NUMBER_1234567890.

var pageText = page.GetText();

if (pageText != null)

If it finds this data using regular expression. It stores the value and its location based on the following:

LEAdRECT Rect = pageText.Words[I].Bounds.ToLeadRect();

We Store the value and the rect Bounds information into our database.

Client Applicaiton

When the user opens our windows form application, they can open the document which displays the case number on the left and the RasterImageViewer on the right. When the user click on the case number we would like it draw a rectangle around the Case_Number found, using the bounds rectangle we captured on OCR Process.


#4 Posted : Thursday, March 3, 2016 6:18:51 AM(UTC)


Groups: Registered, Tech Support
Posts: 14

In the project I attached, the OCR bounds for specific words are stored in a reference LEADRECT structure(eg: AlignRect), a rectangle is drawn as follows:

RasterImageGdiPlusGraphicsContainer GraphicsContainer = new RasterImageGdiPlusGraphicsContainer(rasterImageViewer2.Image);
GraphicsContainer.Graphics.DrawRectangle(new Pen(Color.Red), AlignRect.X, AlignRect.Y, AlignRect.Width, AlignRect.Height);
This draws on the Image inside the Viewer (using bitmap coordinates). Please try to modify the demo to draw a rectangle the same way around the text you need and if you face problems with this demo, tell me what you tried and what problems you faced.

Hussam Barouqa
Developer Support Engineer
LEAD Technologies, Inc.

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.058 seconds.