ClearImage .NET API
AutoRotate Method (CiRepair)
Example 





Inlite.ClearImage Namespace > CiRepair Class : AutoRotate Method
Automatically rotate the image
Syntax
'Declaration
 
Public Function AutoRotate() As EPageRotation
'Usage
 
Dim instance As CiRepair
Dim value As EPageRotation
 
value = instance.AutoRotate()
public EPageRotation AutoRotate()
public function AutoRotate(): EPageRotation; 
public function AutoRotate() : EPageRotation;
public:
EPageRotation AutoRotate(); 

Return Value

If the image contains enough capital letters of the Latin alphabet, this method returns ciRotNoneciRotUpsideDownciRotLeft, or ciRotRight.
If the image does not contain a sufficient number of good quality letters, then graphical features like lines are used.
If the most lines are horizontal, this method returns ciRotPortrait. If the most lines are vertical, this method returns ciRotLeftOrRight.
If neither sufficient letters or lines are present, this method returns ciRotUnknow.

 

Remarks

If needed call AutoDeskew prior to calling AutoRotate.
If rotation is established and image rotated to the right-side-up orientation .
If object.Image.IsZone is true then object.Image.Parent is rotated base on data within object.Image.Zone rectangle.

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