def getBackSpeed(self, t): a = self.detectionDictionnary.get(t - 1) b = self.detectionDictionnary.get(t + 1) if a == None or b == None: return None speedVectorX = a.backX - b.backX speedVectorY = a.backY - b.backY p = Point(speedVectorX, speedVectorY) return p
def getFrontSpeed(self, t): a = self.detectionDictionnary.get(t - 1) b = self.detectionDictionnary.get(t + 1) if a == None or b == None: return None speedVectorX = a.frontX - b.frontX speedVectorY = a.frontY - b.frontY p = Point(speedVectorX, speedVectorY) return p
def getSpeedVector(self, t): a = self.detectionDictionnary.get(t - 1) b = self.detectionDictionnary.get(t + 1) if a == None or b == None: return None speedVectorX = a.massX - b.massX speedVectorY = a.massY - b.massY p = Point(speedVectorX, speedVectorY) return p
def getOrientationVector(self, t): d = self.detectionDictionnary.get(t) if d == None: return None if d.frontX == None: return None if d.backX == None: return None deltaX = d.frontX - d.backX deltaY = d.frontY - d.backY p = Point(deltaX, deltaY) return p
''' threshold to compute head-genital events ''' MAX_DISTANCE_HEAD_HEAD_GENITAL_THRESHOLD = 15 oneFrame = 1 oneSecond = 30 oneMinute = 30*60 oneHour = 30*60*60 oneDay = 30*60*60*24 oneWeek = 30*60*60*24*7 '''time window at the end of an event to test overlap with another event''' TIME_WINDOW_BEFORE_EVENT = 15*oneFrame ''' Cage center in 50x50cm area''' cageCenterCoordinates50x50Area = Point( 256, 208 ) ''' Corner Coordinates in 50x50cm area ''' cornerCoordinates50x50Area = [ (114,63), (398,63), (398,353), (114,353) ] def second( second ): return second * oneSecond def day( day ): return day* oneDay