The Kernel of the Guided Image Filter I am trying to understand how to calculate kernel matrix for guided image filter. Following is the formula for kernel calculation. 


where k is window withing pixels i and j belong i assumed that window k is a 3x3 matrix and take following I matrix to calculate kernel. omega is total number of pixels in window.
I am confused about index i and j so if I take a matrix 3x 3 that is as 
$$
     I=   \begin{matrix}
        1 &amp; 2 &amp; 3 \\
        4 &amp; 5 &amp; 6 \\
        7 &amp; 8 &amp; 9 \\
        \end{matrix}
$$
now mean is 5 and variance is 6.67 taking epsilon as 0.002 and omega is 9 I calculated value for kernel for the first pixel so taking i = pixel(1,1) and all rest will be j including i== j case. then my output came as (I used excel sheet to do this I could have used MATLAB)

$$
     W=   \begin{matrix}
        0.111 &amp; 0.111 &amp; 0.111\\
        0.111 &amp; 0.111 &amp; 0.111 \\
        0.111 &amp; 0.111 &amp; 0.111 \\
        \end{matrix}
$$

when I changed values in matrix I output was still same so I doubt i understood something really wrong. Is there anyone who can explain me how to calculate W in this formula. 
Most confusing term for me is that sum of k:(i,j) over window k. If anyone can explain me I guess I will be able to correct my calculation. 



Reference

The paper - Guided Image Filtering (Available on Scribd).
Please check section 3.3 for kernel formula.
The Guided Image Filter is a filter which assumes Piece Wise Linear model of the image.
Basically, it tries to estimate the best Linear Estimator per patch / pixel of the image.

Since it is Linear its coefficients are based on the first and second moments of the local patch.

You can see the code in my Q42415 GitHub Repository which also includes an implementation in Kernel Form in ApplyLocalLinearKernel().
Here are some results (Output of Q42415):