??? 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_cor​r2(f2,k2,f​1,k1,im2,i​m1, 'sdthres

4 views (last 30 days)
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, 'sdthres
imgo1 = 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_edges
im1 = rgb2gray(img1);
im2 = rgb2gray(img2);
symmetric_match
m
cavg
size(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
end
end
showfeatures(f2,im2);
showfeatures(f1,im1);
hold on
for 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');
end
end

Accepted Answer

Walter Roberson
Walter Roberson on 24 Dec 2012
That code attempts to call corr() passing in three numeric parameters, followed by a name/value pair of 'sdthresh', which that code documents as controlling the Sampson distance cutoff for corr()
I have looked around and I have not found a version of corr() that supports sdthresh as a parameter. I did find someone's version of corr() that supported a third numeric parameter (intended, in that particular code to represent a lag), but MATLAB's corr() has never supported a third numeric parameter and has never supported sdthresh.
The first MATLAB version that had corr() was R14, released in 2004. The SIFT software you are looking at was written in 2002. It must have been using some other version of corr(). Unfortunately we cannot tell what at this time, as it did not include the source for corr() in the .rar for that SIFT code. The source code for corr() that you extract here is for MATLAB's corr() that never had that option.

More Answers (1)

Image Analyst
Image Analyst on 24 Dec 2012
Well you, for some reason, didn't post the function line of corr() where the error lies. But you passed in 6 arguments and apparently it wants a different number.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!