Example #1
0
        public virtual async Task <IEnumerable <Rectangle> > ExtractFacesAsync()
        {
            FacesResponse ??= await _client.AnnotateAsync(new AnnotateImageRequest()
            {
                Image    = _image,
                Features =
                {
                    new Feature {
                        Type = Feature.Types.Type.FaceDetection
                    }
                }
            });

            return(ExtractFaces());
        }
Example #2
0
        public async Task <Vertex> SkipAdImageLocationAsync(string imageUri)
        {
            var image = await Image.FromFileAsync(imageUri);

            var req = new AnnotateImageRequest
            {
                Image    = image,
                Features = { new Feature {
                                 Type = Feature.Types.Type.DocumentTextDetection
                             } }
            };

            var resp = await _apiClient.AnnotateAsync(req);

            for (var i = 0; i < resp.TextAnnotations.Count - 1; ++i)
            {
                var annCurr = resp.TextAnnotations[i];
                var annNext = resp.TextAnnotations[i + 1];

                if (IsSkipAdSequence(annCurr.Description, annNext.Description))
                {
                    return(annCurr.BoundingPoly.Vertices.First());
                }
            }
            return(null);
        }