问题描述
我正在研究Canny Edge检测器。我有一些代码允许使用3个参数的canny输出。输入是文件,下限因子(sig1),上限因子(sig2)。效果很好:
def auto_canny(image,sig1,sig2):
med = np.median(image)
lower = int(max(0,(1.0 - sig1) * med))
upper = int(min(255,(1.0 + sig2) * med))
edged = cv2.Canny(image,lower,upper)
return edged
我想做的是有一个单独的程序,将这些程序的输出打印出来。例如,使用sig1和sig2的5x5的值分别为0.0、0.2、0.4、0.6和0.8。这是我目前正在使用的:
def canny_image(file):
gray = cv2.imread(file,0) #Don't need this if its a grayscale image
blurred = cv2.GaussianBlur(gray,(3,3),0)
#fig,axes = plt.subplots(nrows=5,ncols=5)
auto = auto_canny(blurred,-0.9,0) # I'd like to take this and create a matrix of images
plt.subplots(figsize=(10,10))
plt.subplot(211),plt.imshow(auto,cmap = 'gray')
plt.subplot(212),plt.imshow(gray,cmap = 'gray')
#for n in range (0,10):
# auto = auto_canny(blurred,n/100)
# plt.plot(auto)
# plt.show()
现在,代码仍然在灰色图像上产生单个输出以进行比较。我的一些尝试已显示为“已注释”,任何想法都将不胜感激。谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)