Getting clean lines from a smudged image

@c_dottel

As @crackwitz said, you can use a thinning algorithm. There are two in the extra module.
https://docs.opencv.org/master/df/d2d/group__ximgproc.html#ga37002c6ca80c978edb6ead5d6b39740c

The optional third argument is the algorithm. Zhang-Suen is the default one, and a good choice.

You can also try Canny. It gets 1 pixel thin lines for edges. Canny won’t give you a line but the contour of the line. It uses two threshold you can play with.
https://docs.opencv.org/master/da/d22/tutorial_py_canny.html
image