When i run the following code,the matlab is getting error;
??? Error using ==> corr at 115 Wrong number of arguments.Error in ==> motion_corr2 at 108 [a, F] = corr(p1, p2, C, 'sdthresh', sdthresh, corr_opts{:});Error in ==> symmetric_match at 3 [p2a,p1a,a2,Fa] = motion_corr2(f2,k2,f1,k1,im2,im1, 'sdthresimgo1 = imread('A1.jpg');img1 = imresize(imgo1,2,'bilinear');imgo2 = imread('B2.jpg');img2 = imresize(imgo2, 2, 'bilinear');[features,pyr,imp,keys] = detect_features(img1,1.5,0,3,4,4,4,.04,5);[features2,pyr2,imp2,keys2] = detect_features(img2,1.5,0,3,4,4,4,.04,5);kill_edgesim1 = rgb2gray(img1);im2 = rgb2gray(img2);symmetric_matchmcavgsize(fk1)
partical codes of function corr.m
pnames = {'type' 'rows' 'tail'};dflts = {'p' 'a' 'both'};[errid,errmsg,type,rows,tail] = statgetargs(pnames,dflts,varargin{:});if ~isempty(errid) error(sprintf('stats:corr:%s',errid),errmsg);end
function motion_corr2.m
function [p1, p2 , a, F] = motion_corr2(f1,k1,f2,k2,im1,im2, varargin)% STEP 0: Process options
[p1, ... smoothing, ... nmsrad, ... rthresh, ... rthresh2, ... sdthresh, ... dthresh, ... corr_opts] = process_options(varargin, 'p1', [], ... 'smoothing', 2, ... 'nmsrad', 2, ... 'rthresh', 0.3, ... 'rthresh2', nan, ... 'sdthresh', 1e-2, ... 'dthresh', 30);if (isnan(rthresh2)) rthresh2 = rthresh / 2.0; end% STEP 2: Form a cost matrix based upon local properties of the
% interest points. The cost metric we use here is the sum of
% squared differences of intensity values in a square
% neighborhood around the pixels; a hard Euclidean distance
% threshold is implemented so all point pairs that are too far
% apart are given infinite cost.
C = make_cost(k1,k2);p1 = f1(:,1:2); %create homogeneous coordinates
p2 = f2(:,1:2);p1(:,3) = 1;p2(:,3) = 1;% STEP 3: Compute the correspondence.
[a, F] = corr(p1, p2, C, 'sdthresh', sdthresh, corr_opts{:});
symmetric_match.m
close all[p2a,p1a,a2,Fa] = motion_corr2(f2,k2,f1,k1,im2,im1, 'sdthresh', 1e-4);[p1b,p2b,a1,Fb] = motion_corr2(f1,k1,f2,k2,im1,im2,'sdthresh', 1e-4);r=zeros(size(a1,1),1);for i=1:size(a1,1) if a1(i)>0 if a2(a1(i)) == i r(i)=1; end endendshowfeatures(f2,im2);showfeatures(f1,im1);hold onfor i=1:size(p1b,1) x = p1b(i,1); y = p1b(i,2); if a1(i)~=0 & r(i)>0 u = p2b(a1(i),1)-p1b(i,1); v = p2b(a1(i),2)-p1b(i,2); plot([x x+u],[y y+v],'y'); endend
Best Answer