Leadtools.ImageProcessing.Color Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
SegmentCommand Constructor(Int32,SegmentCommandFlags)
See Also  Example



threshold
The tolerance value of each segment. Valid values for this parameter are: 0 to 255 for 1, 2, 3, 4, 5, 6, 7, 8, 24, and 32-bit images, 0 to 4095 for 12-bit images and 0 to 65535 for 16, 48, and 64-bit images.
flags
Flag that indicates the color space used in the segmentation. For a list of possible values, refer to SegmentCommandFlags.
Initializes a new SegmentCommand class object with explicit parameters.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal threshold As Integer, _
   ByVal flags As SegmentCommandFlags _
)
Visual Basic (Usage)Copy Code
Dim threshold As Integer
Dim flags As SegmentCommandFlags
 
Dim instance As SegmentCommand(threshold, flags)
C# 
public SegmentCommand( 
   int threshold,
   SegmentCommandFlags flags
)
C++/CLI 
public:
SegmentCommand( 
   int threshold,
   SegmentCommandFlags flags
)

Parameters

threshold
The tolerance value of each segment. Valid values for this parameter are: 0 to 255 for 1, 2, 3, 4, 5, 6, 7, 8, 24, and 32-bit images, 0 to 4095 for 12-bit images and 0 to 65535 for 16, 48, and 64-bit images.
flags
Flag that indicates the color space used in the segmentation. For a list of possible values, refer to SegmentCommandFlags.

Example

Run the SegmentCommand on an image.

Visual BasicCopy Code
Public Sub SegmentConstructorExample()
   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
   Dim command As SegmentCommand = New SegmentCommand(20, SegmentCommandFlags.Rgb)
   ' segment the image.
   command.Run(leadImage)
   codecs.Save(leadImage, LeadtoolsExamples.Common.ImagesPath.Path + "Result.jpg", RasterImageFormat.Jpeg, 24)

   RasterCodecs.Shutdown()
End Sub
C#Copy Code
public void SegmentConstructorExample() 

   // 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 
   SegmentCommand command = new SegmentCommand(20, SegmentCommandFlags.Rgb); 
   // segment the image. 
   command.Run(image); 
   codecs.Save(image, LeadtoolsExamples.Common.ImagesPath.Path + "Result.jpg", RasterImageFormat.Jpeg, 24); 
 
   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