import fnmatch
import cv2
from pylab import *
import os
_mapfilename = 'E:/LIU0106RES/TCIFCImerge02/'
filenames = fnmatch.filter(os.listdir('E:/LIU0106RES/TCImerge/'), '*.jpg')
filenamesfci = fnmatch.filter(os.listdir('E:/LIU0106RES/FCImerge/'), '*.jpg')
for i in range(len(filenames)):
# for i in range(10):
# mapfilename = _mapfilename + str(filenames[i]).split('.')[0] + '.png'
tcif = 'E:/LIU0106RES/TCImerge/' + filenames[i]
fcif = 'E:/LIU0106RES/FCImerge/' + filenamesfci[i]
# _shpname = str(filenames[i]).split('_')[0]
# _B12filenames = fnmatch.filter(os.listdir('E:/LIU0106RES/FCImerge/'), _shpname + '*.jpg')
# fcif = 'E:/LIU0106RES/FCImerge/' + _B12filenames[0]
# print(tcif)
# print(fcif)
outf = str(filenames[i]).split('.')[0] + 'FCI.png'
# print(outf)
#
img1 = cv2.imread(tcif, cv2.IMREAD_COLOR)
img4 = cv2.imread(fcif)
img1 = cv2.cvtColor(img1, cv2.COLOR_BGR2RGB)
img4 = cv2.cvtColor(img4, cv2.COLOR_BGR2RGB)
fig = plt.figure()
subplot(121)
imshow(img1)
title('TCI')
axis('off')
subplot(122)
imshow(img4)
title('FCI')
axis('off')
fig.set_size_inches(22, 10)
# plt.savefig('D:/nocloud_researth122702res/' + str(t) + '.png', bbox_inches='tight')
plt.savefig(_mapfilename + outf, bbox_inches='tight')
plt.close()
print(i)
# # show()
|