赞
踩
通常,CV中对某一张图片i_in进行处理之后得到i_out。为了得到两者之间的差异,可以利用OpenCV
对它们进行逐像素相减得到可视化结果.
i_vis=i_out-i_in
import random import math import os import os import cv2 import numpy as np # import pandas as pd from os import listdir from os.path import isfile, join mypath = 'input.png' mypath1 = 'output.png' image = cv2.imread(mypath) image1 = cv2.imread(mypath1) scale = 3 res = image.astype('float64') - image1.astype('float64') def postprocess_activations(activations): #using the approach in https://arxiv.org/abs/1612.03928 output = np.abs(activations) output = np.sum(output, axis = -1).squeeze() output /= output.max() output *= 255 return 255 - output.astype('uint8') res = postprocess_activations(res) * scale im_color = cv2.applyColorMap(res, cv2.COLORMAP_JET) # im_color = cv2.applyColorMap(res, cv2.COLORMAP_TWILIGHT) cv2.imwrite('vis_result.jpg', im_color[:, :, ::-1])
i_int:
i_out:
i_vis:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。