Ask Your Question

Revision history [back]

You don't have to rebuild to use it. You can simply pip install contrib with: pip install opencv-contrib-python. Then you can simply use zhang-suen thinning implementation like this:

image = cv2.imread("opencv.png")
thinned = cv2.ximgproc.thinning(cv2.cvtColor(image, cv2.COLOR_RGB2GRAY))

If you plot the image before and after you get something like this:

image description