Image tiling & combining images

6 ビュー (過去 30 日間)
Sam
Sam 2013 年 2 月 7 日
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 Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by