├── .DS_Store ├── ._.DS_Store ├── ._main.py ├── ._Object_Detection ├── ._Tampering_Detection ├── ._Real_Time_Object_Detection ├── ._haarcascade_frontalface_default.xml ├── README.md └── main.py /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supreeth101/Abnormal-human-Activity-detection/HEAD/.DS_Store -------------------------------------------------------------------------------- /._.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supreeth101/Abnormal-human-Activity-detection/HEAD/._.DS_Store -------------------------------------------------------------------------------- /._main.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supreeth101/Abnormal-human-Activity-detection/HEAD/._main.py -------------------------------------------------------------------------------- /._Object_Detection: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supreeth101/Abnormal-human-Activity-detection/HEAD/._Object_Detection -------------------------------------------------------------------------------- /._Tampering_Detection: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supreeth101/Abnormal-human-Activity-detection/HEAD/._Tampering_Detection -------------------------------------------------------------------------------- /._Real_Time_Object_Detection: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supreeth101/Abnormal-human-Activity-detection/HEAD/._Real_Time_Object_Detection -------------------------------------------------------------------------------- /._haarcascade_frontalface_default.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supreeth101/Abnormal-human-Activity-detection/HEAD/._haarcascade_frontalface_default.xml -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # smart-cctv 2 | 3 | A Smart Surveillance System using an advanced digital Image processing technique alongside the mix of computer vision and unsupervised machine learning techniques. 4 | Abnormal human activity detection has wide applications that span across monitoring in public spaces to personal health rehabilitation. 5 | This principally concentrates on automation of video surveillance in ATM machines and recognize any sort of potential criminal exercises and alert the concerned authorities. 6 | 7 | # Screenshots 8 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import cv2 3 | import time 4 | 5 | face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') 6 | eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml') 7 | 8 | cap = cv2.VideoCapture(0) 9 | 10 | Sec = 0 11 | Min = 0 12 | Check = 1 13 | Counter = 1 14 | 15 | while 1: 16 | ret, img = cap.read() 17 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 18 | #if ret is True: 19 | # gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 20 | #else: 21 | # continue 22 | faces = face_cascade.detectMultiScale(gray, 1.3, 5) 23 | 24 | for (x,y,w,h) in faces: 25 | cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2) 26 | roi_gray = gray[y:y+h, x:x+w] 27 | roi_color = img[y:y+h, x:x+w] 28 | 29 | eyes = eye_cascade.detectMultiScale(roi_gray) 30 | for (ex,ey,ew,eh) in eyes: 31 | cv2.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2) 32 | 33 | if len(faces) > 0: 34 | 35 | Sec += 1 36 | print(str(Min) + " Mins " + str(Sec) + " Sec ") 37 | 38 | cv2.putText(img, "Time: " + str(Min) + " Mins " + str(Sec) + " Sec ", (0,img.shape[0] -30), cv2.FONT_HERSHEY_TRIPLEX, 0.5, (0,0,255), 1) 39 | cv2.putText(img, "Number of faces detected: " + str(faces.shape[0]), (0,img.shape[0] -10), cv2.FONT_HERSHEY_TRIPLEX, 0.5, (0,0,255), 1) 40 | 41 | time.sleep(1) 42 | if Sec == 60: 43 | Sec = 0 44 | Min += 1 45 | print(str(Min) + " Minute") 46 | 47 | if Min == 2: 48 | print("Alert") 49 | if Check == 1: 50 | import http.client 51 | conn = http.client.HTTPConnection("api.msg91.com") 52 | payload = "{ \"sender\": \"ATMAUT\", \"route\": \"4\", \"country\": \"91\", \"sms\": [ { \"message\": \"Suspicious activity detected inside ATM.\", \"to\": [ \"9677104366\"] } ] }" 53 | headers = {'authkey': "209349Aqh8iTXUN1Of5accca05",'content-type': "application/json"} 54 | conn.request("POST", "/api/v2/sendsms", payload, headers) 55 | res = conn.getresponse() 56 | data = res.read() 57 | print(data.decode("utf-8")) 58 | Check += 1 59 | 60 | if len(faces) > 2 and Counter == 1: 61 | import http.client 62 | conn = http.client.HTTPConnection("api.msg91.com") 63 | payload = "{ \"sender\": \"SRMVDP\", \"route\": \"4\", \"country\": \"91\", \"sms\": [ { \"message\": \"Suspicious activity detected inside SRM VDP ATM.\", \"to\": [ \"9551631252\"] } ] }" 64 | headers = {'authkey': "209349Aqh8iTXUN1Of5accca05",'content-type': "application/json"} 65 | conn.request("POST", "/api/v2/sendsms", payload, headers) 66 | res = conn.getresponse() 67 | data = res.read() 68 | print(data.decode("utf-8")) 69 | Counter += 1 70 | 71 | 72 | if len(faces) == 0: 73 | 74 | print('No face detected') 75 | cv2.putText(img, "No face detected ", (0,img.shape[0] -10), cv2.FONT_HERSHEY_TRIPLEX, 0.5, (0,0,255), 1) 76 | Sec = 0 77 | Min = 0 78 | 79 | cv2.imshow('img',img) 80 | k = cv2.waitKey(30) & 0xff 81 | if k == 27: 82 | break 83 | 84 | cap.release() 85 | cv2.destroyAllWindows() 86 | --------------------------------------------------------------------------------