Compute Non-Local Myriad filtering for Cauchy denoising with weights.
This page shows a code to extract patches with the Cauchy similarity measure and perform a Myriad filtering of the pixel-wise samples.
Contents
Load noisy image and set the gamma parameter.
Load a gray-scale image and set the gamma parameter.
input= imread('parrotCauchyNoise_K=5.png');
gamma=5;
Extraction of samples from patches with cauchy similarity.
The function K_cauchy_best_patches return a three dimension matrix of size MxNxK. MxN is the image size. K in the number of retained patches in the samples.
[sampleFromPatches, weights] = kCauchyNearestPatches(input, gamma,... 'SampleSize', 40,... 'PatchWidth', 3,... 'SearchWindowRadius', 15);
Normalization of the weights.
alpha = 0.1;
weights = exp(alpha*weights);
weights = weights ./ ...
repmat(sum(weights, 3), [1,1, size(weights,3)]) * size(weights,3);
Compute the Myriad M-estimator of non-local samples.
The function MyriadFilter has two inputs: * sampleFromPatchesthe is the vector of samples for each pixels, represented in a three dimension matrix of size MxNxK. MxN is the image size. K in the number of samples. * gamma is the parameter of the objective function.
filtred = MyriadFilter(sampleFromPatches, [], weights);
------------------------------ Call Generalized Myriad filter ------------------------------ size image: 256 x 256 --------------------------
Display the results.
figure, imshow(uint8(input)), title('noisy') figure, imshow(uint8(filtred)), title('filtred')

