0
$\begingroup$

I am trying to segment warped text lines found in photos taken from a page of a book (from the camera of a smartphone). This is meant as a preprocessing step before running OCR on them.

I have found two relevant papers on this:

https://sites.google.com/a/iupr.com/bukhari/home/papers/Bukhari-Coupled-Snakelets-IJDAR12.pdf?attredirects=0

https://www.researchgate.net/profile/Rafael_Lins/publication/221000335_An_Efficient_Algorithm_for_Segmenting_Warped_Text-Lines_in_Document_Images/links/0fcfd5063a49cc779c000000.pdf?origin=publication_detail

I read the papers but they're too hard to implement, can anyone help?

Example input no.1:

Example input no.2:

$\endgroup$
  • $\begingroup$ What do you mean with "too hard to implement"? Explain what you're having problems with specifically; that will possibly make it possible for us to help. $\endgroup$ – Marcus Müller Dec 18 '16 at 23:29
  • $\begingroup$ Too hard for me (as I am a newbie coder). If anyone is willing to give it a go, it would be greatly appreciated! $\endgroup$ – John Dec 19 '16 at 3:10
  • $\begingroup$ Check out the section on running average binarization in Gonzalez and Woods, assumes your goal is to render the characters black on a white background as a preprocessing step. $\endgroup$ – Rethunk Jun 4 '17 at 13:07
0
$\begingroup$

Your question is very broad and I won't go read the papers and implement it for you. If you could show specific problems, we might help you better (or the guys at stackoverflow for programming questions).

Meanwhile, you can have a look at these two resources, which treat a similar problem, including some code:

http://www.pyimagesearch.com/2014/09/01/build-kick-ass-mobile-document-scanner-just-5-minutes/

https://mzucker.github.io/2016/08/15/page-dewarping.html

$\endgroup$
0
$\begingroup$

Your images are quite nice and clean, so it may be possible to do segment the letters using a single function on MATLAB. In fact this is the kind of image which MATLAB uses as examples in its documentation for this function, imbinarize.

Try reading the image in and running this line of code
bin = ~imbinarize(im, 'adaptive', 'ForegroundPolarity', 'dark');
where im is the image matrix (converted to grayscale) and bin is your output binary image (~ inverts the image, making the letters white)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.