对眼底图像中心区进行血管的检测。用了HoughLinesP()直线检测法,附上执行时的三张图
代码如下:
# 分离出 图像中心的绿色通道
img_ori = cv2.imread('./dataset/1.jpg')
img_resized = cv2.resize(img_ori, (width, height), interpolation=cv2.INTER_CUBIC)
cv2.imshow('resize', img_resized )
b,g,r = cv2.split(img_resized)
# 进行 CLAHE 处理,提取绿色通道
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))
img_clahe_green = clahe.apply(g)
cv2.imshow('green', img_clahe_green)
# 检测图像绿色通道中的血管,画直线
line_detect_possible(img_clahe_green ,11)
--------下面是血管检测函数 ------------------------
在整图中提取各小窗口的图像,用HoughLinesP()来检测小窗口的直线,然后在整图中画出来,
比在整图中用HoughLinesP()检测效果好。
def line_detect_possible(img_src,size):
width = img_src.shape[0]
height = img_src.shape[1]
gaus = cv2.GaussianBlur(img_src, (3