Additionaly to question Identifying and removing features from scanned handwriten text, I'm looking for procedure suggestion that will identify only the lines of text like from image But problem is that sometimes lines can be skewed (borders of image (paper) are not skewed, lines only). The purpose is to identify start and end center positions (according to height of line) for each line (lengths and skewnes). Because, in other part of text there are shorter lines, that must be identified, and separated from long ones (but this is my problem for which I hope I have solution). I experimented with ImageLines on binarized image, but results are not satisfying.

  • 1
    $\begingroup$ I think a line detection based on Radon could work nicely. E.g. in ImageAdjust@Radon[ImageRotate[ImageAdjust@ColorNegate@ImageResize[ColorConvert[Import["http://i.stack.imgur.com/uRUEw.jpg"],"Grayscale"],512],\[Pi]/2]] the three brightest spots correspond to the three text lines, parametrized with angle and distance from center. $\endgroup$ – Thies Heidecke Jul 17 '16 at 9:42
  • 1
    $\begingroup$ I think the standard way to do this is to find the spanning tree of the image components (as I've done here: mathematica.stackexchange.com/a/91727/242) - the majority of edges in that tree will be aligned with the text, so you can just remove outliers and take the mean direction from the other edges. Alternatively, you could try estimating the angle using an FFT (see here: stackoverflow.com/questions/33698068/align-text-for-ocr/…) $\endgroup$ – Niki Estner Jul 17 '16 at 20:27
  • $\begingroup$ @nikie, your usage of trees is very inspiring for me, and can be very useful. Maybe you have idea how to apply method of sums by x, and finding peaks, but in case when part of image with lines is skewed. How to find skew angle, and apply sumation appropriate. Maximizing peaks is point in that case. $\endgroup$ – Dragutin Jul 18 '16 at 21:34

Your Answer

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

Browse other questions tagged or ask your own question.