如何改善细胞核的分割?

问题描述

我刚刚开始学习python中的opencv和图像分析。我想分割以下核的图像(DropBox链接)。对于某些原子核,它是细分的,对于某些原子核,它是细分的。有什么办法可以改善管道?任何帮助将是可观的。 https://www.dropbox.com/s/av238k79858hsw3/c48bit.tiff?dl=0

我尝试了以下代码

# original code https://github.com/bnsreenu/python_for_microscopists/tree/master/other_files https://www.youtube.com/watch?v=AsTvGxuiqKs
import cv2
import numpy as np
from matplotlib import pyplot as plt
from scipy import ndimage
from skimage import measure,color,io
img = cv2.imread("c48bit.tiff")
cells=img[:,:,0]  
pixels_to_um = 0.454 
ret1,thresh = cv2.threshold(cells,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
kernel = np.ones((3,3),np.uint8)
opening = cv2.morphologyEx(thresh,cv2.MORPH_OPEN,kernel,iterations = 2)
from skimage.segmentation import clear_border
opening = clear_border(opening) 
sure_bg = cv2.dilate(opening,iterations=10)
dist_transform = cv2.distanceTransform(opening,cv2.disT_L2,5)
print(dist_transform.max()) 
ret2,sure_fg = cv2.threshold(dist_transform,0.01*dist_transform.max(),0)
sure_fg = np.uint8(sure_fg)
unkNown = cv2.subtract(sure_bg,sure_fg)
ret3,markers = cv2.connectedComponents(sure_fg)
markers = markers+10
markers[unkNown==255] = 0
markers = cv2.watershed(img,markers)
img[markers == -1] = [0,255]  
img2 = color.label2rgb(markers,bg_label=0)
cv2.imwrite('overlay.png',img)

enter image description here

解决方法

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

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

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