Ejemplo n.º 1
0
    result,avg=motiondetection(avg,avg_float)
    if result=='Yes' and lastresult=='Yes':
        test=test+1
    else:
        test=0
    if result=='Yes':
        print("detect motion")
        print(test)
    else:
        print("No motion")
  
    if test>15 and door_test():
        frame=vs.read()
        cv2.imwrite('img.jpg',frame)
        print("sendemail")
        vs.record()
        ttt = time.strftime("%Y%m%d%H%M%S", time.localtime())
        mp4 = '/home/pi/share/record'+ttt+'.mp4'
        convert('/home/pi/pi_record/video.h264', mp4)
        copyfile(mp4,'/var/www/LSAteam11/'+ttt+'.mp4')
        sending()
        test=0
        result,avg,avg_float=warmup(avg,avg_float)
        
    else:
        result,avg=motiondetection(avg,avg_float)
fps.stop()
cv2.destroyAllWindows()
vs.stop()