cloudmersive-image-recognition-api-client 1.2.9 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -4
- data/docs/FaceApi.md +113 -0
- data/docs/FaceCompareResponse.md +11 -0
- data/docs/FaceLocateWithLandmarksResponse.md +11 -0
- data/docs/FaceMatch.md +13 -0
- data/docs/FacePoint.md +9 -0
- data/docs/FaceWithLandmarks.md +20 -0
- data/lib/cloudmersive-image-recognition-api-client.rb +5 -0
- data/lib/cloudmersive-image-recognition-api-client/api/face_api.rb +119 -0
- data/lib/cloudmersive-image-recognition-api-client/models/face_compare_response.rb +220 -0
- data/lib/cloudmersive-image-recognition-api-client/models/face_locate_with_landmarks_response.rb +220 -0
- data/lib/cloudmersive-image-recognition-api-client/models/face_match.rb +239 -0
- data/lib/cloudmersive-image-recognition-api-client/models/face_point.rb +199 -0
- data/lib/cloudmersive-image-recognition-api-client/models/face_with_landmarks.rb +318 -0
- data/lib/cloudmersive-image-recognition-api-client/version.rb +1 -1
- data/spec/api/face_api_spec.rb +25 -0
- data/spec/models/face_compare_response_spec.rb +60 -0
- data/spec/models/face_locate_with_landmarks_response_spec.rb +60 -0
- data/spec/models/face_match_spec.rb +72 -0
- data/spec/models/face_point_spec.rb +48 -0
- data/spec/models/face_with_landmarks_spec.rb +114 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28d47f3b97ad2eb1de71ef4973102482bd9ce25fcc57f5317bd63fe6f79b1b23
|
4
|
+
data.tar.gz: 1deafa860293ddf923f7ea597778a2424a13c8e3dd4dcd6ea725da744d8f6219
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85885ad1774529b094f81a7e091df07ed60b22a9e1ee0796900741d5205c787cb79bbb46945d42c1fc0578bba7c42339ae3512c304324e7b9354202126a163da
|
7
|
+
data.tar.gz: 89bab982050f215252ac237a0fcba21fe0085caf865d280e433a54e19100b0084967b1e09d96663496cb42efb8329bc5a9ae6a27cc0bd460a082b8825488f8b9
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Image Recognition and Processing APIs let you use Machine Learning to recognize
|
|
7
7
|
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
8
8
|
|
9
9
|
- API version: v1
|
10
|
-
- Package version: 1.
|
10
|
+
- Package version: 1.3.0
|
11
11
|
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
12
12
|
|
13
13
|
## Installation
|
@@ -23,15 +23,15 @@ gem build cloudmersive-image-recognition-api-client.gemspec
|
|
23
23
|
Then either install the gem locally:
|
24
24
|
|
25
25
|
```shell
|
26
|
-
gem install ./cloudmersive-image-recognition-api-client-1.
|
26
|
+
gem install ./cloudmersive-image-recognition-api-client-1.3.0.gem
|
27
27
|
```
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-image-recognition-api-client-1.
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-image-recognition-api-client-1.3.0.gem` to install the development dependencies)
|
29
29
|
|
30
30
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
31
31
|
|
32
32
|
Finally add this to the Gemfile:
|
33
33
|
|
34
|
-
gem 'cloudmersive-image-recognition-api-client', '~> 1.
|
34
|
+
gem 'cloudmersive-image-recognition-api-client', '~> 1.3.0'
|
35
35
|
|
36
36
|
### Install from Git
|
37
37
|
|
@@ -89,10 +89,12 @@ Class | Method | HTTP request | Description
|
|
89
89
|
*CloudmersiveImageRecognitionApiClient::EditApi* | [**edit_composite_basic**](docs/EditApi.md#edit_composite_basic) | **POST** /image/edit/composite/{location} | Composite two images together
|
90
90
|
*CloudmersiveImageRecognitionApiClient::EditApi* | [**edit_draw_rectangle**](docs/EditApi.md#edit_draw_rectangle) | **POST** /image/edit/draw/rectangle | Draw rectangle onto an image
|
91
91
|
*CloudmersiveImageRecognitionApiClient::EditApi* | [**edit_draw_text**](docs/EditApi.md#edit_draw_text) | **POST** /image/edit/draw/text | Draw text onto an image
|
92
|
+
*CloudmersiveImageRecognitionApiClient::FaceApi* | [**face_compare**](docs/FaceApi.md#face_compare) | **POST** /image/face/compare-and-match | Compare and match faces
|
92
93
|
*CloudmersiveImageRecognitionApiClient::FaceApi* | [**face_crop_first**](docs/FaceApi.md#face_crop_first) | **POST** /image/face/crop/first | Crop image to face (square)
|
93
94
|
*CloudmersiveImageRecognitionApiClient::FaceApi* | [**face_crop_first_round**](docs/FaceApi.md#face_crop_first_round) | **POST** /image/face/crop/first/round | Crop image to face (round)
|
94
95
|
*CloudmersiveImageRecognitionApiClient::FaceApi* | [**face_detect_age**](docs/FaceApi.md#face_detect_age) | **POST** /image/face/detect-age | Detect the age of people in an image
|
95
96
|
*CloudmersiveImageRecognitionApiClient::FaceApi* | [**face_locate**](docs/FaceApi.md#face_locate) | **POST** /image/face/locate | Find faces in an image
|
97
|
+
*CloudmersiveImageRecognitionApiClient::FaceApi* | [**face_locate_with_landmarks**](docs/FaceApi.md#face_locate_with_landmarks) | **POST** /image/face/locate-with-landmarks | Find faces and face landmarks (eyes, eye brows, nose, mouth) in an image
|
96
98
|
*CloudmersiveImageRecognitionApiClient::NsfwApi* | [**nsfw_classify**](docs/NsfwApi.md#nsfw_classify) | **POST** /image/nsfw/classify | Not safe for work (NSFW) racy content classification
|
97
99
|
*CloudmersiveImageRecognitionApiClient::RecognizeApi* | [**recognize_describe**](docs/RecognizeApi.md#recognize_describe) | **POST** /image/recognize/describe | Describe an image in natural language
|
98
100
|
*CloudmersiveImageRecognitionApiClient::RecognizeApi* | [**recognize_detect_and_unskew_document**](docs/RecognizeApi.md#recognize_detect_and_unskew_document) | **POST** /image/recognize/detect-document/unskew | Detect and unskew a photo of a document
|
@@ -112,7 +114,12 @@ Class | Method | HTTP request | Description
|
|
112
114
|
- [CloudmersiveImageRecognitionApiClient::DrawTextInstance](docs/DrawTextInstance.md)
|
113
115
|
- [CloudmersiveImageRecognitionApiClient::DrawTextRequest](docs/DrawTextRequest.md)
|
114
116
|
- [CloudmersiveImageRecognitionApiClient::Face](docs/Face.md)
|
117
|
+
- [CloudmersiveImageRecognitionApiClient::FaceCompareResponse](docs/FaceCompareResponse.md)
|
115
118
|
- [CloudmersiveImageRecognitionApiClient::FaceLocateResponse](docs/FaceLocateResponse.md)
|
119
|
+
- [CloudmersiveImageRecognitionApiClient::FaceLocateWithLandmarksResponse](docs/FaceLocateWithLandmarksResponse.md)
|
120
|
+
- [CloudmersiveImageRecognitionApiClient::FaceMatch](docs/FaceMatch.md)
|
121
|
+
- [CloudmersiveImageRecognitionApiClient::FacePoint](docs/FacePoint.md)
|
122
|
+
- [CloudmersiveImageRecognitionApiClient::FaceWithLandmarks](docs/FaceWithLandmarks.md)
|
116
123
|
- [CloudmersiveImageRecognitionApiClient::ImageDescriptionResponse](docs/ImageDescriptionResponse.md)
|
117
124
|
- [CloudmersiveImageRecognitionApiClient::NsfwResult](docs/NsfwResult.md)
|
118
125
|
- [CloudmersiveImageRecognitionApiClient::ObjectDetectionResult](docs/ObjectDetectionResult.md)
|
data/docs/FaceApi.md
CHANGED
@@ -4,10 +4,69 @@ All URIs are relative to *https://api.cloudmersive.com*
|
|
4
4
|
|
5
5
|
Method | HTTP request | Description
|
6
6
|
------------- | ------------- | -------------
|
7
|
+
[**face_compare**](FaceApi.md#face_compare) | **POST** /image/face/compare-and-match | Compare and match faces
|
7
8
|
[**face_crop_first**](FaceApi.md#face_crop_first) | **POST** /image/face/crop/first | Crop image to face (square)
|
8
9
|
[**face_crop_first_round**](FaceApi.md#face_crop_first_round) | **POST** /image/face/crop/first/round | Crop image to face (round)
|
9
10
|
[**face_detect_age**](FaceApi.md#face_detect_age) | **POST** /image/face/detect-age | Detect the age of people in an image
|
10
11
|
[**face_locate**](FaceApi.md#face_locate) | **POST** /image/face/locate | Find faces in an image
|
12
|
+
[**face_locate_with_landmarks**](FaceApi.md#face_locate_with_landmarks) | **POST** /image/face/locate-with-landmarks | Find faces and face landmarks (eyes, eye brows, nose, mouth) in an image
|
13
|
+
|
14
|
+
|
15
|
+
# **face_compare**
|
16
|
+
> FaceCompareResponse face_compare(input_image, match_face)
|
17
|
+
|
18
|
+
Compare and match faces
|
19
|
+
|
20
|
+
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.
|
21
|
+
|
22
|
+
### Example
|
23
|
+
```ruby
|
24
|
+
# load the gem
|
25
|
+
require 'cloudmersive-image-recognition-api-client'
|
26
|
+
# setup authorization
|
27
|
+
CloudmersiveImageRecognitionApiClient.configure do |config|
|
28
|
+
# Configure API key authorization: Apikey
|
29
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
30
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
31
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
32
|
+
end
|
33
|
+
|
34
|
+
api_instance = CloudmersiveImageRecognitionApiClient::FaceApi.new
|
35
|
+
|
36
|
+
input_image = File.new("/path/to/file.txt") # File | 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.
|
37
|
+
|
38
|
+
match_face = File.new("/path/to/file.txt") # File | Image of a single face to compare and match against.
|
39
|
+
|
40
|
+
|
41
|
+
begin
|
42
|
+
#Compare and match faces
|
43
|
+
result = api_instance.face_compare(input_image, match_face)
|
44
|
+
p result
|
45
|
+
rescue CloudmersiveImageRecognitionApiClient::ApiError => e
|
46
|
+
puts "Exception when calling FaceApi->face_compare: #{e}"
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
### Parameters
|
51
|
+
|
52
|
+
Name | Type | Description | Notes
|
53
|
+
------------- | ------------- | ------------- | -------------
|
54
|
+
**input_image** | **File**| 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. |
|
55
|
+
**match_face** | **File**| Image of a single face to compare and match against. |
|
56
|
+
|
57
|
+
### Return type
|
58
|
+
|
59
|
+
[**FaceCompareResponse**](FaceCompareResponse.md)
|
60
|
+
|
61
|
+
### Authorization
|
62
|
+
|
63
|
+
[Apikey](../README.md#Apikey)
|
64
|
+
|
65
|
+
### HTTP request headers
|
66
|
+
|
67
|
+
- **Content-Type**: multipart/form-data
|
68
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
69
|
+
|
11
70
|
|
12
71
|
|
13
72
|
# **face_crop_first**
|
@@ -226,3 +285,57 @@ Name | Type | Description | Notes
|
|
226
285
|
|
227
286
|
|
228
287
|
|
288
|
+
# **face_locate_with_landmarks**
|
289
|
+
> FaceLocateWithLandmarksResponse face_locate_with_landmarks(image_file)
|
290
|
+
|
291
|
+
Find faces and face landmarks (eyes, eye brows, nose, mouth) in an image
|
292
|
+
|
293
|
+
Locate the positions of all faces in an image, along with the eyes, eye brows, nose and mouth components of each
|
294
|
+
|
295
|
+
### Example
|
296
|
+
```ruby
|
297
|
+
# load the gem
|
298
|
+
require 'cloudmersive-image-recognition-api-client'
|
299
|
+
# setup authorization
|
300
|
+
CloudmersiveImageRecognitionApiClient.configure do |config|
|
301
|
+
# Configure API key authorization: Apikey
|
302
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
303
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
304
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
305
|
+
end
|
306
|
+
|
307
|
+
api_instance = CloudmersiveImageRecognitionApiClient::FaceApi.new
|
308
|
+
|
309
|
+
image_file = File.new("/path/to/file.txt") # File | Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
310
|
+
|
311
|
+
|
312
|
+
begin
|
313
|
+
#Find faces and face landmarks (eyes, eye brows, nose, mouth) in an image
|
314
|
+
result = api_instance.face_locate_with_landmarks(image_file)
|
315
|
+
p result
|
316
|
+
rescue CloudmersiveImageRecognitionApiClient::ApiError => e
|
317
|
+
puts "Exception when calling FaceApi->face_locate_with_landmarks: #{e}"
|
318
|
+
end
|
319
|
+
```
|
320
|
+
|
321
|
+
### Parameters
|
322
|
+
|
323
|
+
Name | Type | Description | Notes
|
324
|
+
------------- | ------------- | ------------- | -------------
|
325
|
+
**image_file** | **File**| Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. |
|
326
|
+
|
327
|
+
### Return type
|
328
|
+
|
329
|
+
[**FaceLocateWithLandmarksResponse**](FaceLocateWithLandmarksResponse.md)
|
330
|
+
|
331
|
+
### Authorization
|
332
|
+
|
333
|
+
[Apikey](../README.md#Apikey)
|
334
|
+
|
335
|
+
### HTTP request headers
|
336
|
+
|
337
|
+
- **Content-Type**: multipart/form-data
|
338
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
339
|
+
|
340
|
+
|
341
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# CloudmersiveImageRecognitionApiClient::FaceCompareResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**error_details** | **String** | | [optional]
|
7
|
+
**successful** | **BOOLEAN** | True if the operation was successful, false otherwise | [optional]
|
8
|
+
**faces** | [**Array<FaceMatch>**](FaceMatch.md) | Array of faces found in the input image | [optional]
|
9
|
+
**face_count** | **Integer** | Number of faces found in the image | [optional]
|
10
|
+
|
11
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# CloudmersiveImageRecognitionApiClient::FaceLocateWithLandmarksResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**error_details** | **String** | | [optional]
|
7
|
+
**successful** | **BOOLEAN** | True if the operation was successful, false otherwise | [optional]
|
8
|
+
**faces** | [**Array<FaceWithLandmarks>**](FaceWithLandmarks.md) | Array of faces found in the image | [optional]
|
9
|
+
**face_count** | **Integer** | Number of faces found in the image | [optional]
|
10
|
+
|
11
|
+
|
data/docs/FaceMatch.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# CloudmersiveImageRecognitionApiClient::FaceMatch
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**left_x** | **Integer** | X coordinate of the left side of the face | [optional]
|
7
|
+
**top_y** | **Integer** | Y coordinate of the top side of the face | [optional]
|
8
|
+
**right_x** | **Integer** | X coordinate of the right side of the face | [optional]
|
9
|
+
**bottom_y** | **Integer** | Y coordinate of the bottom side of the face | [optional]
|
10
|
+
**high_confidence_match** | **BOOLEAN** | True if there is a high confidence match, false otherwise | [optional]
|
11
|
+
**match_score** | **Float** | Match score from 0.0 to 1.0 with higher scores indicating a greater match; scores above 0.7 indicate a match | [optional]
|
12
|
+
|
13
|
+
|
data/docs/FacePoint.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveImageRecognitionApiClient::FacePoint
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**x** | **Integer** | X location, where 0 is the left-most pixel | [optional]
|
7
|
+
**y** | **Integer** | Y location, where 0 is the top-most pixel | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# CloudmersiveImageRecognitionApiClient::FaceWithLandmarks
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**left_eyebrow** | [**Array<FacePoint>**](FacePoint.md) | | [optional]
|
7
|
+
**right_eyebrow** | [**Array<FacePoint>**](FacePoint.md) | | [optional]
|
8
|
+
**left_eye** | [**Array<FacePoint>**](FacePoint.md) | | [optional]
|
9
|
+
**right_eye** | [**Array<FacePoint>**](FacePoint.md) | | [optional]
|
10
|
+
**bottom_and_sides_of_face** | [**Array<FacePoint>**](FacePoint.md) | | [optional]
|
11
|
+
**nose_bridge** | [**Array<FacePoint>**](FacePoint.md) | | [optional]
|
12
|
+
**nose_bottom** | [**Array<FacePoint>**](FacePoint.md) | | [optional]
|
13
|
+
**lips_inner_outline** | [**Array<FacePoint>**](FacePoint.md) | | [optional]
|
14
|
+
**lips_outer_outline** | [**Array<FacePoint>**](FacePoint.md) | | [optional]
|
15
|
+
**left_x** | **Integer** | X coordinate of the left side of the face | [optional]
|
16
|
+
**top_y** | **Integer** | Y coordinate of the top side of the face | [optional]
|
17
|
+
**right_x** | **Integer** | X coordinate of the right side of the face | [optional]
|
18
|
+
**bottom_y** | **Integer** | Y coordinate of the bottom side of the face | [optional]
|
19
|
+
|
20
|
+
|
@@ -25,7 +25,12 @@ require 'cloudmersive-image-recognition-api-client/models/draw_rectangle_request
|
|
25
25
|
require 'cloudmersive-image-recognition-api-client/models/draw_text_instance'
|
26
26
|
require 'cloudmersive-image-recognition-api-client/models/draw_text_request'
|
27
27
|
require 'cloudmersive-image-recognition-api-client/models/face'
|
28
|
+
require 'cloudmersive-image-recognition-api-client/models/face_compare_response'
|
28
29
|
require 'cloudmersive-image-recognition-api-client/models/face_locate_response'
|
30
|
+
require 'cloudmersive-image-recognition-api-client/models/face_locate_with_landmarks_response'
|
31
|
+
require 'cloudmersive-image-recognition-api-client/models/face_match'
|
32
|
+
require 'cloudmersive-image-recognition-api-client/models/face_point'
|
33
|
+
require 'cloudmersive-image-recognition-api-client/models/face_with_landmarks'
|
29
34
|
require 'cloudmersive-image-recognition-api-client/models/image_description_response'
|
30
35
|
require 'cloudmersive-image-recognition-api-client/models/nsfw_result'
|
31
36
|
require 'cloudmersive-image-recognition-api-client/models/object_detection_result'
|
@@ -20,6 +20,69 @@ module CloudmersiveImageRecognitionApiClient
|
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
22
|
|
23
|
+
# Compare and match faces
|
24
|
+
# 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.
|
25
|
+
# @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.
|
26
|
+
# @param match_face Image of a single face to compare and match against.
|
27
|
+
# @param [Hash] opts the optional parameters
|
28
|
+
# @return [FaceCompareResponse]
|
29
|
+
def face_compare(input_image, match_face, opts = {})
|
30
|
+
data, _status_code, _headers = face_compare_with_http_info(input_image, match_face, opts)
|
31
|
+
return data
|
32
|
+
end
|
33
|
+
|
34
|
+
# Compare and match faces
|
35
|
+
# 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.
|
36
|
+
# @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.
|
37
|
+
# @param match_face Image of a single face to compare and match against.
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @return [Array<(FaceCompareResponse, Fixnum, Hash)>] FaceCompareResponse data, response status code and response headers
|
40
|
+
def face_compare_with_http_info(input_image, match_face, opts = {})
|
41
|
+
if @api_client.config.debugging
|
42
|
+
@api_client.config.logger.debug "Calling API: FaceApi.face_compare ..."
|
43
|
+
end
|
44
|
+
# verify the required parameter 'input_image' is set
|
45
|
+
if @api_client.config.client_side_validation && input_image.nil?
|
46
|
+
fail ArgumentError, "Missing the required parameter 'input_image' when calling FaceApi.face_compare"
|
47
|
+
end
|
48
|
+
# verify the required parameter 'match_face' is set
|
49
|
+
if @api_client.config.client_side_validation && match_face.nil?
|
50
|
+
fail ArgumentError, "Missing the required parameter 'match_face' when calling FaceApi.face_compare"
|
51
|
+
end
|
52
|
+
# resource path
|
53
|
+
local_var_path = "/image/face/compare-and-match"
|
54
|
+
|
55
|
+
# query parameters
|
56
|
+
query_params = {}
|
57
|
+
|
58
|
+
# header parameters
|
59
|
+
header_params = {}
|
60
|
+
# HTTP header 'Accept' (if needed)
|
61
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
62
|
+
# HTTP header 'Content-Type'
|
63
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
64
|
+
|
65
|
+
# form parameters
|
66
|
+
form_params = {}
|
67
|
+
form_params["inputImage"] = input_image
|
68
|
+
form_params["matchFace"] = match_face
|
69
|
+
|
70
|
+
# http body (model)
|
71
|
+
post_body = nil
|
72
|
+
auth_names = ['Apikey']
|
73
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
74
|
+
:header_params => header_params,
|
75
|
+
:query_params => query_params,
|
76
|
+
:form_params => form_params,
|
77
|
+
:body => post_body,
|
78
|
+
:auth_names => auth_names,
|
79
|
+
:return_type => 'FaceCompareResponse')
|
80
|
+
if @api_client.config.debugging
|
81
|
+
@api_client.config.logger.debug "API called: FaceApi#face_compare\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
82
|
+
end
|
83
|
+
return data, status_code, headers
|
84
|
+
end
|
85
|
+
|
23
86
|
# Crop image to face (square)
|
24
87
|
# Crop an image to the face (rectangular crop). If there is more than one face present, choose the first one.
|
25
88
|
# @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
@@ -243,5 +306,61 @@ module CloudmersiveImageRecognitionApiClient
|
|
243
306
|
end
|
244
307
|
return data, status_code, headers
|
245
308
|
end
|
309
|
+
|
310
|
+
# Find faces and face landmarks (eyes, eye brows, nose, mouth) in an image
|
311
|
+
# Locate the positions of all faces in an image, along with the eyes, eye brows, nose and mouth components of each
|
312
|
+
# @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
313
|
+
# @param [Hash] opts the optional parameters
|
314
|
+
# @return [FaceLocateWithLandmarksResponse]
|
315
|
+
def face_locate_with_landmarks(image_file, opts = {})
|
316
|
+
data, _status_code, _headers = face_locate_with_landmarks_with_http_info(image_file, opts)
|
317
|
+
return data
|
318
|
+
end
|
319
|
+
|
320
|
+
# Find faces and face landmarks (eyes, eye brows, nose, mouth) in an image
|
321
|
+
# Locate the positions of all faces in an image, along with the eyes, eye brows, nose and mouth components of each
|
322
|
+
# @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
323
|
+
# @param [Hash] opts the optional parameters
|
324
|
+
# @return [Array<(FaceLocateWithLandmarksResponse, Fixnum, Hash)>] FaceLocateWithLandmarksResponse data, response status code and response headers
|
325
|
+
def face_locate_with_landmarks_with_http_info(image_file, opts = {})
|
326
|
+
if @api_client.config.debugging
|
327
|
+
@api_client.config.logger.debug "Calling API: FaceApi.face_locate_with_landmarks ..."
|
328
|
+
end
|
329
|
+
# verify the required parameter 'image_file' is set
|
330
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
331
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling FaceApi.face_locate_with_landmarks"
|
332
|
+
end
|
333
|
+
# resource path
|
334
|
+
local_var_path = "/image/face/locate-with-landmarks"
|
335
|
+
|
336
|
+
# query parameters
|
337
|
+
query_params = {}
|
338
|
+
|
339
|
+
# header parameters
|
340
|
+
header_params = {}
|
341
|
+
# HTTP header 'Accept' (if needed)
|
342
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
343
|
+
# HTTP header 'Content-Type'
|
344
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
345
|
+
|
346
|
+
# form parameters
|
347
|
+
form_params = {}
|
348
|
+
form_params["imageFile"] = image_file
|
349
|
+
|
350
|
+
# http body (model)
|
351
|
+
post_body = nil
|
352
|
+
auth_names = ['Apikey']
|
353
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
354
|
+
:header_params => header_params,
|
355
|
+
:query_params => query_params,
|
356
|
+
:form_params => form_params,
|
357
|
+
:body => post_body,
|
358
|
+
:auth_names => auth_names,
|
359
|
+
:return_type => 'FaceLocateWithLandmarksResponse')
|
360
|
+
if @api_client.config.debugging
|
361
|
+
@api_client.config.logger.debug "API called: FaceApi#face_locate_with_landmarks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
362
|
+
end
|
363
|
+
return data, status_code, headers
|
364
|
+
end
|
246
365
|
end
|
247
366
|
end
|
@@ -0,0 +1,220 @@
|
|
1
|
+
=begin
|
2
|
+
#imageapi
|
3
|
+
|
4
|
+
#Image Recognition and Processing APIs let you use Machine Learning to recognize and process images, and also perform useful image modification operations.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: unset
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveImageRecognitionApiClient
|
16
|
+
# Results of comparing/matching faces in an image
|
17
|
+
class FaceCompareResponse
|
18
|
+
attr_accessor :error_details
|
19
|
+
|
20
|
+
# True if the operation was successful, false otherwise
|
21
|
+
attr_accessor :successful
|
22
|
+
|
23
|
+
# Array of faces found in the input image
|
24
|
+
attr_accessor :faces
|
25
|
+
|
26
|
+
# Number of faces found in the image
|
27
|
+
attr_accessor :face_count
|
28
|
+
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
+
def self.attribute_map
|
32
|
+
{
|
33
|
+
:'error_details' => :'ErrorDetails',
|
34
|
+
:'successful' => :'Successful',
|
35
|
+
:'faces' => :'Faces',
|
36
|
+
:'face_count' => :'FaceCount'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Attribute type mapping.
|
41
|
+
def self.swagger_types
|
42
|
+
{
|
43
|
+
:'error_details' => :'String',
|
44
|
+
:'successful' => :'BOOLEAN',
|
45
|
+
:'faces' => :'Array<FaceMatch>',
|
46
|
+
:'face_count' => :'Integer'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
return unless attributes.is_a?(Hash)
|
54
|
+
|
55
|
+
# convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
57
|
+
|
58
|
+
if attributes.has_key?(:'ErrorDetails')
|
59
|
+
self.error_details = attributes[:'ErrorDetails']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'Successful')
|
63
|
+
self.successful = attributes[:'Successful']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes.has_key?(:'Faces')
|
67
|
+
if (value = attributes[:'Faces']).is_a?(Array)
|
68
|
+
self.faces = value
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.has_key?(:'FaceCount')
|
73
|
+
self.face_count = attributes[:'FaceCount']
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
79
|
+
# @return Array for valid properties with the reasons
|
80
|
+
def list_invalid_properties
|
81
|
+
invalid_properties = Array.new
|
82
|
+
return invalid_properties
|
83
|
+
end
|
84
|
+
|
85
|
+
# Check to see if the all the properties in the model are valid
|
86
|
+
# @return true if the model is valid
|
87
|
+
def valid?
|
88
|
+
return true
|
89
|
+
end
|
90
|
+
|
91
|
+
# Checks equality by comparing each attribute.
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def ==(o)
|
94
|
+
return true if self.equal?(o)
|
95
|
+
self.class == o.class &&
|
96
|
+
error_details == o.error_details &&
|
97
|
+
successful == o.successful &&
|
98
|
+
faces == o.faces &&
|
99
|
+
face_count == o.face_count
|
100
|
+
end
|
101
|
+
|
102
|
+
# @see the `==` method
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def eql?(o)
|
105
|
+
self == o
|
106
|
+
end
|
107
|
+
|
108
|
+
# Calculates hash code according to all attributes.
|
109
|
+
# @return [Fixnum] Hash code
|
110
|
+
def hash
|
111
|
+
[error_details, successful, faces, face_count].hash
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds the object from hash
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
+
# @return [Object] Returns the model itself
|
117
|
+
def build_from_hash(attributes)
|
118
|
+
return nil unless attributes.is_a?(Hash)
|
119
|
+
self.class.swagger_types.each_pair do |key, type|
|
120
|
+
if type =~ /\AArray<(.*)>/i
|
121
|
+
# check to ensure the input is an array given that the the attribute
|
122
|
+
# is documented as an array but the input is not
|
123
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
124
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
125
|
+
end
|
126
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
127
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
128
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
129
|
+
end
|
130
|
+
|
131
|
+
self
|
132
|
+
end
|
133
|
+
|
134
|
+
# Deserializes the data based on type
|
135
|
+
# @param string type Data type
|
136
|
+
# @param string value Value to be deserialized
|
137
|
+
# @return [Object] Deserialized data
|
138
|
+
def _deserialize(type, value)
|
139
|
+
case type.to_sym
|
140
|
+
when :DateTime
|
141
|
+
DateTime.parse(value)
|
142
|
+
when :Date
|
143
|
+
Date.parse(value)
|
144
|
+
when :String
|
145
|
+
value.to_s
|
146
|
+
when :Integer
|
147
|
+
value.to_i
|
148
|
+
when :Float
|
149
|
+
value.to_f
|
150
|
+
when :BOOLEAN
|
151
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
152
|
+
true
|
153
|
+
else
|
154
|
+
false
|
155
|
+
end
|
156
|
+
when :Object
|
157
|
+
# generic object (usually a Hash), return directly
|
158
|
+
value
|
159
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
160
|
+
inner_type = Regexp.last_match[:inner_type]
|
161
|
+
value.map { |v| _deserialize(inner_type, v) }
|
162
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
163
|
+
k_type = Regexp.last_match[:k_type]
|
164
|
+
v_type = Regexp.last_match[:v_type]
|
165
|
+
{}.tap do |hash|
|
166
|
+
value.each do |k, v|
|
167
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
else # model
|
171
|
+
temp_model = CloudmersiveImageRecognitionApiClient.const_get(type).new
|
172
|
+
temp_model.build_from_hash(value)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
# Returns the string representation of the object
|
177
|
+
# @return [String] String presentation of the object
|
178
|
+
def to_s
|
179
|
+
to_hash.to_s
|
180
|
+
end
|
181
|
+
|
182
|
+
# to_body is an alias to to_hash (backward compatibility)
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
184
|
+
def to_body
|
185
|
+
to_hash
|
186
|
+
end
|
187
|
+
|
188
|
+
# Returns the object in the form of hash
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_hash
|
191
|
+
hash = {}
|
192
|
+
self.class.attribute_map.each_pair do |attr, param|
|
193
|
+
value = self.send(attr)
|
194
|
+
next if value.nil?
|
195
|
+
hash[param] = _to_hash(value)
|
196
|
+
end
|
197
|
+
hash
|
198
|
+
end
|
199
|
+
|
200
|
+
# Outputs non-array value in the form of hash
|
201
|
+
# For object, use to_hash. Otherwise, just return the value
|
202
|
+
# @param [Object] value Any valid value
|
203
|
+
# @return [Hash] Returns the value in the form of hash
|
204
|
+
def _to_hash(value)
|
205
|
+
if value.is_a?(Array)
|
206
|
+
value.compact.map{ |v| _to_hash(v) }
|
207
|
+
elsif value.is_a?(Hash)
|
208
|
+
{}.tap do |hash|
|
209
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
210
|
+
end
|
211
|
+
elsif value.respond_to? :to_hash
|
212
|
+
value.to_hash
|
213
|
+
else
|
214
|
+
value
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|