AutoBinaryCommand Class (original) (raw)
Summary
Applies binary segmentation to the image using an automatically calculated threshold based on a two-peak method of statistical analysis of the histogram. This command is available in the Document/Medical Toolkits.
Syntax
C#
Objective-C
C++/CLI
Java
Python
@interface LTAutoBinaryCommand : LTRasterCommand
public class AutoBinaryCommand
extends RasterCommand
class AutoBinaryCommand(RasterCommand):
Example
Run the AutoBinaryCommand on an image and apply automatic binary segmentation on it.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Color;
public void AutoBinaryCommandExample()
{
// Load an image
RasterCodecs codecs = new RasterCodecs();
codecs.ThrowExceptionsOnInvalidImages = true;
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\Beauty16.jpg"));
// Prepare the command
AutoBinaryCommand command = new AutoBinaryCommand();
//Apply Auto Binary Segment.
command.Run(image);
codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Result.jpg"), RasterImageFormat.Jpeg, 24);
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}