LEADTOOLS (Leadtools assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
PointFromImage Method
See Also 
Leadtools Namespace > RasterImage Class : PointFromImage Method



viewPerspective
Destination view perspective to which the point should be translated.
pt
The point to translate.
viewPerspective
Destination view perspective to which the point should be translated.
pt
The point to translate.
Translates a point (x,y) from this RasterImage view perspective to the specified view perspective. Supported in Silverlight, Windows Phone 7

Syntax

Visual Basic (Declaration) 
Public Function PointFromImage( _
   ByVal viewPerspective As RasterViewPerspective, _
   ByVal pt As LeadPoint _
) As LeadPoint
Visual Basic (Usage)Copy Code
Dim instance As RasterImage
Dim viewPerspective As RasterViewPerspective
Dim pt As LeadPoint
Dim value As LeadPoint
 
value = instance.PointFromImage(viewPerspective, pt)
C# 
public LeadPoint PointFromImage( 
   RasterViewPerspective viewPerspective,
   LeadPoint pt
)
C++/CLI 
public:
LeadPoint PointFromImage( 
   RasterViewPerspective viewPerspective,
   LeadPoint pt
) 

Parameters

viewPerspective
Destination view perspective to which the point should be translated.
pt
The point to translate.

Return Value

The translated point.

Example

This example finds out where the origin of the image would be. Then it converts a known point to bitmap coordinates.

Visual BasicCopy Code
Public Sub PointFromImageExample()
      Dim codecs As RasterCodecs = New RasterCodecs()
      ' Load an image that has BottomLeft ViewPerspective
      Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ULAY1.BMP"))

      Dim ImagePoint As LeadPoint = New LeadPoint(0, 0)
      ImagePoint = image.PointFromImage(RasterViewPerspective.TopLeft, ImagePoint)
      Console.WriteLine(String.Format("{0},{1}", ImagePoint.X, ImagePoint.Y))

      ImagePoint.X = 0
      ImagePoint.Y = 0
      ImagePoint = image.PointToImage(RasterViewPerspective.TopLeft, ImagePoint)
      Console.WriteLine(String.Format("{0},{1}", ImagePoint.X, ImagePoint.Y))

      image.Dispose()
      codecs.Dispose()
   End Sub

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
C#Copy Code
public void PointFromImageExample()
   {
      RasterCodecs codecs = new RasterCodecs();
      // Load an image that has BottomLeft ViewPerspective
      RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ULAY1.BMP"));

      LeadPoint ImagePoint = new LeadPoint(0, 0);
      ImagePoint = image.PointFromImage(RasterViewPerspective.TopLeft, ImagePoint);
      Console.WriteLine(string.Format("{0},{1}", ImagePoint.X, ImagePoint.Y));

      ImagePoint.X = 0;
      ImagePoint.Y = 0;
      ImagePoint = image.PointToImage(RasterViewPerspective.TopLeft, ImagePoint);
      Console.WriteLine(string.Format("{0},{1}", ImagePoint.X, ImagePoint.Y));

      image.Dispose();
      codecs.Dispose();
   }

static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
SilverlightCSharpCopy Code
public void PointFromImageExample(RasterImage image)
{
   // image should be an image that has BottomLeft ViewPerspective (ulay1.bmp)
   LeadPoint ImagePoint = new LeadPoint(0, 0);
   ImagePoint = image.PointFromImage(RasterViewPerspective.TopLeft, ImagePoint);
   Debug.WriteLine(string.Format("{0},{1}", ImagePoint.X, ImagePoint.Y));

   ImagePoint.X = 0;
   ImagePoint.Y = 0;
   ImagePoint = image.PointToImage(RasterViewPerspective.TopLeft, ImagePoint);
   Debug.WriteLine(string.Format("{0},{1}", ImagePoint.X, ImagePoint.Y));

   image.Dispose();
}
SilverlightVBCopy Code
Public Sub PointFromImageExample(ByVal image As RasterImage)
   ' image should be an image that has BottomLeft ViewPerspective (ulay1.bmp)
   Dim ImagePoint As LeadPoint = New LeadPoint(0, 0)
   ImagePoint = image.PointFromImage(RasterViewPerspective.TopLeft, ImagePoint)
   Debug.WriteLine(String.Format("{0},{1}", ImagePoint.X, ImagePoint.Y))

   ImagePoint.X = 0
   ImagePoint.Y = 0
   ImagePoint = image.PointToImage(RasterViewPerspective.TopLeft, ImagePoint)
   Debug.WriteLine(String.Format("{0},{1}", ImagePoint.X, ImagePoint.Y))

   image.Dispose()
End Sub

Remarks

For more information, refer to Accounting for View Perspective.

For more information, refer to Changing Image Coordinates.

Requirements

Target Platforms: Silverlight, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only), Windows Phone 7

See Also