Search in sources :

Example 6 with LocalizedObjectAnnotation

use of com.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation in project java-vision by googleapis.

the class ITSystemTest method detectLocalizedObjectsTest.

@Test
public void detectLocalizedObjectsTest() throws IOException {
    List<AnnotateImageResponse> responses = getResponsesList("puppies.jpg", Type.OBJECT_LOCALIZATION, false);
    List<String> actual = new ArrayList<>();
    for (AnnotateImageResponse res : responses) {
        for (LocalizedObjectAnnotation entity : res.getLocalizedObjectAnnotationsList()) {
            actual.add(entity.getName());
        }
    }
    assertThat(actual).contains("Dog");
}
Also used : AnnotateImageResponse(com.google.cloud.vision.v1.AnnotateImageResponse) ArrayList(java.util.ArrayList) LocalizedObjectAnnotation(com.google.cloud.vision.v1.LocalizedObjectAnnotation) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)6 AnnotateImageResponse (com.google.cloud.vision.v1.AnnotateImageResponse)4 LocalizedObjectAnnotation (com.google.cloud.vision.v1.LocalizedObjectAnnotation)4 ByteString (com.google.protobuf.ByteString)4 AnnotateImageRequest (com.google.cloud.vision.v1.AnnotateImageRequest)2 BatchAnnotateImagesResponse (com.google.cloud.vision.v1.BatchAnnotateImagesResponse)2 Image (com.google.cloud.vision.v1.Image)2 ImageAnnotatorClient (com.google.cloud.vision.v1.ImageAnnotatorClient)2 AnnotateImageRequest (com.google.cloud.vision.v1p3beta1.AnnotateImageRequest)2 AnnotateImageResponse (com.google.cloud.vision.v1p3beta1.AnnotateImageResponse)2 BatchAnnotateImagesResponse (com.google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse)2 Image (com.google.cloud.vision.v1p3beta1.Image)2 ImageAnnotatorClient (com.google.cloud.vision.v1p3beta1.ImageAnnotatorClient)2 LocalizedObjectAnnotation (com.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation)2 FileInputStream (java.io.FileInputStream)2 Test (org.junit.Test)2 ImageSource (com.google.cloud.vision.v1.ImageSource)1 ImageSource (com.google.cloud.vision.v1p3beta1.ImageSource)1