There are samples here [1] and here [2] to get you started. The paper is here: [3]
---
[0] http://docs.opencv.org/3.0-beta/modules/text/doc/erfilter.ht...
[1] https://github.com/Itseez/opencv_contrib/blob/master/modules...
[2] https://github.com/Itseez/opencv_contrib/blob/master/modules...
[3] http://cmp.felk.cvut.cz/~neumalu1/neumann-cvpr2012.pdf