viep-fault-detection / services /shadow_detection.py
Sanjayraju30's picture
Rename shadow_detection.py to services/shadow_detection.py
7e7091f verified
raw
history blame
289 Bytes
import numpy as np
import cv2
def detect_shadow_coverage(image_path):
image = cv2.imread(image_path)
grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
shadow_ratio = (grayscale < 50).sum() / grayscale.size
return shadow_ratio > 0.3 # Simulated threshold: >30% shadowed