Leadtools.ImageProcessing.Effects Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.10
ObjectInformationCommand Constructor
See Also  Example
Leadtools.ImageProcessing.Effects Namespace > ObjectInformationCommand Class : ObjectInformationCommand Constructor




Initializes a new ObjectInformationCommand class object with default parameters.

Overload List

OverloadDescription
ObjectInformationCommand Constructor() Initializes a new ObjectInformationCommand class object with default parameters.  
ObjectInformationCommand Constructor(Boolean) Initializes a new ObjectInformationCommand class object with explicit parameters.  

Example

Visual BasicCopy Code
ImageProcessing.Effects.ObjectInformationCommand.ObjectInformationConstructor
   Public Sub ObjectInformationConstructorExample()
      RasterCodecs.Startup()
      Dim codecs As New RasterCodecs()
      codecs.ThrowExceptionsOnInvalidImages = True

      Dim leadImage As RasterImage = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Master.jpg")

      ' Prepare the command
      ' Get the objects center of mass and it's roundness. I am not interested in the axis' orientation, so I pass Nothing_
      Dim command As ObjectInformationCommand = New ObjectInformationCommand
      command.Weighted = False
      command.Run(leadImage)

      MessageBox.Show("Angle = " + command.Angle.ToString + Chr(13) + _
         "Roundness = " + command.Roundness.ToString + Chr(13) + _
         "X = " + command.CenterOfMass.X.ToString + Chr(13) + _
         "Y = " + command.CenterOfMass.Y.ToString)

      RasterCodecs.Shutdown()
   End Sub
C#Copy Code
ImageProcessing.Effects.ObjectInformationCommand.ObjectInformationConstructor 
      public void ObjectInformationConstructorExample() 
      { 
         // Load an image 
         RasterCodecs.Startup(); 
         RasterCodecs codecs = new RasterCodecs(); 
         codecs.ThrowExceptionsOnInvalidImages = true; 
 
         RasterImage image = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Master.jpg"); 
 
         // Prepare the command 
         // Get the objects center of mass and it's roundness. I am not interested in the axis' orientation, so I pass NULL_ 
         ObjectInformationCommand command = new ObjectInformationCommand(); 
         command.Weighted = false; 
         command.Run(image); 
 
         MessageBox.Show("Angle = "     + command.Angle + "\n" + 
            "Roundness = " + command.Roundness + "\n" + 
            "X = "         + command.CenterOfMass.X + "\n" + 
            "Y = "         + command.CenterOfMass.Y); 
 
         RasterCodecs.Shutdown(); 
      }

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also