在弱光图像中应用高斯模糊和Canny边缘检测后的白线检测

问题描述

我有两张图像,一张很亮,边缘检测效果很好,白线清晰可见。

还有另一幅图像是在黑暗中用弱光拍摄的,白线很淡,几乎看不见。

原始图片

弱光:

enter image description here

好光:

enter image description here

Canny Edge Detection

弱光

enter image description here

好光

enter image description here

我可以对这两个图像应用什么图像过滤器,以便对这两个图像都检测到白线。我尝试了灰度和高斯模糊,然后进行了Canny边缘检测,但是效果不佳

我的代码

img = mpimg.imread(filenm)

# first convert to grayscale
grayscale = cv2.cvtColor(img,cv2.COLOR_RGB2GRAY)

#apply gaussian blur before canny edge detection
kernel_size=125
gaussian_blurred = cv2.GaussianBlur(grayscale,(kernel_size,kernel_size),0)

# Canny edge detection threshold ratio 1:3
low_threshold = 50
high_threshold = 150
edges = cv2.Canny(gaussian_blurred,low_threshold,high_threshold)


plt.imshow(edges,cmap='Greys_r')

解决方法

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

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

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