imageimage-processingocrandroid-image

Auto-cropping image with detection of crop-lines


I am working on a project, which is an Android app that uses camera to capture a photo of a ticket and does OCR recognition for only a part of it. I have no previous experience of image processing, but I know it must be some kind of tricky way, because Android applications have small RAM limits.

Below, I attach image before any processing:

enter image description here

My aim is to automatically detect these lines of (---) and crop it so that the final image look like this one:

enter image description here

What's more - it's important to stay open-source and do it without sending photos to an external image processing service.


Solution

  • You can try using Hough Transform to find the lines. OpenCV has a implementation that is open source and works on Android.

    HoughLineP is a very efficient Version of the HoughTransform to find Line Segments.