I am trying to implement Cloud Vision API (TEXT_DETECTION) and I want to get all texts and it's vertices positions from image. Here is an example:
I want to get 4 "objects". One, Two, Three and Four with vertices positions.
Here is the response part of my code:
final TextAnnotation text = batchResponse.getResponses()
.get(0).getFullTextAnnotation();
I can then get such information as:
text.getPages().get(0).getBlocks().get(0).getParagraphs().get(0).getWords().get(0).getSymbols().get(0)
However it seems really complex. How to get these data?
PS. Here is my full code:
Feature desiredFeature = new Feature();
desiredFeature.setType("TEXT_DETECTION");
AnnotateImageRequest request = new AnnotateImageRequest();
request.setImage(inputImage);
request.setFeatures(Arrays.asList(desiredFeature));
BatchAnnotateImagesRequest batchRequest =
new BatchAnnotateImagesRequest();
batchRequest.setRequests(Arrays.asList(request));
BatchAnnotateImagesResponse batchResponse =
vision.images().annotate(batchRequest).execute();
final TextAnnotation text = batchResponse.getResponses()
.get(0).getFullTextAnnotation();