0
A
回答
0
试试这个代码:
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)
它采用开放
的形态运行看看这个http://stackoverflow.com/questions/7416025/how-do-i-smooth- the-curvescontours-in-opencv 是你在找什么? –
我也发现这个:http://stackoverflow.com/questions/37068448/opencv-how-to-smooth-contour-reducing-noise –
谢谢Cezar。我想了解链接中正在使用的步骤。你提供的答案也可以帮助,但它现在正在给出一个白色的图像。 – ISha