def addHeatMaps(idir, hdir):
print 'addHeatMaps: ' + hdir
for i in os.listdir(hdir):
if i.endswith(".png") and not i.endswith("_overlay.png"):
filename = i[:-4]
print filename
heatmap = cv2.imread(hdir + i)
image = cv2.imread(idir + i)
if heatmap.shape != image.shape:
print 'Shape not equal'
continue
heatmap_jet = cv2.applyColorMap(heatmap, cv2.COLORMAP_WINTER)
heatmap = heatmap/255
for c in range(0,3):
#image[:,:,c] = image[:,:,c] + (0.1 + 0.9* heatmap[:,:,c]) * heatmap_jet[:,:,c]
image[:, :, c] = heatmap_jet[:,:,c] + np.multiply(image[:,:, c] , (1.0 - heatmap[:,:,c]))
cv2.imwrite(hdir + filename + '_overlay.png', image)
评论列表
文章目录