ClearImage COM API
BorderExtract Method
CiRepair Object : BorderExtract Method
Description
Extract document image using borders
Syntax
Visual Basic
Public Sub BorderExtract( _
   Optional ByVal Flags As EBorderExtractFlags = ciBexBorderDeskewCrop, _
   Optional ByVal Algorithm As EBorderExtractAlgorithm = ciBeaCleaner _
) 
Parameters
Flags
ValueDescription
ciBexBorderRemove borders only
ciBexBorderDeskewRemove borders and deskew
ciBexBorderDeskewCropRemove borders, deskew, and crop
ciBexDeskewCropDeskew, and crop
Algorithm
ValueDescription
ciBeaCleanerCleaner border extraction
ciBeaFasterFaster border extraction
Remarks

Borders are 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 = ciBexBorder border area pixels are set to white
If Flags = ciBexBorderDeskew border area pixels are set to white and whole image is deskewed.
If Flags = ciBexBorderDeskewCrop border area pixels are set to white and image is deskewed.  Then image is cropped along the lines between former border and inner area.
If Flags = ciBexDeskewCrop image is deskewed, then cropped along the lines between former border and inner area. Remnants might remain on the image.

Example
Sub RepairMethods(imageFile As String, imageFileOut As String)
    ' Create objects and open input images
  Dim Ci As New CiServer
  Dim Repair As CiRepair: Set Repair = Ci.CreateRepair
  Repair.Image.Open imageFile
    ' 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 ciBexBorderDeskewCrop, ciBeaCleaner
  Repair.RemovePunchHoles
  Repair.SmoothCharacters ciSmoothDarkenEdges
  Repair.CleanNoise 3                ' Use CleanNoiseExt to remove white noise
  '  Repair.CleanNoiseExt (ciCnxBlackNoise + ciCnxWhiteNoise), 3, 3, 10, 0
  Repair.pLineCurvature = ciCurvLow
  Repair.pMaxLineAngle = 5
  Repair.pMaxLineGap = 5
  Repair.pMinLineLength = 200
  Repair.DeleteLines ciLineVertAndHorz, ciTrue
  Repair.Image.SaveAs imageFileOut, ciEXT
End Sub
See Also

CiRepair Object  | CiRepair Members