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,207 @@
|
|
1
|
+
=begin
|
2
|
+
#ocrapi
|
3
|
+
|
4
|
+
#The powerful Optical Character Recognition (OCR) APIs let you convert scanned images of pages into recognized text.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'uri'
|
14
|
+
|
15
|
+
module CloudmersiveOcrApiClient
|
16
|
+
class PdfOcrApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Convert a PDF into text lines with location
|
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.
|
24
|
+
# @param image_file PDF file to perform OCR on.
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
27
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image before OCR is applied; this is recommended).
|
28
|
+
# @return [PdfToLinesWithLocationResult]
|
29
|
+
def pdf_ocr_pdf_to_lines_with_location(image_file, opts = {})
|
30
|
+
data, _status_code, _headers = pdf_ocr_pdf_to_lines_with_location_with_http_info(image_file, opts)
|
31
|
+
data
|
32
|
+
end
|
33
|
+
|
34
|
+
# Convert a PDF into text lines with location
|
35
|
+
# 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.
|
36
|
+
# @param image_file PDF file to perform OCR on.
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
39
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image before OCR is applied; this is recommended).
|
40
|
+
# @return [Array<(PdfToLinesWithLocationResult, Fixnum, Hash)>] PdfToLinesWithLocationResult data, response status code and response headers
|
41
|
+
def pdf_ocr_pdf_to_lines_with_location_with_http_info(image_file, opts = {})
|
42
|
+
if @api_client.config.debugging
|
43
|
+
@api_client.config.logger.debug 'Calling API: PdfOcrApi.pdf_ocr_pdf_to_lines_with_location ...'
|
44
|
+
end
|
45
|
+
# verify the required parameter 'image_file' is set
|
46
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
47
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling PdfOcrApi.pdf_ocr_pdf_to_lines_with_location"
|
48
|
+
end
|
49
|
+
# resource path
|
50
|
+
local_var_path = '/ocr/pdf/to/lines-with-location'
|
51
|
+
|
52
|
+
# query parameters
|
53
|
+
query_params = {}
|
54
|
+
|
55
|
+
# header parameters
|
56
|
+
header_params = {}
|
57
|
+
# HTTP header 'Accept' (if needed)
|
58
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
59
|
+
# HTTP header 'Content-Type'
|
60
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
61
|
+
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
62
|
+
header_params[:'preprocessing'] = opts[:'preprocessing'] if !opts[:'preprocessing'].nil?
|
63
|
+
|
64
|
+
# form parameters
|
65
|
+
form_params = {}
|
66
|
+
form_params['imageFile'] = image_file
|
67
|
+
|
68
|
+
# http body (model)
|
69
|
+
post_body = nil
|
70
|
+
auth_names = ['Apikey']
|
71
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
72
|
+
:header_params => header_params,
|
73
|
+
:query_params => query_params,
|
74
|
+
:form_params => form_params,
|
75
|
+
:body => post_body,
|
76
|
+
:auth_names => auth_names,
|
77
|
+
:return_type => 'PdfToLinesWithLocationResult')
|
78
|
+
if @api_client.config.debugging
|
79
|
+
@api_client.config.logger.debug "API called: PdfOcrApi#pdf_ocr_pdf_to_lines_with_location\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
80
|
+
end
|
81
|
+
return data, status_code, headers
|
82
|
+
end
|
83
|
+
# Convert a PDF into words with location
|
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.
|
85
|
+
# @param image_file PDF file to perform OCR on.
|
86
|
+
# @param [Hash] opts the optional parameters
|
87
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
88
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image before OCR is applied; this is recommended).
|
89
|
+
# @return [PdfToWordsWithLocationResult]
|
90
|
+
def pdf_ocr_pdf_to_words_with_location(image_file, opts = {})
|
91
|
+
data, _status_code, _headers = pdf_ocr_pdf_to_words_with_location_with_http_info(image_file, opts)
|
92
|
+
data
|
93
|
+
end
|
94
|
+
|
95
|
+
# Convert a PDF into words with location
|
96
|
+
# 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.
|
97
|
+
# @param image_file PDF file to perform OCR on.
|
98
|
+
# @param [Hash] opts the optional parameters
|
99
|
+
# @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
100
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image before OCR is applied; this is recommended).
|
101
|
+
# @return [Array<(PdfToWordsWithLocationResult, Fixnum, Hash)>] PdfToWordsWithLocationResult data, response status code and response headers
|
102
|
+
def pdf_ocr_pdf_to_words_with_location_with_http_info(image_file, opts = {})
|
103
|
+
if @api_client.config.debugging
|
104
|
+
@api_client.config.logger.debug 'Calling API: PdfOcrApi.pdf_ocr_pdf_to_words_with_location ...'
|
105
|
+
end
|
106
|
+
# verify the required parameter 'image_file' is set
|
107
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
108
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling PdfOcrApi.pdf_ocr_pdf_to_words_with_location"
|
109
|
+
end
|
110
|
+
# resource path
|
111
|
+
local_var_path = '/ocr/pdf/to/words-with-location'
|
112
|
+
|
113
|
+
# query parameters
|
114
|
+
query_params = {}
|
115
|
+
|
116
|
+
# header parameters
|
117
|
+
header_params = {}
|
118
|
+
# HTTP header 'Accept' (if needed)
|
119
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
120
|
+
# HTTP header 'Content-Type'
|
121
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
122
|
+
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
123
|
+
header_params[:'preprocessing'] = opts[:'preprocessing'] if !opts[:'preprocessing'].nil?
|
124
|
+
|
125
|
+
# form parameters
|
126
|
+
form_params = {}
|
127
|
+
form_params['imageFile'] = image_file
|
128
|
+
|
129
|
+
# http body (model)
|
130
|
+
post_body = nil
|
131
|
+
auth_names = ['Apikey']
|
132
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
133
|
+
:header_params => header_params,
|
134
|
+
:query_params => query_params,
|
135
|
+
:form_params => form_params,
|
136
|
+
:body => post_body,
|
137
|
+
:auth_names => auth_names,
|
138
|
+
:return_type => 'PdfToWordsWithLocationResult')
|
139
|
+
if @api_client.config.debugging
|
140
|
+
@api_client.config.logger.debug "API called: PdfOcrApi#pdf_ocr_pdf_to_words_with_location\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
141
|
+
end
|
142
|
+
return data, status_code, headers
|
143
|
+
end
|
144
|
+
# Converts an uploaded PDF file into text via Optical Character Recognition.
|
145
|
+
# @param image_file PDF file to perform OCR on.
|
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'
|
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)
|
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).
|
150
|
+
# @return [PdfToTextResponse]
|
151
|
+
def pdf_ocr_post(image_file, opts = {})
|
152
|
+
data, _status_code, _headers = pdf_ocr_post_with_http_info(image_file, opts)
|
153
|
+
data
|
154
|
+
end
|
155
|
+
|
156
|
+
# Converts an uploaded PDF file into text via Optical Character Recognition.
|
157
|
+
# @param image_file PDF file to perform OCR on.
|
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'
|
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)
|
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).
|
162
|
+
# @return [Array<(PdfToTextResponse, Fixnum, Hash)>] PdfToTextResponse data, response status code and response headers
|
163
|
+
def pdf_ocr_post_with_http_info(image_file, opts = {})
|
164
|
+
if @api_client.config.debugging
|
165
|
+
@api_client.config.logger.debug 'Calling API: PdfOcrApi.pdf_ocr_post ...'
|
166
|
+
end
|
167
|
+
# verify the required parameter 'image_file' is set
|
168
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
169
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling PdfOcrApi.pdf_ocr_post"
|
170
|
+
end
|
171
|
+
# resource path
|
172
|
+
local_var_path = '/ocr/pdf/toText'
|
173
|
+
|
174
|
+
# query parameters
|
175
|
+
query_params = {}
|
176
|
+
|
177
|
+
# header parameters
|
178
|
+
header_params = {}
|
179
|
+
# HTTP header 'Accept' (if needed)
|
180
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
181
|
+
# HTTP header 'Content-Type'
|
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?
|
184
|
+
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
185
|
+
header_params[:'preprocessing'] = opts[:'preprocessing'] if !opts[:'preprocessing'].nil?
|
186
|
+
|
187
|
+
# form parameters
|
188
|
+
form_params = {}
|
189
|
+
form_params['imageFile'] = image_file
|
190
|
+
|
191
|
+
# http body (model)
|
192
|
+
post_body = nil
|
193
|
+
auth_names = ['Apikey']
|
194
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
195
|
+
:header_params => header_params,
|
196
|
+
:query_params => query_params,
|
197
|
+
:form_params => form_params,
|
198
|
+
:body => post_body,
|
199
|
+
:auth_names => auth_names,
|
200
|
+
:return_type => 'PdfToTextResponse')
|
201
|
+
if @api_client.config.debugging
|
202
|
+
@api_client.config.logger.debug "API called: PdfOcrApi#pdf_ocr_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
203
|
+
end
|
204
|
+
return data, status_code, headers
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
@@ -0,0 +1,353 @@
|
|
1
|
+
=begin
|
2
|
+
#ocrapi
|
3
|
+
|
4
|
+
#The powerful Optical Character Recognition (OCR) APIs let you convert scanned images of pages into recognized text.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'uri'
|
14
|
+
|
15
|
+
module CloudmersiveOcrApiClient
|
16
|
+
class PreprocessingApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Convert an image of text into a binarized (light and dark) view
|
23
|
+
# Perform an adaptive binarization algorithm on the input image to prepare it for further OCR operations.
|
24
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [String]
|
27
|
+
def preprocessing_binarize(image_file, opts = {})
|
28
|
+
data, _status_code, _headers = preprocessing_binarize_with_http_info(image_file, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Convert an image of text into a binarized (light and dark) view
|
33
|
+
# Perform an adaptive binarization algorithm on the input image to prepare it for further OCR operations.
|
34
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
37
|
+
def preprocessing_binarize_with_http_info(image_file, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: PreprocessingApi.preprocessing_binarize ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'image_file' is set
|
42
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling PreprocessingApi.preprocessing_binarize"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/ocr/preprocessing/image/binarize'
|
47
|
+
|
48
|
+
# query parameters
|
49
|
+
query_params = {}
|
50
|
+
|
51
|
+
# header parameters
|
52
|
+
header_params = {}
|
53
|
+
# HTTP header 'Accept' (if needed)
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
55
|
+
# HTTP header 'Content-Type'
|
56
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
57
|
+
|
58
|
+
# form parameters
|
59
|
+
form_params = {}
|
60
|
+
form_params['imageFile'] = image_file
|
61
|
+
|
62
|
+
# http body (model)
|
63
|
+
post_body = nil
|
64
|
+
auth_names = ['Apikey']
|
65
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
66
|
+
:header_params => header_params,
|
67
|
+
:query_params => query_params,
|
68
|
+
:form_params => form_params,
|
69
|
+
:body => post_body,
|
70
|
+
:auth_names => auth_names,
|
71
|
+
:return_type => 'String')
|
72
|
+
if @api_client.config.debugging
|
73
|
+
@api_client.config.logger.debug "API called: PreprocessingApi#preprocessing_binarize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
74
|
+
end
|
75
|
+
return data, status_code, headers
|
76
|
+
end
|
77
|
+
# Convert an image of text into a binary (light and dark) view with ML
|
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.
|
79
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
80
|
+
# @param [Hash] opts the optional parameters
|
81
|
+
# @return [String]
|
82
|
+
def preprocessing_binarize_advanced(image_file, opts = {})
|
83
|
+
data, _status_code, _headers = preprocessing_binarize_advanced_with_http_info(image_file, opts)
|
84
|
+
data
|
85
|
+
end
|
86
|
+
|
87
|
+
# Convert an image of text into a binary (light and dark) view with ML
|
88
|
+
# 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.
|
89
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
90
|
+
# @param [Hash] opts the optional parameters
|
91
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
92
|
+
def preprocessing_binarize_advanced_with_http_info(image_file, opts = {})
|
93
|
+
if @api_client.config.debugging
|
94
|
+
@api_client.config.logger.debug 'Calling API: PreprocessingApi.preprocessing_binarize_advanced ...'
|
95
|
+
end
|
96
|
+
# verify the required parameter 'image_file' is set
|
97
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
98
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling PreprocessingApi.preprocessing_binarize_advanced"
|
99
|
+
end
|
100
|
+
# resource path
|
101
|
+
local_var_path = '/ocr/preprocessing/image/binarize/advanced'
|
102
|
+
|
103
|
+
# query parameters
|
104
|
+
query_params = {}
|
105
|
+
|
106
|
+
# header parameters
|
107
|
+
header_params = {}
|
108
|
+
# HTTP header 'Accept' (if needed)
|
109
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
110
|
+
# HTTP header 'Content-Type'
|
111
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
112
|
+
|
113
|
+
# form parameters
|
114
|
+
form_params = {}
|
115
|
+
form_params['imageFile'] = image_file
|
116
|
+
|
117
|
+
# http body (model)
|
118
|
+
post_body = nil
|
119
|
+
auth_names = ['Apikey']
|
120
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
121
|
+
:header_params => header_params,
|
122
|
+
:query_params => query_params,
|
123
|
+
:form_params => form_params,
|
124
|
+
:body => post_body,
|
125
|
+
:auth_names => auth_names,
|
126
|
+
:return_type => 'String')
|
127
|
+
if @api_client.config.debugging
|
128
|
+
@api_client.config.logger.debug "API called: PreprocessingApi#preprocessing_binarize_advanced\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
129
|
+
end
|
130
|
+
return data, status_code, headers
|
131
|
+
end
|
132
|
+
# Get the angle of the page / document / receipt
|
133
|
+
# Analyzes a photo or image of a document and identifies the rotation angle of the page.
|
134
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
135
|
+
# @param [Hash] opts the optional parameters
|
136
|
+
# @return [GetPageAngleResult]
|
137
|
+
def preprocessing_get_page_angle(image_file, opts = {})
|
138
|
+
data, _status_code, _headers = preprocessing_get_page_angle_with_http_info(image_file, opts)
|
139
|
+
data
|
140
|
+
end
|
141
|
+
|
142
|
+
# Get the angle of the page / document / receipt
|
143
|
+
# Analyzes a photo or image of a document and identifies the rotation angle of the page.
|
144
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
145
|
+
# @param [Hash] opts the optional parameters
|
146
|
+
# @return [Array<(GetPageAngleResult, Fixnum, Hash)>] GetPageAngleResult data, response status code and response headers
|
147
|
+
def preprocessing_get_page_angle_with_http_info(image_file, opts = {})
|
148
|
+
if @api_client.config.debugging
|
149
|
+
@api_client.config.logger.debug 'Calling API: PreprocessingApi.preprocessing_get_page_angle ...'
|
150
|
+
end
|
151
|
+
# verify the required parameter 'image_file' is set
|
152
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
153
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling PreprocessingApi.preprocessing_get_page_angle"
|
154
|
+
end
|
155
|
+
# resource path
|
156
|
+
local_var_path = '/ocr/preprocessing/image/get-page-angle'
|
157
|
+
|
158
|
+
# query parameters
|
159
|
+
query_params = {}
|
160
|
+
|
161
|
+
# header parameters
|
162
|
+
header_params = {}
|
163
|
+
# HTTP header 'Accept' (if needed)
|
164
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
165
|
+
# HTTP header 'Content-Type'
|
166
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
167
|
+
|
168
|
+
# form parameters
|
169
|
+
form_params = {}
|
170
|
+
form_params['imageFile'] = image_file
|
171
|
+
|
172
|
+
# http body (model)
|
173
|
+
post_body = nil
|
174
|
+
auth_names = ['Apikey']
|
175
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
176
|
+
:header_params => header_params,
|
177
|
+
:query_params => query_params,
|
178
|
+
:form_params => form_params,
|
179
|
+
:body => post_body,
|
180
|
+
:auth_names => auth_names,
|
181
|
+
:return_type => 'GetPageAngleResult')
|
182
|
+
if @api_client.config.debugging
|
183
|
+
@api_client.config.logger.debug "API called: PreprocessingApi#preprocessing_get_page_angle\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
184
|
+
end
|
185
|
+
return data, status_code, headers
|
186
|
+
end
|
187
|
+
# Detect and unrotate a document image
|
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.
|
189
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
190
|
+
# @param [Hash] opts the optional parameters
|
191
|
+
# @return [String]
|
192
|
+
def preprocessing_unrotate(image_file, opts = {})
|
193
|
+
data, _status_code, _headers = preprocessing_unrotate_with_http_info(image_file, opts)
|
194
|
+
data
|
195
|
+
end
|
196
|
+
|
197
|
+
# Detect and unrotate a document image
|
198
|
+
# 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.
|
199
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
200
|
+
# @param [Hash] opts the optional parameters
|
201
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
202
|
+
def preprocessing_unrotate_with_http_info(image_file, opts = {})
|
203
|
+
if @api_client.config.debugging
|
204
|
+
@api_client.config.logger.debug 'Calling API: PreprocessingApi.preprocessing_unrotate ...'
|
205
|
+
end
|
206
|
+
# verify the required parameter 'image_file' is set
|
207
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
208
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling PreprocessingApi.preprocessing_unrotate"
|
209
|
+
end
|
210
|
+
# resource path
|
211
|
+
local_var_path = '/ocr/preprocessing/image/unrotate'
|
212
|
+
|
213
|
+
# query parameters
|
214
|
+
query_params = {}
|
215
|
+
|
216
|
+
# header parameters
|
217
|
+
header_params = {}
|
218
|
+
# HTTP header 'Accept' (if needed)
|
219
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
220
|
+
# HTTP header 'Content-Type'
|
221
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
222
|
+
|
223
|
+
# form parameters
|
224
|
+
form_params = {}
|
225
|
+
form_params['imageFile'] = image_file
|
226
|
+
|
227
|
+
# http body (model)
|
228
|
+
post_body = nil
|
229
|
+
auth_names = ['Apikey']
|
230
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
231
|
+
:header_params => header_params,
|
232
|
+
:query_params => query_params,
|
233
|
+
:form_params => form_params,
|
234
|
+
:body => post_body,
|
235
|
+
:auth_names => auth_names,
|
236
|
+
:return_type => 'String')
|
237
|
+
if @api_client.config.debugging
|
238
|
+
@api_client.config.logger.debug "API called: PreprocessingApi#preprocessing_unrotate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
239
|
+
end
|
240
|
+
return data, status_code, headers
|
241
|
+
end
|
242
|
+
# Detect and unrotate a document image (advanced)
|
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.
|
244
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
245
|
+
# @param [Hash] opts the optional parameters
|
246
|
+
# @return [String]
|
247
|
+
def preprocessing_unrotate_advanced(image_file, opts = {})
|
248
|
+
data, _status_code, _headers = preprocessing_unrotate_advanced_with_http_info(image_file, opts)
|
249
|
+
data
|
250
|
+
end
|
251
|
+
|
252
|
+
# Detect and unrotate a document image (advanced)
|
253
|
+
# 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.
|
254
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
255
|
+
# @param [Hash] opts the optional parameters
|
256
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
257
|
+
def preprocessing_unrotate_advanced_with_http_info(image_file, opts = {})
|
258
|
+
if @api_client.config.debugging
|
259
|
+
@api_client.config.logger.debug 'Calling API: PreprocessingApi.preprocessing_unrotate_advanced ...'
|
260
|
+
end
|
261
|
+
# verify the required parameter 'image_file' is set
|
262
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
263
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling PreprocessingApi.preprocessing_unrotate_advanced"
|
264
|
+
end
|
265
|
+
# resource path
|
266
|
+
local_var_path = '/ocr/preprocessing/image/unrotate/advanced'
|
267
|
+
|
268
|
+
# query parameters
|
269
|
+
query_params = {}
|
270
|
+
|
271
|
+
# header parameters
|
272
|
+
header_params = {}
|
273
|
+
# HTTP header 'Accept' (if needed)
|
274
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
275
|
+
# HTTP header 'Content-Type'
|
276
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
277
|
+
|
278
|
+
# form parameters
|
279
|
+
form_params = {}
|
280
|
+
form_params['imageFile'] = image_file
|
281
|
+
|
282
|
+
# http body (model)
|
283
|
+
post_body = nil
|
284
|
+
auth_names = ['Apikey']
|
285
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
286
|
+
:header_params => header_params,
|
287
|
+
:query_params => query_params,
|
288
|
+
:form_params => form_params,
|
289
|
+
:body => post_body,
|
290
|
+
:auth_names => auth_names,
|
291
|
+
:return_type => 'String')
|
292
|
+
if @api_client.config.debugging
|
293
|
+
@api_client.config.logger.debug "API called: PreprocessingApi#preprocessing_unrotate_advanced\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
294
|
+
end
|
295
|
+
return data, status_code, headers
|
296
|
+
end
|
297
|
+
# Detect and unskew a photo of a document
|
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.
|
299
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
300
|
+
# @param [Hash] opts the optional parameters
|
301
|
+
# @return [String]
|
302
|
+
def preprocessing_unskew(image_file, opts = {})
|
303
|
+
data, _status_code, _headers = preprocessing_unskew_with_http_info(image_file, opts)
|
304
|
+
data
|
305
|
+
end
|
306
|
+
|
307
|
+
# Detect and unskew a photo of a document
|
308
|
+
# 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.
|
309
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
310
|
+
# @param [Hash] opts the optional parameters
|
311
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
312
|
+
def preprocessing_unskew_with_http_info(image_file, opts = {})
|
313
|
+
if @api_client.config.debugging
|
314
|
+
@api_client.config.logger.debug 'Calling API: PreprocessingApi.preprocessing_unskew ...'
|
315
|
+
end
|
316
|
+
# verify the required parameter 'image_file' is set
|
317
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
318
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling PreprocessingApi.preprocessing_unskew"
|
319
|
+
end
|
320
|
+
# resource path
|
321
|
+
local_var_path = '/ocr/preprocessing/image/unskew'
|
322
|
+
|
323
|
+
# query parameters
|
324
|
+
query_params = {}
|
325
|
+
|
326
|
+
# header parameters
|
327
|
+
header_params = {}
|
328
|
+
# HTTP header 'Accept' (if needed)
|
329
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
330
|
+
# HTTP header 'Content-Type'
|
331
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
332
|
+
|
333
|
+
# form parameters
|
334
|
+
form_params = {}
|
335
|
+
form_params['imageFile'] = image_file
|
336
|
+
|
337
|
+
# http body (model)
|
338
|
+
post_body = nil
|
339
|
+
auth_names = ['Apikey']
|
340
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
341
|
+
:header_params => header_params,
|
342
|
+
:query_params => query_params,
|
343
|
+
:form_params => form_params,
|
344
|
+
:body => post_body,
|
345
|
+
:auth_names => auth_names,
|
346
|
+
:return_type => 'String')
|
347
|
+
if @api_client.config.debugging
|
348
|
+
@api_client.config.logger.debug "API called: PreprocessingApi#preprocessing_unskew\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
349
|
+
end
|
350
|
+
return data, status_code, headers
|
351
|
+
end
|
352
|
+
end
|
353
|
+
end
|