https://blog.csdn.net/u013381011/article/details/78414203
from libtiff import TIFF
import os
import cv2
import numpy as np
correct_lbl='F:\\g\\ead_challenge\\segmentation_repeat\\correct_mask'
files=os.listdir(correct_lbl)
for file in files[8:12]:
temp_mask=os.path.join(correct_lbl,file)
print('dir',temp_mask)
tif=TIFF.open(temp_mask,mode='r')
all_img=np.zeros((6,)+tif.read_image().shape)
for idx,image in enumerate(list(tif.iter_images())):
print(image.shape)
all_img[idx,:,:]=image
print('all_img',all_img.shape)
'''
解析出来的all_img是<class 'numpy.ndarray'> (5, 499, 472)
'''
target=np.zeros((all_img.shape[1:3]))
print(target.shape)
target[np.where(all_img[0,:,:] == 255)] = 1
me=