ReceiptManager / receipt-parser-legacy

A supermarket receipt parser written in Python using tesseract OCR

Home Page:https://tech.trivago.com/2015/10/06/python_receipt_parser/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Switch to ImageMagick auto-orient instead of a hard coded 90 degree rotation

bram-atmire opened this issue · comments

Switch to ImageMagick auto-orient instead of a hard coded 90 degree rotation

Sorry, after trying this out, it seems to be a stupid idea. This relies on orientation attributes being present in the file, but if they are not there, auto orient doesn't really help.

Still, it would be nice to have some kind of an auto-orientation solution, instead of relying on all images being presented in the same orientation.

Hehe, no worries. If we find a good heuristic to auto-rotate the receipts, we can add it.
Will keep that open for the time being.

This is over a year old, but what about doing a basic text recognition on the image, rotating it 90 degrees and doing again until the receipt has been scanned in all 4 orientations, then just take whichever orientation had the highest recognized words?

If this sounds like a reasonable enough solution I'd be happy to look into implementing it.

Some thoughts:

  • The runtime would be four times as long. Don't think it's a deal breaker, but it's something to be aware of.
  • The text recognition might be false positives because the date- and price recognition are based on regular expressions that could detect matches for different rotations.

Both points might be non-issues. We could just try, I guess.

An alternative might be to start with making the rotation configurable. It might even serve as a basis for future work: if there is no rotation given in the config, we can use the rotation heuristic you describe.
Does that make sense? Would you be interested in working on that?