コード例 #1
0
 def validateselectedimage(self, imgname):
     selectimg = imageops.XImage(imgname)
     selectwdth = selectimg._width
     selectht = selectimg._height
     if ((selectwdth != self.bundle.wd) or (selectht != self.bundle.ht)):
         raise ImageError("select image of correct size !")
     else:
         return selectimg
コード例 #2
0
ファイル: pyeigenfaces.py プロジェクト: shulix/FaceReco
 def validateSelectedImage(self, imgname):
     selectimg = imageops.XImage(imgname)
     selectwdth = selectimg._width
     selectht = selectimg._height
     if ((selectwdth != self.bundle.wd) or (selectht != self.bundle.ht)):
         raise ImageError("select image of matching dimensions !")
     else:
         return selectimg
コード例 #3
0
 def validateDirectory(self,imgfilenameslist):                
     if (len(imgfilenameslist)==0):
         print "folder empty!"
         raise DirError("folder empty!")
     imgfilelist=[]
     for z in imgfilenameslist:
         img=imageops.XImage(z)
         imgfilelist.append(img)        
     sampleimg=imgfilelist[0]
     imgwdth=sampleimg._width
     imght=sampleimg._height        
     #check if all images have same dimensions
     for x in imgfilelist:
         newwdth=x._width
         newht=x._height
         if((newwdth!=imgwdth) or (newht!=imght)):
             raise DirError("select folder with all images of equal dimensions !")
     return imgfilelist
コード例 #4
0
 def validateDirectory(self, imgfilenameslist):
     if (len(imgfilenameslist) == 0):
         #print "folder empty!"
         print "carpeta vacia!"
         #raise DirError("folder empty!")
         raise DirError("carpeta vacia!")
     imgfilelist = []
     for z in imgfilenameslist:
         img = imageops.XImage(z)
         imgfilelist.append(img)
     sampleimg = imgfilelist[0]
     imgwdth = sampleimg._width
     imght = sampleimg._height
     #check if all images have same dimensions //check si todas las imagenes tienen las mismas dimensiones
     for x in imgfilelist:
         newwdth = x._width
         newht = x._height
         if ((newwdth != imgwdth) or (newht != imght)):
             #raise DirError("select folder with all images of equal dimensions !")
             raise DirError(
                 "selecciona una carpeta con todas las imagenes de dimensiones iguales!"
             )
     return imgfilelist