The four-point perspective transformation sometimes does more harm than good, especially when the receipt isn't cut precisely. In this example, the OCR mostly fails due to the transformation distorting the contents.
Would it be possible to modify the transformation to ignore those small imperfections?
Alternatively, would it be possible to crop the image based on color instead, e.g. use a black backdrop when scanning / taking a picture and then automatically crop that black backdrop?
Receipt:

Outline:

The four-point perspective transformation sometimes does more harm than good, especially when the receipt isn't cut precisely. In this example, the OCR mostly fails due to the transformation distorting the contents.
Would it be possible to modify the transformation to ignore those small imperfections?
Alternatively, would it be possible to crop the image based on color instead, e.g. use a black backdrop when scanning / taking a picture and then automatically crop that black backdrop?
Receipt:

Outline:
