How to fix a skewed document photo in Python

pip install cloudmersive-ocr-api-client
from __future__ import print_functionimport timeimport cloudmersive_ocr_api_clientfrom cloudmersive_ocr_api_client.rest import ApiExceptionfrom pprint import pprint# Configure API key authorization: Apikeyconfiguration = cloudmersive_ocr_api_client.Configuration()configuration.api_key['Apikey'] = 'YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['Apikey'] = 'Bearer'# create an instance of the API classapi_instance = cloudmersive_ocr_api_client.PreprocessingApi(cloudmersive_ocr_api_client.ApiClient(configuration))image_file = '/path/to/file' # file | Image file to perform OCR on.  Common file formats such as PNG, JPEG are supported.try:# Detect and unskew a photo of a documentapi_response = api_instance.preprocessing_unskew(image_file)pprint(api_response)except ApiException as e:print("Exception when calling PreprocessingApi->preprocessing_unskew: %s\n" % e)

--

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

5 steps to adopt Redmine to Enterprise-ready solution

Apache Flink Series — Part 1

Python Libraries Required for Data Science

PSR-4 autoloading in plugins and themes

Personal iOS/Android project development flow setup

9 Tools You Should Be Using In Your Plugin Development

How to convert Excel XLSX into JSON in Python

The Complete Web Developer in 2022: Zero to Mastery

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

More from Medium

Crop Image to Face with Square Crop in Python

Python Datatype : List

Hack like a pro with basic Python and scheduled tasks

Python sigma rule #1