Leadtools.ImageProcessing.Core Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.10
AutoCropRectangleCommand Constructor(Int32)
See Also  Example
Leadtools.ImageProcessing.Core Namespace > AutoCropRectangleCommand Class > AutoCropRectangleCommand Constructor : AutoCropRectangleCommand Constructor(Int32)




threshold
Delta value for detecting blank space. Starting at each edge of the image and evaluating toward the center, any change in intensity that is less than or equal to this parameter is considered blank space. Valid values are 0 to 255.
Initializes a new AutoCropRectangleCommand class object with explicit parameters.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal threshold As Integer _
)
Visual Basic (Usage)Copy Code
Dim threshold As Integer
 
Dim instance As AutoCropRectangleCommand(threshold)
C# 
public AutoCropRectangleCommand( 
   int threshold
)
Managed Extensions for C++ 
public: AutoCropRectangleCommand( 
   int threshold
)
C++/CLI 
public:
AutoCropRectangleCommand( 
   int threshold
)

Parameters

threshold
Delta value for detecting blank space. Starting at each edge of the image and evaluating toward the center, any change in intensity that is less than or equal to this parameter is considered blank space. Valid values are 0 to 255.

Example

Visual BasicCopy Code
ImageProcessing.Core.AutoCropRectangleCommand.AutoCropRectangleConstructor
   Public Sub AutoCropRectangleConstructorExample()
      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
      Dim threshold As Integer = 0
      Try
         Dim command As AutoCropRectangleCommand
         command = New AutoCropRectangleCommand(threshold)
         ' Get the Rectangle for AutoCrop with tolerance = threshold passes by the user.
         command.Run(leadImage)
         MessageBox.Show("Left = " + command.Rectangle.Left.ToString() + Chr(13) + "Top = " + command.Rectangle.Top.ToString() + Chr(13) + "Right = " + command.Rectangle.Right.ToString() + Chr(13) + "Bottom = " + command.Rectangle.Bottom.ToString())
      Catch e As Exception
         MessageBox.Show(e.Message)
      End Try

      RasterCodecs.Shutdown()
   End Sub
C#Copy Code
ImageProcessing.Core.AutoCropRectangleCommand.AutoCropRectangleConstructor 
      public void AutoCropRectangleConstructorExample() 
      { 
         // 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 
         int threshold = 0; 
         try 
         { 
            AutoCropRectangleCommand command = new AutoCropRectangleCommand(threshold); 
            // Get the Rectangle for AutoCrop with tolerance = threshold passes by the user. 
            command.Run(image); 
            MessageBox.Show("Left = " + command.Rectangle.Left.ToString() + "\n" +  
               "Top = " + command.Rectangle.Top.ToString() + "\n" + 
               "Right = " + command.Rectangle.Right.ToString() + "\n" +  
               "Bottom = " + command.Rectangle.Bottom.ToString()); 
         } 
         catch(Exception exception) 
         { 
            MessageBox.Show(exception.Message); 
         } 
 
         RasterCodecs.Shutdown(); 
      }

Remarks

For more information, refer to Processing an Image.

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