Class: CloudmersiveImageRecognitionApiClient::FaceApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FaceApi

Returns a new instance of FaceApi.



19
20
21
# File 'lib/cloudmersive-image-recognition-api-client/api/face_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/face_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#face_compare(input_image, match_face, opts = {}) ⇒ FaceCompareResponse

Compare and match faces Find the faces in an input image, and compare against a reference image to determine if there is a match against the face in the reference image. The reference image (second parameter) should contain exactly one face.

Parameters:

  • input_image

    Image file to perform the operation on; this image can contain one or more faces which will be matched against face provided in the second image. Common file formats such as PNG, JPEG are supported.

  • match_face

    Image of a single face to compare and match against.

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

    the optional parameters

Returns:



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

def face_compare(input_image, match_face, opts = {})
  data, _status_code, _headers = face_compare_with_http_info(input_image, match_face, opts)
  data
end

#face_compare_with_http_info(input_image, match_face, opts = {}) ⇒ Array<(FaceCompareResponse, Fixnum, Hash)>

Compare and match faces Find the faces in an input image, and compare against a reference image to determine if there is a match against the face in the reference image. The reference image (second parameter) should contain exactly one face.

Parameters:

  • input_image

    Image file to perform the operation on; this image can contain one or more faces which will be matched against face provided in the second image. Common file formats such as PNG, JPEG are supported.

  • match_face

    Image of a single face to compare and match against.

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

    the optional parameters

Returns:

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

    FaceCompareResponse data, response status code and response headers



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
77
78
79
80
81
82
83
# File 'lib/cloudmersive-image-recognition-api-client/api/face_api.rb', line 39

def face_compare_with_http_info(input_image, match_face, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FaceApi.face_compare ...'
  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 FaceApi.face_compare"
  end
  # verify the required parameter 'match_face' is set
  if @api_client.config.client_side_validation && match_face.nil?
    fail ArgumentError, "Missing the required parameter 'match_face' when calling FaceApi.face_compare"
  end
  # resource path
  local_var_path = '/image/face/compare-and-match'

  # 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['matchFace'] = match_face

  # 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 => 'FaceCompareResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FaceApi#face_compare\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Crop image to face with square crop Crop an image to the face (rectangular crop). If there is more than one face present, choose the first one.

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:

  • (String)


89
90
91
92
# File 'lib/cloudmersive-image-recognition-api-client/api/face_api.rb', line 89

def face_crop_first(image_file, opts = {})
  data, _status_code, _headers = face_crop_first_with_http_info(image_file, opts)
  data
end

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

Crop image to face with round crop Crop an image to the face (circular/round crop). If there is more than one face present, choose the first one.

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:

  • (String)


144
145
146
147
# File 'lib/cloudmersive-image-recognition-api-client/api/face_api.rb', line 144

def face_crop_first_round(image_file, opts = {})
  data, _status_code, _headers = face_crop_first_round_with_http_info(image_file, opts)
  data
end

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

Crop image to face with round crop Crop an image to the face (circular/round crop). If there is more than one face present, choose the first one.

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<(String, Fixnum, Hash)>)

    String data, response status code and response headers



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
190
191
192
193
# File 'lib/cloudmersive-image-recognition-api-client/api/face_api.rb', line 154

def face_crop_first_round_with_http_info(image_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FaceApi.face_crop_first_round ...'
  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 FaceApi.face_crop_first_round"
  end
  # resource path
  local_var_path = '/image/face/crop/first/round'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # 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 => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FaceApi#face_crop_first_round\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Crop image to face with square crop Crop an image to the face (rectangular crop). If there is more than one face present, choose the first one.

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<(String, Fixnum, Hash)>)

    String data, response status code and response headers



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
135
136
137
138
# File 'lib/cloudmersive-image-recognition-api-client/api/face_api.rb', line 99

def face_crop_first_with_http_info(image_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FaceApi.face_crop_first ...'
  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 FaceApi.face_crop_first"
  end
  # resource path
  local_var_path = '/image/face/crop/first'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # 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 => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FaceApi#face_crop_first\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#face_detect_age(image_file, opts = {}) ⇒ AgeDetectionResult

Detect the age of people in an image Identify the age, position, and size of human faces 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:



199
200
201
202
# File 'lib/cloudmersive-image-recognition-api-client/api/face_api.rb', line 199

def face_detect_age(image_file, opts = {})
  data, _status_code, _headers = face_detect_age_with_http_info(image_file, opts)
  data
end

#face_detect_age_with_http_info(image_file, opts = {}) ⇒ Array<(AgeDetectionResult, Fixnum, Hash)>

Detect the age of people in an image Identify the age, position, and size of human faces 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<(AgeDetectionResult, Fixnum, Hash)>)

    AgeDetectionResult data, response status code and response headers



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
245
246
247
248
# File 'lib/cloudmersive-image-recognition-api-client/api/face_api.rb', line 209

def face_detect_age_with_http_info(image_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FaceApi.face_detect_age ...'
  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 FaceApi.face_detect_age"
  end
  # resource path
  local_var_path = '/image/face/detect-age'

  # 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 => 'AgeDetectionResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FaceApi#face_detect_age\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#face_detect_gender(image_file, opts = {}) ⇒ GenderDetectionResult

Detect the gender of people in an image Identify the gender, position, and size of human faces in an image, along with a recognition confidence level. People in the image should be facing the camera.

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:



254
255
256
257
# File 'lib/cloudmersive-image-recognition-api-client/api/face_api.rb', line 254

def face_detect_gender(image_file, opts = {})
  data, _status_code, _headers = face_detect_gender_with_http_info(image_file, opts)
  data
end

#face_detect_gender_with_http_info(image_file, opts = {}) ⇒ Array<(GenderDetectionResult, Fixnum, Hash)>

Detect the gender of people in an image Identify the gender, position, and size of human faces in an image, along with a recognition confidence level. People in the image should be facing the camera.

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<(GenderDetectionResult, Fixnum, Hash)>)

    GenderDetectionResult data, response status code and response headers



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
300
301
302
303
# File 'lib/cloudmersive-image-recognition-api-client/api/face_api.rb', line 264

def face_detect_gender_with_http_info(image_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FaceApi.face_detect_gender ...'
  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 FaceApi.face_detect_gender"
  end
  # resource path
  local_var_path = '/image/face/detect-gender'

  # 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 => 'GenderDetectionResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FaceApi#face_detect_gender\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#face_locate(image_file, opts = {}) ⇒ FaceLocateResponse

Detect and find faces in an image Locate the positions of all faces 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:



309
310
311
312
# File 'lib/cloudmersive-image-recognition-api-client/api/face_api.rb', line 309

def face_locate(image_file, opts = {})
  data, _status_code, _headers = face_locate_with_http_info(image_file, opts)
  data
end

#face_locate_with_http_info(image_file, opts = {}) ⇒ Array<(FaceLocateResponse, Fixnum, Hash)>

Detect and find faces in an image Locate the positions of all faces 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<(FaceLocateResponse, Fixnum, Hash)>)

    FaceLocateResponse data, response status code and response headers



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
355
356
357
358
# File 'lib/cloudmersive-image-recognition-api-client/api/face_api.rb', line 319

def face_locate_with_http_info(image_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FaceApi.face_locate ...'
  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 FaceApi.face_locate"
  end
  # resource path
  local_var_path = '/image/face/locate'

  # 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 => 'FaceLocateResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FaceApi#face_locate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#face_locate_with_landmarks(image_file, opts = {}) ⇒ FaceLocateWithLandmarksResponse

Detect and find faces and landmarks eyes and nose and mouth in image Locate the positions of all faces in an image, along with the eyes, eye brows, nose and mouth components of each

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:



364
365
366
367
# File 'lib/cloudmersive-image-recognition-api-client/api/face_api.rb', line 364

def face_locate_with_landmarks(image_file, opts = {})
  data, _status_code, _headers = face_locate_with_landmarks_with_http_info(image_file, opts)
  data
end

#face_locate_with_landmarks_with_http_info(image_file, opts = {}) ⇒ Array<(FaceLocateWithLandmarksResponse, Fixnum, Hash)>

Detect and find faces and landmarks eyes and nose and mouth in image Locate the positions of all faces in an image, along with the eyes, eye brows, nose and mouth components of each

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:



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
410
411
412
413
# File 'lib/cloudmersive-image-recognition-api-client/api/face_api.rb', line 374

def face_locate_with_landmarks_with_http_info(image_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FaceApi.face_locate_with_landmarks ...'
  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 FaceApi.face_locate_with_landmarks"
  end
  # resource path
  local_var_path = '/image/face/locate-with-landmarks'

  # 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 => 'FaceLocateWithLandmarksResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FaceApi#face_locate_with_landmarks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end