Rotates and flips the image data as necessary to achieve the desired view perspective.
public class ChangeViewPerspectiveCommand : Leadtools.Imageprocessing.RasterCommand, Leadtools.Imageprocessing.IRasterCommand
Public Class ChangeViewPerspectiveCommand
Inherits Leadtools.Imageprocessing.RasterCommand
Implements Leadtools.Imageprocessing.IRasterCommand
public sealed class ChangeViewPerspectiveCommand : Leadtools.Imageprocessing.IRasterCommand
@interface LTChangeViewPerspectiveCommand : LTRasterCommand
public class ChangeViewPerspectiveCommand extends RasterCommand
function Leadtools.ImageProcessing.ChangeViewPerspectiveCommand()
public ref class ChangeViewPerspectiveCommand : public Leadtools.Imageprocessing.RasterCommand, Leadtools.Imageprocessing.IRasterCommand
The ViewPerspective is the arrangement of pixels in the image. This command references image coordinates, which are often different from the display coordinates of an image.
Use this command to change the data and the ViewPerspective to simplify calculations that involve image coordinates. This method does not affect the image display. For more information, refer to Accounting for View Perspective.
This example will load an image and then change its view perspective.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using LeadtoolsExamples.Common;
public void ChangeViewPerspectiveCommandExample()
{
RasterCodecs codecs = new RasterCodecs();
string srcFileName = Path.Combine(ImagesPath.Path, "Image1.cmp");
// Load the source image from disk
RasterImage image = codecs.Load(srcFileName);
// Check the view perspective
Console.WriteLine("Original view perspective = {0}", image.ViewPerspective);
// If the view perspective is TopLeft, change to BottomLeft and vise versa
RasterViewPerspective viewPerspective = image.ViewPerspective;
if (viewPerspective == RasterViewPerspective.TopLeft)
viewPerspective = RasterViewPerspective.BottomLeft;
else
viewPerspective = RasterViewPerspective.TopLeft;
// Change the image view perspective
ChangeViewPerspectiveCommand command = new ChangeViewPerspectiveCommand();
command.ViewPerspective = viewPerspective;
command.InPlace = true;
command.Run(image);
// Re-check the view perspective
Console.WriteLine("New view perspective = {0}", image.ViewPerspective);
Assert.IsTrue(image.ViewPerspective == viewPerspective);
// Clean up
image.Dispose();
codecs.Dispose();
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Public Sub ChangeViewPerspectiveCommandExample()
Dim codecs As RasterCodecs = New RasterCodecs()
Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")
' Load the source image from disk
Dim image As RasterImage = codecs.Load(srcFileName)
' Check the view perspective
Console.WriteLine("Original view perspective = {0}", image.ViewPerspective)
' If the view perspective is TopLeft, change to BottomLeft and vise versa
Dim viewPerspective As RasterViewPerspective = image.ViewPerspective
If viewPerspective = RasterViewPerspective.TopLeft Then
viewPerspective = RasterViewPerspective.BottomLeft
Else
viewPerspective = RasterViewPerspective.TopLeft
End If
' Change the image view perspective
Dim command As ChangeViewPerspectiveCommand = New ChangeViewPerspectiveCommand()
command.ViewPerspective = viewPerspective
command.InPlace = True
command.Run(image)
' Re-check the view perspective
Console.WriteLine("New view perspective = {0}", image.ViewPerspective)
Debug.Assert(image.ViewPerspective = viewPerspective)
' Clean up
image.Dispose()
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Examples;
using Leadtools.ImageProcessing;
using Leadtools.Windows.Media;
public void ChangeViewPerspectiveCommandExample(RasterImage image)
{
RasterCodecs codecs = new RasterCodecs();
// Check the view perspective
Debug.WriteLine("Original view perspective = {0}", image.ViewPerspective);
// If the view perspective is TopLeft, change to BottomLeft and vise versa
RasterViewPerspective viewPerspective = image.ViewPerspective;
if (viewPerspective == RasterViewPerspective.TopLeft)
viewPerspective = RasterViewPerspective.BottomLeft;
else
viewPerspective = RasterViewPerspective.TopLeft;
// Change the image view perspective
ChangeViewPerspectiveCommand command = new ChangeViewPerspectiveCommand();
command.ViewPerspective = viewPerspective;
command.InPlace = true;
command.Run(image);
// Re-check the view perspective
Debug.WriteLine("New view perspective = {0}", image.ViewPerspective);
Debug.Assert(image.ViewPerspective == viewPerspective);
// Clean up
image.Dispose();
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.Windows.Media
Public Sub ChangeViewPerspectiveCommandExample(ByVal image As RasterImage)
Dim codecs As RasterCodecs = New RasterCodecs()
' Check the view perspective
Debug.WriteLine("Original view perspective = {0}", image.ViewPerspective)
' If the view perspective is TopLeft, change to BottomLeft and vise versa
Dim viewPerspective As RasterViewPerspective = image.ViewPerspective
If viewPerspective = RasterViewPerspective.TopLeft Then
viewPerspective = RasterViewPerspective.BottomLeft
Else
viewPerspective = RasterViewPerspective.TopLeft
End If
' Change the image view perspective
Dim command As ChangeViewPerspectiveCommand = New ChangeViewPerspectiveCommand()
command.ViewPerspective = viewPerspective
command.InPlace = True
command.Run(image)
' Re-check the view perspective
Debug.WriteLine("New view perspective = {0}", image.ViewPerspective)
Debug.Assert(image.ViewPerspective = viewPerspective)
' Clean up
image.Dispose()
End Sub
Products |
Support |
Feedback: ChangeViewPerspectiveCommand Class - Leadtools |
Introduction |
Help Version 19.0.2017.6.19
|
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.