Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified securityModule/Face/__pycache__/sercurity_module.cpython-37.pyc
Binary file not shown.
56 changes: 19 additions & 37 deletions securityModule/Face/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,6 @@ <h5>Camera 1 Logs</h5>
</ul>
</div>
</div>
<div class="col s6 center card">
<div class="col s12 card">
<h5>Camera 2 Logs</h5>
</div>
<div style="height: 500px;">
<ul id="result2" style="position: absolute;
top: 60px;
bottom: 20px;
left: 20px;
right: 20px;
overflow: scroll;
height: 80%;" >

</ul>
</div>
</div>
</div>
</div>

Expand All @@ -190,9 +174,7 @@ <h5>Camera 2 Logs</h5>


get_camera1_Logs();
get_camera2_Logs();


function get_camera1_Logs(){
$.ajax({
type: 'POST',
Expand All @@ -201,7 +183,7 @@ <h5>Camera 2 Logs</h5>
success: function(data){
let proxy = JSON.parse(data);
let camera1 = $('#camera1').data('value');
if (camera1 == "on"){
if (camera1 == "on" && proxy['name'] != 'undefined'){
$('#result1').append( "<li>"+ proxy['time']+ ": "+ proxy['name'] +"</li>" );
}
},
Expand All @@ -212,24 +194,24 @@ <h5>Camera 2 Logs</h5>
});
}

function get_camera2_Logs(){
$.ajax({
type: 'POST',
url: "/_view_logii",
dataType: "text",
success: function(data){
let proxy = JSON.parse(data);
let camera2 = $('#camera2').data('value');
if (camera2 == "on"){
$('#result2').append( "<li>"+proxy['time']+ ": "+ proxy['name'] +"</li>" );
}
},
complete: function() {
// Schedule the next request when the current one's complete
setTimeout(get_camera2_Logs, 5000);
}
});
}
// function get_camera2_Logs(){
// $.ajax({
// type: 'POST',
// url: "/_view_logii",
// dataType: "text",
// success: function(data){
// let proxy = JSON.parse(data);
// let camera2 = $('#camera2').data('value');
// if (camera2 == "on"){
// $('#result2').append( "<li>"+proxy['time']+ ": "+ proxy['name'] +"</li>" );
// }
// },
// complete: function() {
// // Schedule the next request when the current one's complete
// setTimeout(get_camera2_Logs, 5000);
// }
// });
// }

// function get_camera3_Logs(){
// $.ajax({
Expand Down
31 changes: 18 additions & 13 deletions securityModule/Face/webstreaming.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# USAGE
# python webstreaming.py --ip 0.0.0.0 --port 8000

from twilio.rest import Client
# import the necessary packages
from sercurity_module import Sercurity
# from imutils.video import VideoStream
Expand All @@ -20,7 +20,7 @@
from firebase_admin import credentials, firestore
import json

cred = credentials.Certificate('/home/haotian/uoftHacks2020/supervisor-f2f29-firebase-adminsdk-l2twy-ae836f2735.json')
cred = credentials.Certificate('/Users/vaishvik/Desktop/uoftHacks2020/supervisor-f2f29-firebase-adminsdk-l2twy-ae836f2735.json')

default_app = firebase_admin.initialize_app(cred)

Expand All @@ -44,22 +44,25 @@
doc_ref.set(Gfeatures)


def send_msg(number, data):
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)
# This my person phone number
client.messages.create(to=number, from_="12563803381", body=data)


def send_log(detected1, detected2):
def send_log(detected1):
t = time.localtime()
current_time = time.strftime("%H:%M:%S", t)
if (detected1 != None):
doc_ref = db.collection(u'Camera').document(u'camera1')
doc_ref.update({ "Log":{"time": current_time, "name":detected1}})
if (detected2 != None):
doc_ref = db.collection(u'Camera').document(u'camera2')
doc_ref.update({ "Log":{"time": current_time, "name":detected2}})
doc_ref = db.collection(u'Camera').document(u'camera1')
doc_ref.update({ "Log":{"time": current_time, "name":detected1}})


# Use Case of the function
send_log(None, "Tien")
send_log("Vash", "goku")
send_log("Vash", None)
send_log("Tien")
send_log("goku")
send_log("Disco")

# initialize the output frame and a lock used to ensure thread-safe
# exchanges of the output frames (useful for multiple browsers/tabs
Expand Down Expand Up @@ -138,7 +141,9 @@ def detect_motion(frameCount, datasets_path, vs):
# print(dangers)
if dangers != None:
print(dangers[0].tostring(), "detected!!!!!!!, Confidence score =", danger_scores[0])
send_log(dangers[0].tostring(), None)
send_log(dangers[0].tostring())
send_msg(6473348273, dangers[0].tostring())


mo, frame_marked = sr.detect_and_show(new_frame, total, frameCount)
if mo:
Expand Down