-1
def generalarea(self):
  for filename in glob.iglob ('*.tif'):
    img = np.asarray(Image.open(filename).convert('L'))                            
    img = 1 * (img < 127)
    garea = (img == 0).sum()
    print garea

def areasplit(self):
  for filename in glob.iglob ('*.tif'):    
    img = np.asarray(Image.open(filename).convert('L'))                            
    img = 1 * (img < 127)
    areasplit = np.split(img.ravel(), 24) # here we are splitting converted to 1D array
  for i in areasplit:
   sarea = (i == 0).sum()
   print sarea

これら 2 つの方法は、作業ディレクトリ内の .tif イメージを処理します。数字の結果に接頭辞 IMAGENAME を追加する必要があります (取得するには、firstimage、6786876876、または secondimage___67876876 のようにします)。そのアイデアをどのように実装しますか?

4

2 に答える 2