Skip to content

How to return aligned properly text from skewed image? #1810

Answered by felixdittrich92
VMM-MMV asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @VMM-MMV 👋,

You can pass some args to the ocr_predictor to reach this:

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 ou…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by VMM-MMV
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants