View on GitHub

Createsimilaritymatrix

NN-Field to Similarity Matrix

Download this project as a .zip file Download this project as a tar.gz file

Converts an NN-field to its Similarity Matrix.

This is a MATLAB implementation of converting nn-field obtained from Patchmatch(@patchmatch) to its similarity matrix.

Salient Features:

Format:
The command line format is as follows.
sm = nnfield2similarity(nnf, wttype, sigma, normalized, make_symm, patchsize, alpha, threshold, mask, ref_img_size)
       nnf - nearest neighbour field
       wttype- 0 - one-type (default) , 1 - gaussian(exp)
       sigma - exponential wt sigma (default - 256)
       normalized - 0/1 (default - 0)
       make_symm - 0/1 (default - 0)
       patchsize - size of search patch (default - 1)
       alpha - for diagonal elements (default - 1.0)
       threshold - for limiting similar patches (default - DBL_MAX)
       mask - patch weight mask (default - center dot)
       ref_img_size - reference image size (2X1) (default - same as nnf)
       sm - output similarity matrix
Examples:
img = double(imresize(imread('lena.png'),0.25)); 
patchsize = 5; nn = 10;
cnn = patchmatch(img, [], patchsize, nn, 20, [], 1, [], [], [], 2);
sm = nnfield2similarity(cnn, 1, 10, [], [], patchsize);
Similarity Matrix on image lena.png'

Authors and Contributors

Sk. Mohammadul Haque (@mohammadul).

Support or Contact

Check out the files in the repository for more details or contact mohammadul@gmail.com and we’ll help you sort it out.