Advertisement

二值图像骨架提取

阅读量:

采用Python的skimage库中提供的morphology模块进行处理,其效果并不理想。计划在明日尝试引入其他算法以进行进一步的测试与验证。

复制代码
 # 骨架提取 效果不好。

    
 path = 'F:/0/'
    
 files = os.listdir(path)
    
 for i in range(len(files)):
    
     print(files[i])
    
     file = Image.open(path+files[i])
    
     f = file.convert('L')
    
     if i == 36:
    
     f.save('F:/10.jpg')
    
     array = np.array(f)
    
     x = array.shape[0]
    
     y = array.shape[1]
    
     # 黑白反色
    
     for m in range(x):
    
     for n in range(y):
    
         if array[m][n] == 0:
    
             array[m][n] = 1
    
         else:
    

全部评论 (0)

还没有任何评论哟~