Spaces:
Runtime error
Runtime error
Rename shadow_detection.py to services/shadow_detection.py
Browse files- services/shadow_detection.py +8 -0
- shadow_detection.py +0 -5
services/shadow_detection.py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
import cv2
|
3 |
+
|
4 |
+
def detect_shadow_coverage(image_path):
|
5 |
+
image = cv2.imread(image_path)
|
6 |
+
grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
7 |
+
shadow_ratio = (grayscale < 50).sum() / grayscale.size
|
8 |
+
return shadow_ratio > 0.3 # Simulated threshold: >30% shadowed
|
shadow_detection.py
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
import random
|
2 |
-
|
3 |
-
def detect_shadow_coverage(image_path):
|
4 |
-
shadow_percent = random.randint(25, 40)
|
5 |
-
return shadow_percent > 30
|
|
|
|
|
|
|
|
|
|
|
|