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::ImageToLinesWithLocationResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if successful, false otherwise | [optional]
|
7
|
+
**lines** | [**Array<OcrLineElement>**](OcrLineElement.md) | Words in the image | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::ImageToTextResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**mean_confidence_level** | **Float** | Confidence level rating of the OCR operation; ratings above 80% are strong. | [optional]
|
7
|
+
**text_result** | **String** | Converted text string from the image input. | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::ImageToWordsWithLocationResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if successful, false otherwise | [optional]
|
7
|
+
**words** | [**Array<OcrWordElement>**](OcrWordElement.md) | Word elements in the image | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::OcrLineElement
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**line_text** | **String** | Text of the line | [optional]
|
7
|
+
**words** | [**Array<OcrWordElement>**](OcrWordElement.md) | Word objects in the line | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::OcrPageResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**page_number** | **Integer** | Page number of the page that was OCR-ed, starting with 1 for the first page in the PDF file | [optional]
|
7
|
+
**mean_confidence_level** | **Float** | Confidence level rating of the OCR operation; ratings above 80% are strong. | [optional]
|
8
|
+
**text_result** | **String** | Converted text string from the image input. | [optional]
|
9
|
+
|
10
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::OcrPageResultWithLinesWithLocation
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**page_number** | **Integer** | Page number of the page that was OCR-ed, starting with 1 for the first page in the PDF file | [optional]
|
7
|
+
**successful** | **BOOLEAN** | True if successful, false otherwise | [optional]
|
8
|
+
**lines** | [**Array<OcrLineElement>**](OcrLineElement.md) | Word elements in the image | [optional]
|
9
|
+
|
10
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::OcrPageResultWithWordsWithLocation
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**page_number** | **Integer** | Page number of the page that was OCR-ed, starting with 1 for the first page in the PDF file | [optional]
|
7
|
+
**successful** | **BOOLEAN** | True if successful, false otherwise | [optional]
|
8
|
+
**words** | [**Array<OcrWordElement>**](OcrWordElement.md) | Word elements in the image | [optional]
|
9
|
+
|
10
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::OcrPhotoTextElement
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**text** | **String** | Text of the word | [optional]
|
7
|
+
**x_left** | **Integer** | X location of the left edge of the word in pixels | [optional]
|
8
|
+
**y_top** | **Integer** | Y location of the top edge of the word in pixels | [optional]
|
9
|
+
**width** | **Integer** | Width of the word in pixels | [optional]
|
10
|
+
**height** | **Integer** | Height of the word in pixels | [optional]
|
11
|
+
**bounding_points** | [**Array<Point>**](Point.md) | Points that form the bounding polygon around the text | [optional]
|
12
|
+
**confidence_level** | **Float** | Confidence level of the machine learning result; possible values are 0.0 (lowest accuracy) - 1.0 (highest accuracy) | [optional]
|
13
|
+
|
14
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::OcrWordElement
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**word_text** | **String** | Text of the word | [optional]
|
7
|
+
**line_number** | **Integer** | Line number of the word | [optional]
|
8
|
+
**word_number** | **Integer** | Index of the word in the line | [optional]
|
9
|
+
**x_left** | **Integer** | X location of the left edge of the word in pixels | [optional]
|
10
|
+
**y_top** | **Integer** | Y location of the top edge of the word in pixels | [optional]
|
11
|
+
**width** | **Integer** | Width of the word in pixels | [optional]
|
12
|
+
**height** | **Integer** | Height of the word in pixels | [optional]
|
13
|
+
**confidence_level** | **Float** | Confidence level of the machine learning result; possible values are 0.0 (lowest accuracy) - 1.0 (highest accuracy) | [optional]
|
14
|
+
**block_number** | **Integer** | Index of the containing block | [optional]
|
15
|
+
**paragraph_number** | **Integer** | Index of the containing paragraph | [optional]
|
16
|
+
**page_number** | **Integer** | Index of the containing page | [optional]
|
17
|
+
|
18
|
+
|
data/docs/PdfOcrApi.md
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::PdfOcrApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://api.cloudmersive.com*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**pdf_ocr_pdf_to_lines_with_location**](PdfOcrApi.md#pdf_ocr_pdf_to_lines_with_location) | **POST** /ocr/pdf/to/lines-with-location | Convert a PDF into text lines with location
|
8
|
+
[**pdf_ocr_pdf_to_words_with_location**](PdfOcrApi.md#pdf_ocr_pdf_to_words_with_location) | **POST** /ocr/pdf/to/words-with-location | Convert a PDF into words with location
|
9
|
+
[**pdf_ocr_post**](PdfOcrApi.md#pdf_ocr_post) | **POST** /ocr/pdf/toText | Converts an uploaded PDF file into text via Optical Character Recognition.
|
10
|
+
|
11
|
+
|
12
|
+
# **pdf_ocr_pdf_to_lines_with_location**
|
13
|
+
> PdfToLinesWithLocationResult pdf_ocr_pdf_to_lines_with_location(image_file, opts)
|
14
|
+
|
15
|
+
Convert a PDF into text lines with location
|
16
|
+
|
17
|
+
Converts a PDF 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.
|
18
|
+
|
19
|
+
### Example
|
20
|
+
```ruby
|
21
|
+
# load the gem
|
22
|
+
require 'cloudmersive-ocr-api-client'
|
23
|
+
# setup authorization
|
24
|
+
CloudmersiveOcrApiClient.configure do |config|
|
25
|
+
# Configure API key authorization: Apikey
|
26
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
27
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
28
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
29
|
+
end
|
30
|
+
|
31
|
+
api_instance = CloudmersiveOcrApiClient::PdfOcrApi.new
|
32
|
+
|
33
|
+
image_file = File.new('/path/to/file.txt') # File | PDF file to perform OCR on.
|
34
|
+
|
35
|
+
opts = {
|
36
|
+
language: 'language_example', # String | 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)
|
37
|
+
preprocessing: 'preprocessing_example' # String | 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).
|
38
|
+
}
|
39
|
+
|
40
|
+
begin
|
41
|
+
#Convert a PDF into text lines with location
|
42
|
+
result = api_instance.pdf_ocr_pdf_to_lines_with_location(image_file, opts)
|
43
|
+
p result
|
44
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
45
|
+
puts "Exception when calling PdfOcrApi->pdf_ocr_pdf_to_lines_with_location: #{e}"
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
49
|
+
### Parameters
|
50
|
+
|
51
|
+
Name | Type | Description | Notes
|
52
|
+
------------- | ------------- | ------------- | -------------
|
53
|
+
**image_file** | **File**| PDF file to perform OCR on. |
|
54
|
+
**language** | **String**| 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) | [optional]
|
55
|
+
**preprocessing** | **String**| 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). | [optional]
|
56
|
+
|
57
|
+
### Return type
|
58
|
+
|
59
|
+
[**PdfToLinesWithLocationResult**](PdfToLinesWithLocationResult.md)
|
60
|
+
|
61
|
+
### Authorization
|
62
|
+
|
63
|
+
[Apikey](../README.md#Apikey)
|
64
|
+
|
65
|
+
### HTTP request headers
|
66
|
+
|
67
|
+
- **Content-Type**: multipart/form-data
|
68
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
# **pdf_ocr_pdf_to_words_with_location**
|
73
|
+
> PdfToWordsWithLocationResult pdf_ocr_pdf_to_words_with_location(image_file, opts)
|
74
|
+
|
75
|
+
Convert a PDF into words with location
|
76
|
+
|
77
|
+
Converts a PDF 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.
|
78
|
+
|
79
|
+
### Example
|
80
|
+
```ruby
|
81
|
+
# load the gem
|
82
|
+
require 'cloudmersive-ocr-api-client'
|
83
|
+
# setup authorization
|
84
|
+
CloudmersiveOcrApiClient.configure do |config|
|
85
|
+
# Configure API key authorization: Apikey
|
86
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
87
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
88
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
89
|
+
end
|
90
|
+
|
91
|
+
api_instance = CloudmersiveOcrApiClient::PdfOcrApi.new
|
92
|
+
|
93
|
+
image_file = File.new('/path/to/file.txt') # File | PDF file to perform OCR on.
|
94
|
+
|
95
|
+
opts = {
|
96
|
+
language: 'language_example', # String | 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)
|
97
|
+
preprocessing: 'preprocessing_example' # String | 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).
|
98
|
+
}
|
99
|
+
|
100
|
+
begin
|
101
|
+
#Convert a PDF into words with location
|
102
|
+
result = api_instance.pdf_ocr_pdf_to_words_with_location(image_file, opts)
|
103
|
+
p result
|
104
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
105
|
+
puts "Exception when calling PdfOcrApi->pdf_ocr_pdf_to_words_with_location: #{e}"
|
106
|
+
end
|
107
|
+
```
|
108
|
+
|
109
|
+
### Parameters
|
110
|
+
|
111
|
+
Name | Type | Description | Notes
|
112
|
+
------------- | ------------- | ------------- | -------------
|
113
|
+
**image_file** | **File**| PDF file to perform OCR on. |
|
114
|
+
**language** | **String**| 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) | [optional]
|
115
|
+
**preprocessing** | **String**| 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). | [optional]
|
116
|
+
|
117
|
+
### Return type
|
118
|
+
|
119
|
+
[**PdfToWordsWithLocationResult**](PdfToWordsWithLocationResult.md)
|
120
|
+
|
121
|
+
### Authorization
|
122
|
+
|
123
|
+
[Apikey](../README.md#Apikey)
|
124
|
+
|
125
|
+
### HTTP request headers
|
126
|
+
|
127
|
+
- **Content-Type**: multipart/form-data
|
128
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
# **pdf_ocr_post**
|
133
|
+
> PdfToTextResponse pdf_ocr_post(image_file, opts)
|
134
|
+
|
135
|
+
Converts an uploaded PDF file into text via Optical Character Recognition.
|
136
|
+
|
137
|
+
### Example
|
138
|
+
```ruby
|
139
|
+
# load the gem
|
140
|
+
require 'cloudmersive-ocr-api-client'
|
141
|
+
# setup authorization
|
142
|
+
CloudmersiveOcrApiClient.configure do |config|
|
143
|
+
# Configure API key authorization: Apikey
|
144
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
145
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
146
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
147
|
+
end
|
148
|
+
|
149
|
+
api_instance = CloudmersiveOcrApiClient::PdfOcrApi.new
|
150
|
+
|
151
|
+
image_file = File.new('/path/to/file.txt') # File | PDF file to perform OCR on.
|
152
|
+
|
153
|
+
opts = {
|
154
|
+
recognition_mode: 'recognition_mode_example', # String | 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 per page; 'Normal' which provides highly fault tolerant OCR recognition uses 26-30 API calls per page; and 'Advanced' which provides the highest quality and most fault-tolerant recognition uses 28-30 API calls per page. Default recognition mode is 'Basic'
|
155
|
+
language: 'language_example', # String | 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)
|
156
|
+
preprocessing: 'preprocessing_example' # String | 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).
|
157
|
+
}
|
158
|
+
|
159
|
+
begin
|
160
|
+
#Converts an uploaded PDF file into text via Optical Character Recognition.
|
161
|
+
result = api_instance.pdf_ocr_post(image_file, opts)
|
162
|
+
p result
|
163
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
164
|
+
puts "Exception when calling PdfOcrApi->pdf_ocr_post: #{e}"
|
165
|
+
end
|
166
|
+
```
|
167
|
+
|
168
|
+
### Parameters
|
169
|
+
|
170
|
+
Name | Type | Description | Notes
|
171
|
+
------------- | ------------- | ------------- | -------------
|
172
|
+
**image_file** | **File**| PDF file to perform OCR on. |
|
173
|
+
**recognition_mode** | **String**| 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 per page; 'Normal' which provides highly fault tolerant OCR recognition uses 26-30 API calls per page; and 'Advanced' which provides the highest quality and most fault-tolerant recognition uses 28-30 API calls per page. Default recognition mode is 'Basic' | [optional]
|
174
|
+
**language** | **String**| 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) | [optional]
|
175
|
+
**preprocessing** | **String**| 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). | [optional]
|
176
|
+
|
177
|
+
### Return type
|
178
|
+
|
179
|
+
[**PdfToTextResponse**](PdfToTextResponse.md)
|
180
|
+
|
181
|
+
### Authorization
|
182
|
+
|
183
|
+
[Apikey](../README.md#Apikey)
|
184
|
+
|
185
|
+
### HTTP request headers
|
186
|
+
|
187
|
+
- **Content-Type**: multipart/form-data
|
188
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
189
|
+
|
190
|
+
|
191
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::PdfToLinesWithLocationResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if successful, false otherwise | [optional]
|
7
|
+
**ocr_pages** | [**Array<OcrPageResultWithLinesWithLocation>**](OcrPageResultWithLinesWithLocation.md) | OCR results for each page | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::PdfToTextResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if successful, false otherwise | [optional]
|
7
|
+
**ocr_pages** | [**Array<OcrPageResult>**](OcrPageResult.md) | Page OCR results | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::PdfToWordsWithLocationResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if successful, false otherwise | [optional]
|
7
|
+
**ocr_pages** | [**Array<OcrPageResultWithWordsWithLocation>**](OcrPageResultWithWordsWithLocation.md) | OCR page results | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::PhotoToWordsWithLocationResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if successful, false otherwise | [optional]
|
7
|
+
**text_elements** | [**Array<OcrPhotoTextElement>**](OcrPhotoTextElement.md) | Word elements in the image | [optional]
|
8
|
+
**diagnostic_image** | **String** | Typically null. To analyze OCR performance, enable diagnostic mode by adding the HTTP header \"DiagnosticMode\" with the value \"true\". When this is true, a diagnostic image showing the details of the OCR result will be set in PNG format into DiagnosticImage. | [optional]
|
9
|
+
|
10
|
+
|
data/docs/Point.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::Point
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**x** | **Integer** | X location in 2D in the image, where 0 represents the left edge of the image | [optional]
|
7
|
+
**y** | **Integer** | Y location in 2D in the image, where 0 represents the top edge of the image | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,338 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::PreprocessingApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://api.cloudmersive.com*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**preprocessing_binarize**](PreprocessingApi.md#preprocessing_binarize) | **POST** /ocr/preprocessing/image/binarize | Convert an image of text into a binarized (light and dark) view
|
8
|
+
[**preprocessing_binarize_advanced**](PreprocessingApi.md#preprocessing_binarize_advanced) | **POST** /ocr/preprocessing/image/binarize/advanced | Convert an image of text into a binary (light and dark) view with ML
|
9
|
+
[**preprocessing_get_page_angle**](PreprocessingApi.md#preprocessing_get_page_angle) | **POST** /ocr/preprocessing/image/get-page-angle | Get the angle of the page / document / receipt
|
10
|
+
[**preprocessing_unrotate**](PreprocessingApi.md#preprocessing_unrotate) | **POST** /ocr/preprocessing/image/unrotate | Detect and unrotate a document image
|
11
|
+
[**preprocessing_unrotate_advanced**](PreprocessingApi.md#preprocessing_unrotate_advanced) | **POST** /ocr/preprocessing/image/unrotate/advanced | Detect and unrotate a document image (advanced)
|
12
|
+
[**preprocessing_unskew**](PreprocessingApi.md#preprocessing_unskew) | **POST** /ocr/preprocessing/image/unskew | Detect and unskew a photo of a document
|
13
|
+
|
14
|
+
|
15
|
+
# **preprocessing_binarize**
|
16
|
+
> String preprocessing_binarize(image_file)
|
17
|
+
|
18
|
+
Convert an image of text into a binarized (light and dark) view
|
19
|
+
|
20
|
+
Perform an adaptive binarization algorithm on the input image to prepare it for further OCR operations.
|
21
|
+
|
22
|
+
### Example
|
23
|
+
```ruby
|
24
|
+
# load the gem
|
25
|
+
require 'cloudmersive-ocr-api-client'
|
26
|
+
# setup authorization
|
27
|
+
CloudmersiveOcrApiClient.configure do |config|
|
28
|
+
# Configure API key authorization: Apikey
|
29
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
30
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
31
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
32
|
+
end
|
33
|
+
|
34
|
+
api_instance = CloudmersiveOcrApiClient::PreprocessingApi.new
|
35
|
+
|
36
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
37
|
+
|
38
|
+
|
39
|
+
begin
|
40
|
+
#Convert an image of text into a binarized (light and dark) view
|
41
|
+
result = api_instance.preprocessing_binarize(image_file)
|
42
|
+
p result
|
43
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
44
|
+
puts "Exception when calling PreprocessingApi->preprocessing_binarize: #{e}"
|
45
|
+
end
|
46
|
+
```
|
47
|
+
|
48
|
+
### Parameters
|
49
|
+
|
50
|
+
Name | Type | Description | Notes
|
51
|
+
------------- | ------------- | ------------- | -------------
|
52
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
53
|
+
|
54
|
+
### Return type
|
55
|
+
|
56
|
+
**String**
|
57
|
+
|
58
|
+
### Authorization
|
59
|
+
|
60
|
+
[Apikey](../README.md#Apikey)
|
61
|
+
|
62
|
+
### HTTP request headers
|
63
|
+
|
64
|
+
- **Content-Type**: multipart/form-data
|
65
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
# **preprocessing_binarize_advanced**
|
70
|
+
> String preprocessing_binarize_advanced(image_file)
|
71
|
+
|
72
|
+
Convert an image of text into a binary (light and dark) view with ML
|
73
|
+
|
74
|
+
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.
|
75
|
+
|
76
|
+
### Example
|
77
|
+
```ruby
|
78
|
+
# load the gem
|
79
|
+
require 'cloudmersive-ocr-api-client'
|
80
|
+
# setup authorization
|
81
|
+
CloudmersiveOcrApiClient.configure do |config|
|
82
|
+
# Configure API key authorization: Apikey
|
83
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
84
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
85
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
86
|
+
end
|
87
|
+
|
88
|
+
api_instance = CloudmersiveOcrApiClient::PreprocessingApi.new
|
89
|
+
|
90
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
91
|
+
|
92
|
+
|
93
|
+
begin
|
94
|
+
#Convert an image of text into a binary (light and dark) view with ML
|
95
|
+
result = api_instance.preprocessing_binarize_advanced(image_file)
|
96
|
+
p result
|
97
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
98
|
+
puts "Exception when calling PreprocessingApi->preprocessing_binarize_advanced: #{e}"
|
99
|
+
end
|
100
|
+
```
|
101
|
+
|
102
|
+
### Parameters
|
103
|
+
|
104
|
+
Name | Type | Description | Notes
|
105
|
+
------------- | ------------- | ------------- | -------------
|
106
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
107
|
+
|
108
|
+
### Return type
|
109
|
+
|
110
|
+
**String**
|
111
|
+
|
112
|
+
### Authorization
|
113
|
+
|
114
|
+
[Apikey](../README.md#Apikey)
|
115
|
+
|
116
|
+
### HTTP request headers
|
117
|
+
|
118
|
+
- **Content-Type**: multipart/form-data
|
119
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
# **preprocessing_get_page_angle**
|
124
|
+
> GetPageAngleResult preprocessing_get_page_angle(image_file)
|
125
|
+
|
126
|
+
Get the angle of the page / document / receipt
|
127
|
+
|
128
|
+
Analyzes a photo or image of a document and identifies the rotation angle of the page.
|
129
|
+
|
130
|
+
### Example
|
131
|
+
```ruby
|
132
|
+
# load the gem
|
133
|
+
require 'cloudmersive-ocr-api-client'
|
134
|
+
# setup authorization
|
135
|
+
CloudmersiveOcrApiClient.configure do |config|
|
136
|
+
# Configure API key authorization: Apikey
|
137
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
138
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
139
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
140
|
+
end
|
141
|
+
|
142
|
+
api_instance = CloudmersiveOcrApiClient::PreprocessingApi.new
|
143
|
+
|
144
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
145
|
+
|
146
|
+
|
147
|
+
begin
|
148
|
+
#Get the angle of the page / document / receipt
|
149
|
+
result = api_instance.preprocessing_get_page_angle(image_file)
|
150
|
+
p result
|
151
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
152
|
+
puts "Exception when calling PreprocessingApi->preprocessing_get_page_angle: #{e}"
|
153
|
+
end
|
154
|
+
```
|
155
|
+
|
156
|
+
### Parameters
|
157
|
+
|
158
|
+
Name | Type | Description | Notes
|
159
|
+
------------- | ------------- | ------------- | -------------
|
160
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
161
|
+
|
162
|
+
### Return type
|
163
|
+
|
164
|
+
[**GetPageAngleResult**](GetPageAngleResult.md)
|
165
|
+
|
166
|
+
### Authorization
|
167
|
+
|
168
|
+
[Apikey](../README.md#Apikey)
|
169
|
+
|
170
|
+
### HTTP request headers
|
171
|
+
|
172
|
+
- **Content-Type**: multipart/form-data
|
173
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
# **preprocessing_unrotate**
|
178
|
+
> String preprocessing_unrotate(image_file)
|
179
|
+
|
180
|
+
Detect and unrotate a document image
|
181
|
+
|
182
|
+
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.
|
183
|
+
|
184
|
+
### Example
|
185
|
+
```ruby
|
186
|
+
# load the gem
|
187
|
+
require 'cloudmersive-ocr-api-client'
|
188
|
+
# setup authorization
|
189
|
+
CloudmersiveOcrApiClient.configure do |config|
|
190
|
+
# Configure API key authorization: Apikey
|
191
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
192
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
193
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
194
|
+
end
|
195
|
+
|
196
|
+
api_instance = CloudmersiveOcrApiClient::PreprocessingApi.new
|
197
|
+
|
198
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
199
|
+
|
200
|
+
|
201
|
+
begin
|
202
|
+
#Detect and unrotate a document image
|
203
|
+
result = api_instance.preprocessing_unrotate(image_file)
|
204
|
+
p result
|
205
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
206
|
+
puts "Exception when calling PreprocessingApi->preprocessing_unrotate: #{e}"
|
207
|
+
end
|
208
|
+
```
|
209
|
+
|
210
|
+
### Parameters
|
211
|
+
|
212
|
+
Name | Type | Description | Notes
|
213
|
+
------------- | ------------- | ------------- | -------------
|
214
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
215
|
+
|
216
|
+
### Return type
|
217
|
+
|
218
|
+
**String**
|
219
|
+
|
220
|
+
### Authorization
|
221
|
+
|
222
|
+
[Apikey](../README.md#Apikey)
|
223
|
+
|
224
|
+
### HTTP request headers
|
225
|
+
|
226
|
+
- **Content-Type**: multipart/form-data
|
227
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
# **preprocessing_unrotate_advanced**
|
232
|
+
> String preprocessing_unrotate_advanced(image_file)
|
233
|
+
|
234
|
+
Detect and unrotate a document image (advanced)
|
235
|
+
|
236
|
+
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.
|
237
|
+
|
238
|
+
### Example
|
239
|
+
```ruby
|
240
|
+
# load the gem
|
241
|
+
require 'cloudmersive-ocr-api-client'
|
242
|
+
# setup authorization
|
243
|
+
CloudmersiveOcrApiClient.configure do |config|
|
244
|
+
# Configure API key authorization: Apikey
|
245
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
246
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
247
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
248
|
+
end
|
249
|
+
|
250
|
+
api_instance = CloudmersiveOcrApiClient::PreprocessingApi.new
|
251
|
+
|
252
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
253
|
+
|
254
|
+
|
255
|
+
begin
|
256
|
+
#Detect and unrotate a document image (advanced)
|
257
|
+
result = api_instance.preprocessing_unrotate_advanced(image_file)
|
258
|
+
p result
|
259
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
260
|
+
puts "Exception when calling PreprocessingApi->preprocessing_unrotate_advanced: #{e}"
|
261
|
+
end
|
262
|
+
```
|
263
|
+
|
264
|
+
### Parameters
|
265
|
+
|
266
|
+
Name | Type | Description | Notes
|
267
|
+
------------- | ------------- | ------------- | -------------
|
268
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
269
|
+
|
270
|
+
### Return type
|
271
|
+
|
272
|
+
**String**
|
273
|
+
|
274
|
+
### Authorization
|
275
|
+
|
276
|
+
[Apikey](../README.md#Apikey)
|
277
|
+
|
278
|
+
### HTTP request headers
|
279
|
+
|
280
|
+
- **Content-Type**: multipart/form-data
|
281
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
# **preprocessing_unskew**
|
286
|
+
> String preprocessing_unskew(image_file)
|
287
|
+
|
288
|
+
Detect and unskew a photo of a document
|
289
|
+
|
290
|
+
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.
|
291
|
+
|
292
|
+
### Example
|
293
|
+
```ruby
|
294
|
+
# load the gem
|
295
|
+
require 'cloudmersive-ocr-api-client'
|
296
|
+
# setup authorization
|
297
|
+
CloudmersiveOcrApiClient.configure do |config|
|
298
|
+
# Configure API key authorization: Apikey
|
299
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
300
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
301
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
302
|
+
end
|
303
|
+
|
304
|
+
api_instance = CloudmersiveOcrApiClient::PreprocessingApi.new
|
305
|
+
|
306
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
307
|
+
|
308
|
+
|
309
|
+
begin
|
310
|
+
#Detect and unskew a photo of a document
|
311
|
+
result = api_instance.preprocessing_unskew(image_file)
|
312
|
+
p result
|
313
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
314
|
+
puts "Exception when calling PreprocessingApi->preprocessing_unskew: #{e}"
|
315
|
+
end
|
316
|
+
```
|
317
|
+
|
318
|
+
### Parameters
|
319
|
+
|
320
|
+
Name | Type | Description | Notes
|
321
|
+
------------- | ------------- | ------------- | -------------
|
322
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
323
|
+
|
324
|
+
### Return type
|
325
|
+
|
326
|
+
**String**
|
327
|
+
|
328
|
+
### Authorization
|
329
|
+
|
330
|
+
[Apikey](../README.md#Apikey)
|
331
|
+
|
332
|
+
### HTTP request headers
|
333
|
+
|
334
|
+
- **Content-Type**: multipart/form-data
|
335
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
336
|
+
|
337
|
+
|
338
|
+
|