Friday 3 November 2017

node.js - How to select lines to find receipt with Hough transform?

I'm working in a code to crop a receipt from an image. I'm
developing the solution in javascript with the "opencv4nodejs" module, but I'm used to
Python and C++.



I've seen different methods like
href="https://www.pyimagesearch.com/2014/09/01/build-kick-ass-mobile-document-scanner-just-5-minutes/"
rel="nofollow noreferrer">this, but this solution doesn't work in noisy
backgrounds and if the contour detected is not continuous. So I decided to make a code
with the Hough Transform.



The algorithm is:
image > grayscale > gaussian blur > dilate > canny > Hough
Probabilistic.



In some images I have a good
result, I just need to filter the best lines to get the 4 corners and crop the image. In
others I have a lot of noise. How can I filter the lines to best fit the
receipt?



Here are some examples of
images:




href="https://i.stack.imgur.com/qCiCA.jpg" rel="nofollow noreferrer"> src="https://i.stack.imgur.com/qCiCA.jpg" alt="example
one">



href="https://i.stack.imgur.com/aWGbY.jpg" rel="nofollow noreferrer"> src="https://i.stack.imgur.com/aWGbY.jpg" alt="example
two">



href="https://i.stack.imgur.com/vc560.jpg" rel="nofollow noreferrer"> src="https://i.stack.imgur.com/vc560.jpg" alt="example
three">

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...