コード例 #1
0
        public async Task DetectImageProperties()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();

            Assert.Equal(s_allAnnotationsResponse.ImagePropertiesAnnotation, client.DetectImageProperties(s_allAnnotationsImage));
            Assert.Equal(s_allAnnotationsResponse.ImagePropertiesAnnotation, await client.DetectImagePropertiesAsync(s_allAnnotationsImage));
        }
コード例 #2
0
        public async Task DetectDocumentText()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();

            Assert.Equal(s_allAnnotationsResponse.FullTextAnnotation, client.DetectDocumentText(s_allAnnotationsImage));
            Assert.Equal(s_allAnnotationsResponse.FullTextAnnotation, await client.DetectDocumentTextAsync(s_allAnnotationsImage));
        }
コード例 #3
0
        public async Task DetectWebInformation()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();

            Assert.Equal(s_allAnnotationsResponse.WebDetection, client.DetectWebInformation(s_allAnnotationsImage));
            Assert.Equal(s_allAnnotationsResponse.WebDetection, await client.DetectWebInformationAsync(s_allAnnotationsImage));
        }
コード例 #4
0
        public async Task DetectSafeSearch()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();

            Assert.Equal(s_allAnnotationsResponse.SafeSearchAnnotation, client.DetectSafeSearch(s_allAnnotationsImage));
            Assert.Equal(s_allAnnotationsResponse.SafeSearchAnnotation, await client.DetectSafeSearchAsync(s_allAnnotationsImage));
        }
コード例 #5
0
        public async Task DetectFaces()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();
            var image = CreateFakeImage(s_allAnnotationsResponse);

            await AssertRepeatedAnnotation(client.DetectFaces, client.DetectFacesAsync, s_allAnnotationsResponse.FaceAnnotations);
        }
コード例 #6
0
        public async Task Annotate()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();
            var request = new AnnotateImageRequest
            {
                Image    = s_allAnnotationsImage,
                Features =
                {
                    new Feature {
                        Type = FeatureType.FaceDetection
                    },
                    new Feature {
                        Type = FeatureType.LogoDetection, MaxResults = 1
                    }
                }
            };
            var expectedResponse = new AnnotateImageResponse
            {
                FaceAnnotations = { s_allAnnotationsResponse.FaceAnnotations },
                LogoAnnotations = { s_allAnnotationsResponse.LogoAnnotations.Take(1) }
            };

            Assert.Equal(expectedResponse, client.Annotate(request));
            Assert.Equal(expectedResponse, await client.AnnotateAsync(request));
        }
コード例 #7
0
        public async Task DetectLandmarks()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();

            await AssertRepeatedAnnotation(client.DetectLandmarks, client.DetectLandmarksAsync, s_allAnnotationsResponse.LandmarkAnnotations);
        }
コード例 #8
0
        public async Task DetectText()
        {
            ImageAnnotatorClient client = new FakeImageAnnotator();

            await AssertRepeatedAnnotation(client.DetectText, client.DetectTextAsync, s_allAnnotationsResponse.TextAnnotations);
        }