Segmentation of warped text lines
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