Class: Google::Cloud::Vision::Annotation
- Inherits:
 - 
      Object
      
        
- Object
 - Google::Cloud::Vision::Annotation
 
 
- Defined in:
 - lib/google/cloud/vision/annotation.rb,
lib/google/cloud/vision/annotation/face.rb,
lib/google/cloud/vision/annotation/text.rb,
lib/google/cloud/vision/annotation/entity.rb,
lib/google/cloud/vision/annotation/vertex.rb,
lib/google/cloud/vision/annotation/properties.rb,
lib/google/cloud/vision/annotation/safe_search.rb 
Overview
Defined Under Namespace
Classes: Entity, Face, Properties, SafeSearch, Text, Vertex
Instance Method Summary collapse
- 
  
    
      #face  ⇒ Face 
    
    
  
  
  
  
  
  
  
  
  
    
The first face result, if there is one.
 - 
  
    
      #face?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
Whether there is at least one result from face detection.
 - 
  
    
      #faces  ⇒ Array<Face> 
    
    
  
  
  
  
  
  
  
  
  
    
The results of face detection.
 - 
  
    
      #label  ⇒ Entity 
    
    
  
  
  
  
  
  
  
  
  
    
The first label result, if there is one.
 - 
  
    
      #label?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
Whether there is at least one result from label detection.
 - 
  
    
      #labels  ⇒ Array<Entity> 
    
    
  
  
  
  
  
  
  
  
  
    
The results of label detection.
 - 
  
    
      #landmark  ⇒ Entity 
    
    
  
  
  
  
  
  
  
  
  
    
The first landmark result, if there is one.
 - 
  
    
      #landmark?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
Whether there is at least one result from landmark detection.
 - 
  
    
      #landmarks  ⇒ Array<Entity> 
    
    
  
  
  
  
  
  
  
  
  
    
The results of landmark detection.
 - 
  
    
      #logo  ⇒ Entity 
    
    
  
  
  
  
  
  
  
  
  
    
The first logo result, if there is one.
 - 
  
    
      #logo?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
Whether there is at least one result from logo detection.
 - 
  
    
      #logos  ⇒ Array<Entity> 
    
    
  
  
  
  
  
  
  
  
  
    
The results of logo detection.
 - 
  
    
      #properties  ⇒ Properties 
    
    
  
  
  
  
  
  
  
  
  
    
The results of properties detection.
 - 
  
    
      #properties?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
Whether there is a result for properties detection.
 - 
  
    
      #safe_search  ⇒ SafeSearch 
    
    
  
  
  
  
  
  
  
  
  
    
The results of safe_search detection.
 - 
  
    
      #safe_search?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
Whether there is a result for safe_search detection.
 - 
  
    
      #text  ⇒ Text 
    
    
  
  
  
  
  
  
  
  
  
    
The results of text (OCR) detection.
 - 
  
    
      #text?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
Whether there is a result from text (OCR) detection.
 - 
  
    
      #to_h  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    
Deeply converts object to a hash.
 
Instance Method Details
#face ⇒ Face
The first face result, if there is one.
      89 90 91  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 89 def face faces.first end  | 
  
#face? ⇒ Boolean
Whether there is at least one result from face detection.
      107 108 109  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 107 def face? faces.count > 0 end  | 
  
#faces ⇒ Array<Face>
The results of face detection.
      69 70 71 72 73  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 69 def faces @faces ||= Array(@grpc.face_annotations).map do |fa| Face.from_grpc fa end end  | 
  
#label ⇒ Entity
The first label result, if there is one.
      262 263 264  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 262 def label labels.first end  | 
  
#label? ⇒ Boolean
Whether there is at least one result from label detection. detection.
      281 282 283  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 281 def label? labels.count > 0 end  | 
  
#labels ⇒ Array<Entity>
The results of label detection.
      242 243 244 245 246  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 242 def labels @labels ||= Array(@grpc.label_annotations).map do |lb| Entity.from_grpc lb end end  | 
  
#landmark ⇒ Entity
The first landmark result, if there is one.
      146 147 148  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 146 def landmark landmarks.first end  | 
  
#landmark? ⇒ Boolean
Whether there is at least one result from landmark detection. detection.
      165 166 167  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 165 def landmark? landmarks.count > 0 end  | 
  
#landmarks ⇒ Array<Entity>
The results of landmark detection.
      126 127 128 129 130  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 126 def landmarks @landmarks ||= Array(@grpc.landmark_annotations).map do |lm| Entity.from_grpc lm end end  | 
  
#logo ⇒ Entity
The first logo result, if there is one.
      204 205 206  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 204 def logo logos.first end  | 
  
#logo? ⇒ Boolean
Whether there is at least one result from logo detection. detection.
      223 224 225  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 223 def logo? logos.count > 0 end  | 
  
#logos ⇒ Array<Entity>
The results of logo detection.
      184 185 186 187 188  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 184 def logos @logos ||= Array(@grpc.logo_annotations).map do |lg| Entity.from_grpc lg end end  | 
  
#properties ⇒ Properties
The results of properties detection.
      373 374 375 376 377  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 373 def properties return nil unless @grpc.image_properties_annotation @properties ||= Properties.from_grpc( @grpc.image_properties_annotation) end  | 
  
#properties? ⇒ Boolean
Whether there is a result for properties detection.
      393 394 395  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 393 def properties? !properties.nil? end  | 
  
#safe_search ⇒ SafeSearch
The results of safe_search detection.
      335 336 337 338  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 335 def safe_search return nil unless @grpc.safe_search_annotation @safe_search ||= SafeSearch.from_grpc(@grpc.safe_search_annotation) end  | 
  
#safe_search? ⇒ Boolean
Whether there is a result for safe_search detection. detection.
      355 356 357  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 355 def safe_search? !safe_search.nil? end  | 
  
#text ⇒ Text
The results of text (OCR) detection.
      299 300 301  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 299 def text @text ||= Text.from_grpc(@grpc.text_annotations) end  | 
  
#text? ⇒ Boolean
Whether there is a result from text (OCR) detection.
      317 318 319  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 317 def text? !text.nil? end  | 
  
#to_h ⇒ Hash
Deeply converts object to a hash. All keys will be symbolized.
      402 403 404 405 406 407  | 
    
      # File 'lib/google/cloud/vision/annotation.rb', line 402 def to_h { faces: faces.map(&:to_h), landmarks: landmarks.map(&:to_h), logos: logos.map(&:to_h), labels: labels.map(&:to_h), text: text.map(&:to_h), safe_search: safe_search.to_h, properties: properties.to_h } end  |