cloudmersive-ocr-api-client 1.4.7 → 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 +1 -1
- data/README.md +7 -7
- data/cloudmersive-ocr-api-client.gemspec +3 -3
- data/docs/FormFieldDefinition.md +1 -0
- data/docs/ImageOcrApi.md +39 -33
- data/docs/PdfOcrApi.md +11 -9
- data/docs/PreprocessingApi.md +6 -6
- data/docs/ReceiptsApi.md +1 -1
- data/lib/cloudmersive-ocr-api-client.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/api/image_ocr_api.rb +49 -49
- data/lib/cloudmersive-ocr-api-client/api/pdf_ocr_api.rb +17 -19
- data/lib/cloudmersive-ocr-api-client/api/preprocessing_api.rb +26 -32
- data/lib/cloudmersive-ocr-api-client/api/receipts_api.rb +6 -7
- data/lib/cloudmersive-ocr-api-client/api_client.rb +11 -9
- data/lib/cloudmersive-ocr-api-client/api_error.rb +1 -1
- data/lib/cloudmersive-ocr-api-client/configuration.rb +2 -2
- data/lib/cloudmersive-ocr-api-client/models/business_card_recognition_result.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/field_result.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/form_definition_template.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/form_field_definition.rb +18 -11
- data/lib/cloudmersive-ocr-api-client/models/form_recognition_result.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/form_table_column_definition.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/form_table_definition.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/get_page_angle_result.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/image_to_lines_with_location_result.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/image_to_text_response.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/image_to_words_with_location_result.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/ocr_line_element.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result.rb +7 -11
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_lines_with_location.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_words_with_location.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/ocr_photo_text_element.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/ocr_word_element.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_lines_with_location_result.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_text_response.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_words_with_location_result.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/photo_to_words_with_location_result.rb +9 -13
- data/lib/cloudmersive-ocr-api-client/models/point.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/receipt_line_item.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/receipt_recognition_result.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/table_cell_result.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/table_result.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/models/table_row_result.rb +7 -10
- data/lib/cloudmersive-ocr-api-client/version.rb +2 -2
- data/spec/api/image_ocr_api_spec.rb +14 -11
- data/spec/api/pdf_ocr_api_spec.rb +5 -5
- data/spec/api/preprocessing_api_spec.rb +7 -7
- data/spec/api/receipts_api_spec.rb +2 -2
- data/spec/api_client_spec.rb +52 -35
- data/spec/configuration_spec.rb +9 -9
- data/spec/models/business_card_recognition_result_spec.rb +9 -10
- data/spec/models/field_result_spec.rb +3 -4
- data/spec/models/form_definition_template_spec.rb +3 -4
- data/spec/models/form_field_definition_spec.rb +24 -19
- data/spec/models/form_recognition_result_spec.rb +6 -7
- data/spec/models/form_table_column_definition_spec.rb +7 -8
- data/spec/models/form_table_definition_spec.rb +5 -6
- data/spec/models/get_page_angle_result_spec.rb +3 -4
- data/spec/models/image_to_lines_with_location_result_spec.rb +3 -4
- data/spec/models/image_to_text_response_spec.rb +3 -4
- data/spec/models/image_to_words_with_location_result_spec.rb +3 -4
- data/spec/models/ocr_line_element_spec.rb +3 -4
- data/spec/models/ocr_page_result_spec.rb +4 -5
- data/spec/models/ocr_page_result_with_lines_with_location_spec.rb +4 -5
- data/spec/models/ocr_page_result_with_words_with_location_spec.rb +4 -5
- data/spec/models/ocr_photo_text_element_spec.rb +8 -9
- data/spec/models/ocr_word_element_spec.rb +12 -13
- data/spec/models/pdf_to_lines_with_location_result_spec.rb +3 -4
- data/spec/models/pdf_to_text_response_spec.rb +3 -4
- data/spec/models/pdf_to_words_with_location_result_spec.rb +3 -4
- data/spec/models/photo_to_words_with_location_result_spec.rb +4 -5
- data/spec/models/point_spec.rb +3 -4
- data/spec/models/receipt_line_item_spec.rb +3 -4
- data/spec/models/receipt_recognition_result_spec.rb +10 -11
- data/spec/models/table_cell_result_spec.rb +3 -4
- data/spec/models/table_result_spec.rb +3 -4
- data/spec/models/table_row_result_spec.rb +2 -3
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
@@ -6,11 +6,11 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'uri'
|
14
14
|
|
15
15
|
module CloudmersiveOcrApiClient
|
16
16
|
class PdfOcrApi
|
@@ -19,7 +19,6 @@ module CloudmersiveOcrApiClient
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
|
23
22
|
# Convert a PDF into text lines with location
|
24
23
|
# 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.
|
25
24
|
# @param image_file PDF file to perform OCR on.
|
@@ -29,7 +28,7 @@ module CloudmersiveOcrApiClient
|
|
29
28
|
# @return [PdfToLinesWithLocationResult]
|
30
29
|
def pdf_ocr_pdf_to_lines_with_location(image_file, opts = {})
|
31
30
|
data, _status_code, _headers = pdf_ocr_pdf_to_lines_with_location_with_http_info(image_file, opts)
|
32
|
-
|
31
|
+
data
|
33
32
|
end
|
34
33
|
|
35
34
|
# Convert a PDF into text lines with location
|
@@ -41,14 +40,14 @@ module CloudmersiveOcrApiClient
|
|
41
40
|
# @return [Array<(PdfToLinesWithLocationResult, Fixnum, Hash)>] PdfToLinesWithLocationResult data, response status code and response headers
|
42
41
|
def pdf_ocr_pdf_to_lines_with_location_with_http_info(image_file, opts = {})
|
43
42
|
if @api_client.config.debugging
|
44
|
-
@api_client.config.logger.debug
|
43
|
+
@api_client.config.logger.debug 'Calling API: PdfOcrApi.pdf_ocr_pdf_to_lines_with_location ...'
|
45
44
|
end
|
46
45
|
# verify the required parameter 'image_file' is set
|
47
46
|
if @api_client.config.client_side_validation && image_file.nil?
|
48
47
|
fail ArgumentError, "Missing the required parameter 'image_file' when calling PdfOcrApi.pdf_ocr_pdf_to_lines_with_location"
|
49
48
|
end
|
50
49
|
# resource path
|
51
|
-
local_var_path =
|
50
|
+
local_var_path = '/ocr/pdf/to/lines-with-location'
|
52
51
|
|
53
52
|
# query parameters
|
54
53
|
query_params = {}
|
@@ -64,7 +63,7 @@ module CloudmersiveOcrApiClient
|
|
64
63
|
|
65
64
|
# form parameters
|
66
65
|
form_params = {}
|
67
|
-
form_params[
|
66
|
+
form_params['imageFile'] = image_file
|
68
67
|
|
69
68
|
# http body (model)
|
70
69
|
post_body = nil
|
@@ -81,7 +80,6 @@ module CloudmersiveOcrApiClient
|
|
81
80
|
end
|
82
81
|
return data, status_code, headers
|
83
82
|
end
|
84
|
-
|
85
83
|
# Convert a PDF into words with location
|
86
84
|
# 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.
|
87
85
|
# @param image_file PDF file to perform OCR on.
|
@@ -91,7 +89,7 @@ module CloudmersiveOcrApiClient
|
|
91
89
|
# @return [PdfToWordsWithLocationResult]
|
92
90
|
def pdf_ocr_pdf_to_words_with_location(image_file, opts = {})
|
93
91
|
data, _status_code, _headers = pdf_ocr_pdf_to_words_with_location_with_http_info(image_file, opts)
|
94
|
-
|
92
|
+
data
|
95
93
|
end
|
96
94
|
|
97
95
|
# Convert a PDF into words with location
|
@@ -103,14 +101,14 @@ module CloudmersiveOcrApiClient
|
|
103
101
|
# @return [Array<(PdfToWordsWithLocationResult, Fixnum, Hash)>] PdfToWordsWithLocationResult data, response status code and response headers
|
104
102
|
def pdf_ocr_pdf_to_words_with_location_with_http_info(image_file, opts = {})
|
105
103
|
if @api_client.config.debugging
|
106
|
-
@api_client.config.logger.debug
|
104
|
+
@api_client.config.logger.debug 'Calling API: PdfOcrApi.pdf_ocr_pdf_to_words_with_location ...'
|
107
105
|
end
|
108
106
|
# verify the required parameter 'image_file' is set
|
109
107
|
if @api_client.config.client_side_validation && image_file.nil?
|
110
108
|
fail ArgumentError, "Missing the required parameter 'image_file' when calling PdfOcrApi.pdf_ocr_pdf_to_words_with_location"
|
111
109
|
end
|
112
110
|
# resource path
|
113
|
-
local_var_path =
|
111
|
+
local_var_path = '/ocr/pdf/to/words-with-location'
|
114
112
|
|
115
113
|
# query parameters
|
116
114
|
query_params = {}
|
@@ -126,7 +124,7 @@ module CloudmersiveOcrApiClient
|
|
126
124
|
|
127
125
|
# form parameters
|
128
126
|
form_params = {}
|
129
|
-
form_params[
|
127
|
+
form_params['imageFile'] = image_file
|
130
128
|
|
131
129
|
# http body (model)
|
132
130
|
post_body = nil
|
@@ -143,36 +141,35 @@ module CloudmersiveOcrApiClient
|
|
143
141
|
end
|
144
142
|
return data, status_code, headers
|
145
143
|
end
|
146
|
-
|
147
144
|
# Converts an uploaded PDF file into text via Optical Character Recognition.
|
148
|
-
#
|
149
145
|
# @param image_file PDF file to perform OCR on.
|
150
146
|
# @param [Hash] opts the optional parameters
|
147
|
+
# @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 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'
|
151
148
|
# @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)
|
152
149
|
# @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).
|
153
150
|
# @return [PdfToTextResponse]
|
154
151
|
def pdf_ocr_post(image_file, opts = {})
|
155
152
|
data, _status_code, _headers = pdf_ocr_post_with_http_info(image_file, opts)
|
156
|
-
|
153
|
+
data
|
157
154
|
end
|
158
155
|
|
159
156
|
# Converts an uploaded PDF file into text via Optical Character Recognition.
|
160
|
-
#
|
161
157
|
# @param image_file PDF file to perform OCR on.
|
162
158
|
# @param [Hash] opts the optional parameters
|
159
|
+
# @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 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'
|
163
160
|
# @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)
|
164
161
|
# @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).
|
165
162
|
# @return [Array<(PdfToTextResponse, Fixnum, Hash)>] PdfToTextResponse data, response status code and response headers
|
166
163
|
def pdf_ocr_post_with_http_info(image_file, opts = {})
|
167
164
|
if @api_client.config.debugging
|
168
|
-
@api_client.config.logger.debug
|
165
|
+
@api_client.config.logger.debug 'Calling API: PdfOcrApi.pdf_ocr_post ...'
|
169
166
|
end
|
170
167
|
# verify the required parameter 'image_file' is set
|
171
168
|
if @api_client.config.client_side_validation && image_file.nil?
|
172
169
|
fail ArgumentError, "Missing the required parameter 'image_file' when calling PdfOcrApi.pdf_ocr_post"
|
173
170
|
end
|
174
171
|
# resource path
|
175
|
-
local_var_path =
|
172
|
+
local_var_path = '/ocr/pdf/toText'
|
176
173
|
|
177
174
|
# query parameters
|
178
175
|
query_params = {}
|
@@ -183,12 +180,13 @@ module CloudmersiveOcrApiClient
|
|
183
180
|
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
184
181
|
# HTTP header 'Content-Type'
|
185
182
|
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
183
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
186
184
|
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
187
185
|
header_params[:'preprocessing'] = opts[:'preprocessing'] if !opts[:'preprocessing'].nil?
|
188
186
|
|
189
187
|
# form parameters
|
190
188
|
form_params = {}
|
191
|
-
form_params[
|
189
|
+
form_params['imageFile'] = image_file
|
192
190
|
|
193
191
|
# http body (model)
|
194
192
|
post_body = nil
|
@@ -6,11 +6,11 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'uri'
|
14
14
|
|
15
15
|
module CloudmersiveOcrApiClient
|
16
16
|
class PreprocessingApi
|
@@ -19,7 +19,6 @@ module CloudmersiveOcrApiClient
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
|
23
22
|
# Convert an image of text into a binarized (light and dark) view
|
24
23
|
# Perform an adaptive binarization algorithm on the input image to prepare it for further OCR operations.
|
25
24
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
@@ -27,7 +26,7 @@ module CloudmersiveOcrApiClient
|
|
27
26
|
# @return [String]
|
28
27
|
def preprocessing_binarize(image_file, opts = {})
|
29
28
|
data, _status_code, _headers = preprocessing_binarize_with_http_info(image_file, opts)
|
30
|
-
|
29
|
+
data
|
31
30
|
end
|
32
31
|
|
33
32
|
# Convert an image of text into a binarized (light and dark) view
|
@@ -37,14 +36,14 @@ module CloudmersiveOcrApiClient
|
|
37
36
|
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
38
37
|
def preprocessing_binarize_with_http_info(image_file, opts = {})
|
39
38
|
if @api_client.config.debugging
|
40
|
-
@api_client.config.logger.debug
|
39
|
+
@api_client.config.logger.debug 'Calling API: PreprocessingApi.preprocessing_binarize ...'
|
41
40
|
end
|
42
41
|
# verify the required parameter 'image_file' is set
|
43
42
|
if @api_client.config.client_side_validation && image_file.nil?
|
44
43
|
fail ArgumentError, "Missing the required parameter 'image_file' when calling PreprocessingApi.preprocessing_binarize"
|
45
44
|
end
|
46
45
|
# resource path
|
47
|
-
local_var_path =
|
46
|
+
local_var_path = '/ocr/preprocessing/image/binarize'
|
48
47
|
|
49
48
|
# query parameters
|
50
49
|
query_params = {}
|
@@ -58,7 +57,7 @@ module CloudmersiveOcrApiClient
|
|
58
57
|
|
59
58
|
# form parameters
|
60
59
|
form_params = {}
|
61
|
-
form_params[
|
60
|
+
form_params['imageFile'] = image_file
|
62
61
|
|
63
62
|
# http body (model)
|
64
63
|
post_body = nil
|
@@ -75,7 +74,6 @@ module CloudmersiveOcrApiClient
|
|
75
74
|
end
|
76
75
|
return data, status_code, headers
|
77
76
|
end
|
78
|
-
|
79
77
|
# Convert an image of text into a binary (light and dark) view with ML
|
80
78
|
# 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.
|
81
79
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
@@ -83,7 +81,7 @@ module CloudmersiveOcrApiClient
|
|
83
81
|
# @return [String]
|
84
82
|
def preprocessing_binarize_advanced(image_file, opts = {})
|
85
83
|
data, _status_code, _headers = preprocessing_binarize_advanced_with_http_info(image_file, opts)
|
86
|
-
|
84
|
+
data
|
87
85
|
end
|
88
86
|
|
89
87
|
# Convert an image of text into a binary (light and dark) view with ML
|
@@ -93,14 +91,14 @@ module CloudmersiveOcrApiClient
|
|
93
91
|
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
94
92
|
def preprocessing_binarize_advanced_with_http_info(image_file, opts = {})
|
95
93
|
if @api_client.config.debugging
|
96
|
-
@api_client.config.logger.debug
|
94
|
+
@api_client.config.logger.debug 'Calling API: PreprocessingApi.preprocessing_binarize_advanced ...'
|
97
95
|
end
|
98
96
|
# verify the required parameter 'image_file' is set
|
99
97
|
if @api_client.config.client_side_validation && image_file.nil?
|
100
98
|
fail ArgumentError, "Missing the required parameter 'image_file' when calling PreprocessingApi.preprocessing_binarize_advanced"
|
101
99
|
end
|
102
100
|
# resource path
|
103
|
-
local_var_path =
|
101
|
+
local_var_path = '/ocr/preprocessing/image/binarize/advanced'
|
104
102
|
|
105
103
|
# query parameters
|
106
104
|
query_params = {}
|
@@ -114,7 +112,7 @@ module CloudmersiveOcrApiClient
|
|
114
112
|
|
115
113
|
# form parameters
|
116
114
|
form_params = {}
|
117
|
-
form_params[
|
115
|
+
form_params['imageFile'] = image_file
|
118
116
|
|
119
117
|
# http body (model)
|
120
118
|
post_body = nil
|
@@ -131,7 +129,6 @@ module CloudmersiveOcrApiClient
|
|
131
129
|
end
|
132
130
|
return data, status_code, headers
|
133
131
|
end
|
134
|
-
|
135
132
|
# Get the angle of the page / document / receipt
|
136
133
|
# Analyzes a photo or image of a document and identifies the rotation angle of the page.
|
137
134
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
@@ -139,7 +136,7 @@ module CloudmersiveOcrApiClient
|
|
139
136
|
# @return [GetPageAngleResult]
|
140
137
|
def preprocessing_get_page_angle(image_file, opts = {})
|
141
138
|
data, _status_code, _headers = preprocessing_get_page_angle_with_http_info(image_file, opts)
|
142
|
-
|
139
|
+
data
|
143
140
|
end
|
144
141
|
|
145
142
|
# Get the angle of the page / document / receipt
|
@@ -149,14 +146,14 @@ module CloudmersiveOcrApiClient
|
|
149
146
|
# @return [Array<(GetPageAngleResult, Fixnum, Hash)>] GetPageAngleResult data, response status code and response headers
|
150
147
|
def preprocessing_get_page_angle_with_http_info(image_file, opts = {})
|
151
148
|
if @api_client.config.debugging
|
152
|
-
@api_client.config.logger.debug
|
149
|
+
@api_client.config.logger.debug 'Calling API: PreprocessingApi.preprocessing_get_page_angle ...'
|
153
150
|
end
|
154
151
|
# verify the required parameter 'image_file' is set
|
155
152
|
if @api_client.config.client_side_validation && image_file.nil?
|
156
153
|
fail ArgumentError, "Missing the required parameter 'image_file' when calling PreprocessingApi.preprocessing_get_page_angle"
|
157
154
|
end
|
158
155
|
# resource path
|
159
|
-
local_var_path =
|
156
|
+
local_var_path = '/ocr/preprocessing/image/get-page-angle'
|
160
157
|
|
161
158
|
# query parameters
|
162
159
|
query_params = {}
|
@@ -170,7 +167,7 @@ module CloudmersiveOcrApiClient
|
|
170
167
|
|
171
168
|
# form parameters
|
172
169
|
form_params = {}
|
173
|
-
form_params[
|
170
|
+
form_params['imageFile'] = image_file
|
174
171
|
|
175
172
|
# http body (model)
|
176
173
|
post_body = nil
|
@@ -187,7 +184,6 @@ module CloudmersiveOcrApiClient
|
|
187
184
|
end
|
188
185
|
return data, status_code, headers
|
189
186
|
end
|
190
|
-
|
191
187
|
# Detect and unrotate a document image
|
192
188
|
# 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.
|
193
189
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
@@ -195,7 +191,7 @@ module CloudmersiveOcrApiClient
|
|
195
191
|
# @return [String]
|
196
192
|
def preprocessing_unrotate(image_file, opts = {})
|
197
193
|
data, _status_code, _headers = preprocessing_unrotate_with_http_info(image_file, opts)
|
198
|
-
|
194
|
+
data
|
199
195
|
end
|
200
196
|
|
201
197
|
# Detect and unrotate a document image
|
@@ -205,14 +201,14 @@ module CloudmersiveOcrApiClient
|
|
205
201
|
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
206
202
|
def preprocessing_unrotate_with_http_info(image_file, opts = {})
|
207
203
|
if @api_client.config.debugging
|
208
|
-
@api_client.config.logger.debug
|
204
|
+
@api_client.config.logger.debug 'Calling API: PreprocessingApi.preprocessing_unrotate ...'
|
209
205
|
end
|
210
206
|
# verify the required parameter 'image_file' is set
|
211
207
|
if @api_client.config.client_side_validation && image_file.nil?
|
212
208
|
fail ArgumentError, "Missing the required parameter 'image_file' when calling PreprocessingApi.preprocessing_unrotate"
|
213
209
|
end
|
214
210
|
# resource path
|
215
|
-
local_var_path =
|
211
|
+
local_var_path = '/ocr/preprocessing/image/unrotate'
|
216
212
|
|
217
213
|
# query parameters
|
218
214
|
query_params = {}
|
@@ -226,7 +222,7 @@ module CloudmersiveOcrApiClient
|
|
226
222
|
|
227
223
|
# form parameters
|
228
224
|
form_params = {}
|
229
|
-
form_params[
|
225
|
+
form_params['imageFile'] = image_file
|
230
226
|
|
231
227
|
# http body (model)
|
232
228
|
post_body = nil
|
@@ -243,7 +239,6 @@ module CloudmersiveOcrApiClient
|
|
243
239
|
end
|
244
240
|
return data, status_code, headers
|
245
241
|
end
|
246
|
-
|
247
242
|
# Detect and unrotate a document image (advanced)
|
248
243
|
# 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.
|
249
244
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
@@ -251,7 +246,7 @@ module CloudmersiveOcrApiClient
|
|
251
246
|
# @return [String]
|
252
247
|
def preprocessing_unrotate_advanced(image_file, opts = {})
|
253
248
|
data, _status_code, _headers = preprocessing_unrotate_advanced_with_http_info(image_file, opts)
|
254
|
-
|
249
|
+
data
|
255
250
|
end
|
256
251
|
|
257
252
|
# Detect and unrotate a document image (advanced)
|
@@ -261,14 +256,14 @@ module CloudmersiveOcrApiClient
|
|
261
256
|
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
262
257
|
def preprocessing_unrotate_advanced_with_http_info(image_file, opts = {})
|
263
258
|
if @api_client.config.debugging
|
264
|
-
@api_client.config.logger.debug
|
259
|
+
@api_client.config.logger.debug 'Calling API: PreprocessingApi.preprocessing_unrotate_advanced ...'
|
265
260
|
end
|
266
261
|
# verify the required parameter 'image_file' is set
|
267
262
|
if @api_client.config.client_side_validation && image_file.nil?
|
268
263
|
fail ArgumentError, "Missing the required parameter 'image_file' when calling PreprocessingApi.preprocessing_unrotate_advanced"
|
269
264
|
end
|
270
265
|
# resource path
|
271
|
-
local_var_path =
|
266
|
+
local_var_path = '/ocr/preprocessing/image/unrotate/advanced'
|
272
267
|
|
273
268
|
# query parameters
|
274
269
|
query_params = {}
|
@@ -282,7 +277,7 @@ module CloudmersiveOcrApiClient
|
|
282
277
|
|
283
278
|
# form parameters
|
284
279
|
form_params = {}
|
285
|
-
form_params[
|
280
|
+
form_params['imageFile'] = image_file
|
286
281
|
|
287
282
|
# http body (model)
|
288
283
|
post_body = nil
|
@@ -299,7 +294,6 @@ module CloudmersiveOcrApiClient
|
|
299
294
|
end
|
300
295
|
return data, status_code, headers
|
301
296
|
end
|
302
|
-
|
303
297
|
# Detect and unskew a photo of a document
|
304
298
|
# 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.
|
305
299
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
@@ -307,7 +301,7 @@ module CloudmersiveOcrApiClient
|
|
307
301
|
# @return [String]
|
308
302
|
def preprocessing_unskew(image_file, opts = {})
|
309
303
|
data, _status_code, _headers = preprocessing_unskew_with_http_info(image_file, opts)
|
310
|
-
|
304
|
+
data
|
311
305
|
end
|
312
306
|
|
313
307
|
# Detect and unskew a photo of a document
|
@@ -317,14 +311,14 @@ module CloudmersiveOcrApiClient
|
|
317
311
|
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
318
312
|
def preprocessing_unskew_with_http_info(image_file, opts = {})
|
319
313
|
if @api_client.config.debugging
|
320
|
-
@api_client.config.logger.debug
|
314
|
+
@api_client.config.logger.debug 'Calling API: PreprocessingApi.preprocessing_unskew ...'
|
321
315
|
end
|
322
316
|
# verify the required parameter 'image_file' is set
|
323
317
|
if @api_client.config.client_side_validation && image_file.nil?
|
324
318
|
fail ArgumentError, "Missing the required parameter 'image_file' when calling PreprocessingApi.preprocessing_unskew"
|
325
319
|
end
|
326
320
|
# resource path
|
327
|
-
local_var_path =
|
321
|
+
local_var_path = '/ocr/preprocessing/image/unskew'
|
328
322
|
|
329
323
|
# query parameters
|
330
324
|
query_params = {}
|
@@ -338,7 +332,7 @@ module CloudmersiveOcrApiClient
|
|
338
332
|
|
339
333
|
# form parameters
|
340
334
|
form_params = {}
|
341
|
-
form_params[
|
335
|
+
form_params['imageFile'] = image_file
|
342
336
|
|
343
337
|
# http body (model)
|
344
338
|
post_body = nil
|
@@ -6,11 +6,11 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'uri'
|
14
14
|
|
15
15
|
module CloudmersiveOcrApiClient
|
16
16
|
class ReceiptsApi
|
@@ -19,7 +19,6 @@ module CloudmersiveOcrApiClient
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
|
23
22
|
# Convert a photo of a receipt into a CSV file containing structured information from the receipt
|
24
23
|
# Leverage Deep Learning to automatically turn a photo of a receipt into a CSV file containing the structured information from the receipt.
|
25
24
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
@@ -27,7 +26,7 @@ module CloudmersiveOcrApiClient
|
|
27
26
|
# @return [Object]
|
28
27
|
def receipts_photo_to_csv(image_file, opts = {})
|
29
28
|
data, _status_code, _headers = receipts_photo_to_csv_with_http_info(image_file, opts)
|
30
|
-
|
29
|
+
data
|
31
30
|
end
|
32
31
|
|
33
32
|
# Convert a photo of a receipt into a CSV file containing structured information from the receipt
|
@@ -37,14 +36,14 @@ module CloudmersiveOcrApiClient
|
|
37
36
|
# @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
|
38
37
|
def receipts_photo_to_csv_with_http_info(image_file, opts = {})
|
39
38
|
if @api_client.config.debugging
|
40
|
-
@api_client.config.logger.debug
|
39
|
+
@api_client.config.logger.debug 'Calling API: ReceiptsApi.receipts_photo_to_csv ...'
|
41
40
|
end
|
42
41
|
# verify the required parameter 'image_file' is set
|
43
42
|
if @api_client.config.client_side_validation && image_file.nil?
|
44
43
|
fail ArgumentError, "Missing the required parameter 'image_file' when calling ReceiptsApi.receipts_photo_to_csv"
|
45
44
|
end
|
46
45
|
# resource path
|
47
|
-
local_var_path =
|
46
|
+
local_var_path = '/ocr/receipts/photo/to/csv'
|
48
47
|
|
49
48
|
# query parameters
|
50
49
|
query_params = {}
|
@@ -58,7 +57,7 @@ module CloudmersiveOcrApiClient
|
|
58
57
|
|
59
58
|
# form parameters
|
60
59
|
form_params = {}
|
61
|
-
form_params[
|
60
|
+
form_params['imageFile'] = image_file
|
62
61
|
|
63
62
|
# http body (model)
|
64
63
|
post_body = nil
|