分割掩模的平滑边缘

3
使用OpenCV(Python)平滑边缘是否可能?掩码

1
请看这个链接:https://dev59.com/mms05IYBdhLWcg3wJurp 这是你要找的东西吗? - Cezar Sas
我还发现了这个:https://dev59.com/3pbfa4cB1Zd3GeqPy8wW - Cezar Sas
谢谢Cezar。我想了解链接中使用的步骤。您提供的答案也有帮助,但现在它只会给出一个白色图像。 - ISha
你能提供一个样例图片吗? - Cezar Sas
我已经编辑了这个问题。 - ISha
1个回答

5

尝试使用这段代码:

import cv2

print(cv2.__version__)

img = cv2.imread('iep43.jpg', 0)
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (11, 11))
(thresh, binRed) = cv2.threshold(img, 128, 255, cv2.THRESH_BINARY)
opening = cv2.morphologyEx(img, cv2.MORPH_OPEN, kernel, iterations=3)
cv2.imwrite("cleaned.jpg", opening)

它使用开运算的形态学操作。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接