cloudmersive-ocr-api-client 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -0
- data/README.md +150 -0
- data/Rakefile +8 -0
- data/cloudmersive-ocr-api-client.gemspec +45 -0
- data/docs/BusinessCardRecognitionResult.md +15 -0
- data/docs/FieldResult.md +9 -0
- data/docs/FormDefinitionTemplate.md +9 -0
- data/docs/FormFieldDefinition.md +25 -0
- data/docs/FormRecognitionResult.md +12 -0
- data/docs/FormTableColumnDefinition.md +13 -0
- data/docs/FormTableDefinition.md +11 -0
- data/docs/GetPageAngleResult.md +9 -0
- data/docs/ImageOcrApi.md +571 -0
- data/docs/ImageToLinesWithLocationResult.md +9 -0
- data/docs/ImageToTextResponse.md +9 -0
- data/docs/ImageToWordsWithLocationResult.md +9 -0
- data/docs/OcrLineElement.md +9 -0
- data/docs/OcrPageResult.md +10 -0
- data/docs/OcrPageResultWithLinesWithLocation.md +10 -0
- data/docs/OcrPageResultWithWordsWithLocation.md +10 -0
- data/docs/OcrPhotoTextElement.md +14 -0
- data/docs/OcrWordElement.md +18 -0
- data/docs/PdfOcrApi.md +191 -0
- data/docs/PdfToLinesWithLocationResult.md +9 -0
- data/docs/PdfToTextResponse.md +9 -0
- data/docs/PdfToWordsWithLocationResult.md +9 -0
- data/docs/PhotoToWordsWithLocationResult.md +10 -0
- data/docs/Point.md +9 -0
- data/docs/PreprocessingApi.md +338 -0
- data/docs/ReceiptLineItem.md +9 -0
- data/docs/ReceiptRecognitionResult.md +16 -0
- data/docs/ReceiptsApi.md +63 -0
- data/docs/TableCellResult.md +9 -0
- data/docs/TableResult.md +9 -0
- data/docs/TableRowResult.md +8 -0
- data/git_push.sh +55 -0
- data/lib/cloudmersive-ocr-api-client.rb +70 -0
- data/lib/cloudmersive-ocr-api-client/api/image_ocr_api.rb +596 -0
- data/lib/cloudmersive-ocr-api-client/api/pdf_ocr_api.rb +207 -0
- data/lib/cloudmersive-ocr-api-client/api/preprocessing_api.rb +353 -0
- data/lib/cloudmersive-ocr-api-client/api/receipts_api.rb +78 -0
- data/lib/cloudmersive-ocr-api-client/api_client.rb +391 -0
- data/lib/cloudmersive-ocr-api-client/api_error.rb +38 -0
- data/lib/cloudmersive-ocr-api-client/configuration.rb +209 -0
- data/lib/cloudmersive-ocr-api-client/models/business_card_recognition_result.rb +256 -0
- data/lib/cloudmersive-ocr-api-client/models/field_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/form_definition_template.rb +200 -0
- data/lib/cloudmersive-ocr-api-client/models/form_field_definition.rb +358 -0
- data/lib/cloudmersive-ocr-api-client/models/form_recognition_result.rb +232 -0
- data/lib/cloudmersive-ocr-api-client/models/form_table_column_definition.rb +236 -0
- data/lib/cloudmersive-ocr-api-client/models/form_table_definition.rb +218 -0
- data/lib/cloudmersive-ocr-api-client/models/get_page_angle_result.rb +196 -0
- data/lib/cloudmersive-ocr-api-client/models/image_to_lines_with_location_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/image_to_text_response.rb +196 -0
- data/lib/cloudmersive-ocr-api-client/models/image_to_words_with_location_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_line_element.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result.rb +205 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_lines_with_location.rb +208 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_words_with_location.rb +208 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_photo_text_element.rb +248 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_word_element.rb +286 -0
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_lines_with_location_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_text_response.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_words_with_location_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/photo_to_words_with_location_result.rb +223 -0
- data/lib/cloudmersive-ocr-api-client/models/point.rb +196 -0
- data/lib/cloudmersive-ocr-api-client/models/receipt_line_item.rb +196 -0
- data/lib/cloudmersive-ocr-api-client/models/receipt_recognition_result.rb +268 -0
- data/lib/cloudmersive-ocr-api-client/models/table_cell_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/table_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/table_row_result.rb +188 -0
- data/lib/cloudmersive-ocr-api-client/version.rb +15 -0
- data/spec/api/image_ocr_api_spec.rb +169 -0
- data/spec/api/pdf_ocr_api_spec.rb +77 -0
- data/spec/api/preprocessing_api_spec.rb +107 -0
- data/spec/api/receipts_api_spec.rb +47 -0
- data/spec/api_client_spec.rb +243 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/business_card_recognition_result_spec.rb +83 -0
- data/spec/models/field_result_spec.rb +47 -0
- data/spec/models/form_definition_template_spec.rb +47 -0
- data/spec/models/form_field_definition_spec.rb +143 -0
- data/spec/models/form_recognition_result_spec.rb +65 -0
- data/spec/models/form_table_column_definition_spec.rb +71 -0
- data/spec/models/form_table_definition_spec.rb +59 -0
- data/spec/models/get_page_angle_result_spec.rb +47 -0
- data/spec/models/image_to_lines_with_location_result_spec.rb +47 -0
- data/spec/models/image_to_text_response_spec.rb +47 -0
- data/spec/models/image_to_words_with_location_result_spec.rb +47 -0
- data/spec/models/ocr_line_element_spec.rb +47 -0
- data/spec/models/ocr_page_result_spec.rb +53 -0
- data/spec/models/ocr_page_result_with_lines_with_location_spec.rb +53 -0
- data/spec/models/ocr_page_result_with_words_with_location_spec.rb +53 -0
- data/spec/models/ocr_photo_text_element_spec.rb +77 -0
- data/spec/models/ocr_word_element_spec.rb +101 -0
- data/spec/models/pdf_to_lines_with_location_result_spec.rb +47 -0
- data/spec/models/pdf_to_text_response_spec.rb +47 -0
- data/spec/models/pdf_to_words_with_location_result_spec.rb +47 -0
- data/spec/models/photo_to_words_with_location_result_spec.rb +53 -0
- data/spec/models/point_spec.rb +47 -0
- data/spec/models/receipt_line_item_spec.rb +47 -0
- data/spec/models/receipt_recognition_result_spec.rb +89 -0
- data/spec/models/table_cell_result_spec.rb +47 -0
- data/spec/models/table_result_spec.rb +47 -0
- data/spec/models/table_row_result_spec.rb +41 -0
- data/spec/spec_helper.rb +111 -0
- metadata +109 -3
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::ReceiptLineItem
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**item_description** | **String** | Description of the item | [optional]
|
7
|
+
**item_price** | **Float** | Price of the item if available | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::ReceiptRecognitionResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if the operation was successful, false otherwise | [optional]
|
7
|
+
**timestamp** | **DateTime** | The date and time printed on the receipt (if included on the receipt) | [optional]
|
8
|
+
**business_name** | **String** | The name of the business printed on the receipt (if included on the receipt) | [optional]
|
9
|
+
**business_website** | **String** | The website URL of the business printed on the receipt (if included on the receipt) | [optional]
|
10
|
+
**address_string** | **String** | The address of the business printed on the receipt (if included on the receipt) | [optional]
|
11
|
+
**phone_number** | **String** | The phone number printed on the receipt (if included on the receipt) | [optional]
|
12
|
+
**receipt_items** | [**Array<ReceiptLineItem>**](ReceiptLineItem.md) | The individual line items comprising the order; does not include total (see ReceiptTotal) | [optional]
|
13
|
+
**receipt_sub_total** | **Float** | Optional; if available, the monetary value of the receipt subtotal - typically not including specialized line items such as Tax. If this value is not available, it will be 0. | [optional]
|
14
|
+
**receipt_total** | **Float** | The total monetary value of the receipt (if included on the receipt) | [optional]
|
15
|
+
|
16
|
+
|
data/docs/ReceiptsApi.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::ReceiptsApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://api.cloudmersive.com*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**receipts_photo_to_csv**](ReceiptsApi.md#receipts_photo_to_csv) | **POST** /ocr/receipts/photo/to/csv | Convert a photo of a receipt into a CSV file containing structured information from the receipt
|
8
|
+
|
9
|
+
|
10
|
+
# **receipts_photo_to_csv**
|
11
|
+
> Object receipts_photo_to_csv(image_file)
|
12
|
+
|
13
|
+
Convert a photo of a receipt into a CSV file containing structured information from the receipt
|
14
|
+
|
15
|
+
Leverage Deep Learning to automatically turn a photo of a receipt into a CSV file containing the structured information from the receipt.
|
16
|
+
|
17
|
+
### Example
|
18
|
+
```ruby
|
19
|
+
# load the gem
|
20
|
+
require 'cloudmersive-ocr-api-client'
|
21
|
+
# setup authorization
|
22
|
+
CloudmersiveOcrApiClient.configure do |config|
|
23
|
+
# Configure API key authorization: Apikey
|
24
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
25
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
26
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
27
|
+
end
|
28
|
+
|
29
|
+
api_instance = CloudmersiveOcrApiClient::ReceiptsApi.new
|
30
|
+
|
31
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
32
|
+
|
33
|
+
|
34
|
+
begin
|
35
|
+
#Convert a photo of a receipt into a CSV file containing structured information from the receipt
|
36
|
+
result = api_instance.receipts_photo_to_csv(image_file)
|
37
|
+
p result
|
38
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
39
|
+
puts "Exception when calling ReceiptsApi->receipts_photo_to_csv: #{e}"
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
43
|
+
### Parameters
|
44
|
+
|
45
|
+
Name | Type | Description | Notes
|
46
|
+
------------- | ------------- | ------------- | -------------
|
47
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
48
|
+
|
49
|
+
### Return type
|
50
|
+
|
51
|
+
**Object**
|
52
|
+
|
53
|
+
### Authorization
|
54
|
+
|
55
|
+
[Apikey](../README.md#Apikey)
|
56
|
+
|
57
|
+
### HTTP request headers
|
58
|
+
|
59
|
+
- **Content-Type**: multipart/form-data
|
60
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
61
|
+
|
62
|
+
|
63
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::TableCellResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**column_id** | **String** | The ID of the column | [optional]
|
7
|
+
**cell_values** | [**Array<OcrPhotoTextElement>**](OcrPhotoTextElement.md) | Result cell value(s) extracted | [optional]
|
8
|
+
|
9
|
+
|
data/docs/TableResult.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::TableResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**table_definition** | [**FormTableDefinition**](FormTableDefinition.md) | The input table definition for reference | [optional]
|
7
|
+
**table_rows_result** | [**Array<TableRowResult>**](TableRowResult.md) | Rows of data in the table | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::TableRowResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**table_row_cells_result** | [**Array<TableCellResult>**](TableCellResult.md) | Table cells in this row result | [optional]
|
7
|
+
|
8
|
+
|
data/git_push.sh
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
4
|
+
#
|
5
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
6
|
+
#
|
7
|
+
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
8
|
+
|
9
|
+
git_user_id=$1
|
10
|
+
git_repo_id=$2
|
11
|
+
release_note=$3
|
12
|
+
|
13
|
+
if [ "$git_user_id" = "" ]; then
|
14
|
+
git_user_id="GIT_USER_ID"
|
15
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
16
|
+
fi
|
17
|
+
|
18
|
+
if [ "$git_repo_id" = "" ]; then
|
19
|
+
git_repo_id="GIT_REPO_ID"
|
20
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
21
|
+
fi
|
22
|
+
|
23
|
+
if [ "$release_note" = "" ]; then
|
24
|
+
release_note="Minor update"
|
25
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
26
|
+
fi
|
27
|
+
|
28
|
+
# Initialize the local directory as a Git repository
|
29
|
+
git init
|
30
|
+
|
31
|
+
# Adds the files in the local repository and stages them for commit.
|
32
|
+
git add .
|
33
|
+
|
34
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
35
|
+
git commit -m "$release_note"
|
36
|
+
|
37
|
+
# Sets the new remote
|
38
|
+
git_remote=`git remote`
|
39
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
40
|
+
|
41
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
42
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
43
|
+
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
44
|
+
else
|
45
|
+
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
46
|
+
fi
|
47
|
+
|
48
|
+
fi
|
49
|
+
|
50
|
+
git pull origin master
|
51
|
+
|
52
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
53
|
+
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
54
|
+
git push origin master 2>&1 | grep -v 'To https'
|
55
|
+
|
@@ -0,0 +1,70 @@
|
|
1
|
+
=begin
|
2
|
+
#ocrapi
|
3
|
+
|
4
|
+
#The powerful Optical Character Recognition (OCR) APIs let you convert scanned images of pages into recognized text.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
# Common files
|
14
|
+
require 'cloudmersive-ocr-api-client/api_client'
|
15
|
+
require 'cloudmersive-ocr-api-client/api_error'
|
16
|
+
require 'cloudmersive-ocr-api-client/version'
|
17
|
+
require 'cloudmersive-ocr-api-client/configuration'
|
18
|
+
|
19
|
+
# Models
|
20
|
+
require 'cloudmersive-ocr-api-client/models/business_card_recognition_result'
|
21
|
+
require 'cloudmersive-ocr-api-client/models/field_result'
|
22
|
+
require 'cloudmersive-ocr-api-client/models/form_definition_template'
|
23
|
+
require 'cloudmersive-ocr-api-client/models/form_field_definition'
|
24
|
+
require 'cloudmersive-ocr-api-client/models/form_recognition_result'
|
25
|
+
require 'cloudmersive-ocr-api-client/models/form_table_column_definition'
|
26
|
+
require 'cloudmersive-ocr-api-client/models/form_table_definition'
|
27
|
+
require 'cloudmersive-ocr-api-client/models/get_page_angle_result'
|
28
|
+
require 'cloudmersive-ocr-api-client/models/image_to_lines_with_location_result'
|
29
|
+
require 'cloudmersive-ocr-api-client/models/image_to_text_response'
|
30
|
+
require 'cloudmersive-ocr-api-client/models/image_to_words_with_location_result'
|
31
|
+
require 'cloudmersive-ocr-api-client/models/ocr_line_element'
|
32
|
+
require 'cloudmersive-ocr-api-client/models/ocr_page_result'
|
33
|
+
require 'cloudmersive-ocr-api-client/models/ocr_page_result_with_lines_with_location'
|
34
|
+
require 'cloudmersive-ocr-api-client/models/ocr_page_result_with_words_with_location'
|
35
|
+
require 'cloudmersive-ocr-api-client/models/ocr_photo_text_element'
|
36
|
+
require 'cloudmersive-ocr-api-client/models/ocr_word_element'
|
37
|
+
require 'cloudmersive-ocr-api-client/models/pdf_to_lines_with_location_result'
|
38
|
+
require 'cloudmersive-ocr-api-client/models/pdf_to_text_response'
|
39
|
+
require 'cloudmersive-ocr-api-client/models/pdf_to_words_with_location_result'
|
40
|
+
require 'cloudmersive-ocr-api-client/models/photo_to_words_with_location_result'
|
41
|
+
require 'cloudmersive-ocr-api-client/models/point'
|
42
|
+
require 'cloudmersive-ocr-api-client/models/receipt_line_item'
|
43
|
+
require 'cloudmersive-ocr-api-client/models/receipt_recognition_result'
|
44
|
+
require 'cloudmersive-ocr-api-client/models/table_cell_result'
|
45
|
+
require 'cloudmersive-ocr-api-client/models/table_result'
|
46
|
+
require 'cloudmersive-ocr-api-client/models/table_row_result'
|
47
|
+
|
48
|
+
# APIs
|
49
|
+
require 'cloudmersive-ocr-api-client/api/image_ocr_api'
|
50
|
+
require 'cloudmersive-ocr-api-client/api/pdf_ocr_api'
|
51
|
+
require 'cloudmersive-ocr-api-client/api/preprocessing_api'
|
52
|
+
require 'cloudmersive-ocr-api-client/api/receipts_api'
|
53
|
+
|
54
|
+
module CloudmersiveOcrApiClient
|
55
|
+
class << self
|
56
|
+
# Customize default settings for the SDK using block.
|
57
|
+
# CloudmersiveOcrApiClient.configure do |config|
|
58
|
+
# config.username = "xxx"
|
59
|
+
# config.password = "xxx"
|
60
|
+
# end
|
61
|
+
# If no block given, return the default Configuration object.
|
62
|
+
def configure
|
63
|
+
if block_given?
|
64
|
+
yield(Configuration.default)
|
65
|
+
else
|
66
|
+
Configuration.default
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,596 @@
|
|
1
|
+
=begin
|
2
|
+
#ocrapi
|
3
|
+
|
4
|
+
#The powerful Optical Character Recognition (OCR) APIs let you convert scanned images of pages into recognized text.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'uri'
|
14
|
+
|
15
|
+
module CloudmersiveOcrApiClient
|
16
|
+
class ImageOcrApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Convert a scanned image into words with location
|
23
|
+
# Converts an uploaded image in common formats such as JPEG, PNG into lines/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
24
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
27
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image before OCR is applied; this is recommended).
|
28
|
+
# @return [ImageToLinesWithLocationResult]
|
29
|
+
def image_ocr_image_lines_with_location(image_file, opts = {})
|
30
|
+
data, _status_code, _headers = image_ocr_image_lines_with_location_with_http_info(image_file, opts)
|
31
|
+
data
|
32
|
+
end
|
33
|
+
|
34
|
+
# Convert a scanned image into words with location
|
35
|
+
# Converts an uploaded image in common formats such as JPEG, PNG into lines/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
36
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
39
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image before OCR is applied; this is recommended).
|
40
|
+
# @return [Array<(ImageToLinesWithLocationResult, Fixnum, Hash)>] ImageToLinesWithLocationResult data, response status code and response headers
|
41
|
+
def image_ocr_image_lines_with_location_with_http_info(image_file, opts = {})
|
42
|
+
if @api_client.config.debugging
|
43
|
+
@api_client.config.logger.debug 'Calling API: ImageOcrApi.image_ocr_image_lines_with_location ...'
|
44
|
+
end
|
45
|
+
# verify the required parameter 'image_file' is set
|
46
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
47
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_image_lines_with_location"
|
48
|
+
end
|
49
|
+
# resource path
|
50
|
+
local_var_path = '/ocr/image/to/lines-with-location'
|
51
|
+
|
52
|
+
# query parameters
|
53
|
+
query_params = {}
|
54
|
+
|
55
|
+
# header parameters
|
56
|
+
header_params = {}
|
57
|
+
# HTTP header 'Accept' (if needed)
|
58
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
59
|
+
# HTTP header 'Content-Type'
|
60
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
61
|
+
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
62
|
+
header_params[:'preprocessing'] = opts[:'preprocessing'] if !opts[:'preprocessing'].nil?
|
63
|
+
|
64
|
+
# form parameters
|
65
|
+
form_params = {}
|
66
|
+
form_params['imageFile'] = image_file
|
67
|
+
|
68
|
+
# http body (model)
|
69
|
+
post_body = nil
|
70
|
+
auth_names = ['Apikey']
|
71
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
72
|
+
:header_params => header_params,
|
73
|
+
:query_params => query_params,
|
74
|
+
:form_params => form_params,
|
75
|
+
:body => post_body,
|
76
|
+
:auth_names => auth_names,
|
77
|
+
:return_type => 'ImageToLinesWithLocationResult')
|
78
|
+
if @api_client.config.debugging
|
79
|
+
@api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_image_lines_with_location\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
80
|
+
end
|
81
|
+
return data, status_code, headers
|
82
|
+
end
|
83
|
+
# Convert a scanned image into words with location
|
84
|
+
# Converts an uploaded image in common formats such as JPEG, PNG into words/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
85
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
86
|
+
# @param [Hash] opts the optional parameters
|
87
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
88
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image before OCR is applied; this is recommended).
|
89
|
+
# @return [ImageToWordsWithLocationResult]
|
90
|
+
def image_ocr_image_words_with_location(image_file, opts = {})
|
91
|
+
data, _status_code, _headers = image_ocr_image_words_with_location_with_http_info(image_file, opts)
|
92
|
+
data
|
93
|
+
end
|
94
|
+
|
95
|
+
# Convert a scanned image into words with location
|
96
|
+
# Converts an uploaded image in common formats such as JPEG, PNG into words/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
97
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
98
|
+
# @param [Hash] opts the optional parameters
|
99
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
100
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image before OCR is applied; this is recommended).
|
101
|
+
# @return [Array<(ImageToWordsWithLocationResult, Fixnum, Hash)>] ImageToWordsWithLocationResult data, response status code and response headers
|
102
|
+
def image_ocr_image_words_with_location_with_http_info(image_file, opts = {})
|
103
|
+
if @api_client.config.debugging
|
104
|
+
@api_client.config.logger.debug 'Calling API: ImageOcrApi.image_ocr_image_words_with_location ...'
|
105
|
+
end
|
106
|
+
# verify the required parameter 'image_file' is set
|
107
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
108
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_image_words_with_location"
|
109
|
+
end
|
110
|
+
# resource path
|
111
|
+
local_var_path = '/ocr/image/to/words-with-location'
|
112
|
+
|
113
|
+
# query parameters
|
114
|
+
query_params = {}
|
115
|
+
|
116
|
+
# header parameters
|
117
|
+
header_params = {}
|
118
|
+
# HTTP header 'Accept' (if needed)
|
119
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
120
|
+
# HTTP header 'Content-Type'
|
121
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
122
|
+
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
123
|
+
header_params[:'preprocessing'] = opts[:'preprocessing'] if !opts[:'preprocessing'].nil?
|
124
|
+
|
125
|
+
# form parameters
|
126
|
+
form_params = {}
|
127
|
+
form_params['imageFile'] = image_file
|
128
|
+
|
129
|
+
# http body (model)
|
130
|
+
post_body = nil
|
131
|
+
auth_names = ['Apikey']
|
132
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
133
|
+
:header_params => header_params,
|
134
|
+
:query_params => query_params,
|
135
|
+
:form_params => form_params,
|
136
|
+
:body => post_body,
|
137
|
+
:auth_names => auth_names,
|
138
|
+
:return_type => 'ImageToWordsWithLocationResult')
|
139
|
+
if @api_client.config.debugging
|
140
|
+
@api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_image_words_with_location\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
141
|
+
end
|
142
|
+
return data, status_code, headers
|
143
|
+
end
|
144
|
+
# Recognize a photo of a business card, extract key business information
|
145
|
+
# Analyzes a photograph of a business card as input, and outputs key business information such as the name of the person, name of the business, the address of the business, the phone number, the email address and more.
|
146
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
147
|
+
# @param [Hash] opts the optional parameters
|
148
|
+
# @return [BusinessCardRecognitionResult]
|
149
|
+
def image_ocr_photo_recognize_business_card(image_file, opts = {})
|
150
|
+
data, _status_code, _headers = image_ocr_photo_recognize_business_card_with_http_info(image_file, opts)
|
151
|
+
data
|
152
|
+
end
|
153
|
+
|
154
|
+
# Recognize a photo of a business card, extract key business information
|
155
|
+
# Analyzes a photograph of a business card as input, and outputs key business information such as the name of the person, name of the business, the address of the business, the phone number, the email address and more.
|
156
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
157
|
+
# @param [Hash] opts the optional parameters
|
158
|
+
# @return [Array<(BusinessCardRecognitionResult, Fixnum, Hash)>] BusinessCardRecognitionResult data, response status code and response headers
|
159
|
+
def image_ocr_photo_recognize_business_card_with_http_info(image_file, opts = {})
|
160
|
+
if @api_client.config.debugging
|
161
|
+
@api_client.config.logger.debug 'Calling API: ImageOcrApi.image_ocr_photo_recognize_business_card ...'
|
162
|
+
end
|
163
|
+
# verify the required parameter 'image_file' is set
|
164
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
165
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_photo_recognize_business_card"
|
166
|
+
end
|
167
|
+
# resource path
|
168
|
+
local_var_path = '/ocr/photo/recognize/business-card'
|
169
|
+
|
170
|
+
# query parameters
|
171
|
+
query_params = {}
|
172
|
+
|
173
|
+
# header parameters
|
174
|
+
header_params = {}
|
175
|
+
# HTTP header 'Accept' (if needed)
|
176
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
177
|
+
# HTTP header 'Content-Type'
|
178
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
179
|
+
|
180
|
+
# form parameters
|
181
|
+
form_params = {}
|
182
|
+
form_params['imageFile'] = image_file
|
183
|
+
|
184
|
+
# http body (model)
|
185
|
+
post_body = nil
|
186
|
+
auth_names = ['Apikey']
|
187
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
188
|
+
:header_params => header_params,
|
189
|
+
:query_params => query_params,
|
190
|
+
:form_params => form_params,
|
191
|
+
:body => post_body,
|
192
|
+
:auth_names => auth_names,
|
193
|
+
:return_type => 'BusinessCardRecognitionResult')
|
194
|
+
if @api_client.config.debugging
|
195
|
+
@api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_photo_recognize_business_card\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
196
|
+
end
|
197
|
+
return data, status_code, headers
|
198
|
+
end
|
199
|
+
# Recognize a photo of a form, extract key fields and business information
|
200
|
+
# Analyzes a photograph of a form as input, and outputs key business fields and information. Customzie data to be extracted by defining fields for the form.
|
201
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
202
|
+
# @param [Hash] opts the optional parameters
|
203
|
+
# @option opts [Object] :form_template_definition Form field definitions
|
204
|
+
# @option opts [String] :recognition_mode Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
205
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement.
|
206
|
+
# @option opts [String] :diagnostics Optional, diagnostics mode, default is 'false'. Possible values are 'true' (will set DiagnosticImage to a diagnostic PNG image in the result), and 'false' (no diagnostics are enabled; this is recommended for best performance).
|
207
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
208
|
+
# @return [FormRecognitionResult]
|
209
|
+
def image_ocr_photo_recognize_form(image_file, opts = {})
|
210
|
+
data, _status_code, _headers = image_ocr_photo_recognize_form_with_http_info(image_file, opts)
|
211
|
+
data
|
212
|
+
end
|
213
|
+
|
214
|
+
# Recognize a photo of a form, extract key fields and business information
|
215
|
+
# Analyzes a photograph of a form as input, and outputs key business fields and information. Customzie data to be extracted by defining fields for the form.
|
216
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
217
|
+
# @param [Hash] opts the optional parameters
|
218
|
+
# @option opts [Object] :form_template_definition Form field definitions
|
219
|
+
# @option opts [String] :recognition_mode Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
220
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement.
|
221
|
+
# @option opts [String] :diagnostics Optional, diagnostics mode, default is 'false'. Possible values are 'true' (will set DiagnosticImage to a diagnostic PNG image in the result), and 'false' (no diagnostics are enabled; this is recommended for best performance).
|
222
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
223
|
+
# @return [Array<(FormRecognitionResult, Fixnum, Hash)>] FormRecognitionResult data, response status code and response headers
|
224
|
+
def image_ocr_photo_recognize_form_with_http_info(image_file, opts = {})
|
225
|
+
if @api_client.config.debugging
|
226
|
+
@api_client.config.logger.debug 'Calling API: ImageOcrApi.image_ocr_photo_recognize_form ...'
|
227
|
+
end
|
228
|
+
# verify the required parameter 'image_file' is set
|
229
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
230
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_photo_recognize_form"
|
231
|
+
end
|
232
|
+
# resource path
|
233
|
+
local_var_path = '/ocr/photo/recognize/form'
|
234
|
+
|
235
|
+
# query parameters
|
236
|
+
query_params = {}
|
237
|
+
|
238
|
+
# header parameters
|
239
|
+
header_params = {}
|
240
|
+
# HTTP header 'Accept' (if needed)
|
241
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
242
|
+
# HTTP header 'Content-Type'
|
243
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
244
|
+
header_params[:'formTemplateDefinition'] = opts[:'form_template_definition'] if !opts[:'form_template_definition'].nil?
|
245
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
246
|
+
header_params[:'preprocessing'] = opts[:'preprocessing'] if !opts[:'preprocessing'].nil?
|
247
|
+
header_params[:'diagnostics'] = opts[:'diagnostics'] if !opts[:'diagnostics'].nil?
|
248
|
+
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
249
|
+
|
250
|
+
# form parameters
|
251
|
+
form_params = {}
|
252
|
+
form_params['imageFile'] = image_file
|
253
|
+
|
254
|
+
# http body (model)
|
255
|
+
post_body = nil
|
256
|
+
auth_names = ['Apikey']
|
257
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
258
|
+
:header_params => header_params,
|
259
|
+
:query_params => query_params,
|
260
|
+
:form_params => form_params,
|
261
|
+
:body => post_body,
|
262
|
+
:auth_names => auth_names,
|
263
|
+
:return_type => 'FormRecognitionResult')
|
264
|
+
if @api_client.config.debugging
|
265
|
+
@api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_photo_recognize_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
266
|
+
end
|
267
|
+
return data, status_code, headers
|
268
|
+
end
|
269
|
+
# Recognize a photo of a form, extract key fields using stored templates
|
270
|
+
# Analyzes a photograph of a form as input, and outputs key business fields and information. Customzie data to be extracted by defining fields for the form. Uses template definitions stored in Cloudmersive Configuration; to configure stored templates in a configuration bucket, log into Cloudmersive Management Portal and navigate to Settings > API Configuration > Create Bucket
|
271
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
272
|
+
# @param [Hash] opts the optional parameters
|
273
|
+
# @option opts [String] :bucket_id Bucket ID of the Configuration Bucket storing the form templates
|
274
|
+
# @option opts [String] :bucket_secret_key Bucket Secret Key of the Configuration Bucket storing the form templates
|
275
|
+
# @option opts [String] :recognition_mode Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
276
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement.
|
277
|
+
# @option opts [String] :diagnostics Optional, diagnostics mode, default is 'false'. Possible values are 'true' (will set DiagnosticImage to a diagnostic PNG image in the result), and 'false' (no diagnostics are enabled; this is recommended for best performance).
|
278
|
+
# @return [FormRecognitionResult]
|
279
|
+
def image_ocr_photo_recognize_form_advanced(image_file, opts = {})
|
280
|
+
data, _status_code, _headers = image_ocr_photo_recognize_form_advanced_with_http_info(image_file, opts)
|
281
|
+
data
|
282
|
+
end
|
283
|
+
|
284
|
+
# Recognize a photo of a form, extract key fields using stored templates
|
285
|
+
# Analyzes a photograph of a form as input, and outputs key business fields and information. Customzie data to be extracted by defining fields for the form. Uses template definitions stored in Cloudmersive Configuration; to configure stored templates in a configuration bucket, log into Cloudmersive Management Portal and navigate to Settings &gt; API Configuration &gt; Create Bucket
|
286
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
287
|
+
# @param [Hash] opts the optional parameters
|
288
|
+
# @option opts [String] :bucket_id Bucket ID of the Configuration Bucket storing the form templates
|
289
|
+
# @option opts [String] :bucket_secret_key Bucket Secret Key of the Configuration Bucket storing the form templates
|
290
|
+
# @option opts [String] :recognition_mode Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
291
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement.
|
292
|
+
# @option opts [String] :diagnostics Optional, diagnostics mode, default is 'false'. Possible values are 'true' (will set DiagnosticImage to a diagnostic PNG image in the result), and 'false' (no diagnostics are enabled; this is recommended for best performance).
|
293
|
+
# @return [Array<(FormRecognitionResult, Fixnum, Hash)>] FormRecognitionResult data, response status code and response headers
|
294
|
+
def image_ocr_photo_recognize_form_advanced_with_http_info(image_file, opts = {})
|
295
|
+
if @api_client.config.debugging
|
296
|
+
@api_client.config.logger.debug 'Calling API: ImageOcrApi.image_ocr_photo_recognize_form_advanced ...'
|
297
|
+
end
|
298
|
+
# verify the required parameter 'image_file' is set
|
299
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
300
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_photo_recognize_form_advanced"
|
301
|
+
end
|
302
|
+
# resource path
|
303
|
+
local_var_path = '/ocr/photo/recognize/form/advanced'
|
304
|
+
|
305
|
+
# query parameters
|
306
|
+
query_params = {}
|
307
|
+
|
308
|
+
# header parameters
|
309
|
+
header_params = {}
|
310
|
+
# HTTP header 'Accept' (if needed)
|
311
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
312
|
+
# HTTP header 'Content-Type'
|
313
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
314
|
+
header_params[:'bucketID'] = opts[:'bucket_id'] if !opts[:'bucket_id'].nil?
|
315
|
+
header_params[:'bucketSecretKey'] = opts[:'bucket_secret_key'] if !opts[:'bucket_secret_key'].nil?
|
316
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
317
|
+
header_params[:'preprocessing'] = opts[:'preprocessing'] if !opts[:'preprocessing'].nil?
|
318
|
+
header_params[:'diagnostics'] = opts[:'diagnostics'] if !opts[:'diagnostics'].nil?
|
319
|
+
|
320
|
+
# form parameters
|
321
|
+
form_params = {}
|
322
|
+
form_params['imageFile'] = image_file
|
323
|
+
|
324
|
+
# http body (model)
|
325
|
+
post_body = nil
|
326
|
+
auth_names = ['Apikey']
|
327
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
328
|
+
:header_params => header_params,
|
329
|
+
:query_params => query_params,
|
330
|
+
:form_params => form_params,
|
331
|
+
:body => post_body,
|
332
|
+
:auth_names => auth_names,
|
333
|
+
:return_type => 'FormRecognitionResult')
|
334
|
+
if @api_client.config.debugging
|
335
|
+
@api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_photo_recognize_form_advanced\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
336
|
+
end
|
337
|
+
return data, status_code, headers
|
338
|
+
end
|
339
|
+
# Recognize a photo of a receipt, extract key business information
|
340
|
+
# Analyzes a photograph of a receipt as input, and outputs key business information such as the name of the business, the address of the business, the phone number of the business, the total of the receipt, the date of the receipt, and more.
|
341
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
342
|
+
# @param [Hash] opts the optional parameters
|
343
|
+
# @option opts [String] :recognition_mode Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
344
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
345
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'None'. Possible values are None (no preprocessing of the image), and 'Advanced' (automatic image enhancement of the image before OCR is applied; this is recommended and needed to handle rotated receipts).
|
346
|
+
# @return [ReceiptRecognitionResult]
|
347
|
+
def image_ocr_photo_recognize_receipt(image_file, opts = {})
|
348
|
+
data, _status_code, _headers = image_ocr_photo_recognize_receipt_with_http_info(image_file, opts)
|
349
|
+
data
|
350
|
+
end
|
351
|
+
|
352
|
+
# Recognize a photo of a receipt, extract key business information
|
353
|
+
# Analyzes a photograph of a receipt as input, and outputs key business information such as the name of the business, the address of the business, the phone number of the business, the total of the receipt, the date of the receipt, and more.
|
354
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
355
|
+
# @param [Hash] opts the optional parameters
|
356
|
+
# @option opts [String] :recognition_mode Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
357
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
358
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'None'. Possible values are None (no preprocessing of the image), and 'Advanced' (automatic image enhancement of the image before OCR is applied; this is recommended and needed to handle rotated receipts).
|
359
|
+
# @return [Array<(ReceiptRecognitionResult, Fixnum, Hash)>] ReceiptRecognitionResult data, response status code and response headers
|
360
|
+
def image_ocr_photo_recognize_receipt_with_http_info(image_file, opts = {})
|
361
|
+
if @api_client.config.debugging
|
362
|
+
@api_client.config.logger.debug 'Calling API: ImageOcrApi.image_ocr_photo_recognize_receipt ...'
|
363
|
+
end
|
364
|
+
# verify the required parameter 'image_file' is set
|
365
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
366
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_photo_recognize_receipt"
|
367
|
+
end
|
368
|
+
# resource path
|
369
|
+
local_var_path = '/ocr/photo/recognize/receipt'
|
370
|
+
|
371
|
+
# query parameters
|
372
|
+
query_params = {}
|
373
|
+
|
374
|
+
# header parameters
|
375
|
+
header_params = {}
|
376
|
+
# HTTP header 'Accept' (if needed)
|
377
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
378
|
+
# HTTP header 'Content-Type'
|
379
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
380
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
381
|
+
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
382
|
+
header_params[:'preprocessing'] = opts[:'preprocessing'] if !opts[:'preprocessing'].nil?
|
383
|
+
|
384
|
+
# form parameters
|
385
|
+
form_params = {}
|
386
|
+
form_params['imageFile'] = image_file
|
387
|
+
|
388
|
+
# http body (model)
|
389
|
+
post_body = nil
|
390
|
+
auth_names = ['Apikey']
|
391
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
392
|
+
:header_params => header_params,
|
393
|
+
:query_params => query_params,
|
394
|
+
:form_params => form_params,
|
395
|
+
:body => post_body,
|
396
|
+
:auth_names => auth_names,
|
397
|
+
:return_type => 'ReceiptRecognitionResult')
|
398
|
+
if @api_client.config.debugging
|
399
|
+
@api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_photo_recognize_receipt\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
400
|
+
end
|
401
|
+
return data, status_code, headers
|
402
|
+
end
|
403
|
+
# Convert a photo of a document into text
|
404
|
+
# Converts an uploaded photo of a document in common formats such as JPEG, PNG into text via Optical Character Recognition. This API is intended to be run on photos of documents, e.g. taken with a smartphone and supports cases where other content, such as a desk, are in the frame and the camera is crooked. If you want to OCR a scanned image, use the image/toText API call instead as it is designed for scanned images.
|
405
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
406
|
+
# @param [Hash] opts the optional parameters
|
407
|
+
# @option opts [String] :recognition_mode Optional; possible values are 'Basic' which provides basic recognition and is not resillient to page rotation, skew or low quality images uses 1-2 API calls; 'Normal' which provides highly fault tolerant OCR recognition uses 26-30 API calls; and 'Advanced' which provides the highest quality and most fault-tolerant recognition uses 28-30 API calls. Default recognition mode is 'Advanced'
|
408
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
409
|
+
# @return [ImageToTextResponse]
|
410
|
+
def image_ocr_photo_to_text(image_file, opts = {})
|
411
|
+
data, _status_code, _headers = image_ocr_photo_to_text_with_http_info(image_file, opts)
|
412
|
+
data
|
413
|
+
end
|
414
|
+
|
415
|
+
# Convert a photo of a document into text
|
416
|
+
# Converts an uploaded photo of a document in common formats such as JPEG, PNG into text via Optical Character Recognition. This API is intended to be run on photos of documents, e.g. taken with a smartphone and supports cases where other content, such as a desk, are in the frame and the camera is crooked. If you want to OCR a scanned image, use the image/toText API call instead as it is designed for scanned images.
|
417
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
418
|
+
# @param [Hash] opts the optional parameters
|
419
|
+
# @option opts [String] :recognition_mode Optional; possible values are 'Basic' which provides basic recognition and is not resillient to page rotation, skew or low quality images uses 1-2 API calls; 'Normal' which provides highly fault tolerant OCR recognition uses 26-30 API calls; and 'Advanced' which provides the highest quality and most fault-tolerant recognition uses 28-30 API calls. Default recognition mode is 'Advanced'
|
420
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
421
|
+
# @return [Array<(ImageToTextResponse, Fixnum, Hash)>] ImageToTextResponse data, response status code and response headers
|
422
|
+
def image_ocr_photo_to_text_with_http_info(image_file, opts = {})
|
423
|
+
if @api_client.config.debugging
|
424
|
+
@api_client.config.logger.debug 'Calling API: ImageOcrApi.image_ocr_photo_to_text ...'
|
425
|
+
end
|
426
|
+
# verify the required parameter 'image_file' is set
|
427
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
428
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_photo_to_text"
|
429
|
+
end
|
430
|
+
# resource path
|
431
|
+
local_var_path = '/ocr/photo/toText'
|
432
|
+
|
433
|
+
# query parameters
|
434
|
+
query_params = {}
|
435
|
+
|
436
|
+
# header parameters
|
437
|
+
header_params = {}
|
438
|
+
# HTTP header 'Accept' (if needed)
|
439
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
440
|
+
# HTTP header 'Content-Type'
|
441
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
442
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
443
|
+
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
444
|
+
|
445
|
+
# form parameters
|
446
|
+
form_params = {}
|
447
|
+
form_params['imageFile'] = image_file
|
448
|
+
|
449
|
+
# http body (model)
|
450
|
+
post_body = nil
|
451
|
+
auth_names = ['Apikey']
|
452
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
453
|
+
:header_params => header_params,
|
454
|
+
:query_params => query_params,
|
455
|
+
:form_params => form_params,
|
456
|
+
:body => post_body,
|
457
|
+
:auth_names => auth_names,
|
458
|
+
:return_type => 'ImageToTextResponse')
|
459
|
+
if @api_client.config.debugging
|
460
|
+
@api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_photo_to_text\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
461
|
+
end
|
462
|
+
return data, status_code, headers
|
463
|
+
end
|
464
|
+
# Convert a photo of a document or receipt into words with location
|
465
|
+
# Converts a photo of a document or receipt in common formats such as JPEG, PNG into words/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on photographs of documents. If you want to OCR scanned documents (e.g. taken with a scanner), be sure to use the image/toText API instead, as it is designed for that use case.
|
466
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
467
|
+
# @param [Hash] opts the optional parameters
|
468
|
+
# @option opts [String] :recognition_mode Optional; possible values are 'Normal' which provides highly fault tolerant OCR recognition uses 26-30 API calls; and 'Advanced' which provides the highest quality and most fault-tolerant recognition uses 28-30 API calls. Default recognition mode is 'Advanced'
|
469
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
470
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image before OCR is applied; this is recommended).
|
471
|
+
# @option opts [String] :diagnostics Optional, diagnostics mode, default is 'false'. Possible values are 'true' (will set DiagnosticImage to a diagnostic PNG image in the result), and 'false' (no diagnostics are enabled; this is recommended for best performance).
|
472
|
+
# @return [PhotoToWordsWithLocationResult]
|
473
|
+
def image_ocr_photo_words_with_location(image_file, opts = {})
|
474
|
+
data, _status_code, _headers = image_ocr_photo_words_with_location_with_http_info(image_file, opts)
|
475
|
+
data
|
476
|
+
end
|
477
|
+
|
478
|
+
# Convert a photo of a document or receipt into words with location
|
479
|
+
# Converts a photo of a document or receipt in common formats such as JPEG, PNG into words/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on photographs of documents. If you want to OCR scanned documents (e.g. taken with a scanner), be sure to use the image/toText API instead, as it is designed for that use case.
|
480
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
481
|
+
# @param [Hash] opts the optional parameters
|
482
|
+
# @option opts [String] :recognition_mode Optional; possible values are 'Normal' which provides highly fault tolerant OCR recognition uses 26-30 API calls; and 'Advanced' which provides the highest quality and most fault-tolerant recognition uses 28-30 API calls. Default recognition mode is 'Advanced'
|
483
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
484
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image before OCR is applied; this is recommended).
|
485
|
+
# @option opts [String] :diagnostics Optional, diagnostics mode, default is 'false'. Possible values are 'true' (will set DiagnosticImage to a diagnostic PNG image in the result), and 'false' (no diagnostics are enabled; this is recommended for best performance).
|
486
|
+
# @return [Array<(PhotoToWordsWithLocationResult, Fixnum, Hash)>] PhotoToWordsWithLocationResult data, response status code and response headers
|
487
|
+
def image_ocr_photo_words_with_location_with_http_info(image_file, opts = {})
|
488
|
+
if @api_client.config.debugging
|
489
|
+
@api_client.config.logger.debug 'Calling API: ImageOcrApi.image_ocr_photo_words_with_location ...'
|
490
|
+
end
|
491
|
+
# verify the required parameter 'image_file' is set
|
492
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
493
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_photo_words_with_location"
|
494
|
+
end
|
495
|
+
# resource path
|
496
|
+
local_var_path = '/ocr/photo/to/words-with-location'
|
497
|
+
|
498
|
+
# query parameters
|
499
|
+
query_params = {}
|
500
|
+
|
501
|
+
# header parameters
|
502
|
+
header_params = {}
|
503
|
+
# HTTP header 'Accept' (if needed)
|
504
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
505
|
+
# HTTP header 'Content-Type'
|
506
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
507
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
508
|
+
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
509
|
+
header_params[:'preprocessing'] = opts[:'preprocessing'] if !opts[:'preprocessing'].nil?
|
510
|
+
header_params[:'diagnostics'] = opts[:'diagnostics'] if !opts[:'diagnostics'].nil?
|
511
|
+
|
512
|
+
# form parameters
|
513
|
+
form_params = {}
|
514
|
+
form_params['imageFile'] = image_file
|
515
|
+
|
516
|
+
# http body (model)
|
517
|
+
post_body = nil
|
518
|
+
auth_names = ['Apikey']
|
519
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
520
|
+
:header_params => header_params,
|
521
|
+
:query_params => query_params,
|
522
|
+
:form_params => form_params,
|
523
|
+
:body => post_body,
|
524
|
+
:auth_names => auth_names,
|
525
|
+
:return_type => 'PhotoToWordsWithLocationResult')
|
526
|
+
if @api_client.config.debugging
|
527
|
+
@api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_photo_words_with_location\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
528
|
+
end
|
529
|
+
return data, status_code, headers
|
530
|
+
end
|
531
|
+
# Convert a scanned image into text
|
532
|
+
# Converts an uploaded image in common formats such as JPEG, PNG into text via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
533
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
534
|
+
# @param [Hash] opts the optional parameters
|
535
|
+
# @option opts [String] :recognition_mode Optional; possible values are 'Basic' which provides basic recognition and is not resillient to page rotation, skew or low quality images uses 1-2 API calls; 'Normal' which provides highly fault tolerant OCR recognition uses 26-30 API calls; and 'Advanced' which provides the highest quality and most fault-tolerant recognition uses 28-30 API calls. Default recognition mode is 'Advanced'
|
536
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
537
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image before OCR is applied; this is recommended).
|
538
|
+
# @return [ImageToTextResponse]
|
539
|
+
def image_ocr_post(image_file, opts = {})
|
540
|
+
data, _status_code, _headers = image_ocr_post_with_http_info(image_file, opts)
|
541
|
+
data
|
542
|
+
end
|
543
|
+
|
544
|
+
# Convert a scanned image into text
|
545
|
+
# Converts an uploaded image in common formats such as JPEG, PNG into text via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
546
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
547
|
+
# @param [Hash] opts the optional parameters
|
548
|
+
# @option opts [String] :recognition_mode Optional; possible values are 'Basic' which provides basic recognition and is not resillient to page rotation, skew or low quality images uses 1-2 API calls; 'Normal' which provides highly fault tolerant OCR recognition uses 26-30 API calls; and 'Advanced' which provides the highest quality and most fault-tolerant recognition uses 28-30 API calls. Default recognition mode is 'Advanced'
|
549
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
550
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image before OCR is applied; this is recommended).
|
551
|
+
# @return [Array<(ImageToTextResponse, Fixnum, Hash)>] ImageToTextResponse data, response status code and response headers
|
552
|
+
def image_ocr_post_with_http_info(image_file, opts = {})
|
553
|
+
if @api_client.config.debugging
|
554
|
+
@api_client.config.logger.debug 'Calling API: ImageOcrApi.image_ocr_post ...'
|
555
|
+
end
|
556
|
+
# verify the required parameter 'image_file' is set
|
557
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
558
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_post"
|
559
|
+
end
|
560
|
+
# resource path
|
561
|
+
local_var_path = '/ocr/image/toText'
|
562
|
+
|
563
|
+
# query parameters
|
564
|
+
query_params = {}
|
565
|
+
|
566
|
+
# header parameters
|
567
|
+
header_params = {}
|
568
|
+
# HTTP header 'Accept' (if needed)
|
569
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
570
|
+
# HTTP header 'Content-Type'
|
571
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
572
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
573
|
+
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
574
|
+
header_params[:'preprocessing'] = opts[:'preprocessing'] if !opts[:'preprocessing'].nil?
|
575
|
+
|
576
|
+
# form parameters
|
577
|
+
form_params = {}
|
578
|
+
form_params['imageFile'] = image_file
|
579
|
+
|
580
|
+
# http body (model)
|
581
|
+
post_body = nil
|
582
|
+
auth_names = ['Apikey']
|
583
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
584
|
+
:header_params => header_params,
|
585
|
+
:query_params => query_params,
|
586
|
+
:form_params => form_params,
|
587
|
+
:body => post_body,
|
588
|
+
:auth_names => auth_names,
|
589
|
+
:return_type => 'ImageToTextResponse')
|
590
|
+
if @api_client.config.debugging
|
591
|
+
@api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
592
|
+
end
|
593
|
+
return data, status_code, headers
|
594
|
+
end
|
595
|
+
end
|
596
|
+
end
|