PhD Ma
PhD Ma

Reputation: 107

Error trying to plot 2 images with different size using matlab

I have 2 images that I need to plot in one figure then display the points of interest found with SURF on both images: Image 1 : size [6113x5693x3] Image 2 : size [4896x3744x3] when trying to plot both of images in one figure with this code:

I = zeros([size(I1,1) size(I1,2)*2 size(I1,3)]);
I(:,1:size(I1,2),:)=I1;
I(:,size(I1,2)+1:size(I1,2)+size(I2,2),:)=I2;
figure, imshow(I); hold on;

and to display the points of interest of each one of them with :

plot([Pos1(:,2) Pos2(:,2)+size(I1,2)]',[Pos1(:,1) Pos2(:,1)]','-');
plot([Pos1(:,2) Pos2(:,2)+size(I1,2)]',[Pos1(:,1) Pos2(:,1)]','o');

I get this error and I dont know how to fixed :

Subscripted assignment dimension mismatch.

Any suggestion will be welcome!

Upvotes: 0

Views: 45

Answers (1)

bremen_matt
bremen_matt

Reputation: 7369

Walk through this line by line. The error occurs on line 3. You are trying to assign I2 (with dimension 4896x3744x3) to a select part of I that has an incorrect first dimension (since the first dimension of I is the same as I1, not I2).

size(I(:,size(I1,2)+1:size(I1,2)+size(I2,2),:)) = [ 6113  3744  3 ]

size(I2) = [4896 3744  3]

Upvotes: 1

Related Questions