Monday 27 August 2018

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 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:



example one



example two



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...