ClearImage .NET API
CleanNoise(CleanNoiseFlags,Int32,Int32,Int32) Method
Example 





Inlite.ClearImageNet Namespace > ImageEditor Class > CleanNoise Method : CleanNoise(CleanNoiseFlags,Int32,Int32,Int32) Method
Control flags to remove noise
Maximum width of noise object in pixels
Maximum height of noise object in pixels
Maximum distance of noise object from an object that is large than sizeHorz or sizeVert
Remove noise objects (extended)
Syntax
'Declaration
 
Public Overloads Sub CleanNoise( _
   ByVal flags As CleanNoiseFlags, _
   ByVal sizeHorz As System.Integer, _
   ByVal sizeVert As System.Integer, _
   ByVal objectDistance As System.Integer _
) 
'Usage
 
Dim instance As ImageEditor
Dim flags As CleanNoiseFlags
Dim sizeHorz As System.Integer
Dim sizeVert As System.Integer
Dim objectDistance As System.Integer
 
instance.CleanNoise(flags, sizeHorz, sizeVert, objectDistance)
public void CleanNoise( 
   CleanNoiseFlags flags,
   System.int sizeHorz,
   System.int sizeVert,
   System.int objectDistance
)
public procedure CleanNoise( 
    flags: CleanNoiseFlags;
    sizeHorz: System.Integer;
    sizeVert: System.Integer;
    objectDistance: System.Integer
); 
public function CleanNoise( 
   flags : CleanNoiseFlags,
   sizeHorz : System.int,
   sizeVert : System.int,
   objectDistance : System.int
);
public:
void CleanNoise( 
   CleanNoiseFlags flags,
   System.int sizeHorz,
   System.int sizeVert,
   System.int objectDistance
) 

Parameters

flags
Control flags to remove noise
sizeHorz
Maximum width of noise object in pixels
sizeVert
Maximum height of noise object in pixels
objectDistance
Maximum distance of noise object from an object that is large than sizeHorz or sizeVert
Remarks
If flags parameter has marginsNoiseOnly set, then black noise is removed in margins only.  Margins are areas adjacent to the edges of the image containing no objects larger than noise objects to be removed.
Example
void RepairMethods(string imageFile, string imageFileOut)
{
    // Open image file
    CiServer ci = Inlite.ClearImageNet.Server.GetThreadServer();
    CiRepair Repair = ci.CreateRepair();
    Repair.Image.Open(imageFile, 1);
    // Do Processing
    Repair.AutoDeskew();             // Use AutoDeskew before AutoRotate
    Repair.AutoRotate();
    // Repair.AutoCrop(10, 10, 10, 10); // Do not use AutoCrop with AutoRegister or BorderExtract
    // Repair.AutoRegister(100, 100);   // Do not use AutoRegister with AutoCrop or BorderExtract
    Repair.AdvancedBinarize(0, 0, 0);
    Repair.BorderExtract(EBorderExtractFlags.ciBexBorderDeskewCrop, EBorderExtractAlgorithm.ciBeaCleaner);
    Repair.RemovePunchHoles();
    Repair.SmoothCharacters(ESmoothType.ciSmoothDarkenEdges);
    Repair.CleanNoise(3);            // Use CleanNoiseExt to remove white noise
    // Repair.CleanNoiseExt(ECleanNoiseFlags.ciCnxBlackNoise | ECleanNoiseFlags.ciCnxWhiteNoise, 3, 3, 10, 0);
    Repair.pLineCurvature = ELineCurvature.ciCurvLow;
    Repair.pMaxLineAngle = 5;
    Repair.pMaxLineGap = 5;
    Repair.pMinLineLength = 200;
    Repair.DeleteLines(ELineDirection.ciLineVertAndHorz, true);
    Repair.Image.SaveAs(imageFileOut, EFileFormat.ciEXT);
}
Sub RepairMethods(imageFile As String, imageFileOut As String)
    ' Open image file
    Dim ci As CiServer = Inlite.ClearImageNet.Server.GetThreadServer()
    Dim Repair As CiRepair = ci.CreateRepair()
    Repair.Image.Open(imageFile, 1)
    ' Do Processing
    Repair.AutoDeskew()             ' Use AutoDeskew before AutoRotate
    Repair.AutoRotate()
    ' Repair.AutoCrop(10, 10, 10, 10) ' Do not use AutoCrop with AutoRegister or BorderExtract
    ' Repair.AutoRegister(100, 100)   ' Do not use AutoRegister with AutoCrop or BorderExtract
    Repair.AdvancedBinarize(0, 0, 0)
    Repair.BorderExtract(EBorderExtractFlags.ciBexBorderDeskewCrop, EBorderExtractAlgorithm.ciBeaCleaner)
    Repair.RemovePunchHoles()
    Repair.SmoothCharacters(ESmoothType.ciSmoothDarkenEdges)
    Repair.CleanNoise(3)            ' Use CleanNoiseExt to remove white noise
    ' Repair.CleanNoiseExt(ECleanNoiseFlags.ciCnxBlackNoise + ECleanNoiseFlags.ciCnxWhiteNoise, 3, 3, 10, 0)
    Repair.pLineCurvature = ELineCurvature.ciCurvLow
    Repair.pMaxLineAngle = 5
    Repair.pMaxLineGap = 5
    Repair.pMinLineLength = 200
    Repair.DeleteLines(ELineDirection.ciLineVertAndHorz, True)
    Repair.Image.SaveAs(imageFileOut, EFileFormat.ciEXT)
End Sub
See Also

Reference

ImageEditor Class
ImageEditor Members
Overload List