-
论文地址
-
代码实现
def Guidedfilter(im,p,r,eps):mean_I = cv2.boxFilter(im,cv2.CV_64F,(r,r));mean_p = cv2.boxFilter(p, cv2.CV_64F,(r,r));mean_Ip = cv2.boxFilter(im*p,cv2.CV_64F,(r,r));cov_Ip = mean_Ip - mean_I*mean_p;# cov(x, y) = E[XY] - E[X]E[Y]mean_II = cv2.boxFilter(im*im,cv2.CV_64F,(r,r));var_I = mean_II - mean_I*mean_I;a = cov_Ip/(var_I + eps);b = mean_p - a*mean_I;mean_a = cv2.boxFilter(a,cv2.CV_64F,(r,r));mean_b = cv2.boxFilter(b,cv2.CV_64F,(r,r));q = mean_a*im + mean_b;return q;
理论介绍
参考1