我正在尝试分割包含DNA链的AFM图像。在下图中,您可以看到原始图像、分割图像和骨骼化版本。。我想知道如何改进我的分割,以便我右边的图像包含更少的小分支,或者同样地,中间的图像有更清晰的边缘和轮廓。
作为参考,这是我的代码:
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
目前没有回答
相关问题 更多 >
编程相关推荐