Many LEADTOOLS methods reference Image coordinates, which are often different from the display coordinates of an image. For example, in Windows, the first pixel of a displayed image is always in the top-left corner, but in the RasterImage object of the same image, the first pixel in memory is often the bottom-left corner of the image. The arrangement of pixels in the Image is called the view perspective.
For information on changing Image coordinates, based on view perspective, refer to "Translating to or from Image Coordinates" below.
LEADTOOLS keeps track of the view perspective in the ViewPerspective property.
The following are possible values.
All toolkits:
[0] Top-left of image is first in memory. |
|
[2] Bottom-left of image is first in memory. |
[1] Top-right of image is first in memory. |
|
[3] Bottom-right of image is first in memory. |
|
[4] First row is the right side, first column is top side. |
|
[4] Same as RightTop, which is TopLeft rotated clockwise by 90 degrees. |
|
[8] First row is the left side, first column is the bottom side. |
|
[8] Same as LeftBottom, which is TopLeft rotated clockwise by 270 degrees. |
|
[1] Same as TopRight, which is BottomLeft rotated clockwise by 180 degrees. |
|
[3] Same as BottomRight, which is TopLeft rotated clockwise by 180 degrees. |
|
[5] First row is the left side, first column is the top side |
|
[5] Same as LeftTop, which is BottomLeft rotated clockwise by 90 degrees |
|
[7] First row is the right side, first column is the bottom side |
|
[7] Same as RightBottom, which is BottomLeft rotated clockwise by 270 degrees |
The methods that display images account for the view perspective, so that the displayed image has the proper orientation. Nevertheless, when getting the Image width and height, you must consider the possibility that the Image may have a rotated view perspective. Also, in some cases, you must translate to or from Image coordinates.
Interpreting the Image Width and Height (Document/Medical only)
In the LEADTOOLS Document/Medical toolkit, an image can have a rotated view perspective if you set RasterCodecs.Options.Load.Rotated to true before you load the image, or if you use the ChangeViewPerspective method for fast rotation.
In such cases, the Width and Height properties may not match the displayed orientation of the image. This is an important consideration in any calculations of the image's aspect ratio. LEADTOOLS provides the following properties to help you with the interpretation:
Translating to and from Image Coordinates
In some situations you must translate to or from Image coordinates. For example, suppose you are using the GetPixelColor method to get the color at the current mouse position. Because Leadtools.RasterImage.GetPixelColor(System.Int32,System.Int32) uses Image coordinates, you must translate the mouse coordinates.
Similarly, if you are working with two Images that have different view perspectives, you may need to translate the Image coordinates from one to the other. LEADTOOLS provides the following methods to simplify the translation:
If necessary, you can also use the following methods to rotate and flip the Image data as necessary to achieve a different view perspective: ChangeViewPerspective
Products |
Support |
Feedback: Accounting for View Perspective |
Introduction |
Help Version 19.0.2017.6.21
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.