Error using ==> mtimes Inner matrix dimensions must agree.

2 ビュー (過去 30 日間)
Vasileios Fotias
Vasileios Fotias 2012 年 8 月 9 日
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');

回答 (1 件)

Nirmal
Nirmal 2012 年 8 月 9 日
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!
  1 件のコメント
Vasileios Fotias
Vasileios Fotias 2012 年 8 月 10 日
What i have to do to resolve this problem?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCoordinate Transformations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by