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 : Monday, November 13, 2006 10:27:39 AM(UTC)

bjames  
bjames

Groups: Registered
Posts: 22


We have an application written in vb 6.0 that uses the ActiveX LEAD Main control. The application has two LEAD main controls. The user loads an image into one of the controls. The user will then rubberband a region. This portion of the image will be copied into the second LEAD Main control for future processing (ocr, etc).

We now need to implement this functionality in a .NET user control that will be embedded in Internet explorer.

To promote code reuse, I tried to use interop to use the ActiveX controls so the code wouldn't have to change, however, because of the way in which we are embedding the control in Internet explorer, the interop implementation will not work.

We now have to implement the functionality in .NET.

After browsing through the help file and here in the forums, I've found some helpful examples on using regions to copy image data, however, the documentation on RasterRegionXForm is lacking and confusing.

Attached to this thread is .NET 2.0 windows application example. It contains two RasterImageViewer controls (LEADMainViewer and LEADZoomIn).

The application will load a sample image into LEADMainViewer. The user will draw a region on the LEADMainViewer and the contents of the region is then copied into the LEADZoomIn control.

This works, however, if the user scrolls LEADMainViewer (horizontally or vertically) to draw a region around an area that isn't seen without scrolling, the results displayed in LEADZoomIn are incorrect. I understand that this is because we are acting on the internal image coordinates but using the client control coordinates and that we must use the RasterRegionXForm class to transform the correct coordinates but this is where I'm stumped.

Can someone please help me to understand how to acheieve the desired functionality.

We will need to allow the user to zoom in on the image and then draw a region and I'm sure will need to use RasterRegionXForm to do this as well since the image will be zoomed.

Thanks in advance to all replies.

Bryan James
File Attachment(s):
LEAD_Region_Test.zip (331kb) downloaded 32 time(s).
 

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, November 14, 2006 5:09:59 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,034

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

You need to fill the "RasterRegionXForm" member values according to the values of the RasterImageViewer when it's scrolled or zoomed.


For more information on the use of
RasterRegionXForm please refer to the topic "Translating Coordinates for a Region" in main .Net help file.

 
#3 Posted : Thursday, January 4, 2007 6:48:52 PM(UTC)

bjames  
bjames

Groups: Registered
Posts: 22


I'm sorry, but those suggestions are as broad as the documentation (almost word for word)...

Just as I stated in the original post and the main reason that I wrote the small example app is because the documentation on this subject is lacking and confusing. Would it at all be possible for someone to look at the sample that I've provided and expound a bit on how to accomplish this? Perhaps some sample source?

Thanks...
 
#4 Posted : Monday, January 8, 2007 6:16:09 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,034

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


If you don't want to work with the matrix, you can
do it in another way by converting the rectangle from window coordinates to
bitmap coordinates and then use the converted rectangle to create the region as follows: (modifying your own code)




Dim _trans As New Leadtools.Helpers.Transformer


_trans.Transform = LEADMainView.Transform


Dim r0 As RectangleF = _trans.RectangleToLogical(e.Rectangle)


Dim r As System.Drawing.Rectangle = New Rectangle(r0.X, r0.Y, r0.Width, r0.Height)


RasImg1.AddRectangleToRegion(Nothing, r, RasterRegionCombineMode.Set)

 
#5 Posted : Sunday, March 25, 2007 8:02:02 PM(UTC)

bjames  
bjames

Groups: Registered
Posts: 22


I'm sorry that I've taken so long to respond but I haven't had a chance to work with this problem.

Your code worked perfectly, however, I can't understand how I could have derived this solution from the help file.

Thanks again for the code sample!
 
#6 Posted : Wednesday, March 28, 2007 12:40:29 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,034

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


Bryan,


I'm glad the problem is solved. Help files usually
contain reference information and sometimes tutorials and other how-to
information. But they can't contain all combinations of toolkit functions that can be used together.


If you run into any issue where you can't locate the
appropriate LEADTOOLS function in the help files, you can try to search these
forums, email us at support@leadtools.com, or post a question in a new forum thread.
 
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-2020, Yet Another Forum.NET
This page was generated in 0.074 seconds.