Straightening thick lines while preserving content

Hi everyone!

I am sorry in advance if my question is too vague or already solved, but I found no ready solutions for this. I am also aware that this question is more about algorithm than about OpenCV, but I really do not know where to dig.

What I am trying to do is to straighten thick curved lines while preserving their content intact. For example, this may be applied to curved text lines, like those created by WordArt.

The expected result is a straightened text line.

There is some body of work to it, like this article. However, the authors are unclear about the most complex step - about straightening the thick line while preserving the letters intact.

I can see and implement the following steps:

  • Apply dilation to obtain a single contour for a single phrase;
  • Apply erosion to obtain a skeletonized image for a single phrase (a curve, basically);
  • Approximate curve to divide it into straight lines with a certain angles among them;

However, I cannot find a proper function/algorithm that could straighten the thick line. My tests indicate that affine and perspective transformations do not suit my needs and do not work on warped data. Something like defishing a fisheye might work, but it rely on camera calibration and I don’t think I can emulate such calibration to use defishing for my needs.

It seems that I am missing something. Could someone possibly give me a hint about algorithms for straightening or dewarping images based on data about angles/contours/edge points?

sounds like a remapping problem

please do not apply random unrelated tags. I have removed them.