[6bc016]: / main.py

Download this file

37 lines (31 with data), 912 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Fall detection main
# 01-Jun-2018: Original version only detects Not Moving
# Modified the codes to detect fall
# Once fall is detected, alarm will be activated
# A couple of services can be enabled when alarm is set
# Available services: SMS, Email with screen shot of the fall moment
import video
import time
import sys
import numpy as np
import cv2
import time
video = video.Video()
time.sleep(1.0) #let camera autofocus + autosaturation settle
video.nextFrame()
video.testBackgroundFrame()
while 1:
#get next frame of video
video.nextFrame()
video.testBackgroundFrame() #press n to delete background?
video.updateBackground()
video.compare()
video.showFrame()
video.testSettings()
k = cv2.waitKey(30) & 0xff
#if video.testDestroy():
if k == 27:
break
#video.release()
cv2.destroyAllWindows()
sys.exit()