Saree-Design-App / utils /gap_closer.py
MBG0903's picture
Create gap_closer.py
224ef24 verified
Raw
History Blame Contribute Delete
414 Bytes
import cv2
import numpy as np
def close_small_gaps(binary):
kernel = np.ones((3, 3), np.uint8)
closed = cv2.morphologyEx(
binary,
cv2.MORPH_CLOSE,
kernel,
iterations=1
)
return closed
def strengthen_lines(binary):
kernel = np.ones((2, 2), np.uint8)
dilated = cv2.dilate(
binary,
kernel,
iterations=1
)
return dilated