class FERETDatabase(FaceDatabase): def __init__(self,image_path, image_ext=".pgm", coord_file=None): ''' Create an object that manages a FERET face database. ''' self.image_path = image_path self.image_ext = image_ext if coord_file == None: coord_name = os.path.join(pv.__path__[0],'analysis','FaceAnalysis','data','coords.3368') self.eyes_file = EyesFile(coord_name) else: self.eyes_file = EyesFile(coord_name) def keys(self): return self.eyes_file.files() def __getitem__(self,key): assert self.eyes_file.hasFile(key) face_obj = FaceDatabase.FaceObject() face_obj.key = key face_obj.person_id = key[:5] leye,reye = self.eyes_file.getEyes(key)[0] face_obj.left_eye = leye face_obj.right_eye = reye im_name = os.path.join(self.image_path,key+self.image_ext) im = pv.Image(im_name) face_obj.image = im return face_obj
def __init__(self,image_path, image_ext=".pgm", coord_file=None): ''' Create an object that manages a FERET face database. ''' self.image_path = image_path self.image_ext = image_ext if coord_file == None: coord_name = os.path.join(pv.__path__[0],'analysis','FaceAnalysis','data','coords.3368') self.eyes_file = EyesFile(coord_name) else: self.eyes_file = EyesFile(coord_name)
def __init__(self, image_path, image_ext=".pgm", coord_file=None): """ Create an object that manages a FERET face database. """ self.image_path = image_path self.image_ext = image_ext if coord_file == None: coord_name = os.path.join(pv.__path__[0], "analysis", "FaceAnalysis", "data", "coords.3368") self.eyes_file = EyesFile(coord_name) else: self.eyes_file = EyesFile(coord_name)
def __init__(self): ''' Create an object that manages a FERET face database. ''' self.image_ext = ".pgm" coord_name = os.path.join(pv.__path__[0],'data','csuScrapShots','coords.txt') self.eyes_file = EyesFile(coord_name) gender_file = os.path.join(pv.__path__[0],'data','csuScrapShots','gender.txt') f = open(gender_file) self.gender = {} for line in f: name,gender = line.split() name = name.split('.')[0] self.gender[name] = gender self.image_path = os.path.join(pv.__path__[0],'data','csuScrapShots')
class ScrapShotsDatabase(FaceDatabase): def __init__(self): ''' Create an object that manages a FERET face database. ''' self.image_ext = ".pgm" coord_name = os.path.join(pv.__path__[0],'data','csuScrapShots','coords.txt') self.eyes_file = EyesFile(coord_name) gender_file = os.path.join(pv.__path__[0],'data','csuScrapShots','gender.txt') f = open(gender_file) self.gender = {} for line in f: name,gender = line.split() name = name.split('.')[0] self.gender[name] = gender self.image_path = os.path.join(pv.__path__[0],'data','csuScrapShots') def keys(self): return self.eyes_file.files() def __getitem__(self,key): assert self.eyes_file.hasFile(key) face_obj = FaceDatabase.FaceObject() face_obj.key = key face_obj.person_id = key[:5] leye,reye = self.eyes_file.getEyes(key)[0] face_obj.left_eye = leye face_obj.right_eye = reye im_name = os.path.join(self.image_path,key+self.image_ext) im = pv.Image(im_name) face_obj.image = im face_obj.gender = self.gender[key] return face_obj
def __init__(self): """ Create an object that manages a FERET face database. """ self.image_ext = ".pgm" coord_name = os.path.join(pv.__path__[0], "data", "csuScrapShots", "coords.txt") self.eyes_file = EyesFile(coord_name) gender_file = os.path.join(pv.__path__[0], "data", "csuScrapShots", "gender.txt") f = open(gender_file) self.gender = {} for line in f: name, gender = line.split() name = name.split(".")[0] self.gender[name] = gender self.image_path = os.path.join(pv.__path__[0], "data", "csuScrapShots")