I need to perform an OCR analysis on an image for an university project.
I am imposed to use PHP, unfortunately, on the Google Cloud Vision Documentation few are the code sample using PHP...
I succeed to perform OCR on one image at time but 80% of the time I have a lot of images (around 20) to treat at once.
So I tried to use BatchRequest, to minimize the API calls, as specified here but I can't found how to build the $requests
array they put at the top.
Btw I tried other APIs like Tesseract but the recognition is not accurate enough to use.
If you only want to perform a batch request you can just use
batchAnnotateImages
usingImageAnnotatorClient
. Below you can find a sample using it as well as a way to create arequest
variable. Also, I include below aasyncBatchAnnotateImages
sample but I recommend the one I mentioned earlier.Using ImageAnnotatorClient with batchAnnotateImages
Using ImageAnnotatorClient with asyncBatchAnnotateImages
Note: To add on this, you can also check an official implementation of a similar case using vision client on this link but its a sample to detect text on a pdf file.
You can also find additional information on these links: