LEADTOOLS(Leadtoolsアセンブリ)

フレームを表示

ChangeViewPerspectiveCommandクラス








メンバ 
任意のビューと視点を得るために必要な画像データを上下左右に反転します。
オブジェクトモデル
構文
public class ChangeViewPerspectiveCommand : RasterCommand, IRasterCommand  
'Declaration
 
Public Class ChangeViewPerspectiveCommand 
   Inherits RasterCommand
   Implements IRasterCommand 
'Usage
 
Dim instance As ChangeViewPerspectiveCommand
public sealed class ChangeViewPerspectiveCommand : IRasterCommand  
@interface LTChangeViewPerspectiveCommand : LTRasterCommand
public class ChangeViewPerspectiveCommand extends RasterCommand
function Leadtools.ImageProcessing.ChangeViewPerspectiveCommand()
public ref class ChangeViewPerspectiveCommand : public RasterCommand, IRasterCommand  
解説

ViewPerspectiveは、imageのピクセルの配置です。このコマンドは、画像の座標を参照します。これは、画像の表示座標とは異なる場合があります。

image座標を含む計算を単純化するためにデータとViewPerspectiveを変更するために、このコマンドを使います。このメソッドは、画像表示に影響を及ぼしません。詳細については、「ビューの視点と方向について」を参照してください。

サンプル

このサンプルはimageをロードして、それからそのビューの視点と方向を変更します。

Copy Code  
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.ImageProcessing;

      
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();
}
RasterCommandExamples.prototype.ChangeViewPerspectiveCommandExample = function () {
    Tools.SetLicense();
    with (Leadtools) {
        with (Leadtools.Codecs) {

            var codecs = new RasterCodecs();
            var srcFileName = "Assets\\Image1.cmp";
            var image;

            // Load the source image from disk
            return Tools.AppInstallFolder().getFileAsync(srcFileName).then(function (loadFile) {
                return codecs.loadAsync(LeadStreamFactory.create(loadFile), 24, CodecsLoadByteOrder.bgr, 1, 1)
            })
                .then(function (img) {
                    image = img;
                    // Check the view perspective
                    console.info("Original view perspective = ", image.viewPerspective);

                    // If the view perspective is TopLeft, change to BottomLeft and vise versa
                    var viewPerspective = image.viewPerspective;
                    if (viewPerspective == RasterViewPerspective.topLeft)
                        viewPerspective = RasterViewPerspective.bottomLeft;
                    else
                        viewPerspective = RasterViewPerspective.topLeft;

                    // Change the image view perspective
                    var command = new Leadtools.ImageProcessing.ChangeViewPerspectiveCommand();
                    command.viewPerspective = viewPerspective;
                    command.inPlace = true;

                    command.run(image);

                    // Re-check the view perspective
                    console.info("New view perspective = ", image.viewPerspective);
                    console.assert(image.viewPerspective === viewPerspective);

                    // Clean up
                    image.close();
                    codecs.close();
                });
        }
    }
}
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;

      
public async Task ChangeViewPerspectiveCommandExample()
{
   RasterCodecs codecs = new RasterCodecs();
   string srcFileName = @"Assets\Image1.cmp";

   // Load the source image from disk
   StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName);
   RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile), 24, CodecsLoadByteOrder.Bgr, 1, 1);

   // 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);
   Assert.IsTrue(image.ViewPerspective == viewPerspective);

   // Clean up
   image.Dispose();
}
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
必要条件

ターゲットプラットホーム

参照

参照

ChangeViewPerspectiveCommandメンバ
Leadtools.ImageProcessing名前空間