gcpr_misc.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:svm-street-detector 作者: morris-frank 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号