-
I want to save bounding box coordinates of highlighted text how can I save them |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 23 replies
-
Hi @hammadyounas2008 👋 Would you mind getting a bit more specific? I think you asked the same question in #561 and I provided an answer. Please check the discussions & issues to see if there is an answer to your question before posting it 🙏 If I'm mistaking, please provide more details: python code snippet that you used, what you expect (a saved file locally, a python dict?) |
Beta Was this translation helpful? Give feedback.
-
For anyone looking for the answer, here is the snippet from the other thread starting from the predictor result: # Everything to produce the result goes here
# ...
export = result.export()
# Flatten the export
page_words = [[word for block in page['blocks'] for line in block['lines'] for word in line['words']] for page in export['pages']]
page_dims = [page['dimensions'] for page in export['pages']]
# Get the coords in [xmin, ymin, xmax, ymax]
words_abs_coords = [
[[int(round(word['geometry'][0][0] * dims[1])), int(round(word['geometry'][0][1] * dims[0])), int(round(word['geometry'][1][0] * dims[1])), int(round(word['geometry'][1][1] * dims[0]))] for word in words]
for words, dims in zip(page_words, page_dims)
] |
Beta Was this translation helpful? Give feedback.
-
Hello @fg-mindee, Thank you for your great work. I am simply retrieving a lot of images from folder and apply OCR model to detect all text in an image and save into the another folder. I am getting strange behavior after OCR detection the image is same in another folder and there is not detected part in an image. Code
|
Beta Was this translation helpful? Give feedback.
For anyone looking for the answer, here is the snippet from the other thread starting from the predictor result: