cloudmersive-ocr-api-client 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -5
- data/cloudmersive-ocr-api-client.gemspec +1 -1
- data/docs/ImageOcrApi.md +59 -0
- data/docs/OcrPhotoTextElement.md +13 -0
- data/docs/PdfOcrApi.md +3 -3
- data/docs/PhotoToWordsWithLocationResult.md +9 -0
- data/docs/PreprocessingApi.md +55 -0
- data/lib/cloudmersive-ocr-api-client.rb +3 -1
- data/lib/cloudmersive-ocr-api-client/api/image_ocr_api.rb +60 -1
- data/lib/cloudmersive-ocr-api-client/api/pdf_ocr_api.rb +3 -3
- data/lib/cloudmersive-ocr-api-client/api/preprocessing_api.rb +57 -1
- data/lib/cloudmersive-ocr-api-client/api_client.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/api_error.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/configuration.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/models/image_to_lines_with_location_result.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/models/image_to_text_response.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/models/image_to_words_with_location_result.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/models/ocr_line_element.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_lines_with_location.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_words_with_location.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/models/ocr_photo_text_element.rb +239 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_word_element.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_lines_with_location_result.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_text_response.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_words_with_location_result.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/models/photo_to_words_with_location_result.rb +200 -0
- data/lib/cloudmersive-ocr-api-client/version.rb +2 -2
- data/spec/api/image_ocr_api_spec.rb +14 -1
- data/spec/api/pdf_ocr_api_spec.rb +2 -2
- data/spec/api/preprocessing_api_spec.rb +13 -1
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/image_to_lines_with_location_result_spec.rb +1 -1
- data/spec/models/image_to_text_response_spec.rb +1 -1
- data/spec/models/image_to_words_with_location_result_spec.rb +1 -1
- data/spec/models/ocr_line_element_spec.rb +1 -1
- data/spec/models/ocr_page_result_spec.rb +1 -1
- data/spec/models/ocr_page_result_with_lines_with_location_spec.rb +1 -1
- data/spec/models/ocr_page_result_with_words_with_location_spec.rb +1 -1
- data/spec/models/ocr_photo_text_element_spec.rb +72 -0
- data/spec/models/ocr_word_element_spec.rb +1 -1
- data/spec/models/pdf_to_lines_with_location_result_spec.rb +1 -1
- data/spec/models/pdf_to_text_response_spec.rb +1 -1
- data/spec/models/pdf_to_words_with_location_result_spec.rb +1 -1
- data/spec/models/photo_to_words_with_location_result_spec.rb +48 -0
- data/spec/spec_helper.rb +1 -1
- metadata +21 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1fd554ab37fa2d1453463fa32b24f9d2b93744e20a68817f292e377d6df2819
|
4
|
+
data.tar.gz: 9c1fda51ead8a3462fa92c7fa8ed1190c88ddd5b3911d2e30fe7aa59847d8902
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b7f78e4e8a4bf7940ad34205f7445e9120bef653b4121e23866a6d42fead58d0efb0036593e2bc737f348dd5193196df4ee5642ac4b8cd1d05595a5fdae0aa4
|
7
|
+
data.tar.gz: 8a186d3095b7a56e23774a0dc87b2497869e6fc0040bb86709db2f73c374a657aca5ba40e93131ec253b843e089ea6b0d1ae597cfe1d5390834284551515a0f1
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ The powerful Optical Character Recognition (OCR) APIs let you convert scanned im
|
|
7
7
|
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
8
8
|
|
9
9
|
- API version: v1
|
10
|
-
- Package version: 1.3.
|
10
|
+
- Package version: 1.3.4
|
11
11
|
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
12
12
|
|
13
13
|
## Installation
|
@@ -23,15 +23,15 @@ gem build cloudmersive-ocr-api-client.gemspec
|
|
23
23
|
Then either install the gem locally:
|
24
24
|
|
25
25
|
```shell
|
26
|
-
gem install ./cloudmersive-ocr-api-client-1.3.
|
26
|
+
gem install ./cloudmersive-ocr-api-client-1.3.4.gem
|
27
27
|
```
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-ocr-api-client-1.3.
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-ocr-api-client-1.3.4.gem` to install the development dependencies)
|
29
29
|
|
30
30
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
31
31
|
|
32
32
|
Finally add this to the Gemfile:
|
33
33
|
|
34
|
-
gem 'cloudmersive-ocr-api-client', '~> 1.3.
|
34
|
+
gem 'cloudmersive-ocr-api-client', '~> 1.3.4'
|
35
35
|
|
36
36
|
### Install from Git
|
37
37
|
|
@@ -90,10 +90,12 @@ Class | Method | HTTP request | Description
|
|
90
90
|
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_image_lines_with_location**](docs/ImageOcrApi.md#image_ocr_image_lines_with_location) | **POST** /ocr/image/to/lines-with-location | Convert a scanned image into words with location
|
91
91
|
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_image_words_with_location**](docs/ImageOcrApi.md#image_ocr_image_words_with_location) | **POST** /ocr/image/to/words-with-location | Convert a scanned image into words with location
|
92
92
|
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_photo_to_text**](docs/ImageOcrApi.md#image_ocr_photo_to_text) | **POST** /ocr/photo/toText | Convert a photo of a document into text
|
93
|
+
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_photo_words_with_location**](docs/ImageOcrApi.md#image_ocr_photo_words_with_location) | **POST** /ocr/photo/to/words-with-location | Convert a photo of a document or receipt into words with location
|
93
94
|
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_post**](docs/ImageOcrApi.md#image_ocr_post) | **POST** /ocr/image/toText | Convert a scanned image into text
|
94
95
|
*CloudmersiveOcrApiClient::PdfOcrApi* | [**pdf_ocr_pdf_to_lines_with_location**](docs/PdfOcrApi.md#pdf_ocr_pdf_to_lines_with_location) | **POST** /ocr/pdf/to/lines-with-location | Convert a PDF into text lines with location
|
95
96
|
*CloudmersiveOcrApiClient::PdfOcrApi* | [**pdf_ocr_pdf_to_words_with_location**](docs/PdfOcrApi.md#pdf_ocr_pdf_to_words_with_location) | **POST** /ocr/pdf/to/words-with-location | Convert a PDF into words with location
|
96
|
-
*CloudmersiveOcrApiClient::PdfOcrApi* | [**pdf_ocr_post**](docs/PdfOcrApi.md#pdf_ocr_post) | **POST** /ocr/pdf/toText | Converts an uploaded PDF file
|
97
|
+
*CloudmersiveOcrApiClient::PdfOcrApi* | [**pdf_ocr_post**](docs/PdfOcrApi.md#pdf_ocr_post) | **POST** /ocr/pdf/toText | Converts an uploaded PDF file into text via Optical Character Recognition.
|
98
|
+
*CloudmersiveOcrApiClient::PreprocessingApi* | [**preprocessing_binarize**](docs/PreprocessingApi.md#preprocessing_binarize) | **POST** /ocr/preprocessing/image/binarize | Convert an image of text into a binary (light and dark) view
|
97
99
|
*CloudmersiveOcrApiClient::PreprocessingApi* | [**preprocessing_unrotate**](docs/PreprocessingApi.md#preprocessing_unrotate) | **POST** /ocr/preprocessing/image/unrotate | Detect and unrotate a document image
|
98
100
|
*CloudmersiveOcrApiClient::PreprocessingApi* | [**preprocessing_unskew**](docs/PreprocessingApi.md#preprocessing_unskew) | **POST** /ocr/preprocessing/image/unskew | Detect and unskew a photo of a document
|
99
101
|
|
@@ -107,10 +109,12 @@ Class | Method | HTTP request | Description
|
|
107
109
|
- [CloudmersiveOcrApiClient::OcrPageResult](docs/OcrPageResult.md)
|
108
110
|
- [CloudmersiveOcrApiClient::OcrPageResultWithLinesWithLocation](docs/OcrPageResultWithLinesWithLocation.md)
|
109
111
|
- [CloudmersiveOcrApiClient::OcrPageResultWithWordsWithLocation](docs/OcrPageResultWithWordsWithLocation.md)
|
112
|
+
- [CloudmersiveOcrApiClient::OcrPhotoTextElement](docs/OcrPhotoTextElement.md)
|
110
113
|
- [CloudmersiveOcrApiClient::OcrWordElement](docs/OcrWordElement.md)
|
111
114
|
- [CloudmersiveOcrApiClient::PdfToLinesWithLocationResult](docs/PdfToLinesWithLocationResult.md)
|
112
115
|
- [CloudmersiveOcrApiClient::PdfToTextResponse](docs/PdfToTextResponse.md)
|
113
116
|
- [CloudmersiveOcrApiClient::PdfToWordsWithLocationResult](docs/PdfToWordsWithLocationResult.md)
|
117
|
+
- [CloudmersiveOcrApiClient::PhotoToWordsWithLocationResult](docs/PhotoToWordsWithLocationResult.md)
|
114
118
|
|
115
119
|
|
116
120
|
## Documentation for Authorization
|
data/docs/ImageOcrApi.md
CHANGED
@@ -7,6 +7,7 @@ Method | HTTP request | Description
|
|
7
7
|
[**image_ocr_image_lines_with_location**](ImageOcrApi.md#image_ocr_image_lines_with_location) | **POST** /ocr/image/to/lines-with-location | Convert a scanned image into words with location
|
8
8
|
[**image_ocr_image_words_with_location**](ImageOcrApi.md#image_ocr_image_words_with_location) | **POST** /ocr/image/to/words-with-location | Convert a scanned image into words with location
|
9
9
|
[**image_ocr_photo_to_text**](ImageOcrApi.md#image_ocr_photo_to_text) | **POST** /ocr/photo/toText | Convert a photo of a document into text
|
10
|
+
[**image_ocr_photo_words_with_location**](ImageOcrApi.md#image_ocr_photo_words_with_location) | **POST** /ocr/photo/to/words-with-location | Convert a photo of a document or receipt into words with location
|
10
11
|
[**image_ocr_post**](ImageOcrApi.md#image_ocr_post) | **POST** /ocr/image/toText | Convert a scanned image into text
|
11
12
|
|
12
13
|
|
@@ -188,6 +189,64 @@ Name | Type | Description | Notes
|
|
188
189
|
|
189
190
|
|
190
191
|
|
192
|
+
# **image_ocr_photo_words_with_location**
|
193
|
+
> PhotoToWordsWithLocationResult image_ocr_photo_words_with_location(image_file, opts)
|
194
|
+
|
195
|
+
Convert a photo of a document or receipt into words with location
|
196
|
+
|
197
|
+
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.
|
198
|
+
|
199
|
+
### Example
|
200
|
+
```ruby
|
201
|
+
# load the gem
|
202
|
+
require 'cloudmersive-ocr-api-client'
|
203
|
+
# setup authorization
|
204
|
+
CloudmersiveOcrApiClient.configure do |config|
|
205
|
+
# Configure API key authorization: Apikey
|
206
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
207
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
208
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
209
|
+
end
|
210
|
+
|
211
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
212
|
+
|
213
|
+
image_file = File.new("/path/to/file.txt") # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
214
|
+
|
215
|
+
opts = {
|
216
|
+
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)
|
217
|
+
}
|
218
|
+
|
219
|
+
begin
|
220
|
+
#Convert a photo of a document or receipt into words with location
|
221
|
+
result = api_instance.image_ocr_photo_words_with_location(image_file, opts)
|
222
|
+
p result
|
223
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
224
|
+
puts "Exception when calling ImageOcrApi->image_ocr_photo_words_with_location: #{e}"
|
225
|
+
end
|
226
|
+
```
|
227
|
+
|
228
|
+
### Parameters
|
229
|
+
|
230
|
+
Name | Type | Description | Notes
|
231
|
+
------------- | ------------- | ------------- | -------------
|
232
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
233
|
+
**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]
|
234
|
+
|
235
|
+
### Return type
|
236
|
+
|
237
|
+
[**PhotoToWordsWithLocationResult**](PhotoToWordsWithLocationResult.md)
|
238
|
+
|
239
|
+
### Authorization
|
240
|
+
|
241
|
+
[Apikey](../README.md#Apikey)
|
242
|
+
|
243
|
+
### HTTP request headers
|
244
|
+
|
245
|
+
- **Content-Type**: multipart/form-data
|
246
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
247
|
+
|
248
|
+
|
249
|
+
|
191
250
|
# **image_ocr_post**
|
192
251
|
> ImageToTextResponse image_ocr_post(image_file, opts)
|
193
252
|
|
@@ -0,0 +1,13 @@
|
|
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
|
+
**confidence_level** | **Float** | Confidence level of the machine learning result; possible values are 0.0 (lowest accuracy) - 1.0 (highest accuracy) | [optional]
|
12
|
+
|
13
|
+
|
data/docs/PdfOcrApi.md
CHANGED
@@ -6,7 +6,7 @@ Method | HTTP request | Description
|
|
6
6
|
------------- | ------------- | -------------
|
7
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
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
|
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
10
|
|
11
11
|
|
12
12
|
# **pdf_ocr_pdf_to_lines_with_location**
|
@@ -132,7 +132,7 @@ Name | Type | Description | Notes
|
|
132
132
|
# **pdf_ocr_post**
|
133
133
|
> PdfToTextResponse pdf_ocr_post(image_file, opts)
|
134
134
|
|
135
|
-
Converts an uploaded PDF file
|
135
|
+
Converts an uploaded PDF file into text via Optical Character Recognition.
|
136
136
|
|
137
137
|
### Example
|
138
138
|
```ruby
|
@@ -156,7 +156,7 @@ opts = {
|
|
156
156
|
}
|
157
157
|
|
158
158
|
begin
|
159
|
-
#Converts an uploaded PDF file
|
159
|
+
#Converts an uploaded PDF file into text via Optical Character Recognition.
|
160
160
|
result = api_instance.pdf_ocr_post(image_file, opts)
|
161
161
|
p result
|
162
162
|
rescue CloudmersiveOcrApiClient::ApiError => e
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::PhotoToWordsWithLocationResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | | [optional]
|
7
|
+
**text_elements** | [**Array<OcrPhotoTextElement>**](OcrPhotoTextElement.md) | Word elements in the image | [optional]
|
8
|
+
|
9
|
+
|
data/docs/PreprocessingApi.md
CHANGED
@@ -4,10 +4,65 @@ All URIs are relative to *https://api.cloudmersive.com*
|
|
4
4
|
|
5
5
|
Method | HTTP request | Description
|
6
6
|
------------- | ------------- | -------------
|
7
|
+
[**preprocessing_binarize**](PreprocessingApi.md#preprocessing_binarize) | **POST** /ocr/preprocessing/image/binarize | Convert an image of text into a binary (light and dark) view
|
7
8
|
[**preprocessing_unrotate**](PreprocessingApi.md#preprocessing_unrotate) | **POST** /ocr/preprocessing/image/unrotate | Detect and unrotate a document image
|
8
9
|
[**preprocessing_unskew**](PreprocessingApi.md#preprocessing_unskew) | **POST** /ocr/preprocessing/image/unskew | Detect and unskew a photo of a document
|
9
10
|
|
10
11
|
|
12
|
+
# **preprocessing_binarize**
|
13
|
+
> Object preprocessing_binarize(image_file)
|
14
|
+
|
15
|
+
Convert an image of text into a binary (light and dark) view
|
16
|
+
|
17
|
+
Perform an advanced adaptive, machine learning-based binarization algorithm on the input image to prepare it for further OCR operations.
|
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::PreprocessingApi.new
|
32
|
+
|
33
|
+
image_file = File.new("/path/to/file.txt") # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
34
|
+
|
35
|
+
|
36
|
+
begin
|
37
|
+
#Convert an image of text into a binary (light and dark) view
|
38
|
+
result = api_instance.preprocessing_binarize(image_file)
|
39
|
+
p result
|
40
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
41
|
+
puts "Exception when calling PreprocessingApi->preprocessing_binarize: #{e}"
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
45
|
+
### Parameters
|
46
|
+
|
47
|
+
Name | Type | Description | Notes
|
48
|
+
------------- | ------------- | ------------- | -------------
|
49
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
50
|
+
|
51
|
+
### Return type
|
52
|
+
|
53
|
+
**Object**
|
54
|
+
|
55
|
+
### Authorization
|
56
|
+
|
57
|
+
[Apikey](../README.md#Apikey)
|
58
|
+
|
59
|
+
### HTTP request headers
|
60
|
+
|
61
|
+
- **Content-Type**: multipart/form-data
|
62
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
63
|
+
|
64
|
+
|
65
|
+
|
11
66
|
# **preprocessing_unrotate**
|
12
67
|
> Object preprocessing_unrotate(image_file)
|
13
68
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -24,10 +24,12 @@ require 'cloudmersive-ocr-api-client/models/ocr_line_element'
|
|
24
24
|
require 'cloudmersive-ocr-api-client/models/ocr_page_result'
|
25
25
|
require 'cloudmersive-ocr-api-client/models/ocr_page_result_with_lines_with_location'
|
26
26
|
require 'cloudmersive-ocr-api-client/models/ocr_page_result_with_words_with_location'
|
27
|
+
require 'cloudmersive-ocr-api-client/models/ocr_photo_text_element'
|
27
28
|
require 'cloudmersive-ocr-api-client/models/ocr_word_element'
|
28
29
|
require 'cloudmersive-ocr-api-client/models/pdf_to_lines_with_location_result'
|
29
30
|
require 'cloudmersive-ocr-api-client/models/pdf_to_text_response'
|
30
31
|
require 'cloudmersive-ocr-api-client/models/pdf_to_words_with_location_result'
|
32
|
+
require 'cloudmersive-ocr-api-client/models/photo_to_words_with_location_result'
|
31
33
|
|
32
34
|
# APIs
|
33
35
|
require 'cloudmersive-ocr-api-client/api/image_ocr_api'
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -203,6 +203,65 @@ module CloudmersiveOcrApiClient
|
|
203
203
|
return data, status_code, headers
|
204
204
|
end
|
205
205
|
|
206
|
+
# Convert a photo of a document or receipt into words with location
|
207
|
+
# 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.
|
208
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
209
|
+
# @param [Hash] opts the optional parameters
|
210
|
+
# @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)
|
211
|
+
# @return [PhotoToWordsWithLocationResult]
|
212
|
+
def image_ocr_photo_words_with_location(image_file, opts = {})
|
213
|
+
data, _status_code, _headers = image_ocr_photo_words_with_location_with_http_info(image_file, opts)
|
214
|
+
return data
|
215
|
+
end
|
216
|
+
|
217
|
+
# Convert a photo of a document or receipt into words with location
|
218
|
+
# 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.
|
219
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
220
|
+
# @param [Hash] opts the optional parameters
|
221
|
+
# @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)
|
222
|
+
# @return [Array<(PhotoToWordsWithLocationResult, Fixnum, Hash)>] PhotoToWordsWithLocationResult data, response status code and response headers
|
223
|
+
def image_ocr_photo_words_with_location_with_http_info(image_file, opts = {})
|
224
|
+
if @api_client.config.debugging
|
225
|
+
@api_client.config.logger.debug "Calling API: ImageOcrApi.image_ocr_photo_words_with_location ..."
|
226
|
+
end
|
227
|
+
# verify the required parameter 'image_file' is set
|
228
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
229
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_photo_words_with_location"
|
230
|
+
end
|
231
|
+
# resource path
|
232
|
+
local_var_path = "/ocr/photo/to/words-with-location"
|
233
|
+
|
234
|
+
# query parameters
|
235
|
+
query_params = {}
|
236
|
+
|
237
|
+
# header parameters
|
238
|
+
header_params = {}
|
239
|
+
# HTTP header 'Accept' (if needed)
|
240
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
241
|
+
# HTTP header 'Content-Type'
|
242
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
243
|
+
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
244
|
+
|
245
|
+
# form parameters
|
246
|
+
form_params = {}
|
247
|
+
form_params["imageFile"] = image_file
|
248
|
+
|
249
|
+
# http body (model)
|
250
|
+
post_body = nil
|
251
|
+
auth_names = ['Apikey']
|
252
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
253
|
+
:header_params => header_params,
|
254
|
+
:query_params => query_params,
|
255
|
+
:form_params => form_params,
|
256
|
+
:body => post_body,
|
257
|
+
:auth_names => auth_names,
|
258
|
+
:return_type => 'PhotoToWordsWithLocationResult')
|
259
|
+
if @api_client.config.debugging
|
260
|
+
@api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_photo_words_with_location\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
261
|
+
end
|
262
|
+
return data, status_code, headers
|
263
|
+
end
|
264
|
+
|
206
265
|
# Convert a scanned image into text
|
207
266
|
# 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.
|
208
267
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -144,7 +144,7 @@ module CloudmersiveOcrApiClient
|
|
144
144
|
return data, status_code, headers
|
145
145
|
end
|
146
146
|
|
147
|
-
# Converts an uploaded PDF file
|
147
|
+
# Converts an uploaded PDF file into text via Optical Character Recognition.
|
148
148
|
#
|
149
149
|
# @param image_file PDF file to perform OCR on.
|
150
150
|
# @param [Hash] opts the optional parameters
|
@@ -156,7 +156,7 @@ module CloudmersiveOcrApiClient
|
|
156
156
|
return data
|
157
157
|
end
|
158
158
|
|
159
|
-
# Converts an uploaded PDF file
|
159
|
+
# Converts an uploaded PDF file into text via Optical Character Recognition.
|
160
160
|
#
|
161
161
|
# @param image_file PDF file to perform OCR on.
|
162
162
|
# @param [Hash] opts the optional parameters
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -20,6 +20,62 @@ module CloudmersiveOcrApiClient
|
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
22
|
|
23
|
+
# Convert an image of text into a binary (light and dark) view
|
24
|
+
# Perform an advanced adaptive, machine learning-based binarization algorithm on the input image to prepare it for further OCR operations.
|
25
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @return [Object]
|
28
|
+
def preprocessing_binarize(image_file, opts = {})
|
29
|
+
data, _status_code, _headers = preprocessing_binarize_with_http_info(image_file, opts)
|
30
|
+
return data
|
31
|
+
end
|
32
|
+
|
33
|
+
# Convert an image of text into a binary (light and dark) view
|
34
|
+
# Perform an advanced adaptive, machine learning-based binarization algorithm on the input image to prepare it for further OCR operations.
|
35
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
36
|
+
# @param [Hash] opts the optional parameters
|
37
|
+
# @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
|
38
|
+
def preprocessing_binarize_with_http_info(image_file, opts = {})
|
39
|
+
if @api_client.config.debugging
|
40
|
+
@api_client.config.logger.debug "Calling API: PreprocessingApi.preprocessing_binarize ..."
|
41
|
+
end
|
42
|
+
# verify the required parameter 'image_file' is set
|
43
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
44
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling PreprocessingApi.preprocessing_binarize"
|
45
|
+
end
|
46
|
+
# resource path
|
47
|
+
local_var_path = "/ocr/preprocessing/image/binarize"
|
48
|
+
|
49
|
+
# query parameters
|
50
|
+
query_params = {}
|
51
|
+
|
52
|
+
# header parameters
|
53
|
+
header_params = {}
|
54
|
+
# HTTP header 'Accept' (if needed)
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
56
|
+
# HTTP header 'Content-Type'
|
57
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
58
|
+
|
59
|
+
# form parameters
|
60
|
+
form_params = {}
|
61
|
+
form_params["imageFile"] = image_file
|
62
|
+
|
63
|
+
# http body (model)
|
64
|
+
post_body = nil
|
65
|
+
auth_names = ['Apikey']
|
66
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
67
|
+
:header_params => header_params,
|
68
|
+
:query_params => query_params,
|
69
|
+
:form_params => form_params,
|
70
|
+
:body => post_body,
|
71
|
+
:auth_names => auth_names,
|
72
|
+
:return_type => 'Object')
|
73
|
+
if @api_client.config.debugging
|
74
|
+
@api_client.config.logger.debug "API called: PreprocessingApi#preprocessing_binarize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
75
|
+
end
|
76
|
+
return data, status_code, headers
|
77
|
+
end
|
78
|
+
|
23
79
|
# Detect and unrotate a document image
|
24
80
|
# 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.
|
25
81
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|