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
These two methods process .tif images in the working directory. I need to add the prefix IMAGENAME to the number result (to get like: firstimage, 6786876876 or secondimage___67876876). How to implement that idea?