Image tiling & combining images

4 次查看(过去 30 天)
Hello. Quite new to the MATLAB, trying to make an image with 4 different images, where each side(upperwest,uppereast,lowereast,lowerwest)is a different image. Like one of those Andy Warhol photographs. But I keep getting this error when I try to run the function:
>> imshow(TileImage(image1,image2,image3,image4))
Subscripted assignment dimension mismatch.
Error in TileImage (line 16)
NewImage(1:floor(end/2),floor(end/2)+1:end,:) =
image2(:,:,:);
Here is my function:
*function [ NewImage ] = TileImage( image1,image2,image3,image4 )
%TileImage takes an input for an array of four tiled image.
% TileImage is an RGB matrix made out of four input image matrices.____
rows = size(image1, 1);
columns = size(image1, 2);
layers = size(image1, 3);
% A matrix to make the image into a matrix of zeros to make all images
% equally sized.
NewImage = uint8(zeros(2.*rows,2.*columns,layers));
% To make all images the same size and place them into a specific
% quadrant.
NewImage(1:floor(end/2),1:floor(end/2),:) = image1(:,:,:);
NewImage(1:floor(end/2),floor(end/2)+1:end,:) = image2(:,:,:);
NewImage(floor(end/2)+1:end,1:floor(end/2),:) = image3(:,:,:);
NewImage(floor(end/2)+1:end,floor(end/2)+1:end,:) = image4(:,:,:);
end*
Am I missing something? Maybe in the command window? All 4 images are already defined in CW. Any help will be much appreciated!!

采纳的回答

Walter Roberson
Walter Roberson 2013-2-7
Like I told you before, here, one of your images is not the same size as one of the others. From the error message, I can tell that image2 is not the same size as image1.
  1 个评论
Sam
Sam 2013-2-7
Thank You. I completly forgot to go back to your answer last night as I was extremely tired. Sorry for the repetition.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by