Spaces:
Paused
Paused
Download utils/segmentation.py from MBG0903/Saree-Design-App: direct link, hf CLI and curl.
- Browser
- Download file 150 Bytes
-
https://huggingface.co/spaces/MBG0903/Saree-Design-App/resolve/main/utils/segmentation.py
- Command line
-
hf download hf://spaces/MBG0903/Saree-Design-App/utils/segmentation.py
-
curl -L -o segmentation.py https://huggingface.co/spaces/MBG0903/Saree-Design-App/resolve/main/utils/segmentation.py
150 Bytes
| import cv2 | |
| def get_connected_regions(binary): | |
| num_labels, labels = cv2.connectedComponents( | |
| binary | |
| ) | |
| return num_labels, labels |