Class: CognitiveVision::ImageFeatures

Inherits:
Object
  • Object
show all
Defined in:
lib/cognitive_vision/image_features.rb

Constant Summary collapse

ANALYZERS =
{
  adult:       ImageFeature::Adult.new,
  categories:  ImageFeature::Category.new,
  description: ImageFeature::Description.new,
  faces:       ImageFeature::Face.new,
  tags:        ImageFeature::Tag.new
}

Instance Method Summary collapse

Constructor Details

#initialize(features) ⇒ ImageFeatures

Returns a new instance of ImageFeatures.



11
12
13
# File 'lib/cognitive_vision/image_features.rb', line 11

def initialize(features)
  @features = [features].flatten
end

Instance Method Details

#analyzersObject



19
20
21
# File 'lib/cognitive_vision/image_features.rb', line 19

def analyzers
  ANALYZERS.map{ |feature, analyzer| analyzer if @features.include?(feature) }.reject(&:nil?)
end

#features_stringObject



15
16
17
# File 'lib/cognitive_vision/image_features.rb', line 15

def features_string
  @features.join(',')
end