public class ChangeViewPerspectiveCommand : RasterCommand
@interface LTChangeViewPerspectiveCommand : LTRasterCommand
public class ChangeViewPerspectiveCommand extends RasterCommand
public ref class ChangeViewPerspectiveCommand : public RasterCommand
class ChangeViewPerspectiveCommand(RasterCommand):
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;
public void ChangeViewPerspectiveCommandExample()
{
RasterCodecs codecs = new RasterCodecs();
string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "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();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}
import java.io.File;
import java.io.IOException;
import org.junit.*;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import static org.junit.Assert.*;
import leadtools.*;
import leadtools.codecs.*;
import leadtools.imageprocessing.*;
public void changeViewPerspectiveCommandExample() {
final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images";
RasterCodecs codecs = new RasterCodecs();
String srcFileName = combine(LEAD_VARS_IMAGES_DIR, "rgsref.cmp");
// Load the source image from disk
RasterImage image = codecs.load(srcFileName);
// Check the view perspective
System.out.printf("Original view perspective = %s%n", image.getViewPerspective());
// If the view perspective is TopLeft, change to BottomLeft and vise versa
RasterViewPerspective viewPerspective = image.getViewPerspective();
if (viewPerspective == RasterViewPerspective.TOP_LEFT)
viewPerspective = RasterViewPerspective.BOTTOM_LEFT;
else
viewPerspective = RasterViewPerspective.TOP_LEFT;
// Change the image view perspective
ChangeViewPerspectiveCommand command = new ChangeViewPerspectiveCommand();
command.setViewPerspective(viewPerspective);
command.setInPlace(true);
command.run(image);
// Re-check the view perspective
assertTrue(image.getViewPerspective() == viewPerspective);
System.out.printf("New view perspective = %s%n", image.getViewPerspective());
// Clean up
image.dispose();
codecs.dispose();
}
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