Class: MicrosoftComputerVision::Client
- Inherits:
-
Object
- Object
- MicrosoftComputerVision::Client
- Defined in:
- lib/microsoft_computer_vision/client.rb
Constant Summary collapse
- API_BASE =
'https://api.projectoxford.ai/vision/v1.0'
Instance Method Summary collapse
- #analyze(image_path, options) ⇒ Object
- #describe(image_path, options) ⇒ Object
- #domain_model(image_path, options) ⇒ Object
- #domain_models ⇒ Object
-
#initialize(subscription_key) ⇒ Client
constructor
A new instance of Client.
- #ocr(image_path, options) ⇒ Object
- #tag(image_path) ⇒ Object
- #thumbnail(image_path, options) ⇒ Object
Constructor Details
#initialize(subscription_key) ⇒ Client
Returns a new instance of Client.
6 7 8 |
# File 'lib/microsoft_computer_vision/client.rb', line 6 def initialize(subscription_key) @subscription_key = subscription_key end |
Instance Method Details
#analyze(image_path, options) ⇒ Object
10 11 12 13 |
# File 'lib/microsoft_computer_vision/client.rb', line 10 def analyze(image_path, ) analyze = Api::Analyze.new([:visual_features], [:details]) post_image_path(analyze.uri, image_path) end |
#describe(image_path, options) ⇒ Object
15 16 17 18 |
# File 'lib/microsoft_computer_vision/client.rb', line 15 def describe(image_path, ) describe = Api::Describe.new([:max_candidates]) post_image_path(describe.uri, image_path) end |
#domain_model(image_path, options) ⇒ Object
30 31 32 33 |
# File 'lib/microsoft_computer_vision/client.rb', line 30 def domain_model(image_path, ) domain_model = Api::DomainModel.new([:model]) post_image_path(domain_model.uri, image_path) end |
#domain_models ⇒ Object
25 26 27 28 |
# File 'lib/microsoft_computer_vision/client.rb', line 25 def domain_models domain_models = Api::DomainModels.new() get(domain_models.uri, {}.to_json) end |
#ocr(image_path, options) ⇒ Object
35 36 37 38 |
# File 'lib/microsoft_computer_vision/client.rb', line 35 def ocr(image_path, ) ocr = Api::OCR.new([:language], [:detect_orientation]) post_image_path(ocr.uri, image_path) end |