无法准确检测血管

时间:2018-10-16 18:17:09

标签: python python-3.x python-2.7 opencv scikit-image

OpenCV或Skimage中是否有任何功能可以准确地找到细血管,或者建议执行什么操作?因为与地面真实图像相比,我的分割图像具有更少的细节。

import cv2 as cv
import numpy as np

img = cv.imread('dataset.tif')
cv.imshow('Input Image',img)

b,g,r= cv.split(img)
cv.imshow('Red Channel',r)
cv.imshow('Green Channel',g)
cv.imshow('Blue Channel',b)
img2= cv.bitwise_not(g)
cv.imshow('Processed Image',img2)

kernel3 = cv.getStructuringElement(cv.MORPH_ELLIPSE,(13,13))

tophat = cv.morphologyEx(img2, cv.MORPH_TOPHAT, kernel3)
cv.imshow('Top hat',tophat)

thres= 12
maxValue = 255
ret,thresh41 = cv.threshold(tophat,thres, maxValue,cv.THRESH_TOZERO)
th, dat = cv.threshold(tophat, thres, maxValue, cv.THRESH_BINARY)
cv.imshow('thresh',dat)
kernel1 = cv.getStructuringElement(cv.MORPH_ELLIPSE,(2,2))
dilation = cv.dilate(dat,kernel1,iterations = 1)
erosion = cv.erode(dilation,kernel1,iterations = 1)
erosion1=cv.GaussianBlur(erosion,(5,5),0)
erosion1=cv.blur(erosion,(5,5),0)
x=cv.subtract(dilation,erosion1)
x = cv.medianBlur(x,5)
cv.imshow("op1",x)
b2=cv.add(erosion,x)
cv.imshow("fin",b2)
#dilation2 = cv.dilate(b2,kernel1,iterations = 1)
output=cv.erode(b2,kernel1,iterations=1)
cv.imshow("Result image",output)


cv.waitKey(0)
cv.destroyAllWindows()

分段血管:Segmented blood vessel

真实背景图片:Ground truth image

0 个答案:

没有答案