Class: CloudmersiveImageRecognitionApiClient::RecognizeApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ RecognizeApi

Returns a new instance of RecognizeApi.



19
20
21
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#recognize_describe(image_file, opts = {}) ⇒ ImageDescriptionResponse

Describe an image in natural language Generate an English language text description of the image as a sentence.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 27

def recognize_describe(image_file, opts = {})
  data, _status_code, _headers = recognize_describe_with_http_info(image_file, opts)
  data
end

#recognize_describe_with_http_info(image_file, opts = {}) ⇒ Array<(ImageDescriptionResponse, Fixnum, Hash)>

Describe an image in natural language Generate an English language text description of the image as a sentence.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ImageDescriptionResponse, Fixnum, Hash)>)

    ImageDescriptionResponse data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 37

def recognize_describe_with_http_info(image_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_describe ...'
  end
  # verify the required parameter 'image_file' is set
  if @api_client.config.client_side_validation && image_file.nil?
    fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_describe"
  end
  # resource path
  local_var_path = '/image/recognize/describe'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['imageFile'] = image_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ImageDescriptionResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecognizeApi#recognize_describe\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recognize_detect_and_unskew_document(image_file, opts = {}) ⇒ String

Detect and unskew a photo of a document 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.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :post_processing_effect (String)

    Optional, post-processing effects to apply to the email, default is None. Possible values are None and BlackAndWhite (force the image into a black and white view to aid in OCR operations).

Returns:

  • (String)


83
84
85
86
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 83

def recognize_detect_and_unskew_document(image_file, opts = {})
  data, _status_code, _headers = recognize_detect_and_unskew_document_with_http_info(image_file, opts)
  data
end

#recognize_detect_and_unskew_document_with_http_info(image_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Detect and unskew a photo of a document 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.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :post_processing_effect (String)

    Optional, post-processing effects to apply to the email, default is None. Possible values are None and BlackAndWhite (force the image into a black and white view to aid in OCR operations).

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 94

def recognize_detect_and_unskew_document_with_http_info(image_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_detect_and_unskew_document ...'
  end
  # verify the required parameter 'image_file' is set
  if @api_client.config.client_side_validation && image_file.nil?
    fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_detect_and_unskew_document"
  end
  # resource path
  local_var_path = '/image/recognize/detect-document/unskew'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
  header_params[:'PostProcessingEffect'] = opts[:'post_processing_effect'] if !opts[:'post_processing_effect'].nil?

  # form parameters
  form_params = {}
  form_params['imageFile'] = image_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecognizeApi#recognize_detect_and_unskew_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recognize_detect_objects(image_file, opts = {}) ⇒ ObjectDetectionResult

Detect objects including types and locations in an image Identify the position, size and description of objects in an image, along with a recognition confidence level. Detects both human people and objects in an image.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



140
141
142
143
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 140

def recognize_detect_objects(image_file, opts = {})
  data, _status_code, _headers = recognize_detect_objects_with_http_info(image_file, opts)
  data
end

#recognize_detect_objects_with_http_info(image_file, opts = {}) ⇒ Array<(ObjectDetectionResult, Fixnum, Hash)>

Detect objects including types and locations in an image Identify the position, size and description of objects in an image, along with a recognition confidence level. Detects both human people and objects in an image.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ObjectDetectionResult, Fixnum, Hash)>)

    ObjectDetectionResult data, response status code and response headers



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 150

def recognize_detect_objects_with_http_info(image_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_detect_objects ...'
  end
  # verify the required parameter 'image_file' is set
  if @api_client.config.client_side_validation && image_file.nil?
    fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_detect_objects"
  end
  # resource path
  local_var_path = '/image/recognize/detect-objects'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['imageFile'] = image_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ObjectDetectionResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecognizeApi#recognize_detect_objects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recognize_detect_people(image_file, opts = {}) ⇒ ObjectDetectionResult

Detect people including locations in an image Identify the position, and size of human people in an image, along with a recognition confidence level. People in the image do NOT need to be facing the camera; they can be facing away, edge-on, etc.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



195
196
197
198
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 195

def recognize_detect_people(image_file, opts = {})
  data, _status_code, _headers = recognize_detect_people_with_http_info(image_file, opts)
  data
end

#recognize_detect_people_with_http_info(image_file, opts = {}) ⇒ Array<(ObjectDetectionResult, Fixnum, Hash)>

Detect people including locations in an image Identify the position, and size of human people in an image, along with a recognition confidence level. People in the image do NOT need to be facing the camera; they can be facing away, edge-on, etc.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ObjectDetectionResult, Fixnum, Hash)>)

    ObjectDetectionResult data, response status code and response headers



205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 205

def recognize_detect_people_with_http_info(image_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_detect_people ...'
  end
  # verify the required parameter 'image_file' is set
  if @api_client.config.client_side_validation && image_file.nil?
    fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_detect_people"
  end
  # resource path
  local_var_path = '/image/recognize/detect-people'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['imageFile'] = image_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ObjectDetectionResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecognizeApi#recognize_detect_people\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recognize_detect_text_fine(image_file, opts = {}) ⇒ FineTextDetectionResult

Detect fine text in a photo of a document Identify the position, and size of small/fine text within a photograph of a document. Identify the location of small text in a photo - such as words and other forms of high density text. Can be used on a scan of a document or a photograph (e.g. smartphone camera) of a document, page or receipt. For OCR purposes - please see our Deep Learning OCR APIs.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



250
251
252
253
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 250

def recognize_detect_text_fine(image_file, opts = {})
  data, _status_code, _headers = recognize_detect_text_fine_with_http_info(image_file, opts)
  data
end

#recognize_detect_text_fine_with_http_info(image_file, opts = {}) ⇒ Array<(FineTextDetectionResult, Fixnum, Hash)>

Detect fine text in a photo of a document Identify the position, and size of small/fine text within a photograph of a document. Identify the location of small text in a photo - such as words and other forms of high density text. Can be used on a scan of a document or a photograph (e.g. smartphone camera) of a document, page or receipt. For OCR purposes - please see our Deep Learning OCR APIs.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FineTextDetectionResult, Fixnum, Hash)>)

    FineTextDetectionResult data, response status code and response headers



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 260

def recognize_detect_text_fine_with_http_info(image_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_detect_text_fine ...'
  end
  # verify the required parameter 'image_file' is set
  if @api_client.config.client_side_validation && image_file.nil?
    fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_detect_text_fine"
  end
  # resource path
  local_var_path = '/image/recognize/detect-text/fine'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['imageFile'] = image_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'FineTextDetectionResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecognizeApi#recognize_detect_text_fine\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recognize_detect_text_large(image_file, opts = {}) ⇒ TextDetectionResult

Detect large text in a photo Identify the position, and size of large text within a photograph. Identify the location of large text in a photo - such as signs, titles, etc. and other forms of large, low-density text. Not suitable for high-density text (e.g. scans of documents, receipts, etc.) for OCR purposes - for OCR, please see our Deep Learning OCR APIs.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



305
306
307
308
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 305

def recognize_detect_text_large(image_file, opts = {})
  data, _status_code, _headers = recognize_detect_text_large_with_http_info(image_file, opts)
  data
end

#recognize_detect_text_large_with_http_info(image_file, opts = {}) ⇒ Array<(TextDetectionResult, Fixnum, Hash)>

Detect large text in a photo Identify the position, and size of large text within a photograph. Identify the location of large text in a photo - such as signs, titles, etc. and other forms of large, low-density text. Not suitable for high-density text (e.g. scans of documents, receipts, etc.) for OCR purposes - for OCR, please see our Deep Learning OCR APIs.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(TextDetectionResult, Fixnum, Hash)>)

    TextDetectionResult data, response status code and response headers



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 315

def recognize_detect_text_large_with_http_info(image_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_detect_text_large ...'
  end
  # verify the required parameter 'image_file' is set
  if @api_client.config.client_side_validation && image_file.nil?
    fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_detect_text_large"
  end
  # resource path
  local_var_path = '/image/recognize/detect-text/large'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['imageFile'] = image_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'TextDetectionResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecognizeApi#recognize_detect_text_large\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recognize_detect_vehicle_license_plates(image_file, opts = {}) ⇒ VehicleLicensePlateDetectionResult

Detect vehicle license plates in an image Identify the position, and size, and content of vehicle license plates in an image. License plates should be within 15-20 degrees on-axis to the camera. Supported image formats are JPG, PNG and BMP.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



360
361
362
363
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 360

def recognize_detect_vehicle_license_plates(image_file, opts = {})
  data, _status_code, _headers = recognize_detect_vehicle_license_plates_with_http_info(image_file, opts)
  data
end

#recognize_detect_vehicle_license_plates_with_http_info(image_file, opts = {}) ⇒ Array<(VehicleLicensePlateDetectionResult, Fixnum, Hash)>

Detect vehicle license plates in an image Identify the position, and size, and content of vehicle license plates in an image. License plates should be within 15-20 degrees on-axis to the camera. Supported image formats are JPG, PNG and BMP.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 370

def recognize_detect_vehicle_license_plates_with_http_info(image_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_detect_vehicle_license_plates ...'
  end
  # verify the required parameter 'image_file' is set
  if @api_client.config.client_side_validation && image_file.nil?
    fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_detect_vehicle_license_plates"
  end
  # resource path
  local_var_path = '/image/recognize/detect-vehicle-license-plates'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['imageFile'] = image_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'VehicleLicensePlateDetectionResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecognizeApi#recognize_detect_vehicle_license_plates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recognize_find_symbol(input_image, target_image, opts = {}) ⇒ FindSymbolResult

Find the location of a symbol in an image Determine if an image contains a symbol, and if so, the location of that symbol in the image.

Parameters:

  • input_image

    Image file to search through for the target image.

  • target_image

    Image to find in the input image.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



416
417
418
419
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 416

def recognize_find_symbol(input_image, target_image, opts = {})
  data, _status_code, _headers = recognize_find_symbol_with_http_info(input_image, target_image, opts)
  data
end

#recognize_find_symbol_with_http_info(input_image, target_image, opts = {}) ⇒ Array<(FindSymbolResult, Fixnum, Hash)>

Find the location of a symbol in an image Determine if an image contains a symbol, and if so, the location of that symbol in the image.

Parameters:

  • input_image

    Image file to search through for the target image.

  • target_image

    Image to find in the input image.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FindSymbolResult, Fixnum, Hash)>)

    FindSymbolResult data, response status code and response headers



427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 427

def recognize_find_symbol_with_http_info(input_image, target_image, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_find_symbol ...'
  end
  # verify the required parameter 'input_image' is set
  if @api_client.config.client_side_validation && input_image.nil?
    fail ArgumentError, "Missing the required parameter 'input_image' when calling RecognizeApi.recognize_find_symbol"
  end
  # verify the required parameter 'target_image' is set
  if @api_client.config.client_side_validation && target_image.nil?
    fail ArgumentError, "Missing the required parameter 'target_image' when calling RecognizeApi.recognize_find_symbol"
  end
  # resource path
  local_var_path = '/image/recognize/find/symbol'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['inputImage'] = input_image
  form_params['targetImage'] = target_image

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'FindSymbolResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecognizeApi#recognize_find_symbol\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recognize_similarity_compare(base_image, comparison_image, opts = {}) ⇒ String

Compare two images for similarity Generates an image similarity score using Deep Learning between 0.0 and 1.0, values closer to 1.0 indicate greater similarity

Parameters:

  • base_image

    Image file to compare against. Common file formats such as PNG, JPEG are supported.

  • comparison_image

    Image to compare to the base image.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :recognition_mode (String)

    Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal.

Returns:

  • (String)


479
480
481
482
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 479

def recognize_similarity_compare(base_image, comparison_image, opts = {})
  data, _status_code, _headers = recognize_similarity_compare_with_http_info(base_image, comparison_image, opts)
  data
end

#recognize_similarity_compare_with_http_info(base_image, comparison_image, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Compare two images for similarity Generates an image similarity score using Deep Learning between 0.0 and 1.0, values closer to 1.0 indicate greater similarity

Parameters:

  • base_image

    Image file to compare against. Common file formats such as PNG, JPEG are supported.

  • comparison_image

    Image to compare to the base image.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :recognition_mode (String)

    Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal.

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 491

def recognize_similarity_compare_with_http_info(base_image, comparison_image, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_similarity_compare ...'
  end
  # verify the required parameter 'base_image' is set
  if @api_client.config.client_side_validation && base_image.nil?
    fail ArgumentError, "Missing the required parameter 'base_image' when calling RecognizeApi.recognize_similarity_compare"
  end
  # verify the required parameter 'comparison_image' is set
  if @api_client.config.client_side_validation && comparison_image.nil?
    fail ArgumentError, "Missing the required parameter 'comparison_image' when calling RecognizeApi.recognize_similarity_compare"
  end
  # resource path
  local_var_path = '/image/recognize/similarity/compare'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
  header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?

  # form parameters
  form_params = {}
  form_params['baseImage'] = base_image
  form_params['comparisonImage'] = comparison_image

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecognizeApi#recognize_similarity_compare\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recognize_similarity_hash(image_file, opts = {}) ⇒ ImageSimilarityHashResponse

Generate a perceptual image hash Generates a hash value for the image; hash values that are closer together in terms of Hamming Distance are more similar.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :recognition_mode (String)

    Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal.

Returns:



543
544
545
546
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 543

def recognize_similarity_hash(image_file, opts = {})
  data, _status_code, _headers = recognize_similarity_hash_with_http_info(image_file, opts)
  data
end

#recognize_similarity_hash_distance(request, opts = {}) ⇒ ImageSimilarityHashDistanceResponse

Calculates the similarity between two perceptual image hashes Calculates the similarity between two perceptual image hashes by computing the Hamming Distance between them.

Parameters:

  • request
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



600
601
602
603
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 600

def recognize_similarity_hash_distance(request, opts = {})
  data, _status_code, _headers = recognize_similarity_hash_distance_with_http_info(request, opts)
  data
end

#recognize_similarity_hash_distance_with_http_info(request, opts = {}) ⇒ Array<(ImageSimilarityHashDistanceResponse, Fixnum, Hash)>

Calculates the similarity between two perceptual image hashes Calculates the similarity between two perceptual image hashes by computing the Hamming Distance between them.

Parameters:

  • request
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 610

def recognize_similarity_hash_distance_with_http_info(request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_similarity_hash_distance ...'
  end
  # verify the required parameter 'request' is set
  if @api_client.config.client_side_validation && request.nil?
    fail ArgumentError, "Missing the required parameter 'request' when calling RecognizeApi.recognize_similarity_hash_distance"
  end
  # resource path
  local_var_path = '/image/recognize/similarity/hash/distance'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(request)
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ImageSimilarityHashDistanceResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecognizeApi#recognize_similarity_hash_distance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recognize_similarity_hash_with_http_info(image_file, opts = {}) ⇒ Array<(ImageSimilarityHashResponse, Fixnum, Hash)>

Generate a perceptual image hash Generates a hash value for the image; hash values that are closer together in terms of Hamming Distance are more similar.

Parameters:

  • image_file

    Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :recognition_mode (String)

    Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal.

Returns:



554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
# File 'lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb', line 554

def recognize_similarity_hash_with_http_info(image_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_similarity_hash ...'
  end
  # verify the required parameter 'image_file' is set
  if @api_client.config.client_side_validation && image_file.nil?
    fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_similarity_hash"
  end
  # resource path
  local_var_path = '/image/recognize/similarity/hash'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
  header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?

  # form parameters
  form_params = {}
  form_params['imageFile'] = image_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ImageSimilarityHashResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecognizeApi#recognize_similarity_hash\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end