26 lines
512 B
Python
26 lines
512 B
Python
import cv2
|
|
from datetime import datetime, timedelta
|
|
from pytz import timezone
|
|
|
|
def camImgStrat():
|
|
img = cv2.imread('night.jpg',0)
|
|
average = img.mean(axis=0).mean(axis=0)
|
|
print(average)
|
|
if average < 100:
|
|
return 1.0
|
|
else:
|
|
return 0.0
|
|
|
|
|
|
def australiaStrat():
|
|
australia = timezone('Australia/Melbourne')
|
|
t = datetime.now().astimezone(australia)
|
|
hour = t.hour
|
|
if hour > 22 or hour < 6:
|
|
return 1.0
|
|
else:
|
|
return 0.0
|
|
|
|
|
|
print(australiaStrat())
|