Skip to content

Latest commit

 

History

History
338 lines (238 loc) · 13 KB

PreprocessingApi.md

File metadata and controls

338 lines (238 loc) · 13 KB

cloudmersive_ocr_api_client.PreprocessingApi

All URIs are relative to https://api.cloudmersive.com

Method HTTP request Description
preprocessing_binarize POST /ocr/preprocessing/image/binarize Convert an image of text into a binarized (light and dark) view
preprocessing_binarize_advanced POST /ocr/preprocessing/image/binarize/advanced Convert an image of text into a binary (light and dark) view with ML
preprocessing_get_page_angle POST /ocr/preprocessing/image/get-page-angle Get the angle of the page / document / receipt
preprocessing_unrotate POST /ocr/preprocessing/image/unrotate Detect and unrotate a document image
preprocessing_unrotate_advanced POST /ocr/preprocessing/image/unrotate/advanced Detect and unrotate a document image (advanced)
preprocessing_unskew POST /ocr/preprocessing/image/unskew Detect and unskew a photo of a document

preprocessing_binarize

str preprocessing_binarize(image_file)

Convert an image of text into a binarized (light and dark) view

Perform an adaptive binarization algorithm on the input image to prepare it for further OCR operations.

Example

from __future__ import print_function
import time
import cloudmersive_ocr_api_client
from cloudmersive_ocr_api_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: Apikey
configuration = 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 class
api_instance = cloudmersive_ocr_api_client.PreprocessingApi(cloudmersive_ocr_api_client.ApiClient(configuration))
image_file = '/path/to/file.txt' # file | Image file to perform OCR on.  Common file formats such as PNG, JPEG are supported.

try:
    # Convert an image of text into a binarized (light and dark) view
    api_response = api_instance.preprocessing_binarize(image_file)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling PreprocessingApi->preprocessing_binarize: %s\n" % e)

Parameters

Name Type Description Notes
image_file file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.

Return type

str

Authorization

Apikey

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json, text/json, application/xml, text/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

preprocessing_binarize_advanced

str preprocessing_binarize_advanced(image_file)

Convert an image of text into a binary (light and dark) view with ML

Perform an advanced adaptive, Deep Learning-based binarization algorithm on the input image to prepare it for further OCR operations. Provides enhanced accuracy than adaptive binarization. Image will be upsampled to 300 DPI if it has a DPI below 300.

Example

from __future__ import print_function
import time
import cloudmersive_ocr_api_client
from cloudmersive_ocr_api_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: Apikey
configuration = 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 class
api_instance = cloudmersive_ocr_api_client.PreprocessingApi(cloudmersive_ocr_api_client.ApiClient(configuration))
image_file = '/path/to/file.txt' # file | Image file to perform OCR on.  Common file formats such as PNG, JPEG are supported.

try:
    # Convert an image of text into a binary (light and dark) view with ML
    api_response = api_instance.preprocessing_binarize_advanced(image_file)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling PreprocessingApi->preprocessing_binarize_advanced: %s\n" % e)

Parameters

Name Type Description Notes
image_file file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.

Return type

str

Authorization

Apikey

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json, text/json, application/xml, text/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

preprocessing_get_page_angle

GetPageAngleResult preprocessing_get_page_angle(image_file)

Get the angle of the page / document / receipt

Analyzes a photo or image of a document and identifies the rotation angle of the page.

Example

from __future__ import print_function
import time
import cloudmersive_ocr_api_client
from cloudmersive_ocr_api_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: Apikey
configuration = 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 class
api_instance = cloudmersive_ocr_api_client.PreprocessingApi(cloudmersive_ocr_api_client.ApiClient(configuration))
image_file = '/path/to/file.txt' # file | Image file to perform OCR on.  Common file formats such as PNG, JPEG are supported.

try:
    # Get the angle of the page / document / receipt
    api_response = api_instance.preprocessing_get_page_angle(image_file)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling PreprocessingApi->preprocessing_get_page_angle: %s\n" % e)

Parameters

Name Type Description Notes
image_file file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.

Return type

GetPageAngleResult

Authorization

Apikey

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json, text/json, application/xml, text/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

preprocessing_unrotate

str preprocessing_unrotate(image_file)

Detect and unrotate a document image

Detect and unrotate an image of a document (e.g. that was scanned at an angle). Great for document scanning applications; once unskewed, this image is perfect for converting to PDF using the Convert API or optical character recognition using the OCR API.

Example

from __future__ import print_function
import time
import cloudmersive_ocr_api_client
from cloudmersive_ocr_api_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: Apikey
configuration = 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 class
api_instance = cloudmersive_ocr_api_client.PreprocessingApi(cloudmersive_ocr_api_client.ApiClient(configuration))
image_file = '/path/to/file.txt' # file | Image file to perform OCR on.  Common file formats such as PNG, JPEG are supported.

try:
    # Detect and unrotate a document image
    api_response = api_instance.preprocessing_unrotate(image_file)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling PreprocessingApi->preprocessing_unrotate: %s\n" % e)

Parameters

Name Type Description Notes
image_file file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.

Return type

str

Authorization

Apikey

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json, text/json, application/xml, text/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

preprocessing_unrotate_advanced

str preprocessing_unrotate_advanced(image_file)

Detect and unrotate a document image (advanced)

Detect and unrotate an image of a document (e.g. that was scanned at an angle) using deep learning. Great for document scanning applications; once unskewed, this image is perfect for converting to PDF using the Convert API or optical character recognition using the OCR API.

Example

from __future__ import print_function
import time
import cloudmersive_ocr_api_client
from cloudmersive_ocr_api_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: Apikey
configuration = 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 class
api_instance = cloudmersive_ocr_api_client.PreprocessingApi(cloudmersive_ocr_api_client.ApiClient(configuration))
image_file = '/path/to/file.txt' # file | Image file to perform OCR on.  Common file formats such as PNG, JPEG are supported.

try:
    # Detect and unrotate a document image (advanced)
    api_response = api_instance.preprocessing_unrotate_advanced(image_file)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling PreprocessingApi->preprocessing_unrotate_advanced: %s\n" % e)

Parameters

Name Type Description Notes
image_file file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.

Return type

str

Authorization

Apikey

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json, text/json, application/xml, text/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

preprocessing_unskew

str preprocessing_unskew(image_file)

Detect and unskew a photo of a document

Detect and unskew a photo of a document (e.g. taken on a cell phone) into a perfectly square image. Great for document scanning applications; once unskewed, this image is perfect for converting to PDF using the Convert API or optical character recognition using the OCR API.

Example

from __future__ import print_function
import time
import cloudmersive_ocr_api_client
from cloudmersive_ocr_api_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: Apikey
configuration = 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 class
api_instance = cloudmersive_ocr_api_client.PreprocessingApi(cloudmersive_ocr_api_client.ApiClient(configuration))
image_file = '/path/to/file.txt' # file | Image file to perform OCR on.  Common file formats such as PNG, JPEG are supported.

try:
    # Detect and unskew a photo of a document
    api_response = api_instance.preprocessing_unskew(image_file)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling PreprocessingApi->preprocessing_unskew: %s\n" % e)

Parameters

Name Type Description Notes
image_file file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.

Return type

str

Authorization

Apikey

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json, text/json, application/xml, text/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]