コード例 #1
0
def listUsers(BASE_PATH):
	userList=[]
	index=0
	ignorefolder = re.compile("(^{0}(/|)(person|gender)/|^{0}(/|)$)".format(BASE_PATH)) #regEx for ignored folders
	for path, dirname, files in os.walk(BASE_PATH):
		if ignorefolder.match(path + "/") != None:
			continue
		try:
			name, sex, configvalid = newfaces.parseConfig(os.path.join( path ,"config"))
			if configvalid:
				userList.append([index,name,path])
				index+=1
		except IOError as (errno, strerror):
			print "I/O error({0}): {1}. File:{2}/config".format(errno, strerror,path)
			continue
コード例 #2
0
def listUsers(BASE_PATH):
    userList = []
    index = 0
    ignorefolder = re.compile("(^{0}(/|)(person|gender)/|^{0}(/|)$)".format(
        BASE_PATH))  #regEx for ignored folders
    for path, dirname, files in os.walk(BASE_PATH):
        if ignorefolder.match(path + "/") != None:
            continue
        try:
            name, sex, configvalid = newfaces.parseConfig(
                os.path.join(path, "config"))
            if configvalid:
                userList.append([index, name, path])
                index += 1
        except IOError as (errno, strerror):
            print "I/O error({0}): {1}. File:{2}/config".format(
                errno, strerror, path)
            continue
コード例 #3
0
 goback = False
 print "[0] [Go back]"
 for index, user, _ in userList:
     print "[{0}] {1}".format(index + 1, user)
 answer = raw_input(
     "Which user do you want to edit(Number)? ")
 if re.match("[0-9]+", answer) != None:
     answer = int(answer)
     if answer == 0:
         goback = True
         break
     for index, user, path in userList:
         if index == (answer - 1):
             name = user
             userpath = path
             nameC, sex, configvalid = newfaces.parseConfig(
                 os.path.join(userpath, "config"))
             print "Configfile of {0}:\nname:{1}\nsex:{2}".format(
                 name, nameC, sex)
             picCounter = 0
             for file in os.listdir(userpath):
                 if pics.match(file) != None:
                     picCounter += 1
             print "There are {0} raw pictures saved for this user\n".format(
                 picCounter)
             while True:
                 #level 3
                 goback = False
                 answer = raw_input(
                     "User: {0}\nWhat do you want to do?\n[0] Go back\n"
                     .format(name) +
                     "[1] Take more pictures\n[2] Preprocess existing pictures for face recognition\n"
コード例 #4
0
					#level 2
					goback = False
					print "[0] [Go back]"
					for index, user, _ in userList:
						print "[{0}] {1}".format(index+1, user)
					answer = raw_input("Which user do you want to edit(Number)? ")
					if re.match("[0-9]+",answer) != None:
						answer = int(answer)
						if answer == 0:
							goback = True
							break
						for index, user, path in userList:
							if index == (answer-1):
								name = user
								userpath = path
								nameC, sex, configvalid = newfaces.parseConfig(os.path.join(userpath,"config"))
								print "Configfile of {0}:\nname:{1}\nsex:{2}".format(name,nameC,sex)
								picCounter = 0
								for file in os.listdir(userpath):
									if pics.match(file) != None:
										picCounter+=1
								print "There are {0} raw pictures saved for this user\n".format(picCounter)
								while True:
									#level 3
									goback = False
									answer = raw_input("User: {0}\nWhat do you want to do?\n[0] Go back\n".format(name)+
									"[1] Take more pictures\n[2] Preprocess existing pictures for face recognition\n"+
									"[3] Delete user\n")
									if re.match("[0-3]",answer) != None:
										answer = int(answer)
										if answer == 0: