I started understanding the problem statement, it look very cool to me. So i started to implement this in Pytorch and learn some stuff in CV.
def guided_filter(x, y, r, eps=1e-2):
x_shape = tf.shape(x)
#y_shape = tf.shape(y)
N = tf_box_filter(tf.ones((1, x_shape[1], x_shape[2], 1), dtype=x.dtype), r)
mean_x = tf_box_filter(x, r) / N
mean_y = tf_box_filter(y, r) / N
cov_xy = tf_box_filter(x * y, r) / N - mean_x * mean_y
var_x = tf_box_filter(x * x, r) / N - mean_x * mean_x
A = cov_xy / (var_x + eps)
b = mean_y - A * mean_x
mean_A = tf_box_filter(A, r) / N
mean_b = tf_box_filter(b, r) / N
output = mean_A * x + mean_b
return output
I find out in guided_filter.py, mean_a is a matrix having sum(mean_a) == reduce((lambda x, y: x * y), mean_a.shape) and sum(mean_b) == 0.
from guided_filter(x, x) getting again x.
Please help me to understand this. I refered the same paper as you for guided_filter
https://kaiminghe.github.io/publications/pami12guidedfilter.pdf
I started understanding the problem statement, it look very cool to me. So i started to implement this in Pytorch and learn some stuff in CV.
I find out in guided_filter.py, mean_a is a matrix having sum(mean_a) == reduce((lambda x, y: x * y), mean_a.shape) and sum(mean_b) == 0. from guided_filter(x, x) getting again x. Please help me to understand this. I refered the same paper as you for guided_filter https://kaiminghe.github.io/publications/pami12guidedfilter.pdf