Denoising a PNG Image with kNN Imputation
Given a PNG image with noise, where noise is defined as having an RGB value equal to [0, 0, 0], we can use k-nearest neighbors imputation to fill in the zeros using nearest neighbor averaging. For each row with a zero value, we find the k-nearest neighbors using a Euclidean metric, confined to columns for which that row is not zero. The accuracy of this image restoration technique will vary depending on how we set our k
parameter.
Here, we attempt to denoise Lena.png. The target image can be downloaded here. See what happens when we vary the k
parameter.
So which value of k do you think produces the best image? Try denoising the image yourself with the script provided below: