class_docstr: A wrapper for `Google Cloud Vision (GCV) <https://cloud.google.com/vision>`_ Text
  Detection APIs.
  
  Note:
      Google Cloud Vision API returns the output text in two types:
  
      * `text_annotations`:
  
          In this format, GCV automatically find the best aggregation
          level for the text, and return the results in a list. We use
          :obj:`~gather_text_annotations` to reterive this type of
          information.
  
      * `full_text_annotation`:
  
          To support better user control, GCV also provides the
          `full_text_annotation` output, where it returns the hierarchical
          structure of the output text. To process this output, we provide
          the :obj:`~gather_full_text_annotation` function to aggregate the
          texts of the given aggregation level.
class_docstr_tok: ["A","wrapper","for","`","Google","Cloud","Vision","(","GCV",")","<","https",":","\/\/cloud.google.com\/vision",">","`","_","Text","Detection","APIs",".","Note",":","Google","Cloud","Vision","API","returns","the","output","text","in","two","types",":","*","`","text_annotations","`",":","In","this","format",",","GCV","automatically","find","the","best","aggregation","level","for","the","text",",","and","return","the","results","in","a","list",".","We","use",":","obj",":","`","~gather_text_annotations","`","to","reterive","this","type","of","information",".","*","`","full_text_annotation","`",":","To","support","better","user","control",",","GCV","also","provides","the","`","full_text_annotation","`","output",",","where","it","returns","the","hierarchical","structure","of","the","output","text",".","To","process","this","output",",","we","provide","the",":","obj",":","`","~gather_full_text_annotation","`","function","to","aggregate","the","texts","of","the","given","aggregation","level","."]
docstr: Convert the text_annotations from GCV output to an :obj:`Layout` object.
  
  Args:
      response (:obj:`AnnotateImageResponse`):
          The returned Google Cloud Vision AnnotateImageResponse object.
  
  Returns:
      :obj:`Layout`: The reterived layout from the response.
docstr_tok: ["Convert","the","text_annotations","from","GCV","output","to","an",":","obj",":","`","Layout","`","object",".","Args",":","response","(",":","obj",":","`","AnnotateImageResponse","`",")",":","The","returned","Google","Cloud","Vision","AnnotateImageResponse","object",".","Returns",":",":","obj",":","`","Layout","`",":","The","reterived","layout","from","the","response","."]
code: def gather_text_annotations(response):
      """Convert the text_annotations from GCV output to an :obj:`Layout` object.
  
      Args:
          response (:obj:`AnnotateImageResponse`):
              The returned Google Cloud Vision AnnotateImageResponse object.
  
      Returns:
          :obj:`Layout`: The reterived layout from the response.
      """
  
      # The 0th element contains all texts
      doc = response.text_annotations[1:]
      gathered_text = Layout()
  
      for i, text_comp in enumerate(doc):
          points = _cvt_GCV_vertices_to_points(
              text_comp.bounding_poly.vertices
          )
          gathered_text.append(
              TextBlock(
                  block=Quadrilateral(points),
                  text=text_comp.description,
                  id=i,
              )
          )
  
      return gathered_text
  
imports: import io
  import os
  import json
  import warnings
  import numpy
  from cv2 import imencode
  from .base import BaseOCRAgent, BaseOCRElementType
  from ..elements import Layout, TextBlock, Quadrilateral, TextBlock
  from ..file_utils import is_gcv_available
label_desc: Use image node_id 5 for calling the GCVAgent obj's underlying member method code with example usage: obj.gather_text_annotations(response) and returns: gathered_text