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:
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document