ClearImage .NET API
BorderExtract Method (ImageEditor)
Example 





Inlite.ClearImageNet Namespace > ImageEditor Class : BorderExtract Method
Enables steps of border-based extraction
Extract document image using borders
Syntax
'Declaration
 
Public Sub BorderExtract( _
   ByVal mode As BorderExtractMode _
) 
'Usage
 
Dim instance As ImageEditor
Dim mode As BorderExtractMode
 
instance.BorderExtract(mode)
public void BorderExtract( 
   BorderExtractMode mode
)
public procedure BorderExtract( 
    mode: BorderExtractMode
); 
public function BorderExtract( 
   mode : BorderExtractMode
);
public:
void BorderExtract( 
   BorderExtractMode mode
) 

Parameters

mode
Enables steps of border-based extraction
Remarks

Borders are a dark areas along the edges of the image.  Borders can be present on one or more sides of the image.  Deskew angle is a dominant angle of the lines between the borders and inner area of the image.


If Flags = remove border area pixels are set to white
If Flags = removeDeskew border area pixels are set to white and the whole image is deskewed.
If Flags = deskewCrop image is deskewed.  The image is cropped along the lines between the former border and inner area.

Example
void RepairMethods(string imageFile, string imageFileOut)
{
    ImageEditor editor = new ImageEditor();
    try
    {
        // Open image file
        editor.Image.Open(imageFile, 1);
        // Do Processing
        editor.AutoDeskew();                // Use AutoDeskew before AutoRotate
        editor.AutoRotate();
        // editor.AutoCrop(10, 10, 10, 10); // Do not use AutoCrop with AutoRegister or BorderExtract
        // editor.AutoRegister(100, 100);   // Do not use AutoRegister with AutoCrop or BorderExtract
        editor.AdvancedBinarize();
        editor.BorderExtract(BorderExtractMode.deskewCrop);
        editor.RemovePunchHoles();
        editor.SmoothCharacters();
        editor.CleanNoise(3);              // Remove only black pixels.  Use CleanNoiseExt to remove white noise
        // editor.CleanNoise(CleanNoiseFlags.black | CleanNoiseFlags.white, 3, 3, 10);
        editor.lineCurvature = LineCurvature.low;
        editor.lineMaxAngle = 5;
        editor.lineMaxGap = 5;
        editor.lineMinLength = 200;
        editor.DeleteLinesAndRepair(LineDirection.horzAndVert);
        //  Save processed image
       editor.Image.SaveAs(imageFileOut, Inlite.ClearImage.EFileFormat.ciEXT);
    }
    catch (ClearImageException ex)
    { Console.WriteLine(ex.Message); }
    finally
    {editor.Dispose(); }  // ClearImage V9 and later
}
See Also

Reference

ImageEditor Class
ImageEditor Members