Code covered by the BSD License
 Image correspondence by c...
 convolve2(x, m, shape, tol)CONVOLVE2 Two dimensional convolution.
 correspDisplay(corresps, ...correspDisplay Display image correspondences
 correspEdgeDisplay(matche...correspEdgeDisplay displays image match under affine flow
 corrpeak(i, m, n, tol)CORRPEAK Find peak of correlation.
 exindex(arr, varargin)
EXINDEX extended array indexing
 findpeaks(h, varargin)FINDPEAKS Finds the local maxima of an array.
 imtransform_same(im, t, i...IMTRANSFORM_SAME transforms an image into the original coordinates
 max2(x)MAX2 Find maximum of 2D array
 patch_std(varargin)PATCH_STD Sliding standard deviation.
 patch_var(x, psize, shape)PATCH_VAR Sliding variance
 setProps(obj, varargin)
setProps sets object properties
 varPeaks(im, patchsize, r...varPeaks Get set of distinctive points in image
 correlCorresp
 Contents.mCORRELCORRESP

View all files
Image correspondences using crosscorrelation
by
David Young
16 Apr 2010
(Updated
09 Dec 2011)
Find matching features in pairs of images using normalised crosscorrelation: class file and demo.

patch_var(x, psize, shape) 
function y = patch_var(x, psize, shape)
%PATCH_VAR Sliding variance
% Y = PATCH_VAR(X, PSIZE) returns a matrix Y each element of which is
% the variance of a patch of X. X must be 2D and contain at least one
% patch. PSIZE gives the size of the patch: if it is a scalar than the
% patch is PSIZEbyPSIZE; otherwise PSIZE should be a 2element
% vector giving the numbers of rows and columns in the patch. Y will
% be smaller than X as zero padding is not done: if size(X) is [nr,nc]
% then size(Y) will be [nrPSIZE(1)+1, ncPSIZE(2)+1].
%
% Y = PATCH_VAR(X, PSIZE, SHAPE) is the same except that SHAPE specifies
% the boundary behaviour as for CONVOLVE2. For example, 'reflect' may be
% used to cause Y to be the same size as X.
% Copyright David Young 2010
% This is very much more efficient (both in time and memory) than
% using COLFILT with VAR.
if nargin < 3
shape = 'valid';
end
m = ones(psize); % averaging mask
n = numel(m);
if strcmp(shape, 'valid')
x = x  mean(x(:)); % improve stability if possible
end
a = convolve2(x, m, shape);
as = convolve2(x.*x, m, shape);
% Best to divide result not mask, as svd in convolve2 is
% sometimes slower if mask is not ones(!)
y = (as  (a.*a)/n )/n;
end


Contact us