Given a list of image urls I want to annotate each image, i.e. extract text from each image. For that, I want to use Google Cloud Vision API client library in Java. Here is my pseudocode:
List<String> imageUrls = ...;
List<AnnotateImageRequest> requests = imageUrls.stream()
.map(convertToRequest)
.collect(Collectors::toList);
BatchAnnotateImagesResponse batchResponse = imageAnnotatorClient.batchAnnotateImages(requests);
Now from batchResponse I can get a list of AnnotateImageResponse. The questions are, does the number of AnnotateImageResponse correspond to the number of requests? Does the order of responses correspond to the order of requests? Can I safely assume that by doing so
for (int i = 0 ; i < imageUrls.size(); i++) {
var url = imageUrls.get(i);
var annotations = batchResponse.getResponses(i).getTextAnnotationsList();
}
I will get annotations for the right image on each iteration of the for loop? This is something that is not clear to me from the documentation.