如何从图像中提取出光滑的骨架?

问题描述

我正在尝试分割包含DNA链的AFM图像。在下面的图像中,您可以看到原始图像,分段图像和框架化版本。

Left: Original image,middle: segmented image,right: skeletonized image

。我不知道如何改善分割效果,以使右侧的图像包含较少的小分支,或者以相同的标记使中间的图像具有更清晰定义的边缘和轮廓。

供参考,这是我的代码

from skimage.morphology import remove_small_objects,dilation
from skimage.segmentation import clear_border
from skimage.filters import unsharp_mask,threshold_triangle,difference_of_gaussians
from skimage import exposure
import numpy as np

def preprocess_img(image,rescaling=False,sharpening=False):
    
    if rescaling: # rescale the intensity of the pixel values
        p2,p99 = np.percentile(image,(2,99))
        image = exposure.rescale_intensity(image,out_range=(p2,p99))
            
    if sharpening and rescaling:
        image = unsharp_mask(image)
    
    thresh = threshold_triangle(image) # apply threshold
    mask = image > thresh
    mask = remove_small_objects(mask > 0)
    mask = dilation(mask)
    mask = clear_border(mask) # remove image border artifacts
    return mask 

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)