public virtual IEnumerable <Rectangle> ExtractText() { TextResponse ??= _client.Annotate(new AnnotateImageRequest() { Image = _image, Features = { new Feature { Type = Feature.Types.Type.TextDetection } } }); // filter text annotations that contains line breaks, this is probably the first one covering the whole image return(TextResponse.TextAnnotations.Where(t => !t.Description.Contains("\n")) .Select(t => GoogleVisionCoordinateTranslator.AbsolutePolyToRectangle(t.BoundingPoly))); }
public virtual IEnumerable <Rectangle> ExtractFaces() { FacesResponse ??= _client.Annotate(new AnnotateImageRequest() { Image = _image, Features = { new Feature { Type = Feature.Types.Type.FaceDetection } } }); return(FacesResponse.FaceAnnotations .Select(f => GoogleVisionCoordinateTranslator.AbsolutePolyToRectangle(f.BoundingPoly)) .Select(f => GoogleVisionCoordinateTranslator.RotateRectangle(f, _rotationToApplyForFaceProcessing, Width, Height))); }