diff --git a/server/nightr/strategies/miloStrats.py b/server/nightr/strategies/miloStrats.py index 4d2f622..b53aa9a 100644 --- a/server/nightr/strategies/miloStrats.py +++ b/server/nightr/strategies/miloStrats.py @@ -1,24 +1,31 @@ import cv2 from datetime import datetime, timedelta from pytz import timezone +from server.nightr.util import Context, Prediction -def camImgStrat(): +def camImgStrat(context : Context) -> Prediction: img = cv2.imread('night.jpg',0) average = img.mean(axis=0).mean(axis=0) print(average) + p = Prediction() if average < 100: - return 1.0 + p.probability = 1.0 + p.reasons.append('Image was dark') else: - return 0.0 + p.reasons.append('Image was light') + p.probability = 0.0 + return p - -def australiaStrat(): +def australiaStrat(context : Context) -> Prediction: australia = timezone('Australia/Melbourne') t = datetime.now().astimezone(australia) hour = t.hour + p = Prediction() if hour > 22 or hour < 6: - return 1.0 + p.probability = 1.0 + p.reasons.append('It\'s day-time in Australia') else: - return 0.0 - + p.probability = 0.0 + p.reasons.append('It\'s night-time in Australia') + return p