kCauchyNearestPatches

Extract the centers of the K best patches with a Cauchy similarity criterion.

Contents

Syntax.

sample = kCauchyNearestPatches( X, gamma );
sample = kCauchyNearestPatches( X, gamma, ...);
[sample, similarity] = kCauchyNearestPatches( X, gamma, ...);

Definitions.

Let be $\gamma \in R$, $P=(p_1, \dots, p_n) \in R^n$ and $Q=(q_1, \dots, q_n) \in R^n$ two patches.

Let define the Cauchy similarity criterion between $P$ and $Q$ by:

$$ C(P,Q) = \sum_{i=1}^n -log(4\gamma^2 +(p_i-q_i)^2).$$

The closest patches are the ones for which $C$ is maximum.

Description.

sample = kCauchyNearestPatches( X ); returns, for each pixel of the image, the centers of the K best patches, in the sense of the Cauchy similarity measure, in a search window around the pixel.

[sample, similarity] = kCauchyNearestPatches( X ); returns, for each pixel of the image, both the centers of the K best patches, in the sense of the Cauchy similarity measure and the Cauchy similarity measure itselves.

Example.

% Load a gray-scale image and set the gamma parameter.
input= imread('parrotCauchyNoise_K=5.png');
gamma=5;

% Patch extraction.
sampleFromPatches = kCauchyNearestPatches(input, gamma,...
                                   'SampleSize', 20,...
                                   'PatchWidth', 3,...
                                   'SearchWindowRadius', 10);
% Display the 3rd nearest sample.
figure,  title('Particular sample.'), imshow(uint8(sampleFromPatches(:,:,3)))

Input arguments.