cloudmersive-image-recognition-api-client 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -4
- data/docs/ImageSimilarityComparisonResponse.md +10 -0
- data/docs/ImageSimilarityHashDistanceRequest.md +9 -0
- data/docs/ImageSimilarityHashDistanceResponse.md +9 -0
- data/docs/ImageSimilarityHashResponse.md +9 -0
- data/docs/RecognizeApi.md +176 -0
- data/lib/cloudmersive-image-recognition-api-client.rb +4 -0
- data/lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb +177 -0
- data/lib/cloudmersive-image-recognition-api-client/models/image_similarity_comparison_response.rb +206 -0
- data/lib/cloudmersive-image-recognition-api-client/models/image_similarity_hash_distance_request.rb +196 -0
- data/lib/cloudmersive-image-recognition-api-client/models/image_similarity_hash_distance_response.rb +196 -0
- data/lib/cloudmersive-image-recognition-api-client/models/image_similarity_hash_response.rb +196 -0
- data/lib/cloudmersive-image-recognition-api-client/version.rb +1 -1
- data/spec/api/recognize_api_spec.rb +39 -0
- data/spec/models/image_similarity_comparison_response_spec.rb +53 -0
- data/spec/models/image_similarity_hash_distance_request_spec.rb +47 -0
- data/spec/models/image_similarity_hash_distance_response_spec.rb +47 -0
- data/spec/models/image_similarity_hash_response_spec.rb +47 -0
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78aa2d52adbc4bddf05b645882451bbd96c12783f531dc58b1b3866861c70a43
|
4
|
+
data.tar.gz: 159bb4496f5cc1afbc39f544c1d47745f4dea5c44db68bc1315bac8dba51d710
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97a3e67ec05eeba5c30f7842257500a5b273395d3d36a47c14a5ce5865c1ecd55008ce3367e0ad58e9a962a100fa99b747251bbff69518a3e812ac31f1eed20b
|
7
|
+
data.tar.gz: 62380f8dad9e08b06e886f9d2ac1d7a9af8fd1bab2315a70cee4a8864462cfdf270f2d5e42c5ac649a8ec62ab7fe5342b5e181efb09c53cd6bedb9feb21ca3b1
|
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: 2.0.
|
10
|
+
- Package version: 2.0.5
|
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-2.0.
|
26
|
+
gem install ./cloudmersive-image-recognition-api-client-2.0.5.gem
|
27
27
|
```
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-image-recognition-api-client-2.0.
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-image-recognition-api-client-2.0.5.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', '~> 2.0.
|
34
|
+
gem 'cloudmersive-image-recognition-api-client', '~> 2.0.5'
|
35
35
|
|
36
36
|
### Install from Git
|
37
37
|
|
@@ -133,6 +133,9 @@ Class | Method | HTTP request | Description
|
|
133
133
|
*CloudmersiveImageRecognitionApiClient::RecognizeApi* | [**recognize_detect_text_large**](docs/RecognizeApi.md#recognize_detect_text_large) | **POST** /image/recognize/detect-text/large | Detect large text in a photo
|
134
134
|
*CloudmersiveImageRecognitionApiClient::RecognizeApi* | [**recognize_detect_vehicle_license_plates**](docs/RecognizeApi.md#recognize_detect_vehicle_license_plates) | **POST** /image/recognize/detect-vehicle-license-plates | Detect vehicle license plates in an image
|
135
135
|
*CloudmersiveImageRecognitionApiClient::RecognizeApi* | [**recognize_find_symbol**](docs/RecognizeApi.md#recognize_find_symbol) | **POST** /image/recognize/find/symbol | Find the location of a symbol in an image
|
136
|
+
*CloudmersiveImageRecognitionApiClient::RecognizeApi* | [**recognize_similarity_compare**](docs/RecognizeApi.md#recognize_similarity_compare) | **POST** /image/recognize/similarity/compare | Compare two images for similarity
|
137
|
+
*CloudmersiveImageRecognitionApiClient::RecognizeApi* | [**recognize_similarity_hash**](docs/RecognizeApi.md#recognize_similarity_hash) | **POST** /image/recognize/similarity/hash | Generate a perceptual image hash
|
138
|
+
*CloudmersiveImageRecognitionApiClient::RecognizeApi* | [**recognize_similarity_hash_distance**](docs/RecognizeApi.md#recognize_similarity_hash_distance) | **POST** /image/recognize/similarity/hash/distance | Calculates the similarity between two perceptual image hashes
|
136
139
|
*CloudmersiveImageRecognitionApiClient::ResizeApi* | [**resize_post**](docs/ResizeApi.md#resize_post) | **POST** /image/resize/preserveAspectRatio/{maxWidth}/{maxHeight} | Resize an image while preserving aspect ratio
|
137
140
|
*CloudmersiveImageRecognitionApiClient::ResizeApi* | [**resize_resize_simple**](docs/ResizeApi.md#resize_resize_simple) | **POST** /image/resize/target/{width}/{height} | Resize an image
|
138
141
|
*CloudmersiveImageRecognitionApiClient::TextGenerationApi* | [**text_generation_create_handwriting_png**](docs/TextGenerationApi.md#text_generation_create_handwriting_png) | **POST** /image/text/create/handwriting/png | Create an image of handwriting in PNG format
|
@@ -166,6 +169,10 @@ Class | Method | HTTP request | Description
|
|
166
169
|
- [CloudmersiveImageRecognitionApiClient::ImageDescriptionResponse](docs/ImageDescriptionResponse.md)
|
167
170
|
- [CloudmersiveImageRecognitionApiClient::ImageMetadata](docs/ImageMetadata.md)
|
168
171
|
- [CloudmersiveImageRecognitionApiClient::ImageMetadataExifValue](docs/ImageMetadataExifValue.md)
|
172
|
+
- [CloudmersiveImageRecognitionApiClient::ImageSimilarityComparisonResponse](docs/ImageSimilarityComparisonResponse.md)
|
173
|
+
- [CloudmersiveImageRecognitionApiClient::ImageSimilarityHashDistanceRequest](docs/ImageSimilarityHashDistanceRequest.md)
|
174
|
+
- [CloudmersiveImageRecognitionApiClient::ImageSimilarityHashDistanceResponse](docs/ImageSimilarityHashDistanceResponse.md)
|
175
|
+
- [CloudmersiveImageRecognitionApiClient::ImageSimilarityHashResponse](docs/ImageSimilarityHashResponse.md)
|
169
176
|
- [CloudmersiveImageRecognitionApiClient::NsfwResult](docs/NsfwResult.md)
|
170
177
|
- [CloudmersiveImageRecognitionApiClient::ObjectDetectionResult](docs/ObjectDetectionResult.md)
|
171
178
|
- [CloudmersiveImageRecognitionApiClient::PersonWithAge](docs/PersonWithAge.md)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# CloudmersiveImageRecognitionApiClient::ImageSimilarityComparisonResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if successful, false otherwise | [optional]
|
7
|
+
**are_images_similar** | **BOOLEAN** | True if images are similar, false otherwise | [optional]
|
8
|
+
**image_similarity_score** | **Float** | Similarity score between 0.0 and 1.0, with 1.0 meaning highly similar and 0.0 meaning highly dissimilar | [optional]
|
9
|
+
|
10
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveImageRecognitionApiClient::ImageSimilarityHashDistanceRequest
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**image_hash1** | **String** | Image hash computed using Cloudmersive Image Hashing API | [optional]
|
7
|
+
**image_hash2** | **String** | Image hash computed using Cloudmersive Image Hashing API | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveImageRecognitionApiClient::ImageSimilarityHashDistanceResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if successful, false otherwise | [optional]
|
7
|
+
**image_similarity_score** | **Float** | Similarity score between 0.0 and 1.0, with 1.0 meaning highly similar and 0.0 meaning highly dissimilar | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveImageRecognitionApiClient::ImageSimilarityHashResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if successful, false otherwise | [optional]
|
7
|
+
**image_hash** | **String** | String representing image perceptual hash value; values with smaller Hamming Distances are more similar than ones with large Hamming Distances | [optional]
|
8
|
+
|
9
|
+
|
data/docs/RecognizeApi.md
CHANGED
@@ -12,6 +12,9 @@ Method | HTTP request | Description
|
|
12
12
|
[**recognize_detect_text_large**](RecognizeApi.md#recognize_detect_text_large) | **POST** /image/recognize/detect-text/large | Detect large text in a photo
|
13
13
|
[**recognize_detect_vehicle_license_plates**](RecognizeApi.md#recognize_detect_vehicle_license_plates) | **POST** /image/recognize/detect-vehicle-license-plates | Detect vehicle license plates in an image
|
14
14
|
[**recognize_find_symbol**](RecognizeApi.md#recognize_find_symbol) | **POST** /image/recognize/find/symbol | Find the location of a symbol in an image
|
15
|
+
[**recognize_similarity_compare**](RecognizeApi.md#recognize_similarity_compare) | **POST** /image/recognize/similarity/compare | Compare two images for similarity
|
16
|
+
[**recognize_similarity_hash**](RecognizeApi.md#recognize_similarity_hash) | **POST** /image/recognize/similarity/hash | Generate a perceptual image hash
|
17
|
+
[**recognize_similarity_hash_distance**](RecognizeApi.md#recognize_similarity_hash_distance) | **POST** /image/recognize/similarity/hash/distance | Calculates the similarity between two perceptual image hashes
|
15
18
|
|
16
19
|
|
17
20
|
# **recognize_describe**
|
@@ -453,3 +456,176 @@ Name | Type | Description | Notes
|
|
453
456
|
|
454
457
|
|
455
458
|
|
459
|
+
# **recognize_similarity_compare**
|
460
|
+
> String recognize_similarity_compare(base_image, comparison_image, opts)
|
461
|
+
|
462
|
+
Compare two images for similarity
|
463
|
+
|
464
|
+
Generates an image similarity score using Deep Learning between 0.0 and 1.0, values closer to 1.0 indicate greater similarity
|
465
|
+
|
466
|
+
### Example
|
467
|
+
```ruby
|
468
|
+
# load the gem
|
469
|
+
require 'cloudmersive-image-recognition-api-client'
|
470
|
+
# setup authorization
|
471
|
+
CloudmersiveImageRecognitionApiClient.configure do |config|
|
472
|
+
# Configure API key authorization: Apikey
|
473
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
474
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
475
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
476
|
+
end
|
477
|
+
|
478
|
+
api_instance = CloudmersiveImageRecognitionApiClient::RecognizeApi.new
|
479
|
+
|
480
|
+
base_image = File.new('/path/to/file.txt') # File | Image file to compare against. Common file formats such as PNG, JPEG are supported.
|
481
|
+
|
482
|
+
comparison_image = File.new('/path/to/file.txt') # File | Image to compare to the base image.
|
483
|
+
|
484
|
+
opts = {
|
485
|
+
recognition_mode: 'recognition_mode_example' # String | Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal.
|
486
|
+
}
|
487
|
+
|
488
|
+
begin
|
489
|
+
#Compare two images for similarity
|
490
|
+
result = api_instance.recognize_similarity_compare(base_image, comparison_image, opts)
|
491
|
+
p result
|
492
|
+
rescue CloudmersiveImageRecognitionApiClient::ApiError => e
|
493
|
+
puts "Exception when calling RecognizeApi->recognize_similarity_compare: #{e}"
|
494
|
+
end
|
495
|
+
```
|
496
|
+
|
497
|
+
### Parameters
|
498
|
+
|
499
|
+
Name | Type | Description | Notes
|
500
|
+
------------- | ------------- | ------------- | -------------
|
501
|
+
**base_image** | **File**| Image file to compare against. Common file formats such as PNG, JPEG are supported. |
|
502
|
+
**comparison_image** | **File**| Image to compare to the base image. |
|
503
|
+
**recognition_mode** | **String**| Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal. | [optional]
|
504
|
+
|
505
|
+
### Return type
|
506
|
+
|
507
|
+
**String**
|
508
|
+
|
509
|
+
### Authorization
|
510
|
+
|
511
|
+
[Apikey](../README.md#Apikey)
|
512
|
+
|
513
|
+
### HTTP request headers
|
514
|
+
|
515
|
+
- **Content-Type**: multipart/form-data
|
516
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
# **recognize_similarity_hash**
|
521
|
+
> ImageSimilarityHashResponse recognize_similarity_hash(image_file, opts)
|
522
|
+
|
523
|
+
Generate a perceptual image hash
|
524
|
+
|
525
|
+
Generates a hash value for the image; hash values that are closer together in terms of Hamming Distance are more similar.
|
526
|
+
|
527
|
+
### Example
|
528
|
+
```ruby
|
529
|
+
# load the gem
|
530
|
+
require 'cloudmersive-image-recognition-api-client'
|
531
|
+
# setup authorization
|
532
|
+
CloudmersiveImageRecognitionApiClient.configure do |config|
|
533
|
+
# Configure API key authorization: Apikey
|
534
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
535
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
536
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
537
|
+
end
|
538
|
+
|
539
|
+
api_instance = CloudmersiveImageRecognitionApiClient::RecognizeApi.new
|
540
|
+
|
541
|
+
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.
|
542
|
+
|
543
|
+
opts = {
|
544
|
+
recognition_mode: 'recognition_mode_example' # String | Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal.
|
545
|
+
}
|
546
|
+
|
547
|
+
begin
|
548
|
+
#Generate a perceptual image hash
|
549
|
+
result = api_instance.recognize_similarity_hash(image_file, opts)
|
550
|
+
p result
|
551
|
+
rescue CloudmersiveImageRecognitionApiClient::ApiError => e
|
552
|
+
puts "Exception when calling RecognizeApi->recognize_similarity_hash: #{e}"
|
553
|
+
end
|
554
|
+
```
|
555
|
+
|
556
|
+
### Parameters
|
557
|
+
|
558
|
+
Name | Type | Description | Notes
|
559
|
+
------------- | ------------- | ------------- | -------------
|
560
|
+
**image_file** | **File**| Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. |
|
561
|
+
**recognition_mode** | **String**| Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal. | [optional]
|
562
|
+
|
563
|
+
### Return type
|
564
|
+
|
565
|
+
[**ImageSimilarityHashResponse**](ImageSimilarityHashResponse.md)
|
566
|
+
|
567
|
+
### Authorization
|
568
|
+
|
569
|
+
[Apikey](../README.md#Apikey)
|
570
|
+
|
571
|
+
### HTTP request headers
|
572
|
+
|
573
|
+
- **Content-Type**: multipart/form-data
|
574
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
575
|
+
|
576
|
+
|
577
|
+
|
578
|
+
# **recognize_similarity_hash_distance**
|
579
|
+
> ImageSimilarityHashDistanceResponse recognize_similarity_hash_distance(request)
|
580
|
+
|
581
|
+
Calculates the similarity between two perceptual image hashes
|
582
|
+
|
583
|
+
Calculates the similarity between two perceptual image hashes by computing the Hamming Distance between them.
|
584
|
+
|
585
|
+
### Example
|
586
|
+
```ruby
|
587
|
+
# load the gem
|
588
|
+
require 'cloudmersive-image-recognition-api-client'
|
589
|
+
# setup authorization
|
590
|
+
CloudmersiveImageRecognitionApiClient.configure do |config|
|
591
|
+
# Configure API key authorization: Apikey
|
592
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
593
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
594
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
595
|
+
end
|
596
|
+
|
597
|
+
api_instance = CloudmersiveImageRecognitionApiClient::RecognizeApi.new
|
598
|
+
|
599
|
+
request = CloudmersiveImageRecognitionApiClient::ImageSimilarityHashDistanceRequest.new # ImageSimilarityHashDistanceRequest |
|
600
|
+
|
601
|
+
|
602
|
+
begin
|
603
|
+
#Calculates the similarity between two perceptual image hashes
|
604
|
+
result = api_instance.recognize_similarity_hash_distance(request)
|
605
|
+
p result
|
606
|
+
rescue CloudmersiveImageRecognitionApiClient::ApiError => e
|
607
|
+
puts "Exception when calling RecognizeApi->recognize_similarity_hash_distance: #{e}"
|
608
|
+
end
|
609
|
+
```
|
610
|
+
|
611
|
+
### Parameters
|
612
|
+
|
613
|
+
Name | Type | Description | Notes
|
614
|
+
------------- | ------------- | ------------- | -------------
|
615
|
+
**request** | [**ImageSimilarityHashDistanceRequest**](ImageSimilarityHashDistanceRequest.md)| |
|
616
|
+
|
617
|
+
### Return type
|
618
|
+
|
619
|
+
[**ImageSimilarityHashDistanceResponse**](ImageSimilarityHashDistanceResponse.md)
|
620
|
+
|
621
|
+
### Authorization
|
622
|
+
|
623
|
+
[Apikey](../README.md#Apikey)
|
624
|
+
|
625
|
+
### HTTP request headers
|
626
|
+
|
627
|
+
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
628
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
629
|
+
|
630
|
+
|
631
|
+
|
@@ -43,6 +43,10 @@ require 'cloudmersive-image-recognition-api-client/models/gender_detection_resul
|
|
43
43
|
require 'cloudmersive-image-recognition-api-client/models/image_description_response'
|
44
44
|
require 'cloudmersive-image-recognition-api-client/models/image_metadata'
|
45
45
|
require 'cloudmersive-image-recognition-api-client/models/image_metadata_exif_value'
|
46
|
+
require 'cloudmersive-image-recognition-api-client/models/image_similarity_comparison_response'
|
47
|
+
require 'cloudmersive-image-recognition-api-client/models/image_similarity_hash_distance_request'
|
48
|
+
require 'cloudmersive-image-recognition-api-client/models/image_similarity_hash_distance_response'
|
49
|
+
require 'cloudmersive-image-recognition-api-client/models/image_similarity_hash_response'
|
46
50
|
require 'cloudmersive-image-recognition-api-client/models/nsfw_result'
|
47
51
|
require 'cloudmersive-image-recognition-api-client/models/object_detection_result'
|
48
52
|
require 'cloudmersive-image-recognition-api-client/models/person_with_age'
|
@@ -469,5 +469,182 @@ module CloudmersiveImageRecognitionApiClient
|
|
469
469
|
end
|
470
470
|
return data, status_code, headers
|
471
471
|
end
|
472
|
+
# Compare two images for similarity
|
473
|
+
# Generates an image similarity score using Deep Learning between 0.0 and 1.0, values closer to 1.0 indicate greater similarity
|
474
|
+
# @param base_image Image file to compare against. Common file formats such as PNG, JPEG are supported.
|
475
|
+
# @param comparison_image Image to compare to the base image.
|
476
|
+
# @param [Hash] opts the optional parameters
|
477
|
+
# @option opts [String] :recognition_mode Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal.
|
478
|
+
# @return [String]
|
479
|
+
def recognize_similarity_compare(base_image, comparison_image, opts = {})
|
480
|
+
data, _status_code, _headers = recognize_similarity_compare_with_http_info(base_image, comparison_image, opts)
|
481
|
+
data
|
482
|
+
end
|
483
|
+
|
484
|
+
# Compare two images for similarity
|
485
|
+
# Generates an image similarity score using Deep Learning between 0.0 and 1.0, values closer to 1.0 indicate greater similarity
|
486
|
+
# @param base_image Image file to compare against. Common file formats such as PNG, JPEG are supported.
|
487
|
+
# @param comparison_image Image to compare to the base image.
|
488
|
+
# @param [Hash] opts the optional parameters
|
489
|
+
# @option opts [String] :recognition_mode Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal.
|
490
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
491
|
+
def recognize_similarity_compare_with_http_info(base_image, comparison_image, opts = {})
|
492
|
+
if @api_client.config.debugging
|
493
|
+
@api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_similarity_compare ...'
|
494
|
+
end
|
495
|
+
# verify the required parameter 'base_image' is set
|
496
|
+
if @api_client.config.client_side_validation && base_image.nil?
|
497
|
+
fail ArgumentError, "Missing the required parameter 'base_image' when calling RecognizeApi.recognize_similarity_compare"
|
498
|
+
end
|
499
|
+
# verify the required parameter 'comparison_image' is set
|
500
|
+
if @api_client.config.client_side_validation && comparison_image.nil?
|
501
|
+
fail ArgumentError, "Missing the required parameter 'comparison_image' when calling RecognizeApi.recognize_similarity_compare"
|
502
|
+
end
|
503
|
+
# resource path
|
504
|
+
local_var_path = '/image/recognize/similarity/compare'
|
505
|
+
|
506
|
+
# query parameters
|
507
|
+
query_params = {}
|
508
|
+
|
509
|
+
# header parameters
|
510
|
+
header_params = {}
|
511
|
+
# HTTP header 'Accept' (if needed)
|
512
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
513
|
+
# HTTP header 'Content-Type'
|
514
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
515
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
516
|
+
|
517
|
+
# form parameters
|
518
|
+
form_params = {}
|
519
|
+
form_params['baseImage'] = base_image
|
520
|
+
form_params['comparisonImage'] = comparison_image
|
521
|
+
|
522
|
+
# http body (model)
|
523
|
+
post_body = nil
|
524
|
+
auth_names = ['Apikey']
|
525
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
526
|
+
:header_params => header_params,
|
527
|
+
:query_params => query_params,
|
528
|
+
:form_params => form_params,
|
529
|
+
:body => post_body,
|
530
|
+
:auth_names => auth_names,
|
531
|
+
:return_type => 'String')
|
532
|
+
if @api_client.config.debugging
|
533
|
+
@api_client.config.logger.debug "API called: RecognizeApi#recognize_similarity_compare\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
534
|
+
end
|
535
|
+
return data, status_code, headers
|
536
|
+
end
|
537
|
+
# Generate a perceptual image hash
|
538
|
+
# Generates a hash value for the image; hash values that are closer together in terms of Hamming Distance are more similar.
|
539
|
+
# @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
540
|
+
# @param [Hash] opts the optional parameters
|
541
|
+
# @option opts [String] :recognition_mode Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal.
|
542
|
+
# @return [ImageSimilarityHashResponse]
|
543
|
+
def recognize_similarity_hash(image_file, opts = {})
|
544
|
+
data, _status_code, _headers = recognize_similarity_hash_with_http_info(image_file, opts)
|
545
|
+
data
|
546
|
+
end
|
547
|
+
|
548
|
+
# Generate a perceptual image hash
|
549
|
+
# Generates a hash value for the image; hash values that are closer together in terms of Hamming Distance are more similar.
|
550
|
+
# @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
551
|
+
# @param [Hash] opts the optional parameters
|
552
|
+
# @option opts [String] :recognition_mode Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal.
|
553
|
+
# @return [Array<(ImageSimilarityHashResponse, Fixnum, Hash)>] ImageSimilarityHashResponse data, response status code and response headers
|
554
|
+
def recognize_similarity_hash_with_http_info(image_file, opts = {})
|
555
|
+
if @api_client.config.debugging
|
556
|
+
@api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_similarity_hash ...'
|
557
|
+
end
|
558
|
+
# verify the required parameter 'image_file' is set
|
559
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
560
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_similarity_hash"
|
561
|
+
end
|
562
|
+
# resource path
|
563
|
+
local_var_path = '/image/recognize/similarity/hash'
|
564
|
+
|
565
|
+
# query parameters
|
566
|
+
query_params = {}
|
567
|
+
|
568
|
+
# header parameters
|
569
|
+
header_params = {}
|
570
|
+
# HTTP header 'Accept' (if needed)
|
571
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
572
|
+
# HTTP header 'Content-Type'
|
573
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
574
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
575
|
+
|
576
|
+
# form parameters
|
577
|
+
form_params = {}
|
578
|
+
form_params['imageFile'] = image_file
|
579
|
+
|
580
|
+
# http body (model)
|
581
|
+
post_body = nil
|
582
|
+
auth_names = ['Apikey']
|
583
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
584
|
+
:header_params => header_params,
|
585
|
+
:query_params => query_params,
|
586
|
+
:form_params => form_params,
|
587
|
+
:body => post_body,
|
588
|
+
:auth_names => auth_names,
|
589
|
+
:return_type => 'ImageSimilarityHashResponse')
|
590
|
+
if @api_client.config.debugging
|
591
|
+
@api_client.config.logger.debug "API called: RecognizeApi#recognize_similarity_hash\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
592
|
+
end
|
593
|
+
return data, status_code, headers
|
594
|
+
end
|
595
|
+
# Calculates the similarity between two perceptual image hashes
|
596
|
+
# Calculates the similarity between two perceptual image hashes by computing the Hamming Distance between them.
|
597
|
+
# @param request
|
598
|
+
# @param [Hash] opts the optional parameters
|
599
|
+
# @return [ImageSimilarityHashDistanceResponse]
|
600
|
+
def recognize_similarity_hash_distance(request, opts = {})
|
601
|
+
data, _status_code, _headers = recognize_similarity_hash_distance_with_http_info(request, opts)
|
602
|
+
data
|
603
|
+
end
|
604
|
+
|
605
|
+
# Calculates the similarity between two perceptual image hashes
|
606
|
+
# Calculates the similarity between two perceptual image hashes by computing the Hamming Distance between them.
|
607
|
+
# @param request
|
608
|
+
# @param [Hash] opts the optional parameters
|
609
|
+
# @return [Array<(ImageSimilarityHashDistanceResponse, Fixnum, Hash)>] ImageSimilarityHashDistanceResponse data, response status code and response headers
|
610
|
+
def recognize_similarity_hash_distance_with_http_info(request, opts = {})
|
611
|
+
if @api_client.config.debugging
|
612
|
+
@api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_similarity_hash_distance ...'
|
613
|
+
end
|
614
|
+
# verify the required parameter 'request' is set
|
615
|
+
if @api_client.config.client_side_validation && request.nil?
|
616
|
+
fail ArgumentError, "Missing the required parameter 'request' when calling RecognizeApi.recognize_similarity_hash_distance"
|
617
|
+
end
|
618
|
+
# resource path
|
619
|
+
local_var_path = '/image/recognize/similarity/hash/distance'
|
620
|
+
|
621
|
+
# query parameters
|
622
|
+
query_params = {}
|
623
|
+
|
624
|
+
# header parameters
|
625
|
+
header_params = {}
|
626
|
+
# HTTP header 'Accept' (if needed)
|
627
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
628
|
+
# HTTP header 'Content-Type'
|
629
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
630
|
+
|
631
|
+
# form parameters
|
632
|
+
form_params = {}
|
633
|
+
|
634
|
+
# http body (model)
|
635
|
+
post_body = @api_client.object_to_http_body(request)
|
636
|
+
auth_names = ['Apikey']
|
637
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
638
|
+
:header_params => header_params,
|
639
|
+
:query_params => query_params,
|
640
|
+
:form_params => form_params,
|
641
|
+
:body => post_body,
|
642
|
+
:auth_names => auth_names,
|
643
|
+
:return_type => 'ImageSimilarityHashDistanceResponse')
|
644
|
+
if @api_client.config.debugging
|
645
|
+
@api_client.config.logger.debug "API called: RecognizeApi#recognize_similarity_hash_distance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
646
|
+
end
|
647
|
+
return data, status_code, headers
|
648
|
+
end
|
472
649
|
end
|
473
650
|
end
|