How to return aligned properly text from skewed image? #1810
-
Beta Was this translation helpful? Give feedback.
Answered by
felixdittrich92
Dec 3, 2024
Replies: 2 comments
-
Hi @VMM-MMV 👋, You can pass some args to the predictor = ocr_predictor(
pretrained=True,
# Document related parameters
assume_straight_pages=False,
straighten_pages=True, # This corrects deskew under the hood
export_as_straight_boxes=True,
detect_orientation=True,
# Orientation specific parameters in combination with `assume_straight_pages=False` and/or `straighten_pages=True`
disable_crop_orientation=True, # Should be False if words inside the doc are multi-oriented
disable_page_orientation=True, # Should be False if the doc is possible more than (-45 - 45 degree rotated)
) The corrected images can be grabbed from the output result = predictor(doc)
# list of numpy arrays containing the corrected images
corrected_images = [page.page for page in result.pages] Best, |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
VMM-MMV
-
Thank You! straighten_pages=True solved the issue. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @VMM-MMV 👋,
You can pass some args to the
ocr_predictor
to reach this:The corrected images can be grabbed from the ou…