Class: Google::Cloud::Vision::Annotation::CropHint
- Inherits:
 - 
      Object
      
        
- Object
 - Google::Cloud::Vision::Annotation::CropHint
 
 
- Defined in:
 - lib/google/cloud/vision/annotation/crop_hint.rb
 
Overview
CropHint
A single crop hint that is used to generate new crops when serving images.
Instance Method Summary collapse
- 
  
    
      #bounds  ⇒ Array<Vertex> 
    
    
  
  
  
  
  
  
  
  
  
    
The bounding polygon for the crop region.
 - 
  
    
      #confidence  ⇒ Float 
    
    
  
  
  
  
  
  
  
  
  
    
The confidence of this being a salient region.
 - 
  
    
      #importance_fraction  ⇒ Float 
    
    
  
  
  
  
  
  
  
  
  
    
The fraction of importance of this salient region with respect to the original image.
 - 
  
    
      #to_h  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    
Deeply converts object to a hash.
 
Instance Method Details
#bounds ⇒ Array<Vertex>
The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale.
      69 70 71 72 73 74  | 
    
      # File 'lib/google/cloud/vision/annotation/crop_hint.rb', line 69 def bounds return [] unless @grpc.bounding_poly @bounds ||= Array(@grpc.bounding_poly.vertices).map do |v| Vertex.from_grpc v end end  | 
  
#confidence ⇒ Float
The confidence of this being a salient region.
      81 82 83  | 
    
      # File 'lib/google/cloud/vision/annotation/crop_hint.rb', line 81 def confidence @grpc.confidence end  | 
  
#importance_fraction ⇒ Float
The fraction of importance of this salient region with respect to the original image.
      91 92 93  | 
    
      # File 'lib/google/cloud/vision/annotation/crop_hint.rb', line 91 def importance_fraction @grpc.importance_fraction end  | 
  
#to_h ⇒ Hash
Deeply converts object to a hash. All keys will be symbolized.
      100 101 102 103  | 
    
      # File 'lib/google/cloud/vision/annotation/crop_hint.rb', line 100 def to_h { bounds: bounds.map(&:to_h), confidence: confidence, importance_fraction: importance_fraction } end  |