#ABDULLAH ABUOLAIM #Anomaly detection import numpy as np import cv2 import math def ProjectPointIntoGp(xPt,yPt): pointVec=np.matrix([[1.0],[1.0],[1.0]]) pointVec[0,0]=float(xPt) pointVec[1,0]=float(yPt) resVec=H*pointVec if resVec[2]==0: resVec[2]=100000000000000000 xRes=int(math.fabs(resVec[0]/resVec[2])) yRes=int(math.fabs(resVec[1]/resVec[2])) return xRes,yRes cap = cv2.VideoCapture('Test001.avi') ret, frame = cap.read() if ret: length = int(cap.get(7)) width = int(cap.get(3)) height = int(cap.get(4)) fps = cap.get(5) H=np.load('UCSDped1_GP_H.npy') xGP, yGP=ProjectPointIntoGp(77,150) #an example point, you can replace it by trajectory x,y coordinates