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



Initializes a new ObjectInformationCommand class object with default parameters.

Syntax

Visual Basic (Declaration) 
Public Function New()
Visual Basic (Usage)Copy Code
Dim instance As ObjectInformationCommand()
C# 
public ObjectInformationCommand()
C++/CLI 
public:
ObjectInformationCommand();

Example

Run the ObjectInformationCommand on an image.

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

   Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "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
public void ObjectInformationConstructorExample() 

   // Load an image 
   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "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