Initializes a new SegmentCommand class object with explicit parameters.
Syntax
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 Basic | Copy 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")
Dim command As SegmentCommand = New SegmentCommand(20, SegmentCommandFlags.Rgb)
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