Visual Basic |
---|
Public Sub BorderExtract( _ Optional ByVal Flags As EBorderExtractFlags = ciBexBorderDeskewCrop, _ Optional ByVal Algorithm As EBorderExtractAlgorithm = ciBeaCleaner _ ) |
Value | Description |
---|---|
ciBexBorder | Remove borders only |
ciBexBorderDeskew | Remove borders and deskew |
ciBexBorderDeskewCrop | Remove borders, deskew, and crop |
ciBexDeskewCrop | Deskew, and crop |
Value | Description |
---|---|
ciBeaCleaner | Cleaner border extraction |
ciBeaFaster | Faster border extraction |
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.
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