IntensityDetectCommand Class (original) (raw)

Summary

Applies binary segmentation to an image by filtering a specific image to detect colors in a specific intensity range, in a specific color channel(s).

Syntax

C#

Objective-C

C++/CLI

Java

Python

@interface LTIntensityDetectCommand : LTRasterCommand 

public class IntensityDetectCommand extends RasterCommand

class IntensityDetectCommand(RasterCommand): 

Example

Run the IntensityDetectCommand on an image.

using Leadtools; using Leadtools.Codecs; using Leadtools.ImageProcessing.Color; public void IntensityDetectCommandExample() { // Load an image RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "dirty_barcode.jpg")); // Prepare the command IntensityDetectCommand command = new IntensityDetectCommand(); //Apply the filter. command.LowThreshold = 128; command.HighThreshold = 255; command.InColor = new RasterColor(255, 255, 255); command.OutColor = new RasterColor(0, 0, 0); command.Channel = IntensityDetectCommandFlags.Master; 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"; }