Interface2017年05月号新画像処理101を読む

8-4 全体への影響を抑えつつ文字等を消せる「クロージング」

import cv2
import numpy as np

img_src = cv2.imread("data/img_8-1.bmp")

kernel = np.ones((5,5),np.uint8)
img_dst = cv2.morphologyEx(img_src, cv2.MORPH_CLOSE, kernel)

cv2.imshow("img_src",img_src)
cv2.imshow("img_dst",img_dst)
cv2.waitKey(0)
cv2.destroyAllWindows()

f:id:bitop:20180319054303p:plain

f:id:bitop:20180322042603p:plain