コード例 #1
0
ファイル: FaceDatabase.py プロジェクト: tsoonjin/pyvision
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
コード例 #2
0
ファイル: FaceDatabase.py プロジェクト: tsoonjin/pyvision
 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)
コード例 #3
0
ファイル: FaceDatabase.py プロジェクト: tigerking/pyvision
    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)
コード例 #4
0
ファイル: FaceDatabase.py プロジェクト: tsoonjin/pyvision
    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')
コード例 #5
0
ファイル: FaceDatabase.py プロジェクト: tsoonjin/pyvision
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
コード例 #6
0
ファイル: FaceDatabase.py プロジェクト: tigerking/pyvision
    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")