def addNewFace(self, location): fc = Face(self.weights) fc.setID(self.faceIDCount) self.totalFaceCount += 1 self.faceIDCount += 1 fc.setPosition(location) self.visibleFaceList.append(fc)
def addNewFace(self, location): """create new face object for a newly detected face""" fc = Face(self.weights) fc.setID(self.faceIDCount) self.totalFaceCount += 1 self.faceIDCount += 1 fc.setPosition(location) self.visibleFaceList.append(fc)
def addNewFace(self, location): fc = Face() fc.id = self.totalFaceCount self.totalFaceCount += 1 fc.setPosition(location) self.visibleFaceList.append(fc)
def analyzeFrame3(self,rects): self.pruneFaceList() if len(rects)>len(self.visibleFaceList): if len(self.visibleFaceList)>0: megaList = self.listHelper(self.visibleFaceList,rects) # print megaList assignmentList = [] for i in range(len(megaList)): highest = 0 index = 0 for j in range(len(megaList[i])): # ensure that face hasn't been used already if megaList[i][j] >= highest and j not in assignmentList: index = j highest = megaList[i][j] assignmentList.append(index) self.makeAssignments(assignmentList, rects) notList = self.listHelper(self.notVisibleFaceList,rects) if notList != []: for i in range(len(rects)): index = -1 highest = 0 for j in range(len(self.notVisibleFaceList)): if j not in assignmentList: # print notList if notList[i][j] > highest: index = j highest = notList[j][i] if index != -1: if notList[index][i] > self.minRemovalScore: face = self.notVisibleFaceList.pop(index) face.setPosition(rects[i]) self.visibleFaceList.append(face) else: fc = Face() fc.id = self.totalFaceCount # print fc.id self.totalFaceCount += 1 fc.setPosition(rects[i]) self.visibleFaceList.append(fc) else: for i in range(len(rects)): fc = Face() fc.id = self.totalFaceCount # print fc.id self.totalFaceCount += 1 fc.setPosition(rects[i]) self.visibleFaceList.append(fc) else: for i in range(len(rects)): fc = Face() fc.id = self.totalFaceCount # print fc.id self.totalFaceCount += 1 fc.setPosition(rects[i]) self.visibleFaceList.append(fc) elif len(rects)==len(self.visibleFaceList): megaList = self.listHelper(self.visibleFaceList,rects) # print megaList assignmentList = [] for i in range(len(megaList)): highest = 0 index = 0 for j in range(len(megaList[i])): if megaList[i][j] >= highest and j not in assignmentList: index = j highest = megaList[i][j] assignmentList.append(index) self.makeAssignments(assignmentList, rects) else: # less rects than faces megaList = self.listHelper(self.visibleFaceList,rects) # print megaList assignmentList = [] probabilityList = [] for i in range(len(megaList)): highest = 0 index = 0 for j in range(len(megaList[i])): if megaList[i][j] >= highest and j not in assignmentList: index = j highest = megaList[i][j] assignmentList.append(index) probabilityList.append(highest) if len(probabilityList)!=0: lowIndex = probabilityList.index(min(probabilityList)) self.notVisibleFaceList.append(self.visibleFaceList.pop(lowIndex)) assignmentList.pop(lowIndex) self.makeAssignments(assignmentList, rects)