Hardware update: only distance less than 15cm for 5 sec then will take thief picture
This commit is contained in:
parent
75ab50acc1
commit
a652f95890
1 changed files with 14 additions and 11 deletions
|
@ -54,7 +54,7 @@ class Car:
|
||||||
|
|
||||||
# countor for theaf picture been taken
|
# countor for theaf picture been taken
|
||||||
self.counter = self.firebase.database().child("signal").child(1).child("counter").get().val()
|
self.counter = self.firebase.database().child("signal").child(1).child("counter").get().val()
|
||||||
print(str(self.counter))
|
#print(str(self.counter))
|
||||||
|
|
||||||
# new update motor and alarm functions, are able to connect embedded system throught firebase
|
# new update motor and alarm functions, are able to connect embedded system throught firebase
|
||||||
|
|
||||||
|
@ -180,14 +180,17 @@ if __name__=="__main__":
|
||||||
|
|
||||||
# Take a picture of someone or some thing try to get close to the vehicle
|
# Take a picture of someone or some thing try to get close to the vehicle
|
||||||
if (dist<=15 and car.cameraOff and car.motorStop and car.alarmStop):
|
if (dist<=15 and car.cameraOff and car.motorStop and car.alarmStop):
|
||||||
print('Take a theaf picture due to distance at ' + str(int(dist)) + 'cm')
|
time.sleep(5)
|
||||||
camera = PiCamera()
|
dist = car.distance()
|
||||||
camera.start_preview()
|
if (dist<=15):
|
||||||
# Camera warm-up time
|
print('Take a theaf picture due to distance at ' + str(int(dist)) + 'cm')
|
||||||
time.sleep(1)
|
camera = PiCamera()
|
||||||
camera.capture('/home/pi/Vehicle-Anti-Theft-Face-Recognition-System/sensor/picture'+str(car.counter)+'.jpg')
|
camera.start_preview()
|
||||||
camera.close()
|
# Camera warm-up time
|
||||||
storage.child('Photos_of_Thieves/Thief_Sensor/picture'+str(car.counter)+'.jpg').put('/home/pi/Vehicle-Anti-Theft-Face-Recognition-System/sensor/picture'+str(car.counter)+'.jpg')
|
time.sleep(1)
|
||||||
car.counter+=1
|
camera.capture('/home/pi/Vehicle-Anti-Theft-Face-Recognition-System/sensor/picture'+str(car.counter)+'.jpg')
|
||||||
car.firebase.database().child("signal").child(1).child("counter").set(car.counter)
|
camera.close()
|
||||||
|
storage.child('Photos_of_Thieves/Thief_Sensor/picture'+str(car.counter)+'.jpg').put('/home/pi/Vehicle-Anti-Theft-Face-Recognition-System/sensor/picture'+str(car.counter)+'.jpg')
|
||||||
|
car.counter+=1
|
||||||
|
car.firebase.database().child("signal").child(1).child("counter").set(car.counter)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
Loading…
Reference in a new issue