Exemplo n.º 1
0
 def add_person(self, name, capture):
     G = Group()
     personsList = G.persons
     add = False
     for i in range(len(personsList)):
         if (G.persons[i].name == name):
             print('Person already added')
             add = True
             break
     if not add:
         #cap = cv2.VideoCapture(0)
         cap = capture
         images = {}
         print('Tomando fotos')
         for i in range(5):
             ret, frame = cap.read()
         for i in range(20):
             #print('FOTO: '+str(i))
             ret, frame = cap.read()
             frame = frame[115:600, 320:960]
             frame = cv2.flip(frame, 0)
             frame = cv2.flip(frame, 1)
             # cv2.imshow('image',frame)
             # print("Press Enter to Exit")
             # cv2.waitKey(0)
             time.sleep(0.3)
             frame = cv2.GaussianBlur(frame, (5, 5), 0)
             images[i] = frame
         #cap.release()
         self.blurry.sort_less_blurred(images)
         self.persons.enrol(name, self.blurry.frames)
         return 1
     return 0
 def add_person(self, name):
     G = Group()
     personsList = G.persons
     add = False
     for i in range(len(personsList)):
         if (G.persons[i].name == name):
             print('Person already added')
             add = True
             break
     if not add:
         cap = cv2.VideoCapture(1)
         cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
         cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)
         cap.set(cv2.CAP_PROP_FPS, 10)
         #cap = capture
         images = {}
         print('Tomando fotos')
         for i in range(5):
             ret, frame = cap.read()
         for i in range(20):
             print('FOTO: ' + str(i))
             ret, frame = cap.read()
             frame = frame[115:600, 320:960]
             frame = cv2.flip(frame, 0)
             frame = cv2.flip(frame, 1)
             cv2.imshow('image', frame)
             time.sleep(0.3)
             frame = cv2.GaussianBlur(frame, (5, 5), 0)
             images[i] = frame
         cap.release()
         self.blurry.sort_less_blurred(images)
         self.persons.enrol(name, self.blurry.frames)
         return 1
     return 0
Exemplo n.º 3
0
 def delete_all_person(self):
     G = Group()
     personsList = G.persons
     for i in range(len(personsList)):
         self.delete_person(G.persons[i].name)
     ids = self.persons.azureService.get_all_names()
     for person in ids[0]:
         self.persons.azureService.delete_person(person['personId'])
Exemplo n.º 4
0
    def get_persons_attributes(self):
        G = Group()
        for p in G.persons:
            print(p)
        return G.persons


# c = Characterization("local")
# c.get_persons()
# c.indentify_person(True)
    def __init__(self):
        self.ROOT_PATH = os.path.dirname(sys.modules['__main__'].__file__)
        self.azureService = Azure()
        self.codeError = 0
        self.gotAttributes = False
        self.frame = None
        self.framesTrain = None
        self.bb_service = []
        # self.service = None
        self.name = "desconocido"
        self.id_debug = None
        self.faceId = ""
        self.accuracy = None
        self.age = 0  #
        self.gender = ""  #male-female
        self.smile = 0  #0-1
        self.pose = {}  #dict pitch, roll, yaw (double)
        self.emotion = None  #anger, contempt, disgust, fear, happiness, neutral, sadness, surprise
        self.beard = 0  #0-1
        self.glasses = ""  #glasses - noglasses
        self.eyesOpen = 0
        self.mouthOpen = 0
        self.bald = 0  #número
        self.hairColor = ""  #brown, blond, red, gray, other, black
        self.sideburns = 0  #0-1
        self.eyeMakeUp = False  #true-false
        self.lipMakeUp = False  #true-false
        self.headWear = 0  #0-1
        self.mask = 0
        self.mustache = 0  #0-1

        self.bb_actual = []
        self.image_actual = None
        self.imageBBPair = ([], None)
        self.happiness = 0
        self.sadness = 0
        self.neutral = 0
        self.surprise = 0
        self.anger = 0

        self.table = 0
        self.country = ""
        self.id = ""
        self.id_azure = ""
        self.interaction = 0

        self.lastInteractionTime = 0
        self.G = Group()

        self.bb = []
Exemplo n.º 6
0
    def __init__(self):
        self.ROOT_PATH = os.path.dirname(sys.modules['__main__'].__file__)
        self.azureService = Azure()
        self.codeError = 0
        self.gotAttributes = False
        self.frame = None
        self.framesTrain = None
        self.bb_service = []
        # self.service = None
        self.name = "desconocido"
        self.id_debug = None
        self.faceId = ""
        self.accuracy = None
        self.age = 0
        self.gender = ""
        self.smile = 0
        self.pose = {}
        self.emotion = None
        self.beard = 0
        self.glasses = ""
        self.eyesOpen = 0
        self.mouthOpen = 0
        self.bald = 0
        self.hairColor = ""
        self.sideburns = 0
        self.eyeMakeUp = False
        self.lipMakeUp = False
        self.headWear = 0
        self.mask = 0
        self.mustache = 0

        self.bb_actual = []
        self.image_actual = None
        self.imageBBPair = ([], None)
        self.happiness = 0
        self.sadness = 0
        self.neutral = 0
        self.surprise = 0
        self.anger = 0

        self.table = 0
        self.country = ""
        self.id = ""
        self.id_azure = ""
        self.interaction = 0

        self.lastInteractionTime = 0
        self.image = None
        self.G = Group()
Exemplo n.º 7
0
 def get_person_attribute(self, name):
     G = Group()
     personsList = G.persons
     id = -1
     for i in range(len(personsList)):
         if (G.persons[i].name == name):
             id = i
             break
     if (id == -1):
         print('Person not recognized')
         return {}
     else:
         attributes = {'age':G.persons[id].age, 'gender':G.persons[id].gender, 'smile':G.persons[id].smile, 'glasses':G.persons[id].glasses, \
                     'bald':G.persons[id].bald, 'hairColor':G.persons[id].hairColor, 'eyeMakeUp':G.persons[id].eyeMakeUp, 'lipMakeUp':G.persons[id].lipMakeUp, \
                     'headWear':G.persons[id].headWear, 'mustache':G.persons[id].mustache, 'beard':G.persons[id].beard}
         return attributes
Exemplo n.º 8
0
 def get_persons_attributes(self):
     G = Group()
     for p in G.persons:
         print(p)
     return G.persons
Exemplo n.º 9
0
 def get_persons(self):
     G = Group()
     personsList = G.persons
     return personsList
 def delete_all_person(self):
     G = Group()
     personsList = G.persons
     for i in range(len(personsList)):
         self.delete_person(G.persons[i].name)