class Gcp::Vision::Annotation

Attributes

annotations[R]

Public Class Methods

new(result) click to toggle source
# 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