Ask Your Question
0

How to do skeletonization for this image [closed]

asked 2017-12-27 21:23:28 -0600

NirvanaDon gravatar image

updated 2017-12-27 21:49:02 -0600

Hey guys, im trying to do skeletonization for this image using python 3.6.3 opencv.

image description

I'm hoping to use Guo-hall or Zhang-Suen thinning algorithms to skeletonize this image. Please advice me for python(3.6.3) opencv.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by NirvanaDon
close date 2017-12-29 02:27:52.645091

Comments

Which version of opencv? And do you have the contrib modules installed?

Tetragramm gravatar imageTetragramm ( 2017-12-28 00:38:25 -0600 )edit

@Tetragramm hey im using opencv 3.3.1 , No im very new to using python.. I only have numpy and opencv2 installed.

NirvanaDon gravatar imageNirvanaDon ( 2017-12-28 00:47:39 -0600 )edit

Very simple!

from skimage.morphology import skeletonize

But please pay attention to this, the input parameter should be either 0 or 1, so you should do it like this:

ske = (skeletonize(thr_img//255) * 255).astype(np.uint8)

moHe gravatar imagemoHe ( 2017-12-29 01:42:43 -0600 )edit

@moHe thank you! i finally got it to work! You save me from many headaches!!!

NirvanaDon gravatar imageNirvanaDon ( 2017-12-29 02:01:51 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-12-28 03:13:46 -0600

LBerger gravatar image

You can use thinning algorithm in ximgproc. You will have to compile opencv_extra sync with opencv

edit flag offensive delete link more

Comments

Sorry, i don't quite understand. I am new to python.. please advice me. Do i need to add extra whl for my python in order to use thinning algorithm in xmingproc?

NirvanaDon gravatar imageNirvanaDon ( 2017-12-28 03:53:15 -0600 )edit

you will need opencv_contrib package or you have to build opencv and opencv_contrib and install in your python version

LBerger gravatar imageLBerger ( 2017-12-28 05:42:52 -0600 )edit

Either the opencv_contrib package from your package manager, or you need to follow the appropriate tutorial HERE. You also need to include the opencv_contrib package in the build. When you download the source, there's a README file that explains how to do it, linked HERE.

Tetragramm gravatar imageTetragramm ( 2017-12-28 11:21:28 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-12-27 21:23:28 -0600

Seen: 7,100 times

Last updated: Dec 28 '17