Closed skylord123 closed 6 years ago
If the bounding box X/Y is undefined then assume 0 (I believe google drops the key if value is zero for some reason).
Fixes #6
Found this stackoverflow question that answered it: https://stackoverflow.com/questions/39378862/incomplete-coordinate-values-for-google-vision-ocr
Example of missing bounding box keys (that made the code fail for me on several PDF files):
{ "locale": "en", "description": "<text removed>", "boundingPoly": { "vertices": [ { "x": 194 }, { "x": 1333 }, { "x": 1333, "y": 1835 }, { "x": 194, "y": 1835 } ] } },
This is the first item in textAnnotations which means it is the full page text.
textAnnotations
Thank you for your patch. Good work ! I have to fix my C version gcv2hocr.....
If the bounding box X/Y is undefined then assume 0 (I believe google drops the key if value is zero for some reason).
Fixes #6
Found this stackoverflow question that answered it: https://stackoverflow.com/questions/39378862/incomplete-coordinate-values-for-google-vision-ocr
Example of missing bounding box keys (that made the code fail for me on several PDF files):
This is the first item in
textAnnotations
which means it is the full page text.