3

is it possible to smooth edges using openCV(python). mask.

ISha
  • 151
  • 1
  • 2
  • 5

1 Answers1

5

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

Cezar Sas
  • 306
  • 3
  • 14