Spaces:
Paused
Paused
Download utils/gap_closer.py from MBG0903/Saree-Design-App: direct link, hf CLI and curl.
- Browser
- Download file 414 Bytes
-
https://huggingface.co/spaces/MBG0903/Saree-Design-App/resolve/main/utils/gap_closer.py
- Command line
-
hf download hf://spaces/MBG0903/Saree-Design-App/utils/gap_closer.py
-
curl -L -o gap_closer.py https://huggingface.co/spaces/MBG0903/Saree-Design-App/resolve/main/utils/gap_closer.py
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=2 | |
| ) | |
| return closed | |
| def strengthen_lines(binary): | |
| kernel = np.ones((2, 2), np.uint8) | |
| dilated = cv2.dilate( | |
| binary, | |
| kernel, | |
| iterations=1 | |
| ) | |
| return dilated |