# digiKam: Season of KDE Update

I’ve been slow on updating the progress of the project — I apologize for that. I’m working on implementing an improved noise estimation function for digiKam.

Currently, I’m working on a CLI version of the implementation to better understand the noise estimation process. The implementation consists of calculating the gradient covariance matrix of the image. For an image patch y, it’s defined as follows:

$C_{y}=G_{y}^T*G_{y}$

where $G_{y} = \left[\begin{array}{cc} D_{hy} & D_{vy} \\ \end{array}\right]$

$D_{hy}$ and $D_{vy}$ are the horizontal and vertical derivatives of the image patch respectively. The resulting matrix is then decomposed to get the eigen values.

To put it briefly, the gradient of the image patch gives us the differences in pixels. We then decompose the covariance matrix to get eigen values whose values represent the strength of the image patch. Specifically, the larger the maximum eigen value, the richer the texture is, in the dominant direction.

I came across an OpenCV function which handles all of this and returns the eigen values (and vectors).

cornerEigenValsAndVecs calculates the eigen values and vectors for a given blocksize and aperture size.

The function returns the result represented in a 6-channel image — the first two containing the eigen values, and the others — the eigen vectors corresponding to those eigen values.

For testing this, I’ve applied a noise with uniform distribution on an image, and calculated the eigen values for the resulting image.

Further tests have to made to check whether the retrieved results match well with that of the algorithm, and proceed to select the “weak textured patches”.