public void DetectWebInformation()
        {
            Image image = LoadResourceImage("SchmidtBrinPage.jpg");
            // Snippet: DetectWebInformation
            ImageAnnotatorClient client       = ImageAnnotatorClient.Create();
            WebDetection         webDetection = client.DetectWebInformation(image);

            foreach (WebDetection.Types.WebImage webImage in webDetection.FullMatchingImages)
            {
                Console.WriteLine($"Full image: {webImage.Url} ({webImage.Score})");
            }
            foreach (WebDetection.Types.WebImage webImage in webDetection.PartialMatchingImages)
            {
                Console.WriteLine($"Partial image: {webImage.Url} ({webImage.Score})");
            }
            foreach (WebDetection.Types.WebPage webPage in webDetection.PagesWithMatchingImages)
            {
                Console.WriteLine($"Page with matching image: {webPage.Url} ({webPage.Score})");
            }
            foreach (WebDetection.Types.WebEntity entity in webDetection.WebEntities)
            {
                Console.WriteLine($"Web entity: {entity.EntityId} / {entity.Description} ({entity.Score})");
            }
            // End snippet
        }
Example #2
0
        public void GetWeb(string imageFile, string extension)
        {
            WebDetection webDetection = clientGoogle.DetectWebInformation(Image.FromBytes(ImageConverter.Base64ToByte(imageFile.Replace($"data:image/{extension};base64,", ""))));

            foreach (WebDetection.Types.WebEntity entity in webDetection.WebEntities)
            {
                Console.WriteLine($"Web entity: {entity.EntityId} / {entity.Description} ({entity.Score})");
            }
        }
Example #3
0
        private void ExecuteProcessCommand(object obj)
        {
            var image = Google.Cloud.Vision.V1.Image.FromFile(Image);

            var documentText = _client.DetectDocumentText(image, _imageContext);
            var detection    = _client.DetectWebInformation(image, _imageContext);
            var text         = _client.DetectText(image, _imageContext);

            var label = detection.BestGuessLabels.FirstOrDefault().Label.ToUpper();

            Detector mainDetector = new Detector(documentText.Text.ToUpper(), label, detection, text);
            var      document     = mainDetector.Execute();

            DocumentType = document.Type.ToString();
            DocumentData = document.ToString();

            OnPropertyChanged("DocumentData");
            OnPropertyChanged("DocumentType");
        }