如何在Python中锐化然后细化手写数字的图像?

时间:2016-03-19 11:51:42

标签: python image-processing scipy scikit-image

原始图片:

Original Image

代码:

image = skimage.img_as_float(original_image) # datattype of original image is uint8
blurred_image = filters.gaussian_filter(image, 3)    
filter_blurred_image = filters.gaussian_filter(blurred_image,1)
alpha = 30
sharpened = blurred_image + alpha * (blurred_image - filter_blurred_image)

original_image数组:https://drive.google.com/file/d/0B2EliTzXsTI3VFJHVVgxTHl6UTg/view?usp=sharing

上面的代码给出了与我预期不同的结果: enter image description here

我想要锐化它然后"瘦"线条,以便我可以检测到它的终点。

2 个答案:

答案 0 :(得分:2)

如果你想图像,那就skimage.morphology.skeletonize

答案 1 :(得分:2)

来自@evbr的

imshow(skimage.morphology.skeletonize(load('image.npy')>128),cm.Greys,interpolation='none')

for:

skeleton 9