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: Create a Google Cloud Vision OCR Agent.
  
  Args:
      languages (:obj:`list`, optional):
          You can specify the language code of the documents to detect to improve
          accuracy. The supported language and their code can be found on `this page
          <https://cloud.google.com/vision/docs/languages>`_.
          Defaults to None.
  
      ocr_image_decode_type (:obj:`str`, optional):
          The format to convert the input image to before sending for GCV OCR.
          Defaults to `".png"`.
  
              * `".png"` is suggested as it does not compress the image.
              * But `".jpg"` could also be a good choice if the input image is very large.
docstr_tok: ["Create","a","Google","Cloud","Vision","OCR","Agent",".","Args",":","languages","(",":","obj",":","`","list","`",",","optional",")",":","You","can","specify","the","language","code","of","the","documents","to","detect","to","improve","accuracy",".","The","supported","language","and","their","code","can","be","found","on","`","this","page","<","https",":","\/\/cloud.google.com\/vision\/docs\/languages",">","`","_",".","Defaults","to","None",".","ocr_image_decode_type","(",":","obj",":","`","str","`",",","optional",")",":","The","format","to","convert","the","input","image","to","before","sending","for","GCV","OCR",".","Defaults","to","`","``",".png","''","`",".","*","`","``",".png","''","`","is","suggested","as","it","does","not","compress","the","image",".","*","But","`","``",".jpg","''","`","could","also","be","a","good","choice","if","the","input","image","is","very","large","."]
code: def __init__(self, languages=None, ocr_image_decode_type=".png"):
      """Create a Google Cloud Vision OCR Agent.
  
      Args:
          languages (:obj:`list`, optional):
              You can specify the language code of the documents to detect to improve
              accuracy. The supported language and their code can be found on `this page
              <https://cloud.google.com/vision/docs/languages>`_.
              Defaults to None.
  
          ocr_image_decode_type (:obj:`str`, optional):
              The format to convert the input image to before sending for GCV OCR.
              Defaults to `".png"`.
  
                  * `".png"` is suggested as it does not compress the image.
                  * But `".jpg"` could also be a good choice if the input image is very large.
      """
      try:
          self._client = _vision.ImageAnnotatorClient()
      except:
          warnings.warn(
              "The GCV credential has not been set. You could not run the detect command."
          )
      self._context = _vision.types.ImageContext(
          language_hints=languages
      )
      self.ocr_image_decode_type = ocr_image_decode_type
  
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 1 to create a new GCVAgent object from inherited base classes: BaseOCRAgent with example: obj = GCVAgent(languages, ocr_image_decode_type)