Image tiling & combining images

4 Ansichten (letzte 30 Tage)
Sam
Sam am 7 Feb. 2013
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!!

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 7 Feb. 2013
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 Kommentar
Sam
Sam am 7 Feb. 2013
Thank You. I completly forgot to go back to your answer last night as I was extremely tired. Sorry for the repetition.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by