class CloudmersiveImageRecognitionApiClient::RecognizeApi
Attributes
Public Class Methods
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Describe an image in natural language Generate an English language text description of the image as a sentence. @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 [ImageDescriptionResponse]
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 27 def recognize_describe(image_file, opts = {}) data, _status_code, _headers = recognize_describe_with_http_info(image_file, opts) data end
Describe an image in natural language Generate an English language text description of the image as a sentence. @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<(ImageDescriptionResponse
, Fixnum, Hash)>] ImageDescriptionResponse
data, response status code and response headers
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 37 def recognize_describe_with_http_info(image_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_describe ...' end # verify the required parameter 'image_file' is set if @api_client.config.client_side_validation && image_file.nil? fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_describe" end # resource path local_var_path = '/image/recognize/describe' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['imageFile'] = image_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ImageDescriptionResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: RecognizeApi#recognize_describe\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Detect and unskew a photo of a document Detect and unskew a photo of a document (e.g. taken on a cell phone) into a perfectly square image. Great for document scanning applications; once unskewed, this image is perfect for converting to PDF using the Convert API or optical character recognition using the OCR API. @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 @option opts [String] :post_processing_effect Optional, post-processing effects to apply to the email, default is None. Possible values are None and BlackAndWhite (force the image into a black and white view to aid in OCR operations). @return [String]
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 83 def recognize_detect_and_unskew_document(image_file, opts = {}) data, _status_code, _headers = recognize_detect_and_unskew_document_with_http_info(image_file, opts) data end
Detect and unskew a photo of a document Detect and unskew a photo of a document (e.g. taken on a cell phone) into a perfectly square image. Great for document scanning applications; once unskewed, this image is perfect for converting to PDF using the Convert API or optical character recognition using the OCR API. @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 @option opts [String] :post_processing_effect Optional, post-processing effects to apply to the email, default is None. Possible values are None and BlackAndWhite (force the image into a black and white view to aid in OCR operations). @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 94 def recognize_detect_and_unskew_document_with_http_info(image_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_detect_and_unskew_document ...' end # verify the required parameter 'image_file' is set if @api_client.config.client_side_validation && image_file.nil? fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_detect_and_unskew_document" end # resource path local_var_path = '/image/recognize/detect-document/unskew' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) header_params[:'PostProcessingEffect'] = opts[:'post_processing_effect'] if !opts[:'post_processing_effect'].nil? # form parameters form_params = {} form_params['imageFile'] = image_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: RecognizeApi#recognize_detect_and_unskew_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Detect objects including types and locations in an image Identify the position, size and description of objects in an image, along with a recognition confidence level. Detects both human people and objects in an image. @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 [ObjectDetectionResult]
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 140 def recognize_detect_objects(image_file, opts = {}) data, _status_code, _headers = recognize_detect_objects_with_http_info(image_file, opts) data end
Detect objects including types and locations in an image Identify the position, size and description of objects in an image, along with a recognition confidence level. Detects both human people and objects in an image. @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<(ObjectDetectionResult
, Fixnum, Hash)>] ObjectDetectionResult
data, response status code and response headers
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 150 def recognize_detect_objects_with_http_info(image_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_detect_objects ...' end # verify the required parameter 'image_file' is set if @api_client.config.client_side_validation && image_file.nil? fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_detect_objects" end # resource path local_var_path = '/image/recognize/detect-objects' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['imageFile'] = image_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ObjectDetectionResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: RecognizeApi#recognize_detect_objects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Detect people including locations in an image Identify the position, and size of human people in an image, along with a recognition confidence level. People in the image do NOT need to be facing the camera; they can be facing away, edge-on, etc. @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 [ObjectDetectionResult]
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 195 def recognize_detect_people(image_file, opts = {}) data, _status_code, _headers = recognize_detect_people_with_http_info(image_file, opts) data end
Detect people including locations in an image Identify the position, and size of human people in an image, along with a recognition confidence level. People in the image do NOT need to be facing the camera; they can be facing away, edge-on, etc. @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<(ObjectDetectionResult
, Fixnum, Hash)>] ObjectDetectionResult
data, response status code and response headers
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 205 def recognize_detect_people_with_http_info(image_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_detect_people ...' end # verify the required parameter 'image_file' is set if @api_client.config.client_side_validation && image_file.nil? fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_detect_people" end # resource path local_var_path = '/image/recognize/detect-people' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['imageFile'] = image_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ObjectDetectionResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: RecognizeApi#recognize_detect_people\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Detect fine text in a photo of a document Identify the position, and size of small/fine text within a photograph of a document. Identify the location of small text in a photo - such as words and other forms of high density text. Can be used on a scan of a document or a photograph (e.g. smartphone camera) of a document, page or receipt. For OCR purposes - please see our Deep Learning OCR APIs. @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 [FineTextDetectionResult]
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 250 def recognize_detect_text_fine(image_file, opts = {}) data, _status_code, _headers = recognize_detect_text_fine_with_http_info(image_file, opts) data end
Detect fine text in a photo of a document Identify the position, and size of small/fine text within a photograph of a document. Identify the location of small text in a photo - such as words and other forms of high density text. Can be used on a scan of a document or a photograph (e.g. smartphone camera) of a document, page or receipt. For OCR purposes - please see our Deep Learning OCR APIs. @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<(FineTextDetectionResult
, Fixnum, Hash)>] FineTextDetectionResult
data, response status code and response headers
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 260 def recognize_detect_text_fine_with_http_info(image_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_detect_text_fine ...' end # verify the required parameter 'image_file' is set if @api_client.config.client_side_validation && image_file.nil? fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_detect_text_fine" end # resource path local_var_path = '/image/recognize/detect-text/fine' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['imageFile'] = image_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'FineTextDetectionResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: RecognizeApi#recognize_detect_text_fine\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Detect large text in a photo Identify the position, and size of large text within a photograph. Identify the location of large text in a photo - such as signs, titles, etc. and other forms of large, low-density text. Not suitable for high-density text (e.g. scans of documents, receipts, etc.) for OCR purposes - for OCR, please see our Deep Learning OCR APIs. @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 [TextDetectionResult]
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 305 def recognize_detect_text_large(image_file, opts = {}) data, _status_code, _headers = recognize_detect_text_large_with_http_info(image_file, opts) data end
Detect large text in a photo Identify the position, and size of large text within a photograph. Identify the location of large text in a photo - such as signs, titles, etc. and other forms of large, low-density text. Not suitable for high-density text (e.g. scans of documents, receipts, etc.) for OCR purposes - for OCR, please see our Deep Learning OCR APIs. @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<(TextDetectionResult
, Fixnum, Hash)>] TextDetectionResult
data, response status code and response headers
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 315 def recognize_detect_text_large_with_http_info(image_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_detect_text_large ...' end # verify the required parameter 'image_file' is set if @api_client.config.client_side_validation && image_file.nil? fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_detect_text_large" end # resource path local_var_path = '/image/recognize/detect-text/large' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['imageFile'] = image_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'TextDetectionResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: RecognizeApi#recognize_detect_text_large\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Detect vehicle license plates in an image Identify the position, and size, and content of vehicle license plates in an image. License plates should be within 15-20 degrees on-axis to the camera. Supported image formats are JPG, PNG and BMP. @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 [VehicleLicensePlateDetectionResult]
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 360 def recognize_detect_vehicle_license_plates(image_file, opts = {}) data, _status_code, _headers = recognize_detect_vehicle_license_plates_with_http_info(image_file, opts) data end
Detect vehicle license plates in an image Identify the position, and size, and content of vehicle license plates in an image. License plates should be within 15-20 degrees on-axis to the camera. Supported image formats are JPG, PNG and BMP. @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<(VehicleLicensePlateDetectionResult
, Fixnum, Hash)>] VehicleLicensePlateDetectionResult
data, response status code and response headers
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 370 def recognize_detect_vehicle_license_plates_with_http_info(image_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_detect_vehicle_license_plates ...' end # verify the required parameter 'image_file' is set if @api_client.config.client_side_validation && image_file.nil? fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_detect_vehicle_license_plates" end # resource path local_var_path = '/image/recognize/detect-vehicle-license-plates' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['imageFile'] = image_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'VehicleLicensePlateDetectionResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: RecognizeApi#recognize_detect_vehicle_license_plates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Find the location of a symbol in an image Determine if an image contains a symbol, and if so, the location of that symbol in the image. @param input_image Image file to search through for the target image. @param target_image Image to find in the input image. @param [Hash] opts the optional parameters @return [FindSymbolResult]
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 416 def recognize_find_symbol(input_image, target_image, opts = {}) data, _status_code, _headers = recognize_find_symbol_with_http_info(input_image, target_image, opts) data end
Find the location of a symbol in an image Determine if an image contains a symbol, and if so, the location of that symbol in the image. @param input_image Image file to search through for the target image. @param target_image Image to find in the input image. @param [Hash] opts the optional parameters @return [Array<(FindSymbolResult
, Fixnum, Hash)>] FindSymbolResult
data, response status code and response headers
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 427 def recognize_find_symbol_with_http_info(input_image, target_image, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_find_symbol ...' end # verify the required parameter 'input_image' is set if @api_client.config.client_side_validation && input_image.nil? fail ArgumentError, "Missing the required parameter 'input_image' when calling RecognizeApi.recognize_find_symbol" end # verify the required parameter 'target_image' is set if @api_client.config.client_side_validation && target_image.nil? fail ArgumentError, "Missing the required parameter 'target_image' when calling RecognizeApi.recognize_find_symbol" end # resource path local_var_path = '/image/recognize/find/symbol' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['inputImage'] = input_image form_params['targetImage'] = target_image # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'FindSymbolResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: RecognizeApi#recognize_find_symbol\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Compare two images for similarity Generates an image similarity score using Deep Learning between 0.0 and 1.0, values closer to 1.0 indicate greater similarity @param base_image Image file to compare against. Common file formats such as PNG, JPEG are supported. @param comparison_image Image to compare to the base image. @param [Hash] opts the optional parameters @option opts [String] :recognition_mode Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal. @return [String]
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 479 def recognize_similarity_compare(base_image, comparison_image, opts = {}) data, _status_code, _headers = recognize_similarity_compare_with_http_info(base_image, comparison_image, opts) data end
Compare two images for similarity Generates an image similarity score using Deep Learning between 0.0 and 1.0, values closer to 1.0 indicate greater similarity @param base_image Image file to compare against. Common file formats such as PNG, JPEG are supported. @param comparison_image Image to compare to the base image. @param [Hash] opts the optional parameters @option opts [String] :recognition_mode Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal. @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 491 def recognize_similarity_compare_with_http_info(base_image, comparison_image, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_similarity_compare ...' end # verify the required parameter 'base_image' is set if @api_client.config.client_side_validation && base_image.nil? fail ArgumentError, "Missing the required parameter 'base_image' when calling RecognizeApi.recognize_similarity_compare" end # verify the required parameter 'comparison_image' is set if @api_client.config.client_side_validation && comparison_image.nil? fail ArgumentError, "Missing the required parameter 'comparison_image' when calling RecognizeApi.recognize_similarity_compare" end # resource path local_var_path = '/image/recognize/similarity/compare' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil? # form parameters form_params = {} form_params['baseImage'] = base_image form_params['comparisonImage'] = comparison_image # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: RecognizeApi#recognize_similarity_compare\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Generate a perceptual image hash Generates a hash value for the image; hash values that are closer together in terms of Hamming Distance are more similar. @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 @option opts [String] :recognition_mode Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal. @return [ImageSimilarityHashResponse]
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 543 def recognize_similarity_hash(image_file, opts = {}) data, _status_code, _headers = recognize_similarity_hash_with_http_info(image_file, opts) data end
Calculates the similarity between two perceptual image hashes Calculates the similarity between two perceptual image hashes by computing the Hamming Distance between them. @param request @param [Hash] opts the optional parameters @return [ImageSimilarityHashDistanceResponse]
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 600 def recognize_similarity_hash_distance(request, opts = {}) data, _status_code, _headers = recognize_similarity_hash_distance_with_http_info(request, opts) data end
Calculates the similarity between two perceptual image hashes Calculates the similarity between two perceptual image hashes by computing the Hamming Distance between them. @param request @param [Hash] opts the optional parameters @return [Array<(ImageSimilarityHashDistanceResponse
, Fixnum, Hash)>] ImageSimilarityHashDistanceResponse
data, response status code and response headers
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 610 def recognize_similarity_hash_distance_with_http_info(request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_similarity_hash_distance ...' end # verify the required parameter 'request' is set if @api_client.config.client_side_validation && request.nil? fail ArgumentError, "Missing the required parameter 'request' when calling RecognizeApi.recognize_similarity_hash_distance" end # resource path local_var_path = '/image/recognize/similarity/hash/distance' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(request) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ImageSimilarityHashDistanceResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: RecognizeApi#recognize_similarity_hash_distance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Generate a perceptual image hash Generates a hash value for the image; hash values that are closer together in terms of Hamming Distance are more similar. @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 @option opts [String] :recognition_mode Optional, specify the recognition mode; possible values are Normal, Basic and Advanced. Default is Normal. @return [Array<(ImageSimilarityHashResponse
, Fixnum, Hash)>] ImageSimilarityHashResponse
data, response status code and response headers
# File lib/cloudmersive-image-recognition-api-client/api/recognize_api.rb, line 554 def recognize_similarity_hash_with_http_info(image_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RecognizeApi.recognize_similarity_hash ...' end # verify the required parameter 'image_file' is set if @api_client.config.client_side_validation && image_file.nil? fail ArgumentError, "Missing the required parameter 'image_file' when calling RecognizeApi.recognize_similarity_hash" end # resource path local_var_path = '/image/recognize/similarity/hash' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil? # form parameters form_params = {} form_params['imageFile'] = image_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ImageSimilarityHashResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: RecognizeApi#recognize_similarity_hash\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end