Exemplo n.º 1
0
 def __init__(self, testimg, imgsdirFeliz, imgsdirNeutro, imgsdirMolesto,
              egfnum, thrsh):
     self.testimg = testimg
     self.matchfile = None
     self.arregloEmociones = []
     self.arregloDistancias = []
     self.imgsdirFeliz = os.path.abspath(imgsdirFeliz)
     self.imgsdirNeutro = os.path.abspath(imgsdirNeutro)
     self.imgsdirMolesto = os.path.abspath(imgsdirMolesto)
     self.threshold = thrsh
     self.egfnum = egfnum
     parts = split(basename(testimg[1]), '.')
     extn = parts[len(parts) - 1]
     self.facet = eigenfaces.FaceRec()
     self.egfnum = self.set_selected_eigenfaces_count(self.egfnum, extn)
     self.facet.checkCache(self.imgsdirFeliz, extn, self.imgnamelist,
                           self.egfnum, self.threshold)
     for j in range(len(self.testimg)):
         self.mindist, self.matchfile = self.facet.findmatchingimage(
             self.testimg[j], self.egfnum, self.threshold)
         if self.mindist < 1e-10:
             self.mindist = 0
         self.emocionMenor = self.mindist
         if platform.system() == 'Windows':
             self.emocionFinal = split(self.matchfile, '\\')
         else:
             self.emocionFinal = split(self.matchfile, '/')
         self.emocionFinal = self.emocionFinal[len(self.emocionFinal) - 2]
         self.arregloEmociones.append(self.emocionFinal)
         self.arregloDistancias.append(self.mindist)
    def __init__(self, testimg, imgsdir, egfnum, thrsh):
        self.testimg = testimg
        self.imgsdir = imgsdir
        self.threshold = thrsh
        self.egfnum = egfnum
        parts = split(basename(testimg), '.')
        extn = parts[len(parts) - 1]
        print '-----------------------------------------------------------------------'
        print "To Match:", self.testimg, " to all ", extn, " images in directory:", imgsdir

        self.facet = eigenfaces.FaceRec()
        self.egfnum = self.set_selected_eigenfaces_count(self.egfnum, extn)
        print "number of eigenfaces used:", self.egfnum
        self.facet.checkCache(self.imgsdir, extn, self.imgnamelist,
                              self.egfnum, self.threshold)
        mindist, matchfile = self.facet.findmatchingimage(
            self.testimg, self.egfnum, self.threshold)

        if (matchfile is ""):
            print "match file in pyfaces"
            matchfile = None

        self.file = matchfile
        if mindist < 1e-10:
            mindist = 0
        if not matchfile:
            print "NOMATCH! try higher threshold"
        else:
            print "matches :" + matchfile + "\n dist :" + str(mindist)
Exemplo n.º 3
0
    def __init__(self, imgsdir, egfnum, thrsh, extn):
        self.imgsdir = imgsdir
        self.threshold = thrsh
        self.egfnum = egfnum
        self.facet = eigenfaces.FaceRec()

        self.extn = extn
        self.egfnum = self.set_selected_eigenfaces_count(self.egfnum, extn)
Exemplo n.º 4
0
    def __init__(self,testimg,imgsdir,egfnum,thrsh):
        self.testimg=testimg
        self.imgsdir=imgsdir
        self.threshold=thrsh
        self.egfnum=egfnum 
	self.matchfile=''    
        parts = split(basename(testimg),'.')
        extn=parts[len(parts) - 1]
        print "mise en correspondance:",self.testimg," avec toutes les ",extn," images d'apprentissage:",imgsdir        
        self.facet= eigenfaces.FaceRec()
        self.egfnum=self.set_selected_eigenfaces_count(self.egfnum,extn)
        #print "nombre de Eingenfaces:",self.egfnum
        self.facet.checkCache(self.imgsdir,extn,self.imgnamelist,self.egfnum,self.threshold)
        mindist,matchfile=self.facet.findmatchingimage(self.testimg,self.egfnum,self.threshold)
        if mindist < 1e-10:
            mindist=0
        if not matchfile:
            print "NOMATCH! try higher threshold"
        else:
            print "Reconnaissance :"+matchfile+" dist :"+str(mindist)
Exemplo n.º 5
0
 def __init__(self, testimg, imgsdir, egfnum, thrsh):
     self.testimg = testimg
     self.imgsdir = imgsdir
     self.threshold = thrsh
     self.egfnum = egfnum
     parts = split(basename(testimg), '.')
     extn = parts[len(parts) - 1]
     #print "to match:",self.testimg," to all ",extn," images in directory:",imgsdir
     self.facet = eigenfaces.FaceRec()
     self.egfnum = self.set_selected_eigenfaces_count(self.egfnum, extn)
     #print "number of eigenfaces used:",self.egfnum
     self.facet.checkCache(self.imgsdir, extn, self.imgnamelist,
                           self.egfnum, self.threshold)
     mindist, matchfile = self.facet.findmatchingimage(
         self.testimg, self.egfnum, self.threshold)
     if mindist < 1e-10:
         mindist = 0
     if not matchfile:
         print '{"matches" :"NOMATCH",  "dist" :"0"}'
     else:
         print '{"matches" :"' + matchfile + '" ,  "dist" :"' + str(
             mindist) + '"}'
Exemplo n.º 6
0
 def __init__(self, testimg, imgsdir, egfnum, thrsh):
     self.testimg = testimg
     self.imgsdir = imgsdir
     self.threshold = thrsh
     self.egfnum = egfnum
     parts = split(basename(testimg), '.')
     extn = parts[len(parts) - 1]
     #print "to match:",self.testimg," to all ",extn," images in directory:",imgsdir
     print "Imagen de Prueba:", self.testimg, " para imagenes extension", extn, "en Base de Datos:", imgsdir
     self.facet = eigenfaces.FaceRec()
     self.egfnum = self.set_selected_eigenfaces_count(self.egfnum, extn)
     #print "number of eigenfaces used:",self.egfnum
     print "numero de eigenfaces utilizadas:", self.egfnum
     self.facet.checkCache(self.imgsdir, extn, self.imgnamelist,
                           self.egfnum, self.threshold)
     mindist, matchfile = self.facet.findmatchingimage(
         self.testimg, self.egfnum, self.threshold)
     if mindist < 1e-10:
         mindist = 0
     if not matchfile:
         #print "NOMATCH! try higher threshold"
         print "NOMATCH! intentar con threshold mas alto"
     else:
         print "matches :" + matchfile + " dist :" + str(mindist)