Gets or sets the threshold for large noise.
public int LargeNoiseThreshold {get; set;} @property (nonatomic, assign) NSInteger largeNoiseThreshold; public int getLargeNoiseThreshold();public void setLargeNoiseThreshold(int intValue);
public:property Int32 LargeNoiseThreshold{Int32 get()void set(Int32 value)}
LargeNoiseThreshold # get and set (ExtractObjectsCommand)
The threshold for the large noise. The default value is 0.
IgnoreLargeNoise must be true for this property to be used.
Objects with any dimension greater than the specified value will be ignored. If ReportIgnored is true, ExObjResult.LargeNoise will be populated with these objects.
If IgnoreSmallNoise is true, this value must be larger than the SmallNoiseThreshold.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Core;public void ExtractObjectsCommandExample(){using (RasterCodecs codecs = new RasterCodecs())// Load the original imageusing (RasterImage inputImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "demoicr2.tif"))){// Setup the extraction optionsExtractObjectsCommand command = new ExtractObjectsCommand(){DetectChildren = true,EightConnectivity = true,Outline = true};// Extract the objectscommand.Run(inputImage);using (ExObjData data = command.Data){// Log the number of objects from the first listExObjObjectList objects = data[0].Objects;Console.WriteLine($"Number of objects (before filtering): {objects.Count}");// Log the number of points around the first object (braces for scope){int count = 0;foreach (ExObjOutlinePoint point in objects.First().Outline)count++;Console.WriteLine($"First object's outline length: {count}");}// Setup the filter optionsExObjFilterOptions filterOptions = new ExObjFilterOptions(){LargeObjectThreshold = -1, // No upper limit on sizeSmallObjectThreshold = 10 // Remove objects smaller than 10x10 pixels};// Filter the objectsdata.FilterList(objects, filterOptions);// Log the number of objects againConsole.WriteLine($"Number of objects (after filtering): {objects.Count}");// Setup the content bound optionsExObjContentBound contentBound = new ExObjContentBound(new LeadRect(192, 260, 323, 146));ExObjContentBoundOptions contentBoundOptions = new ExObjContentBoundOptions(){ObjectsOfInterest = null // Pass null to use every object in data};// Calculate the content boundsdata.CalculateContentBound(new ExObjContentBound[] { contentBound }, contentBoundOptions);// Setup the region optionsExObjRegionOptions regionOptions = new ExObjRegionOptions(){Horizontal = true};// Calculate each object's regiondata.CalculateRegion(objects, regionOptions);// Create an output imageusing (RasterImage outputImage = RasterImage.Create(inputImage.Width, inputImage.Height, 24, inputImage.XResolution, RasterColor.White)){// Fill the output image with whitenew FillCommand(RasterColor.White).Run(outputImage);// Draw the content bound rects for the first word. Red for the input, green for the output.outputImage.AddRectangleToRegion(null, contentBound.Input, RasterRegionCombineMode.Set);new FillCommand(new RasterColor(255, 0, 0)).Run(outputImage);outputImage.AddRectangleToRegion(null, contentBound.Content, RasterRegionCombineMode.Set);new FillCommand(new RasterColor(0, 255, 0)).Run(outputImage);// Populate the output image with each object's regionforeach (ExObjObject @object in objects)foreach (ExObjSegment segment in @object.RegionHorizontal){// Update the region to the current segmentoutputImage.AddRectangleToRegion(null, segment.Bounds, RasterRegionCombineMode.Set);// Fill the region with blacknew FillCommand(RasterColor.Black).Run(outputImage);}// Clear the output image's regionoutputImage.MakeRegionEmpty();// Save the output imagecodecs.Save(outputImage, Path.Combine(LEAD_VARS.ImagesDir, "ExtractObjects.png"), RasterImageFormat.Png, 0);}}}}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
