def detect_crop_hints(self, aspect_ratios=None, limit=10): """Detect crop hints in image. :type aspect_ratios: list :param aspect_ratios: (Optional) List of floats i.e. 4/3 == 1.33333. A maximum of 16 aspect ratios can be given. :type limit: int :param limit: (Optional) The number of crop hints to detect. :rtype: list :returns: List of :class:`~google.cloud.vision.crop_hint.CropHints`. """ feature_type = image_annotator_pb2.Feature.CROP_HINTS feature = image_annotator_pb2.Feature(type=feature_type, max_results=limit) image = _to_gapic_image(self) crop_hints_params = image_annotator_pb2.CropHintsParams( aspect_ratios=aspect_ratios) image_context = image_annotator_pb2.ImageContext( crop_hints_params=crop_hints_params) request = image_annotator_pb2.AnnotateImageRequest( image=image, features=[feature], image_context=image_context) annotations = self._detect_annotation_from_pb([request]) return annotations[0].crop_hints
def detect_full_text(self, language_hints=None, limit=10): """Detect a full document's text. :type language_hints: list :param language_hints: (Optional) A list of BCP-47 language codes. See https://cloud.google.com/vision/docs/languages :type limit: int :param limit: (Optional) The number of documents to detect. :rtype: list :returns: List of :class:`~google.cloud.vision.text.TextAnnotation`. """ feature_type = image_annotator_pb2.Feature.DOCUMENT_TEXT_DETECTION feature = image_annotator_pb2.Feature(type=feature_type, max_results=limit) image = _to_gapic_image(self) image_context = image_annotator_pb2.ImageContext( language_hints=language_hints) request = image_annotator_pb2.AnnotateImageRequest( image=image, features=[feature], image_context=image_context) annotations = self._detect_annotation_from_pb([request]) return annotations[0].full_texts
def _call_fut(self, image): from google.cloud.vision._gax import _to_gapic_image return _to_gapic_image(image)
def _call_fut(self, image): from google.cloud.vision._gax import _to_gapic_image return _to_gapic_image(image)