ClearImage .NET API
CleanNoiseExt Method (CiRepair)
Example 





Inlite.ClearImage Namespace > CiRepair Class : CleanNoiseExt Method
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 maxNoiseSizeHorz or maxNoiseSizeVert
Set to 0
Remove noise objects (extended)
Syntax
'Declaration
 
Public Function CleanNoiseExt( _
   ByVal Flags As ECleanNoiseFlags, _
   ByVal maxNoiseSizeHorz As System.Integer, _
   ByVal maxNoiseSizeVert As System.Integer, _
   ByVal minObjectDistance As System.Integer, _
   ByVal reserved0 As System.Integer _
) As System.Integer
'Usage
 
Dim instance As CiRepair
Dim Flags As ECleanNoiseFlags
Dim maxNoiseSizeHorz As System.Integer
Dim maxNoiseSizeVert As System.Integer
Dim minObjectDistance As System.Integer
Dim reserved0 As System.Integer
Dim value As System.Integer
 
value = instance.CleanNoiseExt(Flags, maxNoiseSizeHorz, maxNoiseSizeVert, minObjectDistance, reserved0)
public System.int CleanNoiseExt( 
   ECleanNoiseFlags Flags,
   System.int maxNoiseSizeHorz,
   System.int maxNoiseSizeVert,
   System.int minObjectDistance,
   System.int reserved0
)
public function CleanNoiseExt( 
    Flags: ECleanNoiseFlags;
    maxNoiseSizeHorz: System.Integer;
    maxNoiseSizeVert: System.Integer;
    minObjectDistance: System.Integer;
    reserved0: System.Integer
): System.Integer; 
public function CleanNoiseExt( 
   Flags : ECleanNoiseFlags,
   maxNoiseSizeHorz : System.int,
   maxNoiseSizeVert : System.int,
   minObjectDistance : System.int,
   reserved0 : System.int
) : System.int;
public:
System.int CleanNoiseExt( 
   ECleanNoiseFlags Flags,
   System.int maxNoiseSizeHorz,
   System.int maxNoiseSizeVert,
   System.int minObjectDistance,
   System.int reserved0
) 

Parameters

Flags
maxNoiseSizeHorz
Maximum width of noise object in pixels
maxNoiseSizeVert
Maximum height of noise object in pixels
minObjectDistance
Maximum distance of noise object from an object that is large than maxNoiseSizeHorz or maxNoiseSizeVert
reserved0
Set to 0
Remarks
If Flags has ciCnxMarginsNoise 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

CiRepair Class
CiRepair Members