LEADTOOLS Support
Imaging
Imaging SDK Questions
Re: Store coordinates of zoomed image and load those coordinates for other images
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, November 17, 2010 3:56:42 AM(UTC)
Groups: Registered
Posts: 40
Thanks: 5 times
Hello
Im using vb.net and LT v17
In WindowsForm using RasterImageViewer
I need to capture the coordinates of an loaded image in Rasterimageviewer and then calling those coordinates when i load another image in Rasterimageviewer.
any help is appreciated
Best regards
AN
#2
Posted
:
Wednesday, November 17, 2010 5:14:00 AM(UTC)
Groups: Registered
Posts: 40
Thanks: 5 times
Probably i found the solution.
I capure the coordinates in this way:
Dim trans As New Transformer(RasterImageViewer1.Transform)
Dim rectF As New RectangleF(CSng(RasterImageViewer1.ClientRectangle.X), CSng(RasterImageViewer1.ClientRectangle.Y), CSng(RasterImageViewer1.ClientRectangle.Width), CSng(RasterImageViewer1.ClientRectangle.Height))
rectF = trans.RectangleToLogical(rectF)
rectF contain X, Y, Width, Height
RasterImageViewer1.ScaleFactor contain the ZoomFactor
Now i load the other image on this way:
TxtBoxX_R, TxtBoxY_R, TxtBoxW_R, TxtBoxH_R are the captured coordinates and TxtBoxZ_R zoom factor.
Dim viewer As RasterImageViewer = RasterImageViewer1 ' get the active viewer
Dim Rect As New Rectangle(CInt(TxtBoxX_R), CInt(TxtBoxY_R), CInt(TxtBoxW_R), CInt(TxtBoxH_R))
Dim trans As New Transformer(viewer.Transform)
Dim RectF As New RectangleF(Rect.X, Rect.Y, Rect.Width, Rect.Height)
RectF = trans.RectangleToPhysical(RectF)
'Dim viewer As RasterImageViewer = RasterImageViewer1 ' get the active viewer
Dim center As PointF = New PointF(RectF.Left + CInt(RectF.Width / 2), RectF.Top + CInt(RectF.Height / 2)) ' get the center of what you see in physical coordinates
Dim t As Transformer = New Transformer(viewer.Transform)
center = t.PointToLogical(center) ' get the center of what you see in logical coordinates
' zoom
Dim scaleFactor As Double = CDbl(TxtBoxZ_R)
viewer.ScaleFactor = scaleFactor
' bring the original center into the view center
t = New Transformer(viewer.Transform)
center = t.PointToPhysical(center) ' get the center of what you saw before the zoom in physical coordinates
viewer.CenterAtPoint(Point.Round(center)) ' bring the old center into the center of the view
#3
Posted
:
Friday, November 19, 2010 12:34:48 PM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Do you want to get the coordinates of the image area that is visible? You can just get the ScrollPosition and multiply it by the ScaleFactor. That will give you the X and Y position, and then you can get the size of the RasterImageViewer and multiply it by the ScaleFactor to get the width and the height.
Thanks
LEADTOOLS Support
Imaging
Imaging SDK Questions
Re: Store coordinates of zoomed image and load those coordinates for other images
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.