【发布时间】:2019-03-08 15:56:44
【问题描述】:
目标是模糊图像中选定对象的边缘。
我已经使用以下代码完成了获取对象轮廓的步骤:
image = cv2.imread('path of image')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
thresh = cv2.threshold(gray, 60, 255, cv2.THRESH_BINARY)[1]
im, contours, hierarchy = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
我还可以使用以下方法绘制轮廓:
cv2.drawContours(image, contours, -1, (0, 255, 0), 2)
现在我想利用存储在contours 中的点来模糊/羽化对象的边缘,也许使用高斯模糊。我怎样才能做到这一点?
非常感谢!
【问题讨论】:
标签: python opencv image-processing