HTML JPG OCR XML BMP
Aspose.OCR  for .NET
OCR

Get skew angle in C#

Automatically detect skew of an image using Aspose.OCR for .NET library.

How to get skew angle using C#

We offer advanced tools and technologies for accurate skew angle detection of images. Our cutting-edge algorithms analyze images to determine their skew angles with precision and efficiency.

To run the examples, you just need to download the Aspose.OCR tools with the following links:

Command line tools

GetSkew project



Run program in Command Prompt


  GetSkew

or

Run program in Command Prompt if you want to use own image (document)


  GetSkew folder/image.png




Recognition result

PropertyTypeDescription
AnglefloatSkew angle in degrees.
ImageIndex   intSequence number of the image on the page. When working with single-page images, this value is always 0.
PageintPage number. When working with single-page images, this value is always 0.
Sourcestring   The full path of the source file. If the file is provided as a MemoryStream object, an array of pixels, or a Base64 string, this value will be empty.


This sample code shows how to get skew angle


	  // Set the license file
            //License lic = new License();
            //lic.SetLicense("Aspose.Total.lic");

            // Create AsposeOcr instance.
            // You can use the overloaded constructor to set characters restriction.
            AsposeOcr api = new AsposeOcr();

            // Create OcrInput object to containerize images
            OcrInput input = new OcrInput(InputType.SingleImage);
            input.Add(fileName);

            // You can put in parameters MemoryStream with image
            // The result is the degree of skew
            List<SkewOutput> result = api.CalculateSkew(input);
            Console.WriteLine("RESULT");
            Console.ResetColor();
            Console.WriteLine("------------------------------------------------------------------------------");

            Console.WriteLine("SKEW IMAGE 1:");
            Console.WriteLine(result[0].Angle);

            input.Clear();

Other Supported Tools

Using C#, one can easily run our examples.

Recognize image (GIF, PNG, JPEG, BMP, TIFF, JFIF)
Recognize PDF (Scanned PDF)
Recognize TIFF (Multipage TIFF)
Preprocess image (GIF, PNG, JPEG, BMP, TIFF, JFIF)
Get JSON (GIF, PNG, JPEG, BMP, TIFF, JFIF)
Get XLSX (GIF, PNG, JPEG, BMP, TIFF, JFIF)
Detect angle (GIF, PNG, JPEG, BMP, TIFF, JFIF)
Recognize image from URL (URL with GIF, PNG, JPEG, BMP, TIFF, JFIF)
Text areas detection (GIF, PNG, JPEG, BMP, TIFF, JFIF)