Error using ==> mtimes Inner matrix dimensions must agree.
4 views (last 30 days)
Show older comments
Dear Sir,
i get back this:
Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> findHomography>calcDist at 22
pts3 = H*[pts1;ones(1,n)];
Error in ==> ransac1 at 52
dist = funcDist(f,x,y);
Error in ==> findHomography at 13
[H corrPtIdx] = ransac1(pts1,pts2,coef,@solveHomo,@calcDist);
Error in ==> newone at 51
[H corrPtIdx] = findHomography(corr_points_1',corr_points_2');
When i run my code! I wish you could help me. SOS This is my code:
I1=imread('TestImages/testc1.png');
I2=imread('TestImages/testc2.png');
Options.upright=true;
Options.tresh=0.0001;
Ipts1=OpenSurf(I1,Options);
PaintSURF(I1, Ipts1);
Ipts2=OpenSurf(I2,Options);
PaintSURF(I2, Ipts2);
Options.verbose=false;
D1 = reshape([Ipts1.descriptor],64,[]);
D2 = reshape([Ipts2.descriptor],64,[]);
err=zeros(1,length(Ipts1));
cor1=1:length(Ipts1);
cor2=zeros(1,length(Ipts1));
for i=1:length(Ipts1),
distance=sum((D2-repmat(D1(:,i),[1 length(Ipts2)])).^2,1);
[err(i),cor2(i)]=min(distance);
end
[err, ind]=sort(err);
cor1=cor1(ind);
cor2=cor2(ind);
[cor2,m,n]=unique(cor2);
cor1=cor1(m);
for i=1:length(cor1)
corr_points_1(i,:)=[Ipts1(cor1(i)).x Ipts1(cor1(i)).y];
corr_points_2(i,:)=[Ipts2(cor2(i)).x Ipts2(cor2(i)).y];
end
figure, imshow(I1);
figure, imshow(I2);
hold on;
for i=1:length(Ipts1),
c=rand(1,3);
plot([Ipts1.x],[Ipts1.y],'O','Color',c)
end
[H corrPtIdx] = findHomography(corr_points_1',corr_points_2');
0 Comments
Answers (1)
Nirmal
on 9 Aug 2012
pts3 = H*[pts1;ones(1,n)];
if you check the size of H and size of [pts1;ones(1,n)], the no. of columns of H and no. of rows of [pts1;ones(1,n)] are not equal. Thats the PROBLEM!
See Also
Categories
Find more on Coordinate Transformations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!