Reputation: 151
is it possible to smooth edges using openCV(python). mask.
Upvotes: 3
Views: 8331
Reputation: 306
Try this code:
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)
It uses the morphological operation of opening
Upvotes: 5