class CloudmersiveImageRecognitionApiClient::FaceApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/cloudmersive-image-recognition-api-client/api/face_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

face_compare(input_image, match_face, opts = {}) click to toggle source

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. @param 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. @param match_face Image of a single face to compare and match against. @param [Hash] opts the optional parameters @return [FaceCompareResponse]

# 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 = {}) click to toggle source

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. @param 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. @param match_face Image of a single face to compare and match against. @param [Hash] opts the optional parameters @return [Array<(FaceCompareResponse, Fixnum, Hash)>] FaceCompareResponse data, response status code and response headers

# 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 = {}) click to toggle source

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. @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. @param [Hash] opts the optional parameters @return [String]

# 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 = {}) click to toggle source

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. @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. @param [Hash] opts the optional parameters @return [String]

# 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 = {}) click to toggle source

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. @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. @param [Hash] opts the optional parameters @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers

# 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 = {}) click to toggle source

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. @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. @param [Hash] opts the optional parameters @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers

# 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 = {}) click to toggle source

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. @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. @param [Hash] opts the optional parameters @return [AgeDetectionResult]

# 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 = {}) click to toggle source

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. @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. @param [Hash] opts the optional parameters @return [Array<(AgeDetectionResult, Fixnum, Hash)>] AgeDetectionResult data, response status code and response headers

# 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 = {}) click to toggle source

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. @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. @param [Hash] opts the optional parameters @return [GenderDetectionResult]

# 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 = {}) click to toggle source

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. @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. @param [Hash] opts the optional parameters @return [Array<(GenderDetectionResult, Fixnum, Hash)>] GenderDetectionResult data, response status code and response headers

# 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 = {}) click to toggle source

Detect and find faces in an image Locate the positions of all faces in an image @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. @param [Hash] opts the optional parameters @return [FaceLocateResponse]

# 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 = {}) click to toggle source

Detect and find faces in an image Locate the positions of all faces in an image @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. @param [Hash] opts the optional parameters @return [Array<(FaceLocateResponse, Fixnum, Hash)>] FaceLocateResponse data, response status code and response headers

# 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 = {}) click to toggle source

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 @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. @param [Hash] opts the optional parameters @return [FaceLocateWithLandmarksResponse]

# 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 = {}) click to toggle source

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 @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. @param [Hash] opts the optional parameters @return [Array<(FaceLocateWithLandmarksResponse, Fixnum, Hash)>] FaceLocateWithLandmarksResponse data, response status code and response headers

# 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