←Select platform

MinimumDotWidth Property

Summary
Gets or sets the minimum width of a dot to be removed.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public int MinimumDotWidth { get; set; } 
@property (nonatomic, assign) NSInteger minimumDotWidth; 
public int getMinimumDotWidth(); 
public void setMinimumDotWidth( 
   int intValue 
); 
public: 
property int MinimumDotWidth { 
   int get(); 
   void set (    int ); 
} 
MinimumDotWidth # get and set (DotRemoveCommand) 

Property Value

The minimum width of a dot to be removed. If DotRemoveCommandFlags.UseDpi is set in the Flags property, units are in thousandths of an inch, otherwise units are in pixels.

Example
C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Core; 
 
public void DotRemoveCommandExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Clean.tif")); 
 
   // Prepare the command 
   DotRemoveCommand command = new DotRemoveCommand(); 
   command.DotRemove += new EventHandler<DotRemoveCommandEventArgs>(DotRemoveEvent_S1); 
   command.Flags = DotRemoveCommandFlags.UseSize; 
   command.MaximumDotHeight = 10; 
   command.MaximumDotWidth = 10; 
   command.MinimumDotHeight = 1; 
   command.MinimumDotWidth = 1; 
 
   command.Run(image); 
 
} 
 
private void DotRemoveEvent_S1(object sender, DotRemoveCommandEventArgs e) 
{ 
   System.Diagnostics.Debug.WriteLine("Size   " + e.BoundingRectangle.Width + e.BoundingRectangle.Height + "Bounds" 
      + e.BoundingRectangle.Left + "," + e.BoundingRectangle.Top + "," + e.BoundingRectangle.Right + "," + e.BoundingRectangle.Bottom + "," 
      + "     WhiteCount" + e.WhiteCount + "    BlackCount" + e.BlackCount, "DotRemove Event"); 
 
   //Do not remove the speck if it contains any white pixels 
   if (e.WhiteCount > 0) 
   { 
      e.Status = RemoveStatus.NoRemove; 
   } 
   else 
   { 
      e.Status = RemoveStatus.Remove; 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.File; 
import java.io.IOException; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.imageprocessing.core.*; 
 
 
public void dotRemoveCommandExample() { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.setThrowExceptionsOnInvalidImages(true); 
 
   RasterImage image = codecs.load(combine(LEAD_VARS_IMAGES_DIR, "Clean.tif")); 
   String outputFileName = combine(LEAD_VARS_IMAGES_DIR, "LEAD_dotRemoveExample.jpg"); 
   // Prepare the command 
   DotRemoveCommand command = new DotRemoveCommand(); 
   command.addDotRemoveCommandListener(dotRemoveEventS1); 
   command.setFlags(DotRemoveCommandFlags.USE_SIZE.getValue()); 
   command.setMaximumDotHeight(10); 
   command.setMaximumDotWidth(10); 
   command.setMinimumDotHeight(1); 
   command.setMinimumDotWidth(1); 
   command.run(image); 
   System.out.println("Executed changes on loaded image..."); 
 
   codecs.save(image, outputFileName, RasterImageFormat.JPEG, 8); 
   System.out.println("Saved updated file to:\n" + outputFileName); 
   assertTrue(new File(outputFileName).exists()); 
} 
 
DotRemoveCommandListener dotRemoveEventS1 = new DotRemoveCommandListener() { 
   @Override 
   public void onDotRemoveEvent(DotRemoveCommandEvent e) { 
      System.out.println("Size   " + e.getBoundingRectangle().getWidth() + e.getBoundingRectangle().getHeight() 
            + "Bounds" + e.getBoundingRectangle().getLeft() + "," + e.getBoundingRectangle().getTop() + "," 
            + e.getBoundingRectangle().getRight() + "," + e.getBoundingRectangle().getBottom() + "," 
            + "     WhiteCount" + e.getWhiteCount() + "    BlackCount" + e.getBlackCount() + " DotRemove Event"); 
 
      // Do not remove the speck if it contains any white pixels 
      if (e.getWhiteCount() > 0) { 
         e.setStatus(RemoveStatus.NO_REMOVE); 
      } else { 
         e.setStatus(RemoveStatus.REMOVE); 
      } 
   } 
}; 
Requirements

Target Platforms

Help Version 23.0.2024.3.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.ImageProcessing.Core Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.