Skeleton prunning for OCR

9 ビュー (過去 30 日間)
Radek
Radek 2015 年 5 月 13 日
コメント済み: Radek 2015 年 7 月 22 日
Hello, I am trying to make OCR algorithm for incomplete numbers. First step should be to reduce image to skeleton. This is done fine with Matlab function.
I have troubles at prunning stage i have tried this approach: http://www.mathworks.com/matlabcentral/answers/88284-remove-the-spurious-edge-of-skeleton
But it isn't reliable enough. and i can't run it twice because it would reduce image too much.
Which is way too complicated for me since i am under time pressure and this algorithm can't handle loops.
Are there any other ways already implemented?
I have to reduce skeleton to features which would consist of Branch points, end points and a few points i will describe.
  4 件のコメント
Radek
Radek 2015 年 5 月 13 日
Thank you very much, I appreciate you time and effort.
Radek
Radek 2015 年 5 月 13 日
And to make myself sure, I rather add original image

サインインしてコメントする。

採用された回答

Brett Shoelson
Brett Shoelson 2015 年 5 月 15 日
編集済み: Brett Shoelson 2015 年 5 月 18 日
Hi Radek, I have some thoughts to share that might be useful. First, recognize that you get different output from infinite thinning than from infinite skeletonization. (bwmorph(bw, 'skeleton', Inf) vs bwmorph(bw, 'thin', Inf) ), and that the latter might give you a better starting point for your training. (You might not even have spurs to worry about.)
Second, regardless of which thinning approach you start with, if you calculate a bwdistgeodesic transform on your thinned bw image--using a mask that is true at all of the endpoints and false elsewhere--the longest constrained path will be the one that contains the maximum value in transformed image. You can reconstruct that spur-less path by tracing along that path, keeping only largest neighbors. (Spurs will necessarily have smaller distance values.)
I have attached a bit of code that will recreate that path from the original binary image. It runs (including the thinning) on the screen capture of your image of a "one" in about 2 msec.
Cheers, Brett
  1 件のコメント
Radek
Radek 2015 年 6 月 1 日
Hi Brett, thank you very much for your cooperation. I tried to use your method, which is very good for simple characters as the one above, but when i used it for looped numbers (0,6,4,8,9), there is selected only part of the loop like this:
Often it is also confused by short distance between two brachpoints like this:
I am also posting original pictures for your consideration.
Are there any ways i can change this method to solve these issues?

サインインしてコメントする。

その他の回答 (1 件)

Brett Shoelson
Brett Shoelson 2015 年 6 月 5 日
Radek: yes, the longest-constrained-path approach I gave you is indeed confounded by loops. On the other hand, did you try infinite thinning instead of infinite skeletonization? I think it might just give you what you're looking for without any subsequent morphological manipulations. Brett
  1 件のコメント
Radek
Radek 2015 年 7 月 22 日
Thank you Brett! Your solution was in the end what i was looking for.

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by