Class: Gcp::Vision::Annotation
- Inherits:
-
Object
- Object
- Gcp::Vision::Annotation
- Defined in:
- lib/gcp/vision/annotation.rb
Defined Under Namespace
Classes: ImageProperty, Label
Instance Attribute Summary collapse
-
#annotations ⇒ Object
readonly
Returns the value of attribute annotations.
Instance Method Summary collapse
-
#initialize(result) ⇒ Annotation
constructor
A new instance of Annotation.
Constructor Details
#initialize(result) ⇒ Annotation
Returns a new instance of Annotation.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gcp/vision/annotation.rb', line 6 def initialize(result) @annotations = {} result.each do |type, annotations| @annotations[type] = case type when "labelAnnotations" annotations.map { |annotation| Gcp::Vision::Annotation::Label.new(annotation) } when "imagePropertiesAnnotation" annotations["dominantColors"]["colors"].map { |annotation| Gcp::Vision::Annotation::ImageProperty.new(annotation) } else annotations end end end |
Instance Attribute Details
#annotations ⇒ Object (readonly)
Returns the value of attribute annotations.
4 5 6 |
# File 'lib/gcp/vision/annotation.rb', line 4 def annotations @annotations end |